- 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
This commit is contained in:
2024-05-07 19:33:29 +05:30
parent 95ae60c464
commit 3c69db0032
33 changed files with 911 additions and 162 deletions

View File

@@ -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|

View File

@@ -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 = "<group>"; };
525954242BE8F01600191286 /* ValueWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValueWrapper.swift; sourceTree = "<group>"; };
525954262BE9178F00191286 /* UserDataDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDataDM.swift; sourceTree = "<group>"; };
525954282BEA079500191286 /* UserEmailVerifyDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserEmailVerifyDM.swift; sourceTree = "<group>"; };
5259542A2BEA292800191286 /* UserRegPostModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserRegPostModel.swift; sourceTree = "<group>"; };
5259542D2BEA393700191286 /* AlertCustomVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertCustomVC.swift; sourceTree = "<group>"; };
5259542F2BEA394300191286 /* CustomAlerts.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CustomAlerts.storyboard; sourceTree = "<group>"; };
525954312BEA39D200191286 /* AddTapGesture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddTapGesture.swift; sourceTree = "<group>"; };
525954332BEA620800191286 /* IntrestTopicDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntrestTopicDM.swift; sourceTree = "<group>"; };
52663FF42BDFAB830001D8CE /* TextFieldErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldErrorView.swift; sourceTree = "<group>"; };
52663FF62BDFACF60001D8CE /* ShadowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShadowView.swift; sourceTree = "<group>"; };
52663FF82BDFAF110001D8CE /* EmailVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailVM.swift; sourceTree = "<group>"; };
@@ -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 = "<group>";
};
5259542C2BEA392A00191286 /* Alerts */ = {
isa = PBXGroup;
children = (
5259542D2BEA393700191286 /* AlertCustomVC.swift */,
5259542F2BEA394300191286 /* CustomAlerts.storyboard */,
);
path = Alerts;
sourceTree = "<group>";
};
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 = "<group>";
@@ -549,6 +572,9 @@
isa = PBXGroup;
children = (
525954262BE9178F00191286 /* UserDataDM.swift */,
525954282BEA079500191286 /* UserEmailVerifyDM.swift */,
5259542A2BEA292800191286 /* UserRegPostModel.swift */,
525954332BEA620800191286 /* IntrestTopicDM.swift */,
);
path = Model;
sourceTree = "<group>";
@@ -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 */,

View File

@@ -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
}
}

View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.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-Regular.ttf">
<string>Exo2-Regular</string>
</array>
</customFonts>
<scenes>
<!--View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-89" y="4"/>
</scene>
<!--Alert CustomVC-->
<scene sceneID="G8M-G5-a7A">
<objects>
<viewController storyboardIdentifier="AlertCustomVC" id="VqU-ZQ-5I8" customClass="AlertCustomVC" customModule="SimpliTend" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="4Fm-io-xfY">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zMV-hx-lLK">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="25" translatesAutoresizingMaskIntoConstraints="NO" id="Cse-oO-eBN">
<rect key="frame" x="20" y="359.66666666666669" width="353" height="157.66666666666669"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="zcQ-hT-ypl">
<rect key="frame" x="10" y="15" width="333" height="32.666666666666664"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5XT-Qk-jhD">
<rect key="frame" x="0.0" y="0.0" width="333" height="21.666666666666668"/>
<attributedString key="attributedText">
<fragment content="Sorry">
<attributes>
<color key="NSColor" name="TextDarkBlue"/>
<font key="NSFont" size="18" name="Exo2-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aOB-Zk-icT">
<rect key="frame" x="0.0" y="31.666666666666629" width="333" height="1"/>
<color key="backgroundColor" name="WelcomeBlue"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Dxc-O0-iN6"/>
</constraints>
</view>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3SZ-d8-nsd" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="10" y="72.666666666666629" width="333" height="0.0"/>
<fontDescription key="fontDescription" name="Exo2-Regular" 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>
<stackView opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="3UR-SG-Uvt">
<rect key="frame" x="10" y="97.666666666666629" width="333" height="50"/>
<subviews>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8Rk-n4-dY5">
<rect key="frame" x="0.0" y="0.0" width="333" height="50"/>
<color key="backgroundColor" name="TextDarkBlue"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Ok, Got it.">
<fontDescription key="titleFontDescription" name="Exo2-SemiBold" family="Exo 2" pointSize="18"/>
</buttonConfiguration>
<connections>
<action selector="doneBtnTapped:" destination="VqU-ZQ-5I8" eventType="touchUpInside" id="fb3-Vb-RBN"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="gQu-pZ-OE0"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<edgeInsets key="layoutMargins" top="15" left="10" bottom="10" right="10"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="pyp-Zt-5fV"/>
<constraints>
<constraint firstItem="zMV-hx-lLK" firstAttribute="trailing" secondItem="pyp-Zt-5fV" secondAttribute="trailing" id="7uR-7I-XhL"/>
<constraint firstItem="zMV-hx-lLK" firstAttribute="top" secondItem="4Fm-io-xfY" secondAttribute="top" id="GYO-3p-H2V"/>
<constraint firstItem="Cse-oO-eBN" firstAttribute="leading" secondItem="pyp-Zt-5fV" secondAttribute="leading" constant="20" id="HQf-Pb-bLV"/>
<constraint firstItem="pyp-Zt-5fV" firstAttribute="trailing" secondItem="Cse-oO-eBN" secondAttribute="trailing" constant="20" id="LPB-mY-z4h"/>
<constraint firstItem="zMV-hx-lLK" firstAttribute="leading" secondItem="pyp-Zt-5fV" secondAttribute="leading" id="R6x-mY-qa7"/>
<constraint firstAttribute="bottom" secondItem="zMV-hx-lLK" secondAttribute="bottom" id="W7n-xi-C2Y"/>
<constraint firstItem="Cse-oO-eBN" firstAttribute="centerY" secondItem="pyp-Zt-5fV" secondAttribute="centerY" id="oBI-jp-OX2"/>
</constraints>
</view>
<connections>
<outlet property="contentTextLbl" destination="3SZ-d8-nsd" id="bIW-Go-KIf"/>
<outlet property="maintitle" destination="5XT-Qk-jhD" id="Pu5-r4-sA8"/>
<outlet property="outsideView" destination="zMV-hx-lLK" id="YdK-Om-D5i"/>
<outlet property="yesBtn" destination="8Rk-n4-dY5" id="Ev4-cD-KoH"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UTs-9w-Hgy" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-877" y="4"/>
</scene>
</scenes>
<resources>
<namedColor name="TextDarkBlue">
<color red="0.10599999874830246" green="0.050999999046325684" blue="0.60399997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="WelcomeBlue">
<color red="0.32899999618530273" green="0.32400000095367432" blue="0.4779999852180481" alpha="0.33000001311302185" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -60,7 +60,7 @@
<color key="textColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="a@a.com" placeholder="Enter your email" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DSB-Ge-wNO" customClass="TextFieldShadow" customModule="WOKA" customModuleProvider="target">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="useless@yopmail.com" placeholder="Enter your email" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DSB-Ge-wNO" customClass="TextFieldShadow" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="34.5" width="354" height="50"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="TextDarkBlue"/>
@@ -167,7 +167,7 @@
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="70" translatesAutoresizingMaskIntoConstraints="NO" id="mhH-Ov-1nU">
<rect key="frame" x="20" y="172.5" width="374" height="247"/>
<rect key="frame" x="20" y="172.5" width="374" height="281.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NYC-6J-drr" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="10" y="0.0" width="354" height="67.5"/>
@@ -178,7 +178,7 @@ Sent to Your Parents Email</string>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="dF8-rD-e8F">
<rect key="frame" x="10" y="137.5" width="354" height="109.5"/>
<rect key="frame" x="10" y="137.5" width="354" height="144"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PLEASE ENTER THE CODE" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tB6-Qz-8Ez" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="354" height="19.5"/>
@@ -222,8 +222,32 @@ Sent to Your Parents Email</string>
<constraint firstAttribute="height" constant="60" id="wdo-po-1qc"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="OTP is valid for 10:00 Min" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WcL-Rp-jOq" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="109.5" width="354" height="19.5"/>
<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>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KX4-Ip-eii" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="136.5" width="354" height="0.0"/>
<color key="tintColor" name="TextDarkBlue"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain">
<attributedString key="attributedTitle">
<fragment content="Resend?">
<attributes>
<font key="NSFont" size="18" name="Exo2-Bold"/>
</attributes>
</fragment>
</attributedString>
</buttonConfiguration>
<connections>
<action selector="forgotPasswordBtnTapped:" destination="vuc-DA-J2M" eventType="touchUpInside" id="SCS-Mh-Vne"/>
<action selector="resendOTPBtnTapped:" destination="Yeg-Vy-0ZA" eventType="touchUpInside" id="OOw-hI-jxu"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dt3-hg-7T4" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="109.5" width="354" height="0.0"/>
<rect key="frame" x="0.0" y="144" width="354" height="0.0"/>
<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"/>
@@ -282,7 +306,9 @@ Sent to Your Parents Email</string>
<outlet property="codeSentLabel" destination="NYC-6J-drr" id="g32-r4-g1l"/>
<outlet property="enterCodeLabel" destination="tB6-Qz-8Ez" id="SGr-eL-sFE"/>
<outlet property="nextBtn" destination="vVW-Kz-YaV" id="oCe-dA-eea"/>
<outlet property="otpValidTillLabel" destination="WcL-Rp-jOq" id="y4D-2Z-xhu"/>
<outlet property="requestThemLabel" destination="M3r-lS-DmW" id="CzM-3U-q7x"/>
<outlet property="resendOTPBtn" destination="KX4-Ip-eii" id="Enu-Ex-nPT"/>
<outlet property="tf1" destination="81S-Fa-CiD" id="Eir-ru-GLT"/>
<outlet property="tf2" destination="42K-Uu-lPQ" id="PnG-VM-sHk"/>
<outlet property="tf3" destination="Hcd-Mm-IxW" id="HrM-fm-bRo"/>
@@ -313,7 +339,7 @@ Sent to Your Parents Email</string>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="70" translatesAutoresizingMaskIntoConstraints="NO" id="L80-bN-1T0">
<rect key="frame" x="20" y="172.5" width="374" height="540.5"/>
<rect key="frame" x="20" y="172.5" width="374" height="510.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Great! Now Lets Create Your WOKAccount" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3x2-kd-tL1" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="10" y="0.0" width="354" height="65"/>
@@ -322,7 +348,7 @@ Sent to Your Parents Email</string>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="bJs-H6-708">
<rect key="frame" x="10" y="135" width="354" height="405.5"/>
<rect key="frame" x="10" y="135" width="354" height="375.5"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="qSD-g5-OZA">
<rect key="frame" x="0.0" y="0.0" width="354" height="99.5"/>
@@ -342,7 +368,7 @@ Sent to Your Parents Email</string>
</constraints>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" enablesReturnKeyAutomatically="YES" textContentType="name"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" enablesReturnKeyAutomatically="YES" textContentType="name"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="paddingLeftCustom">
<real key="value" value="25"/>
@@ -378,7 +404,7 @@ Sent to Your Parents Email</string>
</constraints>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" enablesReturnKeyAutomatically="YES" textContentType="username"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" enablesReturnKeyAutomatically="YES" textContentType="name"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="paddingLeftCustom">
<real key="value" value="25"/>
@@ -397,7 +423,7 @@ Sent to Your Parents Email</string>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="hWX-C0-soL">
<rect key="frame" x="0.0" y="259" width="354" height="99.5"/>
<rect key="frame" x="0.0" y="259" width="354" height="116.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CREATE YOUR PASSWORD" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fev-AX-lcQ" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="354" height="19.5"/>
@@ -414,7 +440,7 @@ Sent to Your Parents Email</string>
</constraints>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" enablesReturnKeyAutomatically="YES" textContentType="email"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" enablesReturnKeyAutomatically="YES" secureTextEntry="YES" textContentType="email"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="paddingLeftCustom">
<real key="value" value="25"/>
@@ -424,20 +450,14 @@ Sent to Your Parents Email</string>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lyv-wM-y12">
<rect key="frame" x="0.0" y="99.5" width="354" height="0.0"/>
<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"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shh!! Dont share your password with anyone." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3LF-iY-Hoi" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="99.5" width="354" height="17"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="14"/>
<color key="textColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shh!! Dont share your password with anyone." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3LF-iY-Hoi" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="388.5" width="354" height="17"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="14"/>
<color key="textColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
@@ -640,7 +660,7 @@ Sent to Your Parents Email</string>
<constraints>
<constraint firstAttribute="height" constant="180" id="auZ-NR-TCk"/>
</constraints>
<collectionViewLayout key="collectionViewLayout" id="VDo-KP-FU1" customClass="CollectionViewCenteredFlowLayout" customModule="CollectionViewCenteredFlowLayout"/>
<collectionViewLayout key="collectionViewLayout" id="Eai-Cb-Sfn" customClass="CollectionViewCenteredFlowLayout" customModule="CollectionViewCenteredFlowLayout"/>
<cells/>
</collectionView>
</subviews>
@@ -1302,7 +1322,7 @@ Sent to Your Parents Email</string>
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="4gw-z0-s4a">
<size key="intrinsicContentSize" width="150.5" height="21"/>
<size key="intrinsicContentSize" width="150.5" height="20"/>
</designable>
<designable name="68c-1b-KSI">
<size key="intrinsicContentSize" width="151.5" height="21"/>
@@ -1311,7 +1331,7 @@ Sent to Your Parents Email</string>
<size key="intrinsicContentSize" width="8.5" height="23.5"/>
</designable>
<designable name="DSB-Ge-wNO">
<size key="intrinsicContentSize" width="119" height="21"/>
<size key="intrinsicContentSize" width="160" height="21"/>
</designable>
<designable name="Hcd-Mm-IxW">
<size key="intrinsicContentSize" width="8.5" height="23.5"/>

View File

@@ -38,6 +38,10 @@ class EmailVC: UIViewController {
}
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
/*
If child registers dont call api to check email, directly hit sendotp and navigate to otp screen
if parent registers check if the email exist or not and then hit sendotp
*/
Utilities.startProgressHUD()
DispatchQueue.main.async { [weak self] in
guard let self else{return}
@@ -49,11 +53,18 @@ class EmailVC: UIViewController {
Utilities.dismissProgressHUD()
return
}
vm.checkEmail()
/*
as per the user type
*/
switch AuthFunc.shareInstance.userType{
case .adult:
vm.checkEmail()
case .kid:
vm.sendOTP()
}
// let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
// let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.oTPVC) as! OTPVC
// self.navigationController?.pushViewController(vc, animated: true)
}
}
}

View File

@@ -25,6 +25,32 @@ class LoginVC: UIViewController {
}
@IBAction func loginBtnTapped(_ sender: LocalisedElementsButton) {
guard let userName = userNameTF.text , let pass = passwordTF.text else{return}
/*
Check for userName
*/
if userName.count < 2{
userNameTF.rightView?.isHidden = false
userNameTF.setError("Username is too short.", show: true)
return
}
/*
Check for password
*/
if pass.count < 6{
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = "Password is too short."
vcPush.mainTitleText = "Error"
// vcPush.onDoneBlock = { isDone in }
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
return
}
vm.loginUser()
}
@@ -51,6 +77,23 @@ extension LoginVC : UITextFieldDelegate{
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
switch textField{
// username - 2,16 , password - 6,16
case userNameTF:
if let rightView = textField.rightView {
// Hide the right view
rightView.isHidden = true
// Check if the right view is hidden
if rightView.isHidden {
// If hidden, hide the associated error view
if let errorView = errorViews.object(forKey: userNameTF) {
errorView.isHidden = true
}
}
}
if !string.numberAndCharacterAndSpecialChar(){return false}
return ValidatorClass.sharedInstanec.limitCharacter(length: 16,textField, shouldChangeCharactersIn: range, replacementString: string)
case passwordTF:
let currentString = (textField.text ?? "") as NSString
let newString = currentString.replacingCharacters(in: range, with: string)
@@ -63,6 +106,8 @@ extension LoginVC : UITextFieldDelegate{
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField{
case userNameTF:
passwordTF.becomeFirstResponder()
case passwordTF:
self.view.endEditing(true)
default:

View File

@@ -21,8 +21,10 @@ class OTPVC : UIViewController{
@IBOutlet weak var tf3: UITextField!
@IBOutlet weak var tf4: UITextField!
@IBOutlet weak var nextBtn: LocalisedElementsButton!
@IBOutlet weak var resendOTPBtn: LocalisedElementsButton!
@IBOutlet weak var codeSentLabel: UILabel!
@IBOutlet weak var otpValidTillLabel: LocalisedElementsLabel!
@IBOutlet weak var enterCodeLabel: UILabel!
@IBOutlet weak var requestThemLabel: LocalisedElementsLabel!
@@ -45,22 +47,19 @@ class OTPVC : UIViewController{
navigationController?.setNavigationBarHidden(true, animated: animated)
}
deinit {
vm.timer?.invalidate()
}
// MARK: - Button Tap Handler
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
switch self.navigateCheck{
case .newPass:
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.newPasswordVC) as! NewPasswordVC
self.navigationController?.pushViewController(vc, animated: true)
case .registeration:
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)
}
vm.validateOTP()
}
@IBAction func resendOTPBtnTapped(_ sender: LocalisedElementsButton) {
vm.remainingTime = 10 * 60
vm.resendOTP()
}
}
// MARK: - TextField Delegate

View File

@@ -35,6 +35,42 @@ class UserDetailsRegisterVC : UIViewController{
// MARK: - Button Tap Handler
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
guard let name = enterNameTF.text ,let userName = enterUserNameTF.text , let pass = enterPasswordTF.text else{return}
/*
Check for name
*/
if name.count < 2{
enterNameTF.rightView?.isHidden = false
enterNameTF.setError("Name is too short.", show: true)
return
}
/*
Check for username
*/
if userName.count < 3{
enterUserNameTF.rightView?.isHidden = false
enterUserNameTF.setError("Username is too short.", show: true)
return
}
/*
Check for password
*/
if pass.count < 6{
enterPasswordTF.rightView?.isHidden = false
enterPasswordTF.setError("Name is too short.", show: true)
return
}
/*
Initializing our local data store for user Register
*/
AuthFunc.shareInstance.regData.full_name = name
AuthFunc.shareInstance.regData.username = userName
AuthFunc.shareInstance.regData.password = pass
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userIntrestVC) as! UserIntrestVC
self.navigationController?.pushViewController(vc, animated: true)
@@ -45,4 +81,36 @@ class UserDetailsRegisterVC : UIViewController{
extension UserDetailsRegisterVC : UITextFieldDelegate{
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool{
switch textField{
case enterNameTF:
if !string.nameCharacterOnly(){return false}
return ValidatorClass.sharedInstanec.limitCharacter(length: 50,textField, shouldChangeCharactersIn: range, replacementString: string)
case enterUserNameTF:
if !string.numberAndCharacterAndSpecialChar(){return false}
return ValidatorClass.sharedInstanec.limitCharacter(length: 16,textField, shouldChangeCharactersIn: range, replacementString: string)
case enterPasswordTF:
let currentString = (textField.text ?? "") as NSString
let newString = currentString.replacingCharacters(in: range, with: string)
newString.count == 0 ? (textField.rightView?.isHidden = true) : (textField.rightView?.isHidden = false)
return ValidatorClass.sharedInstanec.limitCharacter(length: 16,textField, shouldChangeCharactersIn: range, replacementString: string)
default:
return true
}
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField{
case enterNameTF:
enterUserNameTF.becomeFirstResponder()
case enterUserNameTF:
enterPasswordTF.becomeFirstResponder()
case enterPasswordTF:
enterPasswordTF.resignFirstResponder()
default:
break
}
return true
}
}

View File

@@ -69,17 +69,17 @@ class UserIntrestVC: UIViewController {
extension UserIntrestVC : UICollectionViewDelegate , UICollectionViewDataSource{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return test.count
return vm.intrestTopics.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.Authentication.yourIntrestCell, for: indexPath) as! YourIntrestCell
cell.setData(text: test[indexPath.row].text!,selected: test[indexPath.row].selected!)
cell.setData(data: vm.intrestTopics[indexPath.row])
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
test[indexPath.row].selected?.toggle()
vm.intrestTopics[indexPath.row].isSelected?.toggle()
UIView.performWithoutAnimation {
self.collectionView.reloadItems(at: [IndexPath(row: indexPath.row, section: 0)])

View File

@@ -0,0 +1,38 @@
//
// IntrestTopicDM.swift
// WOKA
//
// Created by MacBook Pro on 07/05/24.
//
import Foundation
// MARK: - IntrestTopicDM
struct IntrestTopicDM: Codable {
let result: [Result]?
let totalRecords: Int?
enum CodingKeys: String, CodingKey {
case result
case totalRecords = "total_records"
}
// MARK: - Result
struct Result: Codable {
let id: Int?
let topicName: String?
var isSelected : Bool? = false
enum CodingKeys: String, CodingKey {
case id
case topicName = "topic_name"
case isSelected
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decodeIfPresent(Int.self, forKey: .id)
self.topicName = try container.decodeIfPresent(String.self, forKey: .topicName)
self.isSelected = (try? container.decodeIfPresent(Bool.self, forKey: .isSelected)) ?? false // Defaulting to false if nil
}
}
}

View File

@@ -0,0 +1,12 @@
//
// UserEmailVerifyDM.swift
// WOKA
//
// Created by MacBook Pro on 07/05/24.
//
import Foundation
struct UserEmailVerifyDM : Codable{
let unique_string: String?
}

View File

@@ -0,0 +1,52 @@
//
// UserRegPostModel.swift
// WOKA
//
// Created by MacBook Pro on 07/05/24.
//
import Foundation
//[{"key":"full_name","value":"DemoUser","description":"mandatory","type":"text"},{"key":"username","value":"tests104","description":"mandatory","type":"text"},{"key":"password","value":"123456","description":"mandatory (minimum 6 character)","type":"text"},{"key":"gender","value":"1","description":"mandatory (1 for girl/female, 2 for boy/male)","type":"text"},{"key":"birthdate","value":"2015-11-1","description":"mandatory","type":"text"},{"key":"email","value":"pradyumn@wdimails.com1","description":"mandatory","type":"text"},{"key":"guardian_email","value":"pradyumn@wdimails.com1","description":"mandatroy if user type = 1","type":"text"},{"key":"user_type","value":"1","description":"mandatory ( 1 = below 16, 2 = above 16)","type":"text"},{"key":"language_id","value":"1","description":"mandatory","type":"text"},{"key":"ip_address","value":"111","description":"non mandatory","type":"text","enabled":false},{"key":"interest_topic_id[0]","value":"1","description":"mandatory if user type=1","type":"text"},{"key":"interest_topic_id[1]","value":"2","description":"mandatory if user type=1","type":"text"},{"key":"avtar","value":"avatar1.png","description":"mandatory","type":"text"},{"key":"add_child","value":"1","description":"mandatory when parent adding child","type":"text"}]
struct UserRegPostModel: Encodable {
var full_name: String?
var username : String?
var password : String?
var date_of_birth: String?
var contact_number: String?
var email: String?
var street: String?
var town: String?
var country: String?
var state: String?
var zip_code: String?
var lat: String?
var lng: String?
var pin_code: String?
var cpin_code: String?
var one_signal_player_id: String?
var timezone: String?
var dictionaryRepresentation: [String: Any] {
return [
"full_name": full_name ?? "",
"username" : username ?? "",
"password" : password ?? "",
"date_of_birth": date_of_birth ?? "",
"contact_number": contact_number ?? "",
"email": email ?? "",
"street": street ?? "",
"town": town ?? "",
"country": country ?? "",
"state": state ?? "",
"zip_code": zip_code ?? "",
"lat": lat ?? "",
"lng": lng ?? "",
"pin_code": pin_code ?? "",
"cpin_code": cpin_code ?? "",
"one_signal_player_id": one_signal_player_id ?? "",
"timezone": timezone ?? ""
]
}
}

View File

@@ -21,10 +21,10 @@ class YourIntrestCell: UICollectionViewCell {
// outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
}
func setData(text : String,selected : Bool){
intrestLabel.text = text
func setData(data : IntrestTopicDM.Result){
intrestLabel.text = data.topicName?.capitalized
if selected{
if data.isSelected!{
outerView.backgroundColor = UIColor.white
}else{
outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)

View File

@@ -29,14 +29,14 @@ class EmailVM{
//Checking UserType to update the text
if AuthFunc.shareInstance.userType == .adult{
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterEmail.localized(loc: K.GVar.localized)
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterEmail.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.emailVerifyLabel.isHidden = true
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeAbove.localized(loc: K.GVar.localized)
vc.emailLabel.text = K.AuthenticationStringConstant.emailAbove.localized(loc: K.GVar.localized)
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeAbove.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.emailLabel.text = K.AuthenticationStringConstant.emailAbove.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}else{
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterParentsEmail.localized(loc: K.GVar.localized)
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeBelow.localized(loc: K.GVar.localized)
vc.emailLabel.text = K.AuthenticationStringConstant.emailBelow.localized(loc: K.GVar.localized)
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterParentsEmail.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeBelow.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.emailLabel.text = K.AuthenticationStringConstant.emailBelow.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}
}
@@ -56,50 +56,71 @@ class EmailVM{
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.check_exist_email, method: .post ,parameters: params) {(result : Result<BaseResponseModel<UserDataDM>, NetworkManager.APIError>) in
switch result{
case .success(let data):
// print(data.message)
switch data.success{
case 0:
/*
user exists
*/
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
case 1:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
/*
Create New Account
Send OTP
Start updating the user Reg data
*/
AuthFunc.shareInstance.regData.email = self.vc.enterEmailTF.text!
self.sendOTP()
default:
break
}
// switch data.errorCode{
// case 0: // this means no error
// Utilities.dismissProgressHUD()
// if let data = data.result {
// let sb = UIStoryboard(name: K.StoryBoard.geoFencing, bundle: nil)
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.GeoFencing.geoFencingMapVC) as! GeoFencingMapVC
// vcPush.vm.patientLocationLink = data
// self.navigationController?.setNavigationBarHidden(false, animated: true)
// self.navigationController?.pushViewController(vcPush, animated: true)
// }else{
// let sb = UIStoryboard(name: K.StoryBoard.geoFencing, bundle: nil)
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.GeoFencing.geoFencingMapVC) as! GeoFencingMapVC
// self.navigationController?.setNavigationBarHidden(false, animated: true)
// self.navigationController?.pushViewController(vcPush, animated: true)
// }
// case 1: // handle error
// Utilities.dismissProgressHUD()
// self.toast(msg: data.message ?? "Unrecognised error" , time: 2)
// default:
// Utilities.dismissProgressHUD()
// break
// }
case .failure(let error):
Utilities.dismissProgressHUD()
print(error)
// Utilities.dismissProgressHUD()
// switch error {
// case .noNetwork(let message) , .custom(let message), .unknown(let message):
// Utilities.alertWithBtn(title: "", msgBody: message, okBtnStr: "OK", vc: self)
// default:
// self.toast(msg: String(describing: error) , time: 2)
// }
self.vc.toast(msg: error.localizedDescription , time: 2)
}
}
}
func sendOTP(){
let params: Parameters = [
"email": vc.enterEmailTF.text!,
"user_type": AuthFunc.shareInstance.userType == .adult ? "2" :"1"
]
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi"]
Utilities.startProgressHUD()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.user_email_verification, method: .post ,parameters: params,headers: headers) {(result : Result<BaseResponseModel<UserEmailVerifyDM>, 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)
case 1: // Success
Utilities.dismissProgressHUD()
guard let uniqueString = data.data?.unique_string else{
self.vc.toast(msg: K.ConstantString.unRecognised , time: 1)
return
}
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 1) {
self.navigateToOTP(validateString: uniqueString)
}
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)
}
}
}
private func navigateToOTP(validateString : String){
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.oTPVC) as! OTPVC
vc.vm.validateString = validateString
self.vc.navigationController?.pushViewController(vc, animated: true)
}
}

View File

@@ -16,6 +16,9 @@ class LoginVM{
vc.passwordTF.delegate = self.vc
vc.userNameTF.delegate = self.vc
vc.userNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(validationIconTapped))
vc.userNameTF.rightView?.isHidden = true
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)
let color3 = #colorLiteral(red: 0.968627451, green: 0.7882352941, blue: 0.1294117647, alpha: 1)
@@ -30,6 +33,21 @@ class LoginVM{
vc.userNameTF.roundCorner()
vc.passwordTF.enablePasswordToggle()
vc.passwordTF.rightView?.isHidden = true
self.vc.view.addTapGesture {
let errorView = errorViews.object(forKey: self.vc.userNameTF)
if let errorView = errorView {
errorView.isHidden = true
}
}
}
// Function to handle tap on validation icon
@objc func validationIconTapped() {
let errorView = errorViews.object(forKey: vc.userNameTF)
if let errorView = errorView {
errorView.isHidden.toggle()
}
}
// Function to handle tap on Password Toggle icon
@@ -38,6 +56,9 @@ class LoginVM{
vc.passwordTF.isSecureTextEntry.toggle()
}
/*
After all checks do the api call
*/
func loginUser(){
let params: Parameters = [
"username": vc.userNameTF.text!,
@@ -59,38 +80,9 @@ class LoginVM{
default:
break
}
// switch data.errorCode{
// case 0: // this means no error
// Utilities.dismissProgressHUD()
// if let data = data.result {
// let sb = UIStoryboard(name: K.StoryBoard.geoFencing, bundle: nil)
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.GeoFencing.geoFencingMapVC) as! GeoFencingMapVC
// vcPush.vm.patientLocationLink = data
// self.navigationController?.setNavigationBarHidden(false, animated: true)
// self.navigationController?.pushViewController(vcPush, animated: true)
// }else{
// let sb = UIStoryboard(name: K.StoryBoard.geoFencing, bundle: nil)
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.GeoFencing.geoFencingMapVC) as! GeoFencingMapVC
// self.navigationController?.setNavigationBarHidden(false, animated: true)
// self.navigationController?.pushViewController(vcPush, animated: true)
// }
// case 1: // handle error
// Utilities.dismissProgressHUD()
// self.toast(msg: data.message ?? "Unrecognised error" , time: 2)
// default:
// Utilities.dismissProgressHUD()
// break
// }
case .failure(let error):
Utilities.dismissProgressHUD()
print(error)
// Utilities.dismissProgressHUD()
// switch error {
// case .noNetwork(let message) , .custom(let message), .unknown(let message):
// Utilities.alertWithBtn(title: "", msgBody: message, okBtnStr: "OK", vc: self)
// default:
// self.toast(msg: String(describing: error) , time: 2)
// }
self.vc.toast(msg: error.localizedDescription, time: 2)
}
}
}

View File

@@ -6,12 +6,18 @@
//
import UIKit
import Alamofire
class OTPVM{
weak var vc : OTPVC!
var validateString = String()
var timer: Timer?
var remainingTime: TimeInterval = 10 * 60 // 10 minutes in seconds
func initView(){
startTimer()
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))
@@ -21,13 +27,13 @@ class OTPVM{
tfMod(textField: [vc.tf1, vc.tf2, vc.tf3, vc.tf4])
if AuthFunc.shareInstance.userType == .adult{
vc.codeSentLabel.text = "Please Get the OTP Sent to Your Email".localized(loc: K.GVar.localized)
vc.enterCodeLabel.text = "PLEASE ENTER THE OTP".localized(loc: K.GVar.localized)
vc.requestThemLabel.text = "Dont forget to check your JUNK/SPAM folder".localized(loc: K.GVar.localized)
vc.codeSentLabel.text = "Please Get the OTP Sent to Your Email".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.enterCodeLabel.text = "PLEASE ENTER THE OTP".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.requestThemLabel.text = "Dont forget to check your JUNK/SPAM folder".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}else{
vc.codeSentLabel.text = "Please Get the Code Sent to Your Parents Email".localized(loc: K.GVar.localized)
vc.enterCodeLabel.text = "PLEASE ENTER THE CODE".localized(loc: K.GVar.localized)
vc.requestThemLabel.text = "Request them for the verfication code to activate your account".localized(loc: K.GVar.localized)
vc.codeSentLabel.text = "Please Get the Code Sent to Your Parents Email".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.enterCodeLabel.text = "PLEASE ENTER THE CODE".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.requestThemLabel.text = "Request them for the verfication code to activate your account".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}
}
@@ -40,6 +46,116 @@ class OTPVM{
}
}
// MARK: - Timer Handling
func startTimer() {
vc.resendOTPBtn.isHidden = true
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
}
@objc func updateTimer() {
if remainingTime > 0 {
remainingTime -= 1
updateTimerLabel()
} else {
timer?.invalidate()
vc.resendOTPBtn.isHidden = false
vc.otpValidTillLabel.isHidden = true
// Timer ended, perform any action you want here
}
}
func updateTimerLabel() {
let minutes = Int(remainingTime) / 60
let seconds = Int(remainingTime) % 60
let timeString = String(format: "%02d:%02d", minutes, seconds)
vc.otpValidTillLabel.isHidden = false
vc.otpValidTillLabel.text = "OTP is valid for \(timeString) Min"
}
// MARK: - OTP Validation
func validateOTP(){
let otp = vc.tf1.text! + vc.tf2.text! + vc.tf3.text! + vc.tf4.text!
if otp.count != 4{
self.vc.toast(msg: "Please enter code!", time: 1.8)
return
}
let params: Parameters = [
"unique_string": validateString,
"otp": otp
]
Utilities.startProgressHUD()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.validate_otp, method: .post ,parameters: params) {(result : Result<BaseResponseModel<UserEmailVerifyDM>, 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)
case 1: // Success
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 1) {
self.navigate()
}
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 resendOTP(){
let params: Parameters = [
"email": AuthFunc.shareInstance.regData.email!,
"user_type": AuthFunc.shareInstance.userType == .adult ? "2" :"1"
]
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi"]
Utilities.startProgressHUD(msg: "Sending OTP...")
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.user_email_verification, method: .post ,parameters: params,headers: headers) {(result : Result<BaseResponseModel<UserEmailVerifyDM>, 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)
case 1: // Success
Utilities.dismissProgressHUD()
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)
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(){
switch self.vc.navigateCheck{
case .newPass:
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.newPasswordVC) as! NewPasswordVC
self.vc.navigationController?.pushViewController(vc, animated: true)
case .registeration:
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)
}
}
// MARK: - TextField OTp handling
func textFieldDidChange(_ textField: UITextField, otpCode: String) {

View File

@@ -18,12 +18,40 @@ class UserDetailsRegisterVM{
vc.nextBtn.roundCorner()
tfMod(textField: [vc.enterNameTF, vc.enterPasswordTF, vc.enterUserNameTF])
hindiEnglishLanguage()
vc.enterNameTF.delegate = self.vc
vc.enterPasswordTF.delegate = self.vc
vc.enterUserNameTF.delegate = self.vc
//Adding eye to the password tf
vc.enterPasswordTF.enablePasswordToggle()
vc.enterPasswordTF.rightView?.isHidden = true
//Adding error view to the name tf
vc.enterNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
vc.enterNameTF.rightView?.isHidden = true
vc.enterUserNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
vc.enterUserNameTF.rightView?.isHidden = true
}
@objc func errorName(){
let errorView = errorViews.object(forKey: vc.enterNameTF)
if let errorView = errorView {
errorView.isHidden.toggle()
}
}
@objc func errorUserName(){
let errorView = errorViews.object(forKey: vc.enterNameTF)
if let errorView = errorView {
errorView.isHidden.toggle()
}
}
func hindiEnglishLanguage(){
vc.enterNameTF.placeholder = K.AuthenticationStringConstant.enterName.localized(loc: K.GVar.localized)
vc.enterUserNameTF.placeholder = K.AuthenticationStringConstant.selectUsername.localized(loc: K.GVar.localized)
vc.enterPasswordTF.placeholder = K.AuthenticationStringConstant.enterPassword.localized(loc: K.GVar.localized)
vc.enterNameTF.placeholder = K.AuthenticationStringConstant.enterName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.enterUserNameTF.placeholder = K.AuthenticationStringConstant.selectUsername.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.enterPasswordTF.placeholder = K.AuthenticationStringConstant.enterPassword.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}
private func tfMod(textField : [UITextField]){

View File

@@ -6,11 +6,13 @@
//
import UIKit
import Alamofire
class UserIntrestVM{
weak var vc : UserIntrestVC!
var gender = GenderEnum.none
var intrestTopics = [IntrestTopicDM.Result]()
func initView(){
setupCell()
@@ -31,12 +33,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()
/*
Set the collectionview height
*/
let height = self.vc.collectionView.collectionViewLayout.collectionViewContentSize.height
self.vc.contentHeight.constant = height
vc.view.layoutIfNeeded()
// Add tap gesture recognizer to the view
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(boyBtnTapped))
@@ -47,6 +43,7 @@ class UserIntrestVM{
vc.girlView.addGestureRecognizer(tapGesture2)
setGender()
getIntrests()
}
func setGender(){
@@ -75,7 +72,6 @@ class UserIntrestVM{
self.setGender()
}
}
}
@objc func girlBtnTapped() {
@@ -96,4 +92,40 @@ class UserIntrestVM{
vc.collectionView.delegate = self.vc
vc.collectionView.dataSource = self.vc
}
// MARK: - Get Intrests
func getIntrests(){
Utilities.startProgressHUD()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Auth.interest_topic_listing, method: .post) {(result : Result<BaseResponseModel<IntrestTopicDM>, NetworkManager.APIError>) in
switch result{
case .success(let data):
switch data.success{
case 0:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
case 1:
Utilities.dismissProgressHUD()
if let intrests = data.data?.result{
self.intrestTopics = intrests
self.vc.collectionView.reloadData()
/*
Set the collectionview height
*/
let height = self.vc.collectionView.collectionViewLayout.collectionViewContentSize.height
self.vc.contentHeight.constant = height
self.vc.view.layoutIfNeeded()
}
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
default:
break
}
case .failure(let error):
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription, time: 2)
}
}
}
}

View File

@@ -10,7 +10,7 @@ import Foundation
extension K{
struct GVar{
static var localized = K.LocalizedEnum.english
// static var localized = K.LocalizedEnum.english
}
}

View File

@@ -8,8 +8,5 @@
import Foundation
extension K{
enum LocalizedEnum{
static let hindi = "hi"
static let english = "en"
}
}

View File

@@ -38,15 +38,15 @@ class OnBoardVM{
vc.loginAsGuestBtn.roundCorner()
// Setting button text to localize
vc.createAccountBtn.setTitle("CREATE YOUR ACCOUNT".localized(loc: K.GVar.localized), for: .normal)
vc.loginBtn.setTitle("LOGIN".localized(loc: K.GVar.localized), for: .normal)
vc.loginAsGuestBtn.setTitle("Continue as a Guest".localized(loc: K.GVar.localized), for: .normal)
vc.createAccountBtn.setTitle("CREATE YOUR ACCOUNT".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), for: .normal)
vc.loginBtn.setTitle("LOGIN".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), for: .normal)
vc.loginAsGuestBtn.setTitle("Continue as a Guest".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), for: .normal)
// Init Collection Data
vc.pageControl.numberOfPages = 3
data = [CarouselData(title: "Watch, Listen & Play".localized(loc: K.GVar.localized), desc: "LIVE TV, VIDEOS, GAMES, AND AUDIO BOOKS".localized(loc: K.GVar.localized), image: "Slide1"),
CarouselData(title: "Sing-Along and Shop".localized(loc: K.GVar.localized), desc: "", image: "Slide2"),
CarouselData(title: "Lets all go to WOKALAND".localized(loc: K.GVar.localized), desc: "".localized(loc: K.GVar.localized), image: "Slide3")]
data = [CarouselData(title: "Watch, Listen & Play".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), desc: "LIVE TV, VIDEOS, GAMES, AND AUDIO BOOKS".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), image: "Slide1"),
CarouselData(title: "Sing-Along and Shop".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), desc: "", image: "Slide2"),
CarouselData(title: "Lets all go to WOKALAND".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), desc: "".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), image: "Slide3")]
//Setup CollectionView
setupCell()

View File

@@ -13,5 +13,6 @@ extension K{
static let main = "Main"
static let authenticationSB = "AuthenticationSB"
static let home = "Home"
static let customAlerts = "CustomAlerts"
}
}

View File

@@ -32,5 +32,9 @@ extension K{
static let homeVC = "HomeVC"
}
struct CustomAlerts{
static let alertCustomVC = "AlertCustomVC"
}
}
}

View File

@@ -21,8 +21,8 @@ class Utilities{
// SVProgressHUD.setDefaultMaskType(.black)
// }
static func startProgressHUD(progress: Float? = nil) {
LLSpinner.spin(text: "Please wait...")
static func startProgressHUD(progress: Float? = nil, msg : String? = nil) {
LLSpinner.spin(text: (msg != "" && msg != nil) ? msg : "Please wait...")
// if let progress = progress {
// SVProgressHUD.showProgress(progress)
// } else {

View File

@@ -0,0 +1,29 @@
//
// AddTapGesture.swift
// WOKA
//
// Created by MacBook Pro on 07/05/24.
//
import UIKit
extension UIView {
func addTapGesture(action : @escaping ()->Void ){
let tap = MyTapGestureRecognizer(target: self , action: #selector(self.handleTap(_:)))
tap.action = action
tap.numberOfTapsRequired = 1
self.addGestureRecognizer(tap)
self.isUserInteractionEnabled = true
}
@objc func handleTap(_ sender: MyTapGestureRecognizer) {
sender.action!()
}
}
class MyTapGestureRecognizer: UITapGestureRecognizer {
var action : (()->Void)? = nil
}

View File

@@ -21,7 +21,7 @@ class LocalisedElementsLabel: UILabel {
}
private func setup() {
self.text = self.text?.localized(loc: K.GVar.localized)
self.text = self.text?.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
}
}
@@ -40,6 +40,6 @@ class LocalisedElementsButton : UIButton {
}
private func setup() {
self.setTitle(self.titleLabel?.text?.localized(loc: K.GVar.localized), for: .normal)
self.setTitle(self.titleLabel?.text?.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), for: .normal)
}
}

View File

@@ -33,7 +33,7 @@ extension UITextField {
triagle.backgroundColor = .clear
triagle.translatesAutoresizingMaskIntoConstraints = false
container.addSubview(triagle)
// Create red line
let line = UIView()
line.backgroundColor = .red
@@ -42,7 +42,7 @@ extension UITextField {
// Create message
let label = UILabel()
label.text = " \(string ?? "") "
label.text = " \(string ?? "") "
label.textColor = .white
label.numberOfLines = 0
label.font = UIFont.systemFont(ofSize: 15)

View File

@@ -8,6 +8,14 @@
import Foundation
import AVFoundation
/*
Language Enum
*/
enum LocalizedEnum : String , CaseIterable{
case hindi = "hi"
case english = "en"
}
class AuthFunc{
/**
@@ -18,10 +26,14 @@ class AuthFunc{
var player: AVQueuePlayer?
var playerLooper: AVPlayerLooper?
var userType = UserType.adult
var languageSelected = LocalizedEnum.english
var authID = String()
var authPass = String()
//This is temporary variable. Make it emtpy when the registration is finished.
var regData = UserRegPostModel()
static let shareInstance = AuthFunc()

View File

@@ -24,6 +24,9 @@ struct APIEndPoints {
static let check_exist_email = makeURL(path: "check_exist_email")
static let login = makeURL(path: "login")
static let login_proceed = makeURL(path: "login_proceed")
static let user_email_verification = makeURL(path: "user_email_verification")
static let validate_otp = makeURL(path: "validate_otp")
static let interest_topic_listing = makeURL(path: "interest_topic_listing")
}
// Other endpoint categories...

View File

@@ -13,11 +13,11 @@ class BaseResponseModel<T: Codable> : Codable {
//class BaseResponseModel: Codable {
let success: Int?
let message: String?
let result: T?
let data: T?
enum CodingKeys: String, CodingKey {
case success
case message
case result
case data
}
}

View File

@@ -29,13 +29,18 @@ 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
switch sender{
case hindiBtn:
K.GVar.localized = K.LocalizedEnum.hindi
AuthFunc.shareInstance.languageSelected = .hindi
case englishBtn:
K.GVar.localized = K.LocalizedEnum.english
AuthFunc.shareInstance.languageSelected = .english
default:
K.GVar.localized = K.LocalizedEnum.english
AuthFunc.shareInstance.languageSelected = .english
}
let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil)

View File

@@ -23,16 +23,16 @@ class SelectAgeVM{
let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(adult))
vc.aboveAgeView.addGestureRecognizer(tapGesture2)
vc.privacyLabel.text = "We Value Your Privacy".localized(loc: K.GVar.localized)
vc.magicNoLabel.text = "16 IS THE MAGIC NUMBER".localized(loc: K.GVar.localized)
vc.yearsLabel.text = "YEARS".localized(loc: K.GVar.localized)
vc.iAmAboveLabel.text = "I AM".localized(loc: K.GVar.localized)
vc.iAmUnderLabel.text = "I AM".localized(loc: K.GVar.localized)
vc.underLabel.text = "UNDER".localized(loc: K.GVar.localized)
vc.aboveLabel.text = "ABOVE".localized(loc: K.GVar.localized)
vc.numberText.text = "16".localized(loc: K.GVar.localized)
vc.underTextLabel.text = "We will need your parents email so they can verify and agree to create an account.".localized(loc: K.GVar.localized)
vc.aboveTextLabel.text = "Above 16 users will be registered as a guardian with additional content.".localized(loc: K.GVar.localized)
vc.privacyLabel.text = "We Value Your Privacy".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.magicNoLabel.text = "16 IS THE MAGIC NUMBER".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.yearsLabel.text = "YEARS".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.iAmAboveLabel.text = "I AM".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.iAmUnderLabel.text = "I AM".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.underLabel.text = "UNDER".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.aboveLabel.text = "ABOVE".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.numberText.text = "16".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.underTextLabel.text = "We will need your parents email so they can verify and agree to create an account.".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vc.aboveTextLabel.text = "Above 16 users will be registered as a guardian with additional content.".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
self.vc.wokaLogoTopSpacing.constant = CheckPhoneHomeBtnOrNotch.shareInstance.topConstriant()
}