From 5fdd255130f55277bc312d4f566b517d76ce3e43 Mon Sep 17 00:00:00 2001 From: Bilal Date: Thu, 6 Jun 2024 20:19:22 +0530 Subject: [PATCH] - fixed home name label content hugging issue - added edit btn to full name - Linked the add child to the userregisteration details - Added Hindi Lingual file to profile view - Made the custom alert for deactivate account - updated the username check logic - Added logout api and handled the user logout - Handled the logout when device change globally --- WOKA.xcodeproj/project.pbxproj | 4 +++ WOKA/Alerts/CustomAlerts.storyboard | 7 ++-- WOKA/Alerts/YesNoAlertVC.swift | 12 ++++++- .../EditPencilIcon.imageset/Contents.json | 21 ++++++++++++ .../EditPencilIcon.imageset/pencil.png | Bin 0 -> 687 bytes .../AuthenticationStringConstant.swift | 1 + .../Base.lproj/AuthenticationSB.storyboard | 22 +++++++----- .../Controller/SelectAvatarVC.swift | 2 +- .../Controller/UserDetailsRegisterVC.swift | 10 ++++-- .../Controller/UserIntrestVC.swift | 2 +- .../ViewModel/SelectAvatarVM.swift | 3 ++ .../ViewModel/UserDetailsRegisterVM.swift | 15 ++++++-- .../ViewModel/UserIntrestVM.swift | 5 ++- .../ActivityToast&Indicator/Utilities.swift | 2 +- WOKA/Helpers/NavBarColor.swift | 21 ++++++++++++ .../Validations/StringValidations.swift | 11 ++++++ WOKA/Home/Home.storyboard | 17 +++++++--- .../hi.lproj/Localizable.strings | 14 +++++++- WOKA/Main/AuthFunc/AuthFunc.swift | 4 ++- WOKA/Network Adapter/APIEndPoints.swift | 1 + WOKA/Network Adapter/BaseResponseModel.swift | 11 ++++-- WOKA/Network Adapter/NetworkManager.swift | 32 +++++++++++++++++- WOKA/SideBarNav/Controller/FaqVC.swift | 4 +++ WOKA/SideBarNav/Controller/ProfileVC.swift | 2 +- WOKA/SideBarNav/SideBarNav.storyboard | 8 ++--- WOKA/SideBarNav/ViewModel/ProfileVM.swift | 17 +++++++++- .../Controller/SideMenuVC.swift | 20 +++++++---- .../Controller/TabBarVC.swift | 28 +++++++++++++-- WOKA/TabBar & SideMenu/LinkTypeEnum.swift | 1 + .../ViewModel/SideMenuVM.swift | 32 ++++++++++++++++++ WOKA/Theme/Base.lproj/Theme.storyboard | 14 ++++---- WOKA/Theme/ViewModel/ThemeOneVM.swift | 4 ++- 32 files changed, 295 insertions(+), 52 deletions(-) create mode 100644 WOKA/Assets/Assets.xcassets/Menu/SideMenu/EditPencilIcon.imageset/Contents.json create mode 100644 WOKA/Assets/Assets.xcassets/Menu/SideMenu/EditPencilIcon.imageset/pencil.png create mode 100644 WOKA/Helpers/NavBarColor.swift diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index a059209..4d7e03b 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -159,6 +159,7 @@ 9C9BEEC72BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */; }; 9CA7C6C02C1093E500D73742 /* ProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CA7C6BF2C1093E500D73742 /* ProfileVC.swift */; }; 9CA7C6C22C1095B600D73742 /* ProfileVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CA7C6C12C1095B600D73742 /* ProfileVM.swift */; }; + 9CB4C5A92C118EF300737C00 /* NavBarColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CB4C5A82C118EF300737C00 /* NavBarColor.swift */; }; 9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29A2BE4D614007D7934 /* LoginVC.swift */; }; 9CBCB29D2BE4D6BB007D7934 /* LoginVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */; }; 9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29E2BE4E13A007D7934 /* ValidatorClass.swift */; }; @@ -356,6 +357,7 @@ 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCenteredFlowLayout.swift; sourceTree = ""; }; 9CA7C6BF2C1093E500D73742 /* ProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileVC.swift; sourceTree = ""; }; 9CA7C6C12C1095B600D73742 /* ProfileVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileVM.swift; sourceTree = ""; }; + 9CB4C5A82C118EF300737C00 /* NavBarColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavBarColor.swift; sourceTree = ""; }; 9CBCB29A2BE4D614007D7934 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = ""; }; 9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVM.swift; sourceTree = ""; }; 9CBCB29E2BE4E13A007D7934 /* ValidatorClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidatorClass.swift; sourceTree = ""; }; @@ -784,6 +786,7 @@ 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */, 5219C2C12C086D9B00A1DF4D /* DataTypeConversion.swift */, 9C7939142C0F23AA00F5D6E6 /* NsNotificationExtension.swift */, + 9CB4C5A82C118EF300737C00 /* NavBarColor.swift */, ); path = Helpers; sourceTree = ""; @@ -1385,6 +1388,7 @@ 9C27E1652BDB6FBC00EC1DA9 /* StoryBoardID.swift in Sources */, 52FDBA782BFF23F4009D7AC7 /* TimePeriod.swift in Sources */, 522A931C2C0DE9150098FE49 /* AboutUsVc.swift in Sources */, + 9CB4C5A92C118EF300737C00 /* NavBarColor.swift in Sources */, 525954322BEA39D200191286 /* AddTapGesture.swift in Sources */, 522242682BFC74380085C632 /* TabBarVC.swift in Sources */, 9C27E1722BDB86B600EC1DA9 /* OnBoardCell.swift in Sources */, diff --git a/WOKA/Alerts/CustomAlerts.storyboard b/WOKA/Alerts/CustomAlerts.storyboard index 35b462c..3e00e37 100644 --- a/WOKA/Alerts/CustomAlerts.storyboard +++ b/WOKA/Alerts/CustomAlerts.storyboard @@ -69,7 +69,7 @@ @@ -940,10 +949,10 @@ - + - + diff --git a/WOKA/Localized Module/hi.lproj/Localizable.strings b/WOKA/Localized Module/hi.lproj/Localizable.strings index 727a1c4..10a8fe2 100644 --- a/WOKA/Localized Module/hi.lproj/Localizable.strings +++ b/WOKA/Localized Module/hi.lproj/Localizable.strings @@ -125,7 +125,10 @@ "WHEN ARE YOUR INTRESTS?" = "तुम्हारी अभिरूचियाँ क्या है?"; "Select as many as you want" = "आप जितने चाहें उतने चुनें"; "Ok,Got it." = "ठीक है।"; - +"Add Child Account" = "चाइल्ड खाता जोड़ें"; +"USERNAME" = "उपयोगकर्ता नाम"; +"CHILD NAME?" = "बच्चे का नाम?"; +"PASSWORD" = "पासवर्ड"; /* Intrest VC @@ -158,6 +161,15 @@ "THEME" = "थीम"; "LOGOUT" = "लॉग आउट"; +/* + SideBar Nav + */ +"Profile" = "प्रोफ़ाइल"; +"FULL NAME" = "पूरा नाम"; +"EMAIL" = "ईमेल"; +"Enter your child name" = "अपने बच्चे का नाम दर्ज करें"; + + /* घर वोका का अन्वेषण करें diff --git a/WOKA/Main/AuthFunc/AuthFunc.swift b/WOKA/Main/AuthFunc/AuthFunc.swift index 3f1cb3a..1eef5b7 100644 --- a/WOKA/Main/AuthFunc/AuthFunc.swift +++ b/WOKA/Main/AuthFunc/AuthFunc.swift @@ -36,7 +36,9 @@ class AuthFunc{ var selectedTheme = ThemeSelect.theme1 - //This is temporary variable. Make it emtpy when the registration is finished. + /* + This is temporary variable. Make it emtpy when the registration is finished. + */ var regData = UserRegPostModel() // Singleton instance of AuthFunc diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift index 15e6fd7..5cbf392 100644 --- a/WOKA/Network Adapter/APIEndPoints.swift +++ b/WOKA/Network Adapter/APIEndPoints.swift @@ -60,6 +60,7 @@ struct APIEndPoints { static let user_queries_store = makeURL(path: "user_queries_store") static let guest_queries_store = makeURL(path: "guest_queries_store") static let update_profile = makeURL(path: "update_profile") + static let user_logout = makeURL(path: "user_logout") } // Other endpoint categories... diff --git a/WOKA/Network Adapter/BaseResponseModel.swift b/WOKA/Network Adapter/BaseResponseModel.swift index e338079..dde8ffe 100644 --- a/WOKA/Network Adapter/BaseResponseModel.swift +++ b/WOKA/Network Adapter/BaseResponseModel.swift @@ -8,9 +8,11 @@ import Foundation // MARK: - BaseResponseModel +protocol ResponseProtocol { + var success: Int? { get } +} -class BaseResponseModel : Codable { -//class BaseResponseModel: Codable { +class BaseResponseModel : Codable, ResponseProtocol{ let success: Int? let message: String? let data: T? @@ -21,3 +23,8 @@ class BaseResponseModel : Codable { case data } } + + +struct CommonResponseModel : Codable { + let sad : String? +} diff --git a/WOKA/Network Adapter/NetworkManager.swift b/WOKA/Network Adapter/NetworkManager.swift index 6fd7c98..d356d84 100644 --- a/WOKA/Network Adapter/NetworkManager.swift +++ b/WOKA/Network Adapter/NetworkManager.swift @@ -36,7 +36,7 @@ class NetworkManager{ /// - Parameter (header : HTTPHeaders , Params :[String : Any] , URL , Dedocable Generic T Struct. , queue : dispatchQueue decide) /// - NOTE Oncompletion will be called on main thread so no need to specify the main thread for UI updates /// - Returns: This function returns a GENERIC response base on the T Model & APIError . - func apiRequest( + func apiRequest( url: URLConvertible, method: HTTPMethod, parameters: Parameters? = nil, @@ -57,6 +57,17 @@ class NetworkManager{ // alamofireLogger.request(response.da, didParseResponse: response) switch response.result { case .success(let value): + // Sucess = 4 menas user has logined in other device + if value.success == 4{ + if let topController = UIApplication.topViewController() { + Utilities.alertWithBtnCompletion(title: "Session Expired", msgBody: "Please Login Again", okBtnStr: "OK", vc: topController) { isDone in + AuthFunc.shareInstance.logout() + // UIApplication.setRootView(MainNavController.instantiate(from: .Main)) + UIApplication.setRootView(LoginNavVC.instantiate(from: .AuthenticationSB)) + } + } + return + } // Handle successful response on the main thread DispatchQueue.main.async { completionHandler(.success(value)) @@ -137,3 +148,22 @@ final class AlamofireLogger: EventMonitor { NSLog("⚡️⚡️⚡️⚡️ Response All Headers: \(String(describing: response.response?.allHeaderFields))") } } + + + +extension UIApplication { + class func topViewController(_ base: UIViewController? = UIApplication.shared.mainKeyWindow?.rootViewController) -> UIViewController? { + if let nav = base as? UINavigationController { + return topViewController(nav.visibleViewController) + } + if let tab = base as? UITabBarController { + if let selected = tab.selectedViewController { + return topViewController(selected) + } + } + if let presented = base?.presentedViewController { + return topViewController(presented) + } + return base + } +} diff --git a/WOKA/SideBarNav/Controller/FaqVC.swift b/WOKA/SideBarNav/Controller/FaqVC.swift index 288ee3c..e4a306a 100644 --- a/WOKA/SideBarNav/Controller/FaqVC.swift +++ b/WOKA/SideBarNav/Controller/FaqVC.swift @@ -24,6 +24,8 @@ class FaqVC: UIViewController { navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() + + self.navigationController?.setColor(color: .white) } func setupCell(){ @@ -40,6 +42,8 @@ class FaqVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) + + self.navigationController?.setColor(color: .black) } } diff --git a/WOKA/SideBarNav/Controller/ProfileVC.swift b/WOKA/SideBarNav/Controller/ProfileVC.swift index 49c6a4e..bfd61d4 100644 --- a/WOKA/SideBarNav/Controller/ProfileVC.swift +++ b/WOKA/SideBarNav/Controller/ProfileVC.swift @@ -24,7 +24,7 @@ class ProfileVC: UIViewController { super.viewDidLoad() vm.vc = self vm.initView() - self.title = "Profile" + self.title = "Profile".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() diff --git a/WOKA/SideBarNav/SideBarNav.storyboard b/WOKA/SideBarNav/SideBarNav.storyboard index bcc21ea..0f2873d 100644 --- a/WOKA/SideBarNav/SideBarNav.storyboard +++ b/WOKA/SideBarNav/SideBarNav.storyboard @@ -413,7 +413,7 @@ -