Skip to content

Commit fc6e06e

Browse files
baquerchashmeetsingh
authored andcommitted
Feat: Add resend verification link for the user (#537)
* Add resend verification link for the user * Make button small and place below signup * Handle Already registered email message * Fix Typo * Fix swiftlint * update podchecksum * Update pod version * Fix Swiftlint * Fix * Change Xcode Version * Update OS version
1 parent d0b5795 commit fc6e06e

File tree

11 files changed

+97
-31
lines changed

11 files changed

+97
-31
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
jobs:
44
lint:
55
macos:
6-
xcode: "10.0.0"
6+
xcode: "10.2.1"
77
steps:
88
- checkout
99
- run:
@@ -14,7 +14,7 @@ jobs:
1414
command: swiftlint
1515
test:
1616
macos:
17-
xcode: "10.0.0"
17+
xcode: "10.2.1"
1818
steps:
1919
- checkout
2020
- run:
@@ -26,7 +26,7 @@ jobs:
2626

2727
deploy:
2828
macos:
29-
xcode: "10.0.0"
29+
xcode: "10.2.1"
3030
steps:
3131
- checkout
3232
- run:

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ target 'Susi' do
2121
pod 'SwiftDate', '~> 4.5.0'
2222
pod 'NVActivityIndicatorView'
2323
pod 'Fakery', '~> 3.3.0'
24-
pod 'M13Checkbox', :git => 'https://github.com/Marxon13/M13Checkbox.git', :branch => 'swift_4_2'
24+
pod 'M13Checkbox'
2525
pod 'ReachabilitySwift'
2626
pod 'Localize-Swift'
2727
pod 'paper-onboarding'

Podfile.lock

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PODS:
1111
- Ji/Ji-libxml (2.1.0)
1212
- Kingfisher (4.10.1)
1313
- Localize-Swift (2.0.0)
14-
- M13Checkbox (3.2.2)
14+
- M13Checkbox (3.4.0)
1515
- Material (2.17.0):
1616
- Material/Core (= 2.17.0)
1717
- Material/Core (2.17.0):
@@ -44,7 +44,7 @@ DEPENDENCIES:
4444
- FTPopOverMenu_Swift (~> 0.1.3)
4545
- Kingfisher (~> 4.10.0)
4646
- Localize-Swift
47-
- M13Checkbox (from `https://github.com/Marxon13/M13Checkbox.git`, branch `swift_4_2`)
47+
- M13Checkbox
4848
- Material (from `https://github.com/CosmicMind/Material.git`, branch `development`)
4949
- Motion (from `https://github.com/CosmicMind/Motion.git`, branch `development`)
5050
- NVActivityIndicatorView
@@ -67,6 +67,7 @@ SPEC REPOS:
6767
- Ji
6868
- Kingfisher
6969
- Localize-Swift
70+
- M13Checkbox
7071
- NVActivityIndicatorView
7172
- paper-onboarding
7273
- ReachabilitySwift
@@ -79,9 +80,6 @@ SPEC REPOS:
7980
- Toast-Swift
8081

8182
EXTERNAL SOURCES:
82-
M13Checkbox:
83-
:branch: swift_4_2
84-
:git: https://github.com/Marxon13/M13Checkbox.git
8583
Material:
8684
:branch: development
8785
:git: https://github.com/CosmicMind/Material.git
@@ -90,9 +88,6 @@ EXTERNAL SOURCES:
9088
:git: https://github.com/CosmicMind/Motion.git
9189

9290
CHECKOUT OPTIONS:
93-
M13Checkbox:
94-
:commit: c26efb918e40ae4662dc6659b60f7c5493e94807
95-
:git: https://github.com/Marxon13/M13Checkbox.git
9691
Material:
9792
:commit: 4ab1b08c3365a00f409a210162ae72ed8425f299
9893
:git: https://github.com/CosmicMind/Material.git
@@ -109,7 +104,7 @@ SPEC CHECKSUMS:
109104
Ji: 21946da4e13425485ddd424edfaeeced0d80ad28
110105
Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0
111106
Localize-Swift: c798ec9286494866f7068f85f7c71283ac5bdab4
112-
M13Checkbox: 82182615a76646475b451ebe448a998f77f8cc6e
107+
M13Checkbox: 6f59404540ac98ba83a3d1afac335895a40c6a5d
113108
Material: 856e0168ab93fc477f875577c152c9e62f4ab869
114109
Motion: 3acabedc5a499f6b12deaa34deb68b425b005720
115110
NVActivityIndicatorView: ec7440a57af2450319d3a4181cca7da6fc127064
@@ -123,7 +118,6 @@ SPEC CHECKSUMS:
123118
SwiftValidators: 660ce9ef3f0358c25c3a6154f7edc02c7d4a0578
124119
Toast-Swift: 594b5c5e5129f15438e410207e43287f027b3c00
125120

126-
PODFILE CHECKSUM: 9b8f14b1a46ec3d802c3eb0dbd813391f49a6f98
121+
PODFILE CHECKSUM: c0d3ac6392c31961b5f3a0108501cdaf990069ee
127122

128-
129-
COCOAPODS: 1.5.3
123+
COCOAPODS: 1.7.2

Scripts/build_for_testing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
xcodebuild clean build-for-testing \
44
-workspace Susi.xcworkspace \
55
-sdk iphonesimulator \
6-
-destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2' \
6+
-destination 'platform=iOS Simulator,name=iPhone 8,OS=12.2' \
77
-scheme Susi | xcpretty -c && exit ${PIPESTATUS[0]}

Susi.xcodeproj/project.pbxproj

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@
809809
developmentRegion = English;
810810
hasScannedForEncodings = 0;
811811
knownRegions = (
812+
English,
812813
en,
813814
Base,
814815
ru,
@@ -893,7 +894,7 @@
893894
files = (
894895
);
895896
inputPaths = (
896-
"${SRCROOT}/Pods/Target Support Files/Pods-Susi/Pods-Susi-frameworks.sh",
897+
"${PODS_ROOT}/Target Support Files/Pods-Susi/Pods-Susi-frameworks.sh",
897898
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
898899
"${BUILT_PRODUCTS_DIR}/BouncyLayout/BouncyLayout.framework",
899900
"${BUILT_PRODUCTS_DIR}/CTShowcase/CTShowcase.framework",
@@ -942,7 +943,7 @@
942943
);
943944
runOnlyForDeploymentPostprocessing = 0;
944945
shellPath = /bin/sh;
945-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Susi/Pods-Susi-frameworks.sh\"\n";
946+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Susi/Pods-Susi-frameworks.sh\"\n";
946947
showEnvVarsInLog = 0;
947948
};
948949
B0C2866CE33C31CF9F8BA064 /* [CP] Embed Pods Frameworks */ = {
@@ -951,7 +952,7 @@
951952
files = (
952953
);
953954
inputPaths = (
954-
"${SRCROOT}/Pods/Target Support Files/Pods-SusiUITests/Pods-SusiUITests-frameworks.sh",
955+
"${PODS_ROOT}/Target Support Files/Pods-SusiUITests/Pods-SusiUITests-frameworks.sh",
955956
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
956957
);
957958
name = "[CP] Embed Pods Frameworks";
@@ -960,7 +961,7 @@
960961
);
961962
runOnlyForDeploymentPostprocessing = 0;
962963
shellPath = /bin/sh;
963-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SusiUITests/Pods-SusiUITests-frameworks.sh\"\n";
964+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SusiUITests/Pods-SusiUITests-frameworks.sh\"\n";
964965
showEnvVarsInLog = 0;
965966
};
966967
/* End PBXShellScriptBuildPhase section */
@@ -1150,6 +1151,7 @@
11501151
6D4D9B471E768E190067459C /* Debug */ = {
11511152
isa = XCBuildConfiguration;
11521153
buildSettings = {
1154+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
11531155
ALWAYS_SEARCH_USER_PATHS = NO;
11541156
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
11551157
CLANG_ANALYZER_NONNULL = YES;
@@ -1197,6 +1199,7 @@
11971199
GCC_WARN_UNUSED_FUNCTION = YES;
11981200
GCC_WARN_UNUSED_VARIABLE = YES;
11991201
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
1202+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
12001203
MTL_ENABLE_DEBUG_INFO = YES;
12011204
ONLY_ACTIVE_ARCH = YES;
12021205
SDKROOT = iphoneos;
@@ -1210,6 +1213,7 @@
12101213
6D4D9B481E768E190067459C /* Release */ = {
12111214
isa = XCBuildConfiguration;
12121215
buildSettings = {
1216+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
12131217
ALWAYS_SEARCH_USER_PATHS = NO;
12141218
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
12151219
CLANG_ANALYZER_NONNULL = YES;
@@ -1251,6 +1255,7 @@
12511255
GCC_WARN_UNUSED_FUNCTION = YES;
12521256
GCC_WARN_UNUSED_VARIABLE = YES;
12531257
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
1258+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
12541259
MTL_ENABLE_DEBUG_INFO = NO;
12551260
SDKROOT = iphoneos;
12561261
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -1268,6 +1273,7 @@
12681273
CLANG_ENABLE_MODULES = YES;
12691274
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
12701275
DEVELOPMENT_TEAM = 7P4K4M8A4Q;
1276+
DYLIB_INSTALL_NAME_BASE = "@rpath";
12711277
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
12721278
INFOPLIST_FILE = "Susi/Supporting Files/Info.plist";
12731279
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
@@ -1294,6 +1300,7 @@
12941300
CLANG_ENABLE_MODULES = YES;
12951301
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
12961302
DEVELOPMENT_TEAM = 7P4K4M8A4Q;
1303+
DYLIB_INSTALL_NAME_BASE = "@rpath";
12971304
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
12981305
INFOPLIST_FILE = "Susi/Supporting Files/Info.plist";
12991306
IPHONEOS_DEPLOYMENT_TARGET = 11.0;

Susi/Controllers/SignUpController/SignUpVCMethods.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,28 @@ extension SignUpViewController {
208208
}
209209
}
210210
}
211-
211+
212+
// Get Verification Link
213+
214+
func performResendVerification() {
215+
resendVerificationLinkButton.addTarget(self, action: #selector(resendVerificationLink), for: .touchUpInside)
216+
}
217+
218+
@objc func resendVerificationLink() {
219+
let param = [
220+
Client.UserKeys.EmailID: emailTextField.text
221+
]
222+
Client.sharedInstance.resendVerificationLink(param as [String : AnyObject]) { (success, responseMessage) in
223+
DispatchQueue.main.async {
224+
if success {
225+
self.view.makeToast(ControllerConstants.SignUp.verificationLink)
226+
} else {
227+
self.view.makeToast(ControllerConstants.SignUp.errorMessage)
228+
}
229+
}
230+
}
231+
}
232+
212233
}
213234

214235
extension SignUpViewController: UITextFieldDelegate {

Susi/Controllers/SignUpController/SignUpViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ class SignUpViewController: GeneralViewController {
2424
closeButton.imageView?.transform = CGAffineTransform(rotationAngle: -(.pi/2))
2525
}
2626
}
27-
27+
@IBOutlet weak var resendVerificationLinkButton: UIButton!
2828
override func viewDidLoad() {
2929
super.viewDidLoad()
3030
addTapGesture()
3131
prepareFields()
3232
prepareSignUpButton()
3333
addDelegates()
34+
performResendVerification()
3435
}
3536

3637
override func localizeStrings() {

Susi/Helpers/ControllerConstants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ class ControllerConstants {
147147
static let passwordDoNotMatch = "Passwords do not match"
148148
static let signUp = "Sign Up"
149149
static let successSignup = "You successfully signed-up! An email with a verification link was sent to your address."
150+
static let verificationLink = "Your request for a new verification link has been processed! An email with a verification link was sent to your address."
151+
static let errorMessage = "Already registered email! please provide a new email."
150152
}
151153

152154
struct UserDefaultsKeys {

Susi/Model/Client/Constants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extension Client {
4242
static let CheckRegistration = "/aaa/checkRegistration.json"
4343
static let ReportSkill = "/cms/reportSkill.json"
4444
static let GetLanguages = "/cms/getAllLanguages.json"
45+
static let ResendVerificationLink = "/aaa/resendVerificationLink.json"
4546
static let GetUserAvatar = "/getAvatar.png"
4647
static let BookmarkSkill = "/cms/bookmarkSkill.json"
4748
}
@@ -73,6 +74,7 @@ extension Client {
7374
static let NewPassword = "newpassword"
7475
static let EmailExists = "exists"
7576
static let CheckEmail = "check_email"
77+
static let EmailID = "emailId"
7678
}
7779

7880
struct ChatKeys {

Susi/Model/Client/Convenience.swift

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,33 @@ extension Client {
675675
})
676676
}
677677

678+
// MARK: - Resend Verification Link Method
679+
680+
func resendVerificationLink(_ params: [String: AnyObject], _ completion: @escaping(_ success: Bool, _ error: String?) -> Void) {
681+
let url = getApiUrl(UserDefaults.standard.object(forKey: ControllerConstants.UserDefaultsKeys.ipAddress) as! String, Methods.ResendVerificationLink)
682+
_ = makeRequest(url, .get, [:], parameters: params, completion: { (results, message) in
683+
684+
if let _ = message {
685+
completion(false, ResponseMessages.ServerError)
686+
} else if let results = results {
687+
688+
guard let response = results as? [String: AnyObject] else {
689+
completion(false, ResponseMessages.InvalidParams)
690+
return
691+
}
692+
693+
if let accepted = response[ControllerConstants.accepted] as? Bool {
694+
if accepted {
695+
completion(true, nil)
696+
return
697+
}
698+
completion(false, ResponseMessages.ServerError)
699+
return
700+
}
701+
}
702+
return
703+
})
704+
}
678705
// Bookmark skill
679706

680707
func bookmarkSkill(_ params: [String: AnyObject], _ completion: @escaping(_ success: Bool, _ error: String?) -> Void) {
@@ -703,5 +730,5 @@ extension Client {
703730
return
704731
})
705732
}
706-
733+
707734
}

0 commit comments

Comments
 (0)