- Added api for child register

- Finalised the registration for parent
- Finalised the flow for above 16 and go the registeration completed.
- Added a View controller for showing the linked child.
This commit is contained in:
2024-05-09 18:07:59 +05:30
parent d6624b8de7
commit 3f2899b9a3
26 changed files with 736 additions and 59 deletions

View File

@@ -55,6 +55,12 @@
52663FFB2BDFB1700001D8CE /* TextFieldShadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FFA2BDFB1700001D8CE /* TextFieldShadow.swift */; };
5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */; };
5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */; };
52A3F6A52BECBA8D0000BB0B /* LinkedChildDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6A42BECBA8D0000BB0B /* LinkedChildDM.swift */; };
52A3F6A82BECBF2A0000BB0B /* LinkedChildCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6A62BECBF2A0000BB0B /* LinkedChildCell.swift */; };
52A3F6A92BECBF2A0000BB0B /* LinkedChildCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52A3F6A72BECBF2A0000BB0B /* LinkedChildCell.xib */; };
52A3F6AB2BECBF550000BB0B /* LinkedChildVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */; };
52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */; };
52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */; };
52C6E01B2BE383C000E22D59 /* YourIntrestCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0192BE383C000E22D59 /* YourIntrestCell.swift */; };
52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */; };
52C6E01E2BE3847F00E22D59 /* BorderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E01D2BE3847F00E22D59 /* BorderView.swift */; };
@@ -175,6 +181,12 @@
52663FFA2BDFB1700001D8CE /* TextFieldShadow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldShadow.swift; sourceTree = "<group>"; };
5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetailsRegisterVC.swift; sourceTree = "<group>"; };
5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetailsRegisterVM.swift; sourceTree = "<group>"; };
52A3F6A42BECBA8D0000BB0B /* LinkedChildDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildDM.swift; sourceTree = "<group>"; };
52A3F6A62BECBF2A0000BB0B /* LinkedChildCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildCell.swift; sourceTree = "<group>"; };
52A3F6A72BECBF2A0000BB0B /* LinkedChildCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LinkedChildCell.xib; sourceTree = "<group>"; };
52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVC.swift; sourceTree = "<group>"; };
52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = "<group>"; };
52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVM.swift; sourceTree = "<group>"; };
52C6E0192BE383C000E22D59 /* YourIntrestCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YourIntrestCell.swift; sourceTree = "<group>"; };
52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = YourIntrestCell.xib; sourceTree = "<group>"; };
52C6E01D2BE3847F00E22D59 /* BorderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BorderView.swift; sourceTree = "<group>"; };
@@ -495,6 +507,7 @@
525954312BEA39D200191286 /* AddTapGesture.swift */,
525954592BEB67D200191286 /* DateFormatterLib.swift */,
5259545D2BEBBA1A00191286 /* LoadingIndicatorImageView.swift */,
52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */,
);
path = Helpers;
sourceTree = "<group>";
@@ -585,6 +598,7 @@
5259542A2BEA292800191286 /* UserRegPostModel.swift */,
525954332BEA620800191286 /* IntrestTopicDM.swift */,
5259545B2BEBB80400191286 /* AvatarDM.swift */,
52A3F6A42BECBA8D0000BB0B /* LinkedChildDM.swift */,
);
path = Model;
sourceTree = "<group>";
@@ -596,6 +610,8 @@
52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */,
52C6E0242BE3B46A00E22D59 /* SelectAvatarCell.swift */,
52C6E0252BE3B46A00E22D59 /* SelectAvatarCell.xib */,
52A3F6A62BECBF2A0000BB0B /* LinkedChildCell.swift */,
52A3F6A72BECBF2A0000BB0B /* LinkedChildCell.xib */,
);
path = View;
sourceTree = "<group>";
@@ -609,6 +625,7 @@
52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */,
52C6E0282BE3B52500E22D59 /* SelectAvatarVM.swift */,
9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */,
52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */,
);
path = ViewModel;
sourceTree = "<group>";
@@ -624,6 +641,7 @@
9CBCB29A2BE4D614007D7934 /* LoginVC.swift */,
9CBCB2A22BE50C95007D7934 /* ResetPassUserNameVC.swift */,
9CBCB2A42BE50D49007D7934 /* NewPasswordVC.swift */,
52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */,
);
path = Controller;
sourceTree = "<group>";
@@ -774,6 +792,7 @@
525954382BEB4B3B00191286 /* Exo2-Regular.ttf in Resources */,
525954392BEB4B3B00191286 /* Exo2-ExtraBold.ttf in Resources */,
5259543A2BEB4B3B00191286 /* Exo2-SemiBold.ttf in Resources */,
52A3F6A92BECBF2A0000BB0B /* LinkedChildCell.xib in Resources */,
523ED2652BDA2BC700CFED02 /* Base in Resources */,
52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */,
52C6E0262BE3B46A00E22D59 /* SelectAvatarCell.xib in Resources */,
@@ -856,6 +875,7 @@
5259545E2BEBBA1A00191286 /* LoadingIndicatorImageView.swift in Sources */,
52CA28FC2BE11A0400708B49 /* UserIntrestVM.swift in Sources */,
9C27E1602BDB6ECA00EC1DA9 /* UserDefaultsStruct.swift in Sources */,
52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */,
5259541D2BE8D94400191286 /* QueueHelper.swift in Sources */,
525954232BE8F00400191286 /* BaseResponseModel.swift in Sources */,
9C27E1692BDB76F200EC1DA9 /* OnBoardVM.swift in Sources */,
@@ -877,6 +897,8 @@
523ED25E2BDA2BC700CFED02 /* AppDelegate.swift in Sources */,
52D774ED2BDFC13F001D87DE /* OTPVM.swift in Sources */,
9CBCB2A32BE50C95007D7934 /* ResetPassUserNameVC.swift in Sources */,
52A3F6A52BECBA8D0000BB0B /* LinkedChildDM.swift in Sources */,
52A3F6AB2BECBF550000BB0B /* LinkedChildVC.swift in Sources */,
9CBCB2A52BE50D49007D7934 /* NewPasswordVC.swift in Sources */,
9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */,
9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */,
@@ -895,7 +917,9 @@
525954122BE8C84900191286 /* Toast.swift in Sources */,
525954172BE8CAD300191286 /* NetworkManager.swift in Sources */,
525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */,
52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */,
525954252BE8F01600191286 /* ValueWrapper.swift in Sources */,
52A3F6A82BECBF2A0000BB0B /* LinkedChildCell.swift in Sources */,
52C6E01E2BE3847F00E22D59 /* BorderView.swift in Sources */,
52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */,
525953CF2BE8B28F00191286 /* Utilities.swift in Sources */,

View File

@@ -729,8 +729,10 @@ Sent to Your Parents Email</string>
<outlet property="datePicker" destination="QrL-xJ-2yI" id="KD6-A4-7fS"/>
<outlet property="fullName" destination="5fJ-Y1-sF5" id="Vgt-Nc-6Wc"/>
<outlet property="girlView" destination="6Ik-wa-umx" id="JOO-44-pWF"/>
<outlet property="intrestStackView" destination="8nq-Pj-Asi" id="zfB-2j-Y1w"/>
<outlet property="nextBtn" destination="hAv-PV-elG" id="9sA-zr-2KJ"/>
<outlet property="scrollView" destination="tyX-OO-8o2" id="1Uh-2K-TFb"/>
<outlet property="selectAsManyYouWant" destination="LYR-yD-QKs" id="hQM-p6-gpc"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1l2-jy-JLN" sceneMemberID="firstResponder"/>
@@ -1317,46 +1319,141 @@ Sent to Your Parents Email</string>
</objects>
<point key="canvasLocation" x="41" y="710"/>
</scene>
<!--Linked ChildVC-->
<scene sceneID="8PE-nV-HcF">
<objects>
<viewController storyboardIdentifier="LinkedChildVC" id="WA5-Nv-4b4" customClass="LinkedChildVC" customModule="WOKA" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="YKJ-1S-kas">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BackgroundSplash" translatesAutoresizingMaskIntoConstraints="NO" id="kVU-tZ-Qxe">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="WokaLogo" translatesAutoresizingMaskIntoConstraints="NO" id="Ux8-r9-rZb">
<rect key="frame" x="137" y="50" width="140" height="52.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="Ux8-r9-rZb" secondAttribute="height" multiplier="8:3" id="3Bo-85-Opy"/>
<constraint firstAttribute="width" constant="140" id="abR-fA-jTS"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="60" translatesAutoresizingMaskIntoConstraints="NO" id="OXs-y6-ZlP">
<rect key="frame" x="20" y="132.5" width="374" height="639.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your Email Looks Familiar!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wlw-Ne-TMy" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="10" y="0.0" width="354" height="27"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="24"/>
<color key="textColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="v0K-Jg-3w3">
<rect key="frame" x="10" y="87" width="354" height="552.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WE FOUND BELOW USERNAMES LINKED TO THIS EMAIL ADDRESS" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Z0p-jz-vVx" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="354" height="38.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
<color key="textColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="9Iy-Zh-d0U">
<rect key="frame" x="0.0" y="58.5" width="354" height="494"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableView>
</subviews>
</stackView>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="35" translatesAutoresizingMaskIntoConstraints="NO" id="xXI-1K-L56">
<rect key="frame" x="30" y="792" width="354" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sli-1N-tGE" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="354" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="jaN-n0-fQU"/>
</constraints>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Next">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="nextBtnTapped:" destination="WA5-Nv-4b4" eventType="touchUpInside" id="QrX-n4-iT1"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="uNg-hP-gRk"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="xXI-1K-L56" firstAttribute="leading" secondItem="uNg-hP-gRk" secondAttribute="leading" constant="30" id="7p0-J1-PF5"/>
<constraint firstItem="kVU-tZ-Qxe" firstAttribute="top" secondItem="YKJ-1S-kas" secondAttribute="top" id="BVG-48-yfy"/>
<constraint firstItem="uNg-hP-gRk" firstAttribute="trailing" secondItem="OXs-y6-ZlP" secondAttribute="trailing" constant="20" id="Hwa-yk-lS0"/>
<constraint firstItem="xXI-1K-L56" firstAttribute="top" secondItem="OXs-y6-ZlP" secondAttribute="bottom" constant="20" id="Ne9-jm-rA5"/>
<constraint firstItem="OXs-y6-ZlP" firstAttribute="top" secondItem="Ux8-r9-rZb" secondAttribute="bottom" constant="30" id="T89-hA-lUh"/>
<constraint firstItem="uNg-hP-gRk" firstAttribute="bottom" secondItem="xXI-1K-L56" secondAttribute="bottom" constant="20" id="Twu-MQ-9G8"/>
<constraint firstItem="kVU-tZ-Qxe" firstAttribute="leading" secondItem="uNg-hP-gRk" secondAttribute="leading" id="VOu-Fv-0sF"/>
<constraint firstItem="uNg-hP-gRk" firstAttribute="trailing" secondItem="xXI-1K-L56" secondAttribute="trailing" constant="30" id="WhB-qr-MKA"/>
<constraint firstItem="OXs-y6-ZlP" firstAttribute="leading" secondItem="YKJ-1S-kas" secondAttribute="leading" constant="20" id="XJ4-1w-OUC"/>
<constraint firstItem="Ux8-r9-rZb" firstAttribute="top" secondItem="YKJ-1S-kas" secondAttribute="top" constant="50" id="eJ8-ri-Jct"/>
<constraint firstItem="uNg-hP-gRk" firstAttribute="trailing" secondItem="kVU-tZ-Qxe" secondAttribute="trailing" id="k8W-gX-kSg"/>
<constraint firstItem="Ux8-r9-rZb" firstAttribute="centerX" secondItem="kVU-tZ-Qxe" secondAttribute="centerX" id="mqu-FV-syU"/>
<constraint firstAttribute="bottom" secondItem="kVU-tZ-Qxe" secondAttribute="bottom" id="tq8-Vh-hew"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="7is-S5-wXv"/>
<connections>
<outlet property="nextBtn" destination="Sli-1N-tGE" id="kHT-Fe-Cny"/>
<outlet property="tableView" destination="9Iy-Zh-d0U" id="zZn-yh-yeg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ZHJ-DR-wDf" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="799" y="710"/>
</scene>
</scenes>
<designables>
<designable name="42K-Uu-lPQ">
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="4gw-z0-s4a">
<size key="intrinsicContentSize" width="150.5" height="20"/>
<size key="intrinsicContentSize" width="200.5" height="20"/>
</designable>
<designable name="68c-1b-KSI">
<size key="intrinsicContentSize" width="151.5" height="21"/>
<size key="intrinsicContentSize" width="201.5" height="21"/>
</designable>
<designable name="81S-Fa-CiD">
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="DSB-Ge-wNO">
<size key="intrinsicContentSize" width="160" height="21"/>
<size key="intrinsicContentSize" width="210" height="21"/>
</designable>
<designable name="Hcd-Mm-IxW">
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="JRR-Bk-5UP">
<size key="intrinsicContentSize" width="168" height="20"/>
<size key="intrinsicContentSize" width="218" height="20"/>
</designable>
<designable name="MpT-bm-drv">
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="Skx-Ig-91N">
<size key="intrinsicContentSize" width="149" height="20"/>
<size key="intrinsicContentSize" width="199" height="20"/>
</designable>
<designable name="iJE-dm-qal">
<size key="intrinsicContentSize" width="150.5" height="20"/>
<size key="intrinsicContentSize" width="200.5" height="20"/>
</designable>
<designable name="m50-FZ-yVO">
<size key="intrinsicContentSize" width="151.5" height="21"/>
<size key="intrinsicContentSize" width="201.5" height="21"/>
</designable>
<designable name="tgW-LH-XfR">
<size key="intrinsicContentSize" width="119.5" height="21"/>
<size key="intrinsicContentSize" width="169.5" height="21"/>
</designable>
<designable name="wy2-0C-rxG">
<size key="intrinsicContentSize" width="151.5" height="21"/>
<size key="intrinsicContentSize" width="201.5" height="21"/>
</designable>
</designables>
<resources>

View File

@@ -59,8 +59,10 @@ class EmailVC: UIViewController {
*/
switch AuthFunc.shareInstance.userType{
//if parent verify the email
case .adult:
vm.checkEmail()
// if kid then directly send the otp by checking the format of email
case .kid:
vm.sendOTP()
}

View File

@@ -0,0 +1,62 @@
//
// LinkedChildVC.swift
// WOKA
//
// Created by MacBook Pro on 09/05/24.
//
import UIKit
class LinkedChildVC: UIViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var nextBtn: LocalisedElementsButton!
var vm = LinkedChildVM()
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.initView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(true, animated: animated)
}
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userDetailsRegisterVC) as! UserDetailsRegisterVC
self.navigationController?.pushViewController(vc, animated: true)
}
}
// MARK: - TableView
extension LinkedChildVC : TableViewSRC{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return vm.linkedChilds.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Authentication.linkedChildCell, for: indexPath) as! LinkedChildCell
cell.setData(data: vm.linkedChilds[indexPath.row])
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath.row)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
}

View File

@@ -31,6 +31,20 @@ class SelectAvatarVC: UIViewController {
}
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
// Check for avatar.
if AuthFunc.shareInstance.regData.avtar == nil || AuthFunc.shareInstance.regData.avtar == ""{
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = K.ConstantString.intrest
vcPush.mainTitleText = K.ConstantString.error
// vcPush.onDoneBlock = { isDone in }
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
return
}
vm.registerUser()
}
}
@@ -49,7 +63,8 @@ extension SelectAvatarVC : UICollectionViewDelegate , UICollectionViewDataSource
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
AuthFunc.shareInstance.regData.avtar = vm.avatarData[indexPath.row].avatarName
collectionView.reloadData()
}
}

View File

@@ -22,6 +22,8 @@ class UserIntrestVC: UIViewController {
@IBOutlet weak var fullName: UILabel!
@IBOutlet weak var contentHeight: NSLayoutConstraint!
@IBOutlet weak var intrestStackView: UIStackView!
@IBOutlet weak var selectAsManyYouWant: UILabel!
var vm = UserIntrestVM()
var test = [Temp(text: "ADVENTURES", selected: false),
@@ -63,7 +65,7 @@ class UserIntrestVC: UIViewController {
/*
Append the DOB to RegData
*/
AuthFunc.shareInstance.regData.date_of_birth = dob
AuthFunc.shareInstance.regData.birthdate = dob
// Check for Gender.
if AuthFunc.shareInstance.regData.gender == nil{
@@ -80,21 +82,24 @@ class UserIntrestVC: UIViewController {
}
// Check for Intrest.
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
vcPush.contentLabel = K.ConstantString.intrest
vcPush.mainTitleText = K.ConstantString.error
// vcPush.onDoneBlock = { isDone in }
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
return
if AuthFunc.shareInstance.userType == .kid{
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
vcPush.contentLabel = K.ConstantString.intrest
vcPush.mainTitleText = K.ConstantString.error
// vcPush.onDoneBlock = { isDone in }
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
return
}
}
// Check for DOB.
if AuthFunc.shareInstance.regData.date_of_birth == nil{
if AuthFunc.shareInstance.regData.birthdate == nil{
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC

View File

@@ -0,0 +1,22 @@
//
// LinkedChildDM.swift
// WOKA
//
// Created by MacBook Pro on 09/05/24.
//
import Foundation
// MARK: - LinkedChildDM
struct LinkedChildDM: Codable {
let result: [ResultChild]?
// MARK: - Result
struct ResultChild: Codable {
let id: Int?
let username, fullname: String?
let avtar: String?
}
}

View File

@@ -9,10 +9,10 @@ import Foundation
// MARK: - UserDataDM
struct UserDataDM: Codable {
let result: Result?
let result: ResultData?
// MARK: - Result
struct Result: Codable {
struct ResultData: Codable {
let id: Int?
let username, fullname: String?
let gender: Gender?
@@ -20,19 +20,15 @@ struct UserDataDM: Codable {
let avtar: String?
let userType: String?
let languageMasterID: Int?
let isActive: String?
let deletedAt: String?
let lastLogin, rememberToken: String?
let childDetail: String?
let childDetail: ChildDetail?
let language: Language?
let alreadyLoggedIn: Bool?
enum CodingKeys: String, CodingKey {
case id, username, fullname, gender, birthdate, email, avtar
case userType = "user_type"
case languageMasterID = "language_master_id"
case isActive = "is_active"
case deletedAt = "deleted_at"
case lastLogin = "last_login"
case rememberToken = "remember_token"
case childDetail = "child_detail"
@@ -40,7 +36,30 @@ struct UserDataDM: Codable {
case alreadyLoggedIn = "already_logged_in"
}
}
// MARK: - ChildDetail
struct ChildDetail: Codable {
let id, userID: Int?
let interestTopic: [InterestTopic]?
enum CodingKeys: String, CodingKey {
case id
case userID = "user_id"
case interestTopic = "interest_topic"
}
}
// MARK: - InterestTopic
struct InterestTopic: Codable {
let id: Int?
let topicName: String?
enum CodingKeys: String, CodingKey {
case id
case topicName = "topic_name"
}
}
// MARK: - Gender
struct Gender: Codable {
let id: Int?
@@ -51,7 +70,7 @@ struct UserDataDM: Codable {
case genderName = "gender_name"
}
}
// MARK: - Language
struct Language: Codable {
let id: Int?
@@ -63,5 +82,59 @@ struct UserDataDM: Codable {
}
}
}
//// MARK: - UserDataDM
//struct UserDataDM: Codable {
// let result: Result?
//
// // MARK: - Result
// struct Result: Codable {
// let id: Int?
// let username, fullname: String?
// let gender: Gender?
// let birthdate, email: String?
// let avtar: String?
// let userType: String?
// let languageMasterID: Int?
// let isActive: String?
// let deletedAt: String?
// let lastLogin, rememberToken: String?
// let childDetail: String?
// let language: Language?
// let alreadyLoggedIn: Bool?
//
// enum CodingKeys: String, CodingKey {
// case id, username, fullname, gender, birthdate, email, avtar
// case userType = "user_type"
// case languageMasterID = "language_master_id"
// case isActive = "is_active"
// case deletedAt = "deleted_at"
// case lastLogin = "last_login"
// case rememberToken = "remember_token"
// case childDetail = "child_detail"
// case language
// case alreadyLoggedIn = "already_logged_in"
// }
// }
//
// // MARK: - Gender
// struct Gender: Codable {
// let id: Int?
// let genderName: String?
//
// enum CodingKeys: String, CodingKey {
// case id
// case genderName = "gender_name"
// }
// }
//
// // MARK: - Language
// struct Language: Codable {
// let id: Int?
// let languageName: String?
//
// enum CodingKeys: String, CodingKey {
// case id
// case languageName = "language_name"
// }
// }
//}

View File

@@ -12,7 +12,7 @@ struct UserRegPostModel: Encodable {
var username : String?
var password : String?
var gender : Int? //mandatory (1 for girl/female, 2 for boy/male)
var date_of_birth: String? //2015-11-1
var birthdate: String? //2015-11-1
var email: String?
var guardian_email: String?
var user_type: String?
@@ -28,9 +28,9 @@ struct UserRegPostModel: Encodable {
"username" : username ?? "",
"password" : password ?? "",
"gender" : gender ?? "",
"date_of_birth": date_of_birth ?? "",
"birthdate": birthdate ?? "",
"email": email ?? "",
"guardian_email": guardian_email ?? "",
"guardian_email": guardian_email ?? nil,
"user_type": user_type ?? "",
"language_id": language_id ?? "",
"interest_topic_id": interest_topic_id ?? [],

View File

@@ -0,0 +1,36 @@
//
// LinkedChildCell.swift
// WOKA
//
// Created by MacBook Pro on 09/05/24.
//
import UIKit
class LinkedChildCell: UITableViewCell {
@IBOutlet weak var outerView: UIView!
@IBOutlet weak var childAvatarImage: UIImageView!
@IBOutlet weak var childName: UILabel!
@IBOutlet weak var imageSupportView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
outerView.roundCorner(radius: 15)
imageSupportView.roundCorner()
outerView.backgroundColor = .white.withAlphaComponent(0.5)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func setData(data : LinkedChildDM.ResultChild){
if let imageAvatar = data.avtar{
self.childAvatarImage.imageURL(imageAvatar)
}
self.childName.text = data.username
}
}

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="Exo2-Bold.ttf">
<string>Exo2-Bold</string>
</array>
</customFonts>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="92" id="KGk-i7-Jjw" customClass="LinkedChildCell" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="339" height="92"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="339" height="92"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rA8-pY-AAN">
<rect key="frame" x="5" y="5" width="329" height="82"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="UFR-TQ-lWK">
<rect key="frame" x="10" y="10" width="309" height="62"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2NG-CZ-0UF">
<rect key="frame" x="0.0" y="0.0" width="62" height="62"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="f8t-mb-1EZ">
<rect key="frame" x="15" y="15" width="32" height="32"/>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="2NG-CZ-0UF" secondAttribute="height" multiplier="1:1" id="cMe-9v-ObJ"/>
<constraint firstItem="f8t-mb-1EZ" firstAttribute="top" secondItem="2NG-CZ-0UF" secondAttribute="top" constant="15" id="d59-xS-HY7"/>
<constraint firstItem="f8t-mb-1EZ" firstAttribute="leading" secondItem="2NG-CZ-0UF" secondAttribute="leading" constant="15" id="eJM-iB-ydY"/>
<constraint firstAttribute="bottom" secondItem="f8t-mb-1EZ" secondAttribute="bottom" constant="15" id="jwB-JQ-6WI"/>
<constraint firstAttribute="trailing" secondItem="f8t-mb-1EZ" secondAttribute="trailing" constant="15" id="oCm-mc-Mk6"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rI6-gS-M0U">
<rect key="frame" x="77" y="0.0" width="232" height="62"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="UFR-TQ-lWK" secondAttribute="trailing" constant="10" id="4XC-Fy-V2J"/>
<constraint firstItem="UFR-TQ-lWK" firstAttribute="top" secondItem="rA8-pY-AAN" secondAttribute="top" constant="10" id="TEP-Kw-Ejp"/>
<constraint firstAttribute="bottom" secondItem="UFR-TQ-lWK" secondAttribute="bottom" constant="10" id="VMu-am-vY1"/>
<constraint firstItem="UFR-TQ-lWK" firstAttribute="leading" secondItem="rA8-pY-AAN" secondAttribute="leading" constant="10" id="duI-d6-va3"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="rA8-pY-AAN" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="5" id="ED8-V9-Xhp"/>
<constraint firstAttribute="trailing" secondItem="rA8-pY-AAN" secondAttribute="trailing" constant="5" id="NhI-kG-H12"/>
<constraint firstItem="rA8-pY-AAN" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="5" id="aNa-Fh-qfa"/>
<constraint firstAttribute="bottom" secondItem="rA8-pY-AAN" secondAttribute="bottom" constant="5" id="oh4-tZ-nlM"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="childAvatarImage" destination="f8t-mb-1EZ" id="Jpp-hg-5Vc"/>
<outlet property="childName" destination="rI6-gS-M0U" id="WWN-4s-hQO"/>
<outlet property="imageSupportView" destination="2NG-CZ-0UF" id="PSe-VF-dit"/>
<outlet property="outerView" destination="rA8-pY-AAN" id="f8e-ld-EXM"/>
</connections>
<point key="canvasLocation" x="129.00763358778624" y="36.619718309859159"/>
</tableViewCell>
</objects>
<resources>
<namedColor name="TextDarkBlue">
<color red="0.10599999874830246" green="0.050999999046325684" blue="0.60399997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -16,15 +16,37 @@ class SelectAvatarCell: UICollectionViewCell {
super.awakeFromNib()
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
}
override func layoutSubviews() {
self.roundCorner()
}
func setData(data : AvatarDM.ResultRecords){
/*
Reset the cells
*/
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
if data.avatarName == AuthFunc.shareInstance.regData.avtar{
// Provide haptic feedback
let selectionFeedback = UISelectionFeedbackGenerator()
selectionFeedback.selectionChanged()
UIView.animate(withDuration: 0.1, animations: { [weak self] in
guard let self else{return}
imageView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
}) { _ in
UIView.animate(withDuration: 0.1) { [weak self] in
guard let self else{return}
imageView.transform = .identity
outerView.backgroundColor = .white
}
}
}else{
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
}
if let url = data.avatarImageURL{
self.imageView.imageURL(url)
}
// self.imageView.image = UIImage(named: "avatar")
}
}

View File

@@ -22,15 +22,15 @@
<rect key="frame" x="0.0" y="0.0" width="140" height="137"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar" translatesAutoresizingMaskIntoConstraints="NO" id="jAB-i7-AwW">
<rect key="frame" x="15" y="15" width="110" height="107"/>
<rect key="frame" x="20" y="20" width="100" height="97"/>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="jAB-i7-AwW" secondAttribute="trailing" constant="15" id="HDh-Tm-Oro"/>
<constraint firstItem="jAB-i7-AwW" firstAttribute="top" secondItem="8tw-b5-J4G" secondAttribute="top" constant="15" id="dg8-ZZ-mJq"/>
<constraint firstAttribute="bottom" secondItem="jAB-i7-AwW" secondAttribute="bottom" constant="15" id="nUz-jY-oBc"/>
<constraint firstItem="jAB-i7-AwW" firstAttribute="leading" secondItem="8tw-b5-J4G" secondAttribute="leading" constant="15" id="sKw-ul-aIV"/>
<constraint firstAttribute="trailing" secondItem="jAB-i7-AwW" secondAttribute="trailing" constant="20" id="HDh-Tm-Oro"/>
<constraint firstItem="jAB-i7-AwW" firstAttribute="top" secondItem="8tw-b5-J4G" secondAttribute="top" constant="20" id="dg8-ZZ-mJq"/>
<constraint firstAttribute="bottom" secondItem="jAB-i7-AwW" secondAttribute="bottom" constant="20" id="nUz-jY-oBc"/>
<constraint firstItem="jAB-i7-AwW" firstAttribute="leading" secondItem="8tw-b5-J4G" secondAttribute="leading" constant="20" id="sKw-ul-aIV"/>
</constraints>
</view>
</subviews>

View File

@@ -69,8 +69,7 @@ class EmailVM{
Send OTP
Start updating the user Reg data
*/
AuthFunc.shareInstance.regData.email = self.vc.enterEmailTF.text!
self.sendOTP()
default:
break
@@ -83,6 +82,7 @@ class EmailVM{
}
func sendOTP(){
let params: Parameters = [
"email": vc.enterEmailTF.text!,
"user_type": AuthFunc.shareInstance.userType == .adult ? "2" :"1"
@@ -99,6 +99,14 @@ class EmailVM{
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
case 1: // Success
Utilities.dismissProgressHUD()
/*
Set both guardian and normal email
*/
AuthFunc.shareInstance.regData.email = self.vc.enterEmailTF.text!
if AuthFunc.shareInstance.userType == .kid{
AuthFunc.shareInstance.regData.guardian_email = self.vc.enterEmailTF.text!
}
guard let uniqueString = data.data?.unique_string else{
self.vc.toast(msg: K.ConstantString.unRecognised , time: 1)
return

View File

@@ -0,0 +1,29 @@
//
// LinkedChildVM.swift
// WOKA
//
// Created by MacBook Pro on 09/05/24.
//
import UIKit
class LinkedChildVM{
weak var vc : LinkedChildVC!
var linkedChilds = [LinkedChildDM.ResultChild]()
func initView(){
setupCell()
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
vc.nextBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0))
vc.nextBtn.roundCorner()
}
func setupCell(){
vc.tableView.register(UINib(nibName: K.CellIdentifier.Authentication.linkedChildCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.Authentication.linkedChildCell)
vc.tableView.delegate = vc.self
vc.tableView.dataSource = vc.self
}
}

View File

@@ -64,7 +64,7 @@ class LoginVM{
"username": vc.userNameTF.text!,
"password": vc.passwordTF.text!
]
let header : HTTPHeaders = ["device-id" : "12345"]
let header : HTTPHeaders = ["device-id" : AuthFunc.shareInstance.getDeviceUUID()]
Utilities.startProgressHUD()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.login, method: .post ,parameters: params, headers: header) {(result : Result<BaseResponseModel<UserDataDM?>, NetworkManager.APIError>) in

View File

@@ -129,6 +129,9 @@ class OTPVM{
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
case 1: // Success
Utilities.dismissProgressHUD()
if let string = data.data?.unique_string{
self.validateString = string
}
self.emptyTF(tf: [self.vc.tf1,self.vc.tf2,self.vc.tf3,self.vc.tf4])
self.startTimer()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
@@ -143,7 +146,53 @@ class OTPVM{
}
}
func getLinkedChild(){
let params: Parameters = [
"email": AuthFunc.shareInstance.regData.email!,
]
Utilities.startProgressHUD()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.get_linked_child, method: .post ,parameters: params) {(result : Result<BaseResponseModel<LinkedChildDM>, NetworkManager.APIError>) in
switch result{
case .success(let data):
switch data.success{
case 0: // some error
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userDetailsRegisterVC) as! UserDetailsRegisterVC
self.vc.navigationController?.pushViewController(vc, animated: true)
case 1: // Success
Utilities.dismissProgressHUD()
guard let result = data.data?.result else{
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
return
}
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.linkedChildVC) as! LinkedChildVC
vc.vm.linkedChilds = result
self.vc.navigationController?.pushViewController(vc, animated: true)
default:
Utilities.dismissProgressHUD()
self.vc.toast(msg: K.ConstantString.unRecognised , time: 1)
}
case .failure(let error):
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription , time: 2)
}
}
}
func navigate(){
/*
if parent is doing registeration please check if he has any child linked
*/
if AuthFunc.shareInstance.userType == .adult{
self.getLinkedChild()
return
}
switch self.vc.navigateCheck{
case .newPass:
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)

View File

@@ -6,11 +6,13 @@
//
import UIKit
import Alamofire
class SelectAvatarVM{
weak var vc : SelectAvatarVC!
var avatarData = [AvatarDM.ResultRecords]()
func initView(){
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
@@ -36,7 +38,19 @@ class SelectAvatarVM{
switch data.success{
case 0:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = data.message ?? "Unrecognised error"
vcPush.mainTitleText = "Error"
vcPush.yesBtnText = "Retry?"
vcPush.onDoneBlock = { isDone in
self.getAvatarListing()
}
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.vc.present(vcPush, animated: true)
return
case 1:
Utilities.dismissProgressHUD()
if let avatarData = data.data?.result{
@@ -48,7 +62,88 @@ class SelectAvatarVM{
}
case .failure(let error):
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription, time: 2)
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = error.localizedDescription
vcPush.mainTitleText = "Error"
vcPush.yesBtnText = "Retry?"
vcPush.onDoneBlock = { isDone in
self.getAvatarListing()
}
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.vc.present(vcPush, animated: true)
}
}
}
func registerUser(){
/*
Set UserType
*/
if AuthFunc.shareInstance.userType == .adult{
AuthFunc.shareInstance.regData.user_type = "2"
}else{
AuthFunc.shareInstance.regData.user_type = "1"
}
/*
In Reg Add child will be 0
*/
AuthFunc.shareInstance.regData.add_child = "0"
/*
Set Language id
*/
if AuthFunc.shareInstance.languageSelected == .hindi{
AuthFunc.shareInstance.regData.language_id = "2"
}else{
AuthFunc.shareInstance.regData.language_id = "1"
}
Utilities.startProgressHUD()
let headers : HTTPHeaders = ["device-id" : AuthFunc.shareInstance.getDeviceUUID()]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.child_registration, method: .post,parameters: AuthFunc.shareInstance.regData.dictionaryRepresentation, headers: headers) {(result : Result<BaseResponseModel<UserDataDM>, NetworkManager.APIError>) in
switch result{
case .success(let data):
switch data.success{
case 0:
Utilities.dismissProgressHUD()
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = data.message ?? "Unrecognised error"
vcPush.mainTitleText = "Error"
vcPush.yesBtnText = "Retry?"
vcPush.onDoneBlock = { isDone in
self.getAvatarListing()
}
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.vc.present(vcPush, animated: true)
return
case 1:
Utilities.dismissProgressHUD()
AuthFunc.shareInstance.regData = UserRegPostModel()
print(data.data?.result)
default:
break
}
case .failure(let error):
Utilities.dismissProgressHUD()
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = error.localizedDescription
vcPush.mainTitleText = "Error"
vcPush.yesBtnText = "Retry?"
vcPush.onDoneBlock = { isDone in
self.getAvatarListing()
}
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.vc.present(vcPush, animated: true)
}
}
}

View File

@@ -11,12 +11,9 @@ import Alamofire
class UserIntrestVM{
weak var vc : UserIntrestVC!
// var gender = GenderEnum.none
var intrestTopics = [IntrestTopicDM.Result]()
func initView(){
setupCell()
/*
Setting the minimum and maximum date as per user type
*/
@@ -54,8 +51,24 @@ class UserIntrestVM{
let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(girlBtnTapped))
vc.girlView.addGestureRecognizer(tapGesture2)
if AuthFunc.shareInstance.userType == .adult{
/*
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
*/
setGender()
getIntrests()
}
func setGender(){

View File

@@ -20,6 +20,7 @@ extension K{
struct Authentication{
static let yourIntrestCell = "YourIntrestCell"
static let selectAvatarCell = "SelectAvatarCell"
static let linkedChildCell = "LinkedChildCell"
}
}
}

View File

@@ -26,6 +26,7 @@ extension K{
static let userNameVerify = "Verifying Username"
static let intrest = "Please select intrest."
static let dob = "Please select DOB."
static let registerUser = "Please wait registering user."
static let error = "Error"
}

View File

@@ -26,6 +26,7 @@ extension K{
static let loginVC = "LoginVC"
static let resetPassUserNameVC = "ResetPassUserNameVC"
static let newPasswordVC = "NewPasswordVC"
static let linkedChildVC = "LinkedChildVC"
}
struct Home{

View File

@@ -0,0 +1,14 @@
//
// TypeAlias.swift
// WOKA
//
// Created by MacBook Pro on 09/05/24.
//
import UIKit
typealias CollectionViewSRC = UICollectionViewDelegate & UICollectionViewDataSource
typealias TableViewSRC = UITableViewDelegate & UITableViewDataSource
typealias ImagePicker = UINavigationControllerDelegate & UIImagePickerControllerDelegate

View File

@@ -7,6 +7,7 @@
import Foundation
import AVFoundation
import UIKit
/*
Language Enum
@@ -36,6 +37,16 @@ class AuthFunc{
static let shareInstance = AuthFunc()
func getDeviceUUID() -> String{
/*
UIDevice.current.name // e.g. "My iPhone"
UIDevice.current.model // e.g. @"iPhone", @"iPod touch"
UIDevice.current.localizedModel // localized version of model
UIDevice.current.systemName // e.g. @"iOS"
UIDevice.current.systemVersion // e.g. @"15.5"
*/
return UIDevice.current.identifierForVendor!.uuidString
}
func setAuthIDPass(){
if let id = Bundle.main.infoDictionary?["API_KEY_ID"] as? String{

View File

@@ -29,6 +29,8 @@ struct APIEndPoints {
static let interest_topic_listing = makeURL(path: "interest_topic_listing")
static let check_exist_username = makeURL(path: "check_exist_username")
static let avatar_listing = makeURL(path: "avatar_listing")
static let child_registration = makeURL(path: "child_registration")
static let get_linked_child = makeURL(path: "get_linked_child")
}
// Other endpoint categories...

View File

@@ -29,11 +29,11 @@ class SplashVC: UIViewController {
}
@IBAction func languageBtnTapped(_ sender: UIButton) {
let sb1 = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc1 = sb1.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userIntrestVC) as! UserIntrestVC
self.navigationController?.pushViewController(vc1, animated: true)
return
// let sb1 = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
// let vc1 = sb1.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userIntrestVC) as! UserIntrestVC
// self.navigationController?.pushViewController(vc1, animated: true)
//
// return
switch sender{
case hindiBtn:
AuthFunc.shareInstance.languageSelected = .hindi