From 9cf07a73b2bc949de20205c5c47d592a99eb4377 Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Tue, 12 Apr 2022 20:15:02 -0300 Subject: [PATCH 1/7] inicia implementacao da chamada api de login --- .../RealEstateApp.xcodeproj/project.pbxproj | 8 ++++++ .../APIClient/LoginAPIClient.swift | 28 +++++++++++++++++++ .../RealEstateAPIClientProperty.swift | 1 + .../RealEstateApp/Models/LoginModel.swift | 7 +++++ .../Models/PerformLoginModel.swift | 2 ++ .../PropertyListViewController.swift | 2 ++ 6 files changed, 48 insertions(+) create mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift create mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift create mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/PerformLoginModel.swift diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj index 3d9a6ab..8c4aac7 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 54C4595928077D03004DD3DF /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */; }; 54E204C92804EB8C009FFEDC /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204C82804EB8C009FFEDC /* AccountView.swift */; }; 54E204CB28051E0A009FFEDC /* AccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */; }; + 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; + 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; 980789CB275E8FAF00CED39A /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CA275E8FAF00CED39A /* SettingsViewController.swift */; }; 980789CE275E943D00CED39A /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CD275E943C00CED39A /* FavoritesViewController.swift */; }; 980789D9275EA3C900CED39A /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789D8275EA3C900CED39A /* AccountViewController.swift */; }; @@ -77,6 +79,8 @@ 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = ""; }; 54E204C82804EB8C009FFEDC /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = ""; }; 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewModel.swift; sourceTree = ""; }; + 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; + 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; 980789CA275E8FAF00CED39A /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 980789CD275E943C00CED39A /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = ""; }; 980789D8275EA3C900CED39A /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; @@ -183,6 +187,7 @@ children = ( 980C0C0A2704F1C700F8100A /* RealEstateAPIClientProperty.swift */, B0D7AA932805BFA8006177F8 /* RealEstateAPIFavorites.swift */, + 8B5548A828061B8000714870 /* LoginAPIClient.swift */, ); path = APIClient; sourceTree = ""; @@ -239,6 +244,7 @@ A50AC3F928089F4900873216 /* Address.swift */, A50AC3FB28089FEA00873216 /* Pricing.swift */, B0D7AA912805BBB7006177F8 /* Favorites.swift */, + 8B5548A628061AB400714870 /* LoginModel.swift */, ); path = Models; sourceTree = ""; @@ -471,12 +477,14 @@ A50AC3FC28089FEA00873216 /* Pricing.swift in Sources */, 5498E3B52814DF14002BD1C4 /* PropertyListFactory.swift in Sources */, 54E204CB28051E0A009FFEDC /* AccountViewModel.swift in Sources */, + 8B5548A728061AB400714870 /* LoginModel.swift in Sources */, 980789CB275E8FAF00CED39A /* SettingsViewController.swift in Sources */, B0D7AA942805BFA8006177F8 /* RealEstateAPIFavorites.swift in Sources */, 980C0C1C2704F23E00F8100A /* PropertyDetailsViewController.swift in Sources */, A50AC4062808BEC000873216 /* PropertyImageView.swift in Sources */, E9FE07EC28076C6C00B2752F /* AccountFactory.swift in Sources */, 980C0C112704F1C700F8100A /* RealEstateAPIClientProperty.swift in Sources */, + 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */, 54E204C92804EB8C009FFEDC /* AccountView.swift in Sources */, 5446FD1128178A1200640269 /* Bindable.swift in Sources */, 980789D9275EA3C900CED39A /* AccountViewController.swift in Sources */, diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift new file mode 100644 index 0000000..0504de4 --- /dev/null +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift @@ -0,0 +1,28 @@ +import Foundation + + + +public final class LoginAPIClient { + + func pegaloginmodel(completion: @escaping(LoginModel?, Error?) -> ()) { + let url = URL(string: "https://raw.githubusercontent.com/devpass-tech/challenge-realestate-app/main/api/login.json")! + var loginModel: LoginModel? + + + let dataTask = URLSession.shared.dataTask(with: url) {(data, response, error) in + guard let data = data else { return } + let decoder = JSONDecoder() + do { + completion(try decoder.decode(LoginModel.self, from: data), nil) +// loginModel = try decoder.decode(LoginModel.self, from: data) + + } catch { + completion(nil, error) + } + } + + dataTask.resume() + } + +} + diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/RealEstateAPIClientProperty.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/RealEstateAPIClientProperty.swift index b33a6a1..aa2b221 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/RealEstateAPIClientProperty.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/RealEstateAPIClientProperty.swift @@ -40,3 +40,4 @@ public final class RealEstateAPIClientProperty: RealEstateAPIPropertyProtocol { task.resume() } } + \ No newline at end of file diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift new file mode 100644 index 0000000..1efab8e --- /dev/null +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift @@ -0,0 +1,7 @@ +public struct LoginModel: Decodable { + let success: Bool + + enum CodingKeys: String, CodingKey { + case success = "success" + } +} diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/PerformLoginModel.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/PerformLoginModel.swift new file mode 100644 index 0000000..350c82f --- /dev/null +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/PerformLoginModel.swift @@ -0,0 +1,2 @@ + +import Foundation diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index af10d1a..c79e115 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -8,6 +8,8 @@ import UIKit class PropertyListViewController: UIViewController { + + let loginApiClient = LoginAPIClient() private let viewModel: PropertyListViewModelProtocol From ecf629261f319b78af82ced62f85ecdb12cfb04f Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Thu, 14 Apr 2022 10:06:18 -0300 Subject: [PATCH 2/7] Finaliza implementacao da chamada para a API de login --- .../APIClient/LoginAPIClient.swift | 28 ++++++------------- .../PropertyListViewController.swift | 2 -- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift index 0504de4..1e9597b 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift @@ -1,28 +1,16 @@ import Foundation - - public final class LoginAPIClient { - func pegaloginmodel(completion: @escaping(LoginModel?, Error?) -> ()) { - let url = URL(string: "https://raw.githubusercontent.com/devpass-tech/challenge-realestate-app/main/api/login.json")! - var loginModel: LoginModel? - - - let dataTask = URLSession.shared.dataTask(with: url) {(data, response, error) in - guard let data = data else { return } - let decoder = JSONDecoder() - do { - completion(try decoder.decode(LoginModel.self, from: data), nil) -// loginModel = try decoder.decode(LoginModel.self, from: data) - - } catch { - completion(nil, error) + func getLoginModel(completion: @escaping (Result<(Data, URLResponse), Error>) -> Void) { + URLSession.shared.dataTask(with: URL(string: "https://raw.githubusercontent.com/devpass-tech/challenge-realestate-app/main/api/login.json")!) { data, response, error in + if let error = error { + completion(.failure(error)) + } else if let data = data, let response = response { + completion(.success((data, response))) } + + assertionFailure("Failure") } - - dataTask.resume() } - } - diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index c79e115..af10d1a 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -8,8 +8,6 @@ import UIKit class PropertyListViewController: UIViewController { - - let loginApiClient = LoginAPIClient() private let viewModel: PropertyListViewModelProtocol From 5dd6a08d6253338b43ee3ea51f98a8ef757098f3 Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Tue, 26 Apr 2022 14:15:57 -0300 Subject: [PATCH 3/7] Corrige pontos comentados e adiciona url no plist --- .../APIClient/LoginAPIClient.swift | 34 ++++++++++++++----- .../RealEstateApp/Models/LoginModel.swift | 4 --- .../Plist-URL/ManagerGetURL.swift | 8 +++++ .../RealEstateApp/Resources/Info.plist | 2 ++ .../PropertyListViewController.swift | 2 +- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift index 1e9597b..b4e6f3d 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/DataManager/APIClient/LoginAPIClient.swift @@ -1,16 +1,32 @@ import Foundation +protocol LoginAPIClientProtocol: AnyObject { + func fetchProperties(completion: @escaping (Result<[Property], ErrorRequest>) -> Void) +} + public final class LoginAPIClient { - - func getLoginModel(completion: @escaping (Result<(Data, URLResponse), Error>) -> Void) { - URLSession.shared.dataTask(with: URL(string: "https://raw.githubusercontent.com/devpass-tech/challenge-realestate-app/main/api/login.json")!) { data, response, error in - if let error = error { - completion(.failure(error)) - } else if let data = data, let response = response { - completion(.success((data, response))) + func fetchProperties(completion: @escaping (Result) -> Void) { + let urlString = ManagerGetURL.getLoginURL() + guard let url = URL(string: urlString) else { + completion(.failure(ErrorRequest.urlNotValid)) + return + } + + let task = URLSession.shared.dataTask(with: url) { data, response, error in + guard let response = response as? HTTPURLResponse, response.statusCode == 200, let data = data else { + completion(.failure(ErrorRequest.invalidJson)) + return + } + do { + let decoder = JSONDecoder() + let result = try decoder.decode(LoginModel.self, from: data) + completion(.success(result)) + } catch { + print(error) + completion(.failure(ErrorRequest.noData)) } - - assertionFailure("Failure") } + + task.resume() } } diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift index 1efab8e..9b4e75e 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Models/LoginModel.swift @@ -1,7 +1,3 @@ public struct LoginModel: Decodable { let success: Bool - - enum CodingKeys: String, CodingKey { - case success = "success" - } } diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Plist-URL/ManagerGetURL.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Plist-URL/ManagerGetURL.swift index 0959864..916025f 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Plist-URL/ManagerGetURL.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Plist-URL/ManagerGetURL.swift @@ -27,4 +27,12 @@ struct ManagerGetURL { return urlString } + public static func getLoginURL() -> String { + + let baseURL = InfoPlistBaseURL.getStringValue(forKey: "BaseURL") + let login = InfoPlistBaseURL.getStringValue(forKey: "LoginRequestEndPoint") + let urlString = baseURL + login + + return urlString + } } diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Resources/Info.plist b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Resources/Info.plist index 0ab1d77..02b6a66 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Resources/Info.plist +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Resources/Info.plist @@ -8,6 +8,8 @@ favorites.json PropertyRequestEndPoint listings.json + LoginRequestEndPoint + login.json NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index af10d1a..f01cbe6 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -10,7 +10,7 @@ import UIKit class PropertyListViewController: UIViewController { private let viewModel: PropertyListViewModelProtocol - + private let propertyListView: PropertyListView = { let propertyListView = PropertyListView() return propertyListView From 3b8828d3b33255885ca2471ae67c5db7d4fd3cbf Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Tue, 26 Apr 2022 16:01:31 -0300 Subject: [PATCH 4/7] Inicia implementacao da view de informacoes do imovel --- .../RealEstateApp.xcodeproj/project.pbxproj | 12 +++ .../PropertyDetailsViewController.swift | 2 + .../PropertyInfo/PropertyInfoView.swift | 78 +++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj index 8c4aac7..fb9a02c 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ 54E204CB28051E0A009FFEDC /* AccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */; }; 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; + 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */; }; 980789CB275E8FAF00CED39A /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CA275E8FAF00CED39A /* SettingsViewController.swift */; }; 980789CE275E943D00CED39A /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CD275E943C00CED39A /* FavoritesViewController.swift */; }; 980789D9275EA3C900CED39A /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789D8275EA3C900CED39A /* AccountViewController.swift */; }; @@ -81,6 +82,7 @@ 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewModel.swift; sourceTree = ""; }; 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; + 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyInfoView.swift; sourceTree = ""; }; 980789CA275E8FAF00CED39A /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 980789CD275E943C00CED39A /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = ""; }; 980789D8275EA3C900CED39A /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; @@ -145,6 +147,14 @@ path = Utils; sourceTree = ""; }; + 8BD13BF1281868C1001756F4 /* PropertyInfo */ = { + isa = PBXGroup; + children = ( + 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */, + ); + path = PropertyInfo; + sourceTree = ""; + }; 980789C9275E8F8E00CED39A /* Settings */ = { isa = PBXGroup; children = ( @@ -195,6 +205,7 @@ 980C0C172704F1D500F8100A /* Screens */ = { isa = PBXGroup; children = ( + 8BD13BF1281868C1001756F4 /* PropertyInfo */, 54C4595528077B4B004DD3DF /* Utils */, B0D7AA952805F05B006177F8 /* TabBar */, 980C0C182704F1DE00F8100A /* PropertyList */, @@ -472,6 +483,7 @@ 543091792811EB4100BDC903 /* UIView+Extensions.swift in Sources */, 54309171281094F900BDC903 /* BaseView.swift in Sources */, 980789CE275E943D00CED39A /* FavoritesViewController.swift in Sources */, + 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */, 986153D02704EE2B00838CA6 /* AppDelegate.swift in Sources */, 986153D22704EE2B00838CA6 /* SceneDelegate.swift in Sources */, A50AC3FC28089FEA00873216 /* Pricing.swift in Sources */, diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsViewController.swift index e547f0b..7b65afd 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsViewController.swift @@ -9,6 +9,8 @@ import UIKit class PropertyDetailsViewController: UIViewController { + let propertyInfoView = PropertyInfoView() + private lazy var propertyDetailsView: PropertyDetailsView = { let view = PropertyDetailsView() view.sendContactButton.addTarget(self, action: #selector(sendContactForm), for: .touchUpInside) diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift new file mode 100644 index 0000000..ca94641 --- /dev/null +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift @@ -0,0 +1,78 @@ +import UIKit + +class PropertyInfoView: UIView { + + private lazy var priceLabel: UILabel = { + let label = UILabel() + label.text = " R$ 405.000" + label.font = .systemFont(ofSize: 20) + label.tintColor = .black + label.font = .boldSystemFont(ofSize: 20) + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + private lazy var buildingLabel: UILabel = { + let label = UILabel() + label.text = "Condomínio R$ 495 IPTU R$ 0" + label.tintColor = .black + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + private lazy var infoLabel: UILabel = { + let label = UILabel() + label.text = "69 m² 3 quartos 2 banheiros 1 vaga" + label.font = UIFont.systemFont(ofSize: 14) + label.textColor = UIColor.lightGray.withAlphaComponent(0.9) + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + private lazy var addressLabel: UILabel = { + let label = UILabel() + label.text = "Sem endereço" + label.font = UIFont.systemFont(ofSize: 14) + label.textColor = UIColor.lightGray.withAlphaComponent(0.9) + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + init() { + super.init(frame: .zero) + self.hierarchy() + self.setConstraints() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func hierarchy() { + [priceLabel, buildingLabel, infoLabel, addressLabel].forEach { + addSubview($0) + } + } + + func setConstraints() { + NSLayoutConstraint.activate([ + priceLabel.topAnchor.constraint(equalTo: bottomAnchor, constant: 10), + priceLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -16), + priceLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: 16), + + buildingLabel.topAnchor.constraint(equalTo: priceLabel.bottomAnchor, constant: 10), + buildingLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -16), + buildingLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: 16), + + infoLabel.topAnchor.constraint(equalTo: buildingLabel.bottomAnchor, constant: 10), + infoLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -16), + infoLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: 16), + + addressLabel.topAnchor.constraint(equalTo: infoLabel.bottomAnchor, constant: 10), + addressLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -16), + addressLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: 16), + + bottomAnchor.constraint(equalTo: addressLabel.bottomAnchor, constant: 10) + ]) + } +} From 2b51b2e247cedd086e7a1df750d3116057f067cc Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Tue, 26 Apr 2022 17:49:28 -0300 Subject: [PATCH 5/7] Corrige pontos mencionados nos comentarios --- .../PropertyInfo/PropertyInfoView.swift | 18 ++++-------------- .../PropertyListViewController.swift | 1 - 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift index ca94641..1109003 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyInfo/PropertyInfoView.swift @@ -1,6 +1,6 @@ import UIKit -class PropertyInfoView: UIView { +class PropertyInfoView: BaseView, ViewCodable { private lazy var priceLabel: UILabel = { let label = UILabel() @@ -37,24 +37,14 @@ class PropertyInfoView: UIView { label.translatesAutoresizingMaskIntoConstraints = false return label }() - - init() { - super.init(frame: .zero) - self.hierarchy() - self.setConstraints() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - func hierarchy() { + func setUpHierarchy() { [priceLabel, buildingLabel, infoLabel, addressLabel].forEach { addSubview($0) } } - - func setConstraints() { + + func setUpConstraints() { NSLayoutConstraint.activate([ priceLabel.topAnchor.constraint(equalTo: bottomAnchor, constant: 10), priceLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -16), diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index f01cbe6..fbab49e 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -52,4 +52,3 @@ class PropertyListViewController: UIViewController { } } } - From b0df2be8aadca010e2a2939139acc73ec60e57bc Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Wed, 27 Apr 2022 17:58:01 -0300 Subject: [PATCH 6/7] Cria PropertyDetailsFactory --- .../RealEstateApp.xcodeproj/project.pbxproj | 42 +++++++++++++++ .../PropertyDetailsFactory.swift | 10 ++++ .../PropertyList/PropertyListView.swift | 52 +++++++++++++++++++ .../PropertyListViewController.swift | 19 +++++++ 4 files changed, 123 insertions(+) create mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj index fb9a02c..b7907e8 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj @@ -22,9 +22,22 @@ 54C4595928077D03004DD3DF /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */; }; 54E204C92804EB8C009FFEDC /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204C82804EB8C009FFEDC /* AccountView.swift */; }; 54E204CB28051E0A009FFEDC /* AccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */; }; +<<<<<<< Updated upstream 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */; }; +======= +<<<<<<< Updated upstream +======= +<<<<<<< Updated upstream + 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; + 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; + 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */; }; +======= + 8BD13BF528189CE6001756F4 /* PropertyDetailsFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */; }; +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> Stashed changes 980789CB275E8FAF00CED39A /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CA275E8FAF00CED39A /* SettingsViewController.swift */; }; 980789CE275E943D00CED39A /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CD275E943C00CED39A /* FavoritesViewController.swift */; }; 980789D9275EA3C900CED39A /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789D8275EA3C900CED39A /* AccountViewController.swift */; }; @@ -80,9 +93,22 @@ 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = ""; }; 54E204C82804EB8C009FFEDC /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = ""; }; 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewModel.swift; sourceTree = ""; }; +<<<<<<< Updated upstream + 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; + 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; + 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyInfoView.swift; sourceTree = ""; }; +======= +<<<<<<< Updated upstream +======= +<<<<<<< Updated upstream 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyInfoView.swift; sourceTree = ""; }; +======= + 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyDetailsFactory.swift; sourceTree = ""; }; +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> Stashed changes 980789CA275E8FAF00CED39A /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 980789CD275E943C00CED39A /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = ""; }; 980789D8275EA3C900CED39A /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; @@ -235,6 +261,7 @@ 980C0C1B2704F23E00F8100A /* PropertyDetailsViewController.swift */, A50AC4052808BEC000873216 /* PropertyImageView.swift */, 548DA1EF280D2819000CFFAC /* PropertyDetailsView.swift */, + 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */, ); path = PropertyDetails; sourceTree = ""; @@ -467,7 +494,22 @@ 543091752811D30F00BDC903 /* DesignSystem.swift in Sources */, 986153D42704EE2B00838CA6 /* PropertyListViewController.swift in Sources */, 984DAACC27EE4A66002F3E8A /* PropertyListView.swift in Sources */, +<<<<<<< HEAD + 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, +======= +<<<<<<< Updated upstream +======= +<<<<<<< Updated upstream + 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, +======= +<<<<<<< Updated upstream +======= 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, + 8BD13BF528189CE6001756F4 /* PropertyDetailsFactory.swift in Sources */, +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> b5259ed (Cria PropertyDetailsFactory) 548DA1F0280D2819000CFFAC /* PropertyDetailsView.swift in Sources */, 52E289FA28072CAC009030B3 /* PropertyTableViewCell.swift in Sources */, B0EDEDC0280643F100B1AB1F /* FavoritesViewModel.swift in Sources */, diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift new file mode 100644 index 0000000..3edfcb3 --- /dev/null +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift @@ -0,0 +1,10 @@ +import Foundation + +struct PropertyDetailsFactory { + static func createPropertyDetails() -> PropertyDetailsViewController { + let managerUrl = ManagerGetURL() + let apiClientProperty = RealEstateAPIClientProperty(url: managerUrl) + let viewController = PropertyDetailsViewController() + return viewController + } +} diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift index 096ab83..51c393c 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift @@ -60,6 +60,7 @@ extension PropertyListView: UITableViewDataSource, UITableViewDelegate { return self.listItems.count } +<<<<<<< HEAD func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } @@ -70,5 +71,56 @@ extension PropertyListView: UITableViewDataSource, UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) +======= +<<<<<<< Updated upstream + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + + let cell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier)! +// cell.textLabel?.text = self.listItems[indexPath.row] + return cell +======= +<<<<<<< Updated upstream + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } + + propertyCell.setup(property: listItems[indexPath.row]) + + return propertyCell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) +======= +<<<<<<< Updated upstream + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + + let cell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier)! +// cell.textLabel?.text = self.listItems[indexPath.row] + return cell +======= + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } + + propertyCell.setup(property: listItems[indexPath.row]) + + return propertyCell + } +} + +extension PropertyListView: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let itens = listItems[indexPath.row] + let propertyDetailsFactory = PropertyDetailsFactory.createPropertyDetails() + + //TODO: - row do indexpath + //obter o item da listitems na posicao row + //chamar o factory da propertydetails e se nao tiver, criar + //no factory chamar metodo setup obtendo a viewcontroller + //em seguida fazer push nessa viewcontroller e passar o item da listitens para a prox view controller + //na proxima vc preencher a view com o resultado +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> b5259ed (Cria PropertyDetailsFactory) } } diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index fbab49e..f0aad98 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -9,9 +9,28 @@ import UIKit class PropertyListViewController: UIViewController { +<<<<<<< HEAD private let viewModel: PropertyListViewModelProtocol private let propertyListView: PropertyListView = { +======= +<<<<<<< Updated upstream +======= +<<<<<<< Updated upstream + private let viewModel: PropertyListViewModelProtocol + + private let propertyListView: PropertyListView = { +======= +<<<<<<< Updated upstream +======= + private let viewModel: PropertyListViewModelProtocol + private let + + private let propertyListView: PropertyListView = { +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> Stashed changes +>>>>>>> b5259ed (Cria PropertyDetailsFactory) let propertyListView = PropertyListView() return propertyListView }() From 51cc50f583b1d253f7108d4c46e391a85467d3cd Mon Sep 17 00:00:00 2001 From: Juliane Ferreira Date: Wed, 27 Apr 2022 18:19:30 -0300 Subject: [PATCH 7/7] Revert "Cria PropertyDetailsFactory" This reverts commit b0df2be8aadca010e2a2939139acc73ec60e57bc. --- .../RealEstateApp.xcodeproj/project.pbxproj | 42 --------------- .../PropertyDetailsFactory.swift | 10 ---- .../PropertyList/PropertyListView.swift | 52 ------------------- .../PropertyListViewController.swift | 19 ------- 4 files changed, 123 deletions(-) delete mode 100644 solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj index b7907e8..fb9a02c 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp.xcodeproj/project.pbxproj @@ -22,22 +22,9 @@ 54C4595928077D03004DD3DF /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */; }; 54E204C92804EB8C009FFEDC /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204C82804EB8C009FFEDC /* AccountView.swift */; }; 54E204CB28051E0A009FFEDC /* AccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */; }; -<<<<<<< Updated upstream 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */; }; -======= -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream - 8B5548A728061AB400714870 /* LoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A628061AB400714870 /* LoginModel.swift */; }; - 8B5548A928061B8000714870 /* LoginAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5548A828061B8000714870 /* LoginAPIClient.swift */; }; - 8BD13BF3281868DF001756F4 /* PropertyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */; }; -======= - 8BD13BF528189CE6001756F4 /* PropertyDetailsFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */; }; ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> Stashed changes 980789CB275E8FAF00CED39A /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CA275E8FAF00CED39A /* SettingsViewController.swift */; }; 980789CE275E943D00CED39A /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789CD275E943C00CED39A /* FavoritesViewController.swift */; }; 980789D9275EA3C900CED39A /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980789D8275EA3C900CED39A /* AccountViewController.swift */; }; @@ -93,22 +80,9 @@ 54C4595828077D03004DD3DF /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = ""; }; 54E204C82804EB8C009FFEDC /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = ""; }; 54E204CA28051E0A009FFEDC /* AccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewModel.swift; sourceTree = ""; }; -<<<<<<< Updated upstream - 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; - 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; - 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyInfoView.swift; sourceTree = ""; }; -======= -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream 8B5548A628061AB400714870 /* LoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginModel.swift; sourceTree = ""; }; 8B5548A828061B8000714870 /* LoginAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPIClient.swift; sourceTree = ""; }; 8BD13BF2281868DF001756F4 /* PropertyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyInfoView.swift; sourceTree = ""; }; -======= - 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyDetailsFactory.swift; sourceTree = ""; }; ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> Stashed changes 980789CA275E8FAF00CED39A /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 980789CD275E943C00CED39A /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = ""; }; 980789D8275EA3C900CED39A /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; @@ -261,7 +235,6 @@ 980C0C1B2704F23E00F8100A /* PropertyDetailsViewController.swift */, A50AC4052808BEC000873216 /* PropertyImageView.swift */, 548DA1EF280D2819000CFFAC /* PropertyDetailsView.swift */, - 8BD13BF428189CE6001756F4 /* PropertyDetailsFactory.swift */, ); path = PropertyDetails; sourceTree = ""; @@ -494,22 +467,7 @@ 543091752811D30F00BDC903 /* DesignSystem.swift in Sources */, 986153D42704EE2B00838CA6 /* PropertyListViewController.swift in Sources */, 984DAACC27EE4A66002F3E8A /* PropertyListView.swift in Sources */, -<<<<<<< HEAD - 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, -======= -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream - 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, -======= -<<<<<<< Updated upstream -======= 5498E3B72815B088002BD1C4 /* MapLocationView.swift in Sources */, - 8BD13BF528189CE6001756F4 /* PropertyDetailsFactory.swift in Sources */, ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> b5259ed (Cria PropertyDetailsFactory) 548DA1F0280D2819000CFFAC /* PropertyDetailsView.swift in Sources */, 52E289FA28072CAC009030B3 /* PropertyTableViewCell.swift in Sources */, B0EDEDC0280643F100B1AB1F /* FavoritesViewModel.swift in Sources */, diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift deleted file mode 100644 index 3edfcb3..0000000 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyDetails/PropertyDetailsFactory.swift +++ /dev/null @@ -1,10 +0,0 @@ -import Foundation - -struct PropertyDetailsFactory { - static func createPropertyDetails() -> PropertyDetailsViewController { - let managerUrl = ManagerGetURL() - let apiClientProperty = RealEstateAPIClientProperty(url: managerUrl) - let viewController = PropertyDetailsViewController() - return viewController - } -} diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift index 51c393c..096ab83 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListView.swift @@ -60,7 +60,6 @@ extension PropertyListView: UITableViewDataSource, UITableViewDelegate { return self.listItems.count } -<<<<<<< HEAD func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } @@ -71,56 +70,5 @@ extension PropertyListView: UITableViewDataSource, UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) -======= -<<<<<<< Updated upstream - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - - let cell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier)! -// cell.textLabel?.text = self.listItems[indexPath.row] - return cell -======= -<<<<<<< Updated upstream - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } - - propertyCell.setup(property: listItems[indexPath.row]) - - return propertyCell - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - tableView.deselectRow(at: indexPath, animated: true) -======= -<<<<<<< Updated upstream - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - - let cell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier)! -// cell.textLabel?.text = self.listItems[indexPath.row] - return cell -======= - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - guard let propertyCell = tableView.dequeueReusableCell(withIdentifier: PropertyTableViewCell.identifier, for: indexPath) as? PropertyTableViewCell else { return UITableViewCell() } - - propertyCell.setup(property: listItems[indexPath.row]) - - return propertyCell - } -} - -extension PropertyListView: UITableViewDelegate { - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let itens = listItems[indexPath.row] - let propertyDetailsFactory = PropertyDetailsFactory.createPropertyDetails() - - //TODO: - row do indexpath - //obter o item da listitems na posicao row - //chamar o factory da propertydetails e se nao tiver, criar - //no factory chamar metodo setup obtendo a viewcontroller - //em seguida fazer push nessa viewcontroller e passar o item da listitens para a prox view controller - //na proxima vc preencher a view com o resultado ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> b5259ed (Cria PropertyDetailsFactory) } } diff --git a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift index f0aad98..fbab49e 100644 --- a/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift +++ b/solutions/devsprint-andre-nogueira-1/RealEstateApp/Screens/PropertyList/PropertyListViewController.swift @@ -9,28 +9,9 @@ import UIKit class PropertyListViewController: UIViewController { -<<<<<<< HEAD private let viewModel: PropertyListViewModelProtocol private let propertyListView: PropertyListView = { -======= -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream - private let viewModel: PropertyListViewModelProtocol - - private let propertyListView: PropertyListView = { -======= -<<<<<<< Updated upstream -======= - private let viewModel: PropertyListViewModelProtocol - private let - - private let propertyListView: PropertyListView = { ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> Stashed changes ->>>>>>> b5259ed (Cria PropertyDetailsFactory) let propertyListView = PropertyListView() return propertyListView }()