From 3c69db0032675216779e247de80f6bbe99e3d7c8 Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Tue, 7 May 2024 19:33:29 +0530 Subject: [PATCH] - Added send OTP api - Added verify OTP api - Modified the flow - Made a authfunc to handle the type of user and the language selected - Added OTP fields combine logic. Also handled the otp blank checks. - Added API for intrestes get --- Podfile | 4 +- WOKA.xcodeproj/project.pbxproj | 32 ++++ WOKA/Alerts/AlertCustomVC.swift | 82 ++++++++++ WOKA/Alerts/CustomAlerts.storyboard | 148 ++++++++++++++++++ .../Base.lproj/AuthenticationSB.storyboard | 66 +++++--- WOKA/Authentication/Controller/EmailVC.swift | 19 ++- WOKA/Authentication/Controller/LoginVC.swift | 45 ++++++ WOKA/Authentication/Controller/OTPVC.swift | 21 ++- .../Controller/UserDetailsRegisterVC.swift | 68 ++++++++ .../Controller/UserIntrestVC.swift | 6 +- .../Authentication/Model/IntrestTopicDM.swift | 38 +++++ .../Model/UserEmailVerifyDM.swift | 12 ++ .../Model/UserRegPostModel.swift | 52 ++++++ .../Authentication/View/YourIntrestCell.swift | 6 +- WOKA/Authentication/ViewModel/EmailVM.swift | 99 +++++++----- WOKA/Authentication/ViewModel/LoginVM.swift | 52 +++--- WOKA/Authentication/ViewModel/OTPVM.swift | 128 ++++++++++++++- .../ViewModel/UserDetailsRegisterVM.swift | 34 +++- .../ViewModel/UserIntrestVM.swift | 46 +++++- WOKA/Constants K/GVar.swift | 2 +- WOKA/Constants K/LocalizedEnum.swift | 5 +- WOKA/Constants K/OnBoardVM.swift | 12 +- WOKA/Constants K/StoryBoard.swift | 1 + WOKA/Constants K/StoryBoardID.swift | 4 + .../ActivityToast&Indicator/Utilities.swift | 4 +- WOKA/Helpers/AddTapGesture.swift | 29 ++++ .../UIElements Helper/LocalisedElements.swift | 4 +- .../TextFieldErrorView.swift | 4 +- WOKA/Main/AuthFunc.swift | 12 ++ WOKA/Network Adapter/APIEndPoints.swift | 3 + WOKA/Network Adapter/BaseResponseModel.swift | 4 +- .../Controller/SplashVC.swift | 11 +- .../ViewModel/SelectAgeVM.swift | 20 +-- 33 files changed, 911 insertions(+), 162 deletions(-) create mode 100644 WOKA/Alerts/AlertCustomVC.swift create mode 100644 WOKA/Alerts/CustomAlerts.storyboard create mode 100644 WOKA/Authentication/Model/IntrestTopicDM.swift create mode 100644 WOKA/Authentication/Model/UserEmailVerifyDM.swift create mode 100644 WOKA/Authentication/Model/UserRegPostModel.swift create mode 100644 WOKA/Helpers/AddTapGesture.swift diff --git a/Podfile b/Podfile index 2073593..228a999 100644 --- a/Podfile +++ b/Podfile @@ -11,7 +11,9 @@ target 'WOKA' do pod 'lottie-ios' #Network call - pod 'Alamofire' , '~> 5.9.6' + pod 'Alamofire' + + pod 'CollectionViewCenteredFlowLayout' # Bottom line is for removing IPHONEOS_DEPLOYMENT_TARGET post_install do |installer| diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 0f6eefc..4ac6cf2 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -34,6 +34,12 @@ 525954232BE8F00400191286 /* BaseResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954222BE8F00400191286 /* BaseResponseModel.swift */; }; 525954252BE8F01600191286 /* ValueWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954242BE8F01600191286 /* ValueWrapper.swift */; }; 525954272BE9178F00191286 /* UserDataDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954262BE9178F00191286 /* UserDataDM.swift */; }; + 525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954282BEA079500191286 /* UserEmailVerifyDM.swift */; }; + 5259542B2BEA292800191286 /* UserRegPostModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5259542A2BEA292800191286 /* UserRegPostModel.swift */; }; + 5259542E2BEA393700191286 /* AlertCustomVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5259542D2BEA393700191286 /* AlertCustomVC.swift */; }; + 525954302BEA394400191286 /* CustomAlerts.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5259542F2BEA394300191286 /* CustomAlerts.storyboard */; }; + 525954322BEA39D200191286 /* AddTapGesture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954312BEA39D200191286 /* AddTapGesture.swift */; }; + 525954342BEA620800191286 /* IntrestTopicDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954332BEA620800191286 /* IntrestTopicDM.swift */; }; 52663FF52BDFAB830001D8CE /* TextFieldErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF42BDFAB830001D8CE /* TextFieldErrorView.swift */; }; 52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF62BDFACF60001D8CE /* ShadowView.swift */; }; 52663FF92BDFAF110001D8CE /* EmailVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF82BDFAF110001D8CE /* EmailVM.swift */; }; @@ -151,6 +157,12 @@ 525954222BE8F00400191286 /* BaseResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseResponseModel.swift; sourceTree = ""; }; 525954242BE8F01600191286 /* ValueWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValueWrapper.swift; sourceTree = ""; }; 525954262BE9178F00191286 /* UserDataDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDataDM.swift; sourceTree = ""; }; + 525954282BEA079500191286 /* UserEmailVerifyDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserEmailVerifyDM.swift; sourceTree = ""; }; + 5259542A2BEA292800191286 /* UserRegPostModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserRegPostModel.swift; sourceTree = ""; }; + 5259542D2BEA393700191286 /* AlertCustomVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertCustomVC.swift; sourceTree = ""; }; + 5259542F2BEA394300191286 /* CustomAlerts.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CustomAlerts.storyboard; sourceTree = ""; }; + 525954312BEA39D200191286 /* AddTapGesture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddTapGesture.swift; sourceTree = ""; }; + 525954332BEA620800191286 /* IntrestTopicDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntrestTopicDM.swift; sourceTree = ""; }; 52663FF42BDFAB830001D8CE /* TextFieldErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldErrorView.swift; sourceTree = ""; }; 52663FF62BDFACF60001D8CE /* ShadowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShadowView.swift; sourceTree = ""; }; 52663FF82BDFAF110001D8CE /* EmailVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailVM.swift; sourceTree = ""; }; @@ -302,6 +314,7 @@ 523ED25C2BDA2BC700CFED02 /* WOKA */ = { isa = PBXGroup; children = ( + 5259542C2BEA392A00191286 /* Alerts */, 525954152BE8CAC900191286 /* Network Adapter */, 9CBCB2A62BE5104F007D7934 /* Home */, 52C6E01F2BE3ADD800E22D59 /* Default Enum */, @@ -442,6 +455,15 @@ path = "Network Adapter"; sourceTree = ""; }; + 5259542C2BEA392A00191286 /* Alerts */ = { + isa = PBXGroup; + children = ( + 5259542D2BEA393700191286 /* AlertCustomVC.swift */, + 5259542F2BEA394300191286 /* CustomAlerts.storyboard */, + ); + path = Alerts; + sourceTree = ""; + }; 52C6E01F2BE3ADD800E22D59 /* Default Enum */ = { isa = PBXGroup; children = ( @@ -463,6 +485,7 @@ 5257B2642BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift */, 52D774F02BDFC53B001D87DE /* StringSubScript.swift */, 52C6E01D2BE3847F00E22D59 /* BorderView.swift */, + 525954312BEA39D200191286 /* AddTapGesture.swift */, ); path = Helpers; sourceTree = ""; @@ -549,6 +572,9 @@ isa = PBXGroup; children = ( 525954262BE9178F00191286 /* UserDataDM.swift */, + 525954282BEA079500191286 /* UserEmailVerifyDM.swift */, + 5259542A2BEA292800191286 /* UserRegPostModel.swift */, + 525954332BEA620800191286 /* IntrestTopicDM.swift */, ); path = Model; sourceTree = ""; @@ -725,6 +751,7 @@ 9CDCE1452BDB9B9A003FEF11 /* OnBoardMainSound.m4a in Resources */, 9C56E84B2BDBF03F00E4CA14 /* AuthenticationSB.storyboard in Resources */, 9CBCB2A82BE5105A007D7934 /* Home.storyboard in Resources */, + 525954302BEA394400191286 /* CustomAlerts.storyboard in Resources */, 52C8B0632BDA6993003B51D0 /* Localizable.strings in Resources */, 9C56E8382BDBC3F000E4CA14 /* Exo2-ExtraBold.ttf in Resources */, 9C56E8372BDBC3F000E4CA14 /* Exo2-Thin.ttf in Resources */, @@ -822,6 +849,7 @@ 523ED2622BDA2BC700CFED02 /* SplashVC.swift in Sources */, 9CDC343C2BDBBC6B00093089 /* SelectAgeVC.swift in Sources */, 52C8B0542BDA4BD1003B51D0 /* RoundCorner.swift in Sources */, + 5259542B2BEA292800191286 /* UserRegPostModel.swift in Sources */, 52C8B0572BDA57DB003B51D0 /* Constant.swift in Sources */, 5202AB012BDFA7900043B7BD /* EmailValidation.swift in Sources */, 525954192BE8CC3400191286 /* ConstantString.swift in Sources */, @@ -840,6 +868,7 @@ 9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */, 9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */, 9C56E83B2BDBC6E600E4CA14 /* SelectAgeVM.swift in Sources */, + 5259542E2BEA393700191286 /* AlertCustomVC.swift in Sources */, 52CA28FA2BE119F500708B49 /* UserIntrestVC.swift in Sources */, 9C27E16B2BDB774D00EC1DA9 /* CarouselData.swift in Sources */, 525954212BE8EB7900191286 /* APIEndPoints.swift in Sources */, @@ -851,6 +880,7 @@ 52C8B0692BDA6E1E003B51D0 /* LocalizedEnum.swift in Sources */, 525954122BE8C84900191286 /* Toast.swift in Sources */, 525954172BE8CAD300191286 /* NetworkManager.swift in Sources */, + 525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */, 525954252BE8F01600191286 /* ValueWrapper.swift in Sources */, 52C6E01E2BE3847F00E22D59 /* BorderView.swift in Sources */, 52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */, @@ -861,6 +891,7 @@ 5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */, 525954272BE9178F00191286 /* UserDataDM.swift in Sources */, 9C27E1652BDB6FBC00EC1DA9 /* StoryBoardID.swift in Sources */, + 525954322BEA39D200191286 /* AddTapGesture.swift in Sources */, 9C27E1722BDB86B600EC1DA9 /* OnBoardCell.swift in Sources */, 52C8B05F2BDA5AFA003B51D0 /* SplashVM.swift in Sources */, 52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */, @@ -868,6 +899,7 @@ 52FB2D8F2BDF898F0009B0C7 /* TextFieldPadding.swift in Sources */, 5257B2652BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift in Sources */, 52663FF92BDFAF110001D8CE /* EmailVM.swift in Sources */, + 525954342BEA620800191286 /* IntrestTopicDM.swift in Sources */, 52663FF52BDFAB830001D8CE /* TextFieldErrorView.swift in Sources */, 9C27E16D2BDB852F00EC1DA9 /* GVar.swift in Sources */, 9C56E8462BDBEE6400E4CA14 /* EmailVC.swift in Sources */, diff --git a/WOKA/Alerts/AlertCustomVC.swift b/WOKA/Alerts/AlertCustomVC.swift new file mode 100644 index 0000000..1241b02 --- /dev/null +++ b/WOKA/Alerts/AlertCustomVC.swift @@ -0,0 +1,82 @@ +// AlertCustomVC.swift +// WOKA +// +// Created by MacBook Pro on 07/05/24. +// + +import UIKit + +class AlertCustomVC: UIViewController { + + // Completion block to be executed when the alert is dismissed + var onDoneBlock: ((Bool) -> Void)? + + // Outlets + @IBOutlet weak var contentTextLbl: LocalisedElementsLabel! + @IBOutlet weak var maintitle: UILabel! + @IBOutlet weak var outsideView: UIView! + @IBOutlet weak var yesBtn: UIButton! + + // Properties + var contentLabel = String() + var yesBtnText: String? + var mainTitleText: String? + + override func viewDidLoad() { + super.viewDidLoad() + + // Set button names and content + setBtnName() + + // Dismiss the alert when tapping outside + outsideView.addTapGesture { + self.dismiss(animated: true) + } + } + + + // Set button names and content + func setBtnName() { + self.contentTextLbl.isHidden = false + self.contentTextLbl.text = contentLabel.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + if let yesBtnText = yesBtnText { + self.yesBtn.setTitle(yesBtnText, for: .normal) + } + + if let mainTitleText = mainTitleText { + self.maintitle.text = mainTitleText + } + } + + // Action when done button is tapped + @IBAction func doneBtnTapped(_ sender: UIButton) { + self.dismiss() + // Execute completion block if provided + // self.onDoneBlock?(true) + } + + // Action when cancel button is tapped + @IBAction func cancelBtnTapped(_ sender: UIButton) { + self.dismiss() + } + + // Dismiss the alert with fade transition + private func dismiss() { + let transition = CATransition().fadeTransition() + self.view.layer.add(transition, forKey: kCATransition) + self.dismiss(animated: true) + } +} + +// MARK: - Extension for CATransition to create fade transition + +extension CATransition { + + func fadeTransition() -> CATransition { + let transition = CATransition() + transition.duration = 0.2 + transition.type = CATransitionType.fade + transition.subtype = CATransitionSubtype.fromTop + return transition + } +} diff --git a/WOKA/Alerts/CustomAlerts.storyboard b/WOKA/Alerts/CustomAlerts.storyboard new file mode 100644 index 0000000..ac703c8 --- /dev/null +++ b/WOKA/Alerts/CustomAlerts.storyboard @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + Exo2-Regular + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard index 93f4fa9..e3b9975 100644 --- a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard +++ b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard @@ -60,7 +60,7 @@ - + @@ -167,7 +167,7 @@ - + - + + + -