Skip to content

Conversation

@lfoliveir4
Copy link
Contributor

@lfoliveir4 lfoliveir4 commented Feb 19, 2025

Separa as responsabilidades e tarefas que estavam faltando:

  • View Code
  • View Model
  • Async Await

import Foundation

protocol ContactUSServiceProtocol {
func fetch() async throws -> Data
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch what?
usa um nome mais claro


protocol ContactUSServiceProtocol {
func fetch() async throws -> Data
func send(with parameters: [String: String]) async throws
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send what?
usar um nome mais claro tb

final class ContactUSService: ContactUSServiceProtocol {
func fetch() async throws -> Data {
return try await withCheckedThrowingContinuation { continuation in
AF.shared.request(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ja chegou na parte de parar de usar singleton?
se sim, usar GoodNetworkLayer aqui tb
se n me engano o Jorge tem um PR em q ele usou

se n tiver chegado na parte de remover singlton, pode ignorar


func send(with parameters: [String: String]) async throws {
return try await withCheckedThrowingContinuation { continuation in
AF.shared.request(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mesmo comentario acima

import UIKit

final class ContactUSView: UIView {
let symbolConfiguration = UIImage.SymbolConfiguration(pointSize: 36)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tem propriedade com essa e outras que poderiam ser privates

return stackView
}

func createCTAStackView() -> UIStackView {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oq é CTA?
lembre que não é bom usar siglas (há raras exceções)

}

func fetch() async throws {
guard let data = try? await serivce.fetch() else { return }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dar uma nome melhor para fetch
nao usar try? opcional, já que a funcao dispara erro

fazer protocol para viewModel (se estiver no contexto desse PR)

}

func send(parameters: [String: String]) async throws {
try? await serivce.send(with: parameters)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

melhorar nome e remover try opcional

enum LuzContactUsFactory {
static func make() -> UIViewController {
let service = ContactUSService()
let viewModel = LuzContactUSViewModel(serivce: service)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service*

button.backgroundColor = .systemGray4
button.layer.cornerRadius = 10
button.addTarget(
contactUSView.chatButton.addTarget(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contactUsView

dismiss(animated: true)
}

func fetch() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

melhorar nome

guard
let message = contactUSView.textView.text, message.isEmpty == false
else { return }
let email = model?.mail ?? ""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colocar email no guard let tb

"mensagem": message
]

showLoadingView()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esconder loading ao final da Task

Copy link
Owner

@ppedroam ppedroam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants