Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion CleanCodeApp/AppDelegate/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

self.window = UIWindow(frame: UIScreen.main.bounds)
let rootViewController = HomeFactory3.make()//getRootViewController(forUser: .jorgeRoberto)

let rootViewController = getRootViewController(forUser: .gabrielEirado)

self.window?.rootViewController = UINavigationController(rootViewController: rootViewController)
self.window?.windowScene = windowScene
self.window?.makeKeyAndVisible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ E-mail enviado para:</string>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="xmark.app.fill" catalog="system"/>
<connections>
<action selector="closeButtonAction:" destination="oem-ln-Nx6" eventType="touchUpInside" id="J4e-He-8Zq"/>
<action selector="closeButtonTapped:" destination="oem-ln-Nx6" eventType="touchUpInside" id="J4e-He-8Zq"/>
</connections>
</button>
</subviews>
Expand Down
37 changes: 37 additions & 0 deletions CleanCodeApp/Modules/Features/Lua/ContactsUs/LuaAppURLTarget.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// LuaAppURLTarget.swift
// CleanCodeApp
//
// Created by Gabriel Amaral on 15/02/25.
//

import Foundation

public enum LuaAppURLTarget {

case phone(String)
case mail(String)
case whatsapp(String)

var url: URL? {
switch self {
case .phone(let phoneNumer):
return URL(string: "tel://\(phoneNumer)")

case .mail(let mail):
return URL(string: "mailto:\(mail)")

case .whatsapp(let whatsappNumber):
return URL(string:"whatsapp://send?phone=\(whatsappNumber)&text=Oi)")
}
}

var fallBackURL: URL? {
switch self {
case .whatsapp:
return URL(string:"https://apps.apple.com/app/whatsapp-messenger/id310633997")
default:
return nil
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// LuaContactUsStrings.swift
// CleanCodeApp
//
// Created by Gabriel Amaral on 20/02/25.
//


enum LuaContactUsStrings {
static var defaultErrorTitle = "Ocorreu algum erro"
static var defaultErrorDescription = "Algo de errado aconteceu. Tente novamente mais tarde."
static var textFieldDefaultMessage = "Escreva sua mensagem aqui"
static var emptyMessageTitle = "Mensagem vazia"
static var emptyMessageDescription = "Por favor, escreva uma mensagem antes de enviar."
static var sendMessageErrorDescription = "Erro ao enviar mensagem"
static var defaultSuccessTitle = "Sucesso.."
static var defaultSuccessDescription = "Sua mensagem foi enviada com sucesso."
}
194 changes: 194 additions & 0 deletions CleanCodeApp/Modules/Features/Lua/ContactsUs/LuaContactUsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
import UIKit

final class LuaContactUsView: UIView {

// MARK: - Lazy UI Components
private lazy var scrollView: UIScrollView = {
let scrollView = UIScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
return scrollView
}()

private lazy var contentView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 24, weight: .semibold)
label.text = "Escolha o canal para contato"
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

public lazy var phoneButton: UIButton = {
let button = UIButton()
button.backgroundColor = .systemGray4
button.layer.cornerRadius = 10
let symbolConfiguration = UIImage.SymbolConfiguration(pointSize: 36)
button.setImage(UIImage(systemName: "phone")?.withConfiguration(symbolConfiguration), for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

public lazy var emailButton: UIButton = {
let button = UIButton()
button.backgroundColor = .systemGray4
button.layer.cornerRadius = 10
let symbolConfiguration = UIImage.SymbolConfiguration(pointSize: 36)
button.setImage(UIImage(systemName: "envelope")?.withConfiguration(symbolConfiguration), for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

public lazy var chatButton: UIButton = {
let button = UIButton()
button.backgroundColor = .systemGray4
button.layer.cornerRadius = 10
let symbolConfiguration = UIImage.SymbolConfiguration(pointSize: 36)
button.setImage(UIImage(systemName: "message")?.withConfiguration(symbolConfiguration), for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

public lazy var sendMessageButton: UIButton = {
let button = UIButton()
button.backgroundColor = .blue
button.setTitle(" Enviar ", for: .normal)
button.setTitleColor(.white, for: .normal)
button.layer.cornerRadius = 10
button.setContentHuggingPriority(.required, for: .horizontal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

public lazy var closeButton: UIButton = {
let button = UIButton()
button.setTitle("Voltar", for: .normal)
button.setTitleColor(.blue, for: .normal)
button.backgroundColor = .clear
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.blue.cgColor
button.layer.cornerRadius = 10
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

public lazy var messageLabel: UILabel = {
let label = UILabel()
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
label.text = "Ou envie uma mensagem"
label.numberOfLines = 2
label.setContentHuggingPriority(.defaultLow, for: .horizontal)
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

public lazy var textView: UITextView = {
let textView = UITextView()
textView.text = "Escreva sua mensagem aqui"
textView.font = .systemFont(ofSize: 13)
textView.backgroundColor = .systemGray5
textView.layer.cornerRadius = 10
textView.translatesAutoresizingMaskIntoConstraints = false
return textView
}()

public var textInputted: String {
get {
guard let textInputted = textView.text?.trimmingCharacters(in: .whitespacesAndNewlines) else {
return ""
}
return textInputted
}
}

// MARK: - Lifecycle
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: - Setup UI
private func setupView() {
backgroundColor = .systemGray6
addSubview(scrollView)
scrollView.addSubview(contentView)
addSubviewsToContentView()
addConstraintToUIElements()
}

private func addSubviewsToContentView() {
[titleLabel, phoneButton, emailButton, chatButton, messageLabel, textView, sendMessageButton, closeButton ].forEach { contentView.addSubview($0) }
}

private func addConstraintToUIElements() {
NSLayoutConstraint.activate([

scrollView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
scrollView.leadingAnchor.constraint(equalTo: leadingAnchor),
scrollView.trailingAnchor.constraint(equalTo: trailingAnchor),
scrollView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor),

// ContentView
contentView.topAnchor.constraint(equalTo: scrollView.topAnchor),
contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor),
contentView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor),
contentView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor),

// Title Label
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),

// Phone Button
phoneButton.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 30),
phoneButton.widthAnchor.constraint(equalToConstant: 80),
phoneButton.heightAnchor.constraint(equalToConstant: 80),
phoneButton.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),

// Email Button
emailButton.centerYAnchor.constraint(equalTo: phoneButton.centerYAnchor),
emailButton.widthAnchor.constraint(equalToConstant: 80),
emailButton.heightAnchor.constraint(equalToConstant: 80),
emailButton.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),

// Chat Button
chatButton.centerYAnchor.constraint(equalTo: phoneButton.centerYAnchor),
chatButton.widthAnchor.constraint(equalToConstant: 80),
chatButton.heightAnchor.constraint(equalToConstant: 80),
chatButton.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),

// Message Label
messageLabel.topAnchor.constraint(equalTo: phoneButton.bottomAnchor, constant: 30),
messageLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
messageLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),

// TextView
textView.topAnchor.constraint(equalTo: messageLabel.bottomAnchor, constant: 20),
textView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
textView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
textView.heightAnchor.constraint(equalToConstant: 350),

sendMessageButton.topAnchor.constraint(equalTo: textView.bottomAnchor, constant: 20),
sendMessageButton.heightAnchor.constraint(equalToConstant: 40),
sendMessageButton.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
sendMessageButton.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),

closeButton.topAnchor.constraint(equalTo: sendMessageButton.bottomAnchor, constant: 20),
closeButton.heightAnchor.constraint(equalToConstant: 40),
closeButton.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
closeButton.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
closeButton.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -20)
])
}
}
Loading