From 34889292e8a9ce0d9e091ccbe1fdc0f512074fbc Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Tue, 27 Aug 2024 19:21:17 +0530 Subject: [PATCH] fixed registeration issue for guardian --- .../Controller/UserDetailsRegisterVC.swift | 2 +- .../Controller/UserIntrestVC.swift | 3 +- .../ViewModel/SelectAvatarVM.swift | 2 +- .../ViewModel/UserIntrestVM.swift | 29 +++++++++---------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/WOKA/Authentication/Controller/UserDetailsRegisterVC.swift b/WOKA/Authentication/Controller/UserDetailsRegisterVC.swift index 7b32760..23f2617 100644 --- a/WOKA/Authentication/Controller/UserDetailsRegisterVC.swift +++ b/WOKA/Authentication/Controller/UserDetailsRegisterVC.swift @@ -113,7 +113,7 @@ class UserDetailsRegisterVC : UIViewController{ let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil) let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userIntrestVC) as! UserIntrestVC -// vc.vm.createChildAccount = true + vc.vm.createChildAccount = self.vm.createChildAccount ?? false self.navigationController?.pushViewController(vc, animated: true) } } diff --git a/WOKA/Authentication/Controller/UserIntrestVC.swift b/WOKA/Authentication/Controller/UserIntrestVC.swift index a281ff0..b650b9b 100644 --- a/WOKA/Authentication/Controller/UserIntrestVC.swift +++ b/WOKA/Authentication/Controller/UserIntrestVC.swift @@ -90,7 +90,7 @@ class UserIntrestVC: UIViewController { // } // Check for Intrest. - if AuthFunc.shareInstance.userType == .kid || vm.createChildAccount != nil{ + if AuthFunc.shareInstance.userType == .kid || vm.createChildAccount == true{ if AuthFunc.shareInstance.regData.interest_topic_id == nil || AuthFunc.shareInstance.regData.interest_topic_id?.count == 0{ let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC @@ -105,7 +105,6 @@ class UserIntrestVC: UIViewController { } } - // Check for DOB. if AuthFunc.shareInstance.regData.birthdate == nil{ let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil) diff --git a/WOKA/Authentication/ViewModel/SelectAvatarVM.swift b/WOKA/Authentication/ViewModel/SelectAvatarVM.swift index 014b881..1188341 100644 --- a/WOKA/Authentication/ViewModel/SelectAvatarVM.swift +++ b/WOKA/Authentication/ViewModel/SelectAvatarVM.swift @@ -94,7 +94,7 @@ class SelectAvatarVM{ /* Set UserType */ - if createChildAccount != nil{ + if createChildAccount == true{ AuthFunc.shareInstance.regData.user_type = "1" /* In Add child will be 1 diff --git a/WOKA/Authentication/ViewModel/UserIntrestVM.swift b/WOKA/Authentication/ViewModel/UserIntrestVM.swift index a22eb4e..2111009 100644 --- a/WOKA/Authentication/ViewModel/UserIntrestVM.swift +++ b/WOKA/Authentication/ViewModel/UserIntrestVM.swift @@ -28,16 +28,28 @@ class UserIntrestVM{ /* Setting the minimum and maximum date as per user type */ - if AuthFunc.shareInstance.userType == .adult && createChildAccount == nil{ + if AuthFunc.shareInstance.userType == .adult && createChildAccount == false{ vc.datePicker.minimumDate = Calendar.current.date(byAdding: .year, value: -150, to: Date()) vc.datePicker.maximumDate = Calendar.current.date(byAdding: .year, value: -16, to: Date()) vc.boyText.text = "MALE".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) vc.GirlText.text = "FEMALE".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + + /* + If user type is adult then no need to show intrest + */ + self.vc.intrestStackView.isHidden = true + self.vc.selectAsManyYouWant.isHidden = true }else{ vc.datePicker.minimumDate = Calendar.current.date(byAdding: .year, value: -16, to: Date()) vc.datePicker.maximumDate = Calendar.current.date(byAdding: .year, value: -3, to: Date()) vc.boyText.text = "BOY".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) vc.GirlText.text = "GIRL".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + + /* + If user type is child get the intrest and show all + */ + setupCell() + getIntrests() } vc.fullName.text = (AuthFunc.shareInstance.regData.full_name != nil && AuthFunc.shareInstance.regData.full_name != "") ? AuthFunc.shareInstance.regData.full_name : "Guardian" @@ -57,7 +69,6 @@ class UserIntrestVM{ vc.nextBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) vc.nextBtn.roundCorner() - // Add tap gesture recognizer to the view let tapGesture = UITapGestureRecognizer(target: self, action: #selector(boyBtnTapped)) vc.boyView.addGestureRecognizer(tapGesture) @@ -66,20 +77,6 @@ class UserIntrestVM{ let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(girlBtnTapped)) vc.girlView.addGestureRecognizer(tapGesture2) - if AuthFunc.shareInstance.userType == .adult && createChildAccount == nil{ - /* - If user type is adult then no need to show intrest - */ - self.vc.intrestStackView.isHidden = true - self.vc.selectAsManyYouWant.isHidden = true - }else{ - /* - If user type is child get the intrest and show all - */ - setupCell() - getIntrests() - } - /* Setup Gender Stack for selection */