Showing
11 changed files
with
1210 additions
and
41 deletions
@@ -14,11 +14,11 @@ enum SkModernistFontType: String { | @@ -14,11 +14,11 @@ enum SkModernistFontType: String { | ||
14 | } | 14 | } |
15 | 15 | ||
16 | extension UIFont { | 16 | extension UIFont { |
17 | - static func roboto(type: SkModernistFontType, ofSize: CGFloat) -> UIFont { | 17 | + static func skModernist(type: SkModernistFontType, ofSize: CGFloat) -> UIFont { |
18 | if let font = UIFont(name: type.rawValue, size: ofSize) { | 18 | if let font = UIFont(name: type.rawValue, size: ofSize) { |
19 | return font | 19 | return font |
20 | } else { | 20 | } else { |
21 | - fatalError("Font '\(type.rawValue)' does not exist.❌") | 21 | + return .systemFont(ofSize: ofSize) |
22 | } | 22 | } |
23 | } | 23 | } |
24 | } | 24 | } |
@@ -7,13 +7,12 @@ | @@ -7,13 +7,12 @@ | ||
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | + 00E581BB284F71CD00E779FB /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00E581BA284F71CD00E779FB /* Checkbox.swift */; }; | ||
10 | 17058D52284A4F150078DD82 /* CodeVerificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */; }; | 11 | 17058D52284A4F150078DD82 /* CodeVerificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */; }; |
11 | 17058D54284A4F670078DD82 /* CodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17058D53284A4F670078DD82 /* CodeVerificationView.swift */; }; | 12 | 17058D54284A4F670078DD82 /* CodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17058D53284A4F670078DD82 /* CodeVerificationView.swift */; }; |
12 | 17287C602848AD8D00AA7113 /* Fonts + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */; }; | 13 | 17287C602848AD8D00AA7113 /* Fonts + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */; }; |
13 | 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */; }; | 14 | 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */; }; |
14 | 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */; }; | 15 | 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */; }; |
15 | - 17287C6B2848C69600AA7113 /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = 17287C662848C69600AA7113 /* license.txt */; }; | ||
16 | - 17287C6C2848C69600AA7113 /* fontsme.com.url in Resources */ = {isa = PBXBuildFile; fileRef = 17287C672848C69600AA7113 /* fontsme.com.url */; }; | ||
17 | 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */; }; | 16 | 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */ = {isa = PBXBuildFile; fileRef = 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */; }; |
18 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729E21C28465162006C7C29 /* PhoneService.swift */; }; | 17 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729E21C28465162006C7C29 /* PhoneService.swift */; }; |
19 | 1729E21F28465595006C7C29 /* PhoneNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729E21E28465595006C7C29 /* PhoneNumberView.swift */; }; | 18 | 1729E21F28465595006C7C29 /* PhoneNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729E21E28465595006C7C29 /* PhoneNumberView.swift */; }; |
@@ -30,13 +29,12 @@ | @@ -30,13 +29,12 @@ | ||
30 | /* End PBXBuildFile section */ | 29 | /* End PBXBuildFile section */ |
31 | 30 | ||
32 | /* Begin PBXFileReference section */ | 31 | /* Begin PBXFileReference section */ |
32 | + 00E581BA284F71CD00E779FB /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; }; | ||
33 | 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeVerificationViewController.swift; sourceTree = "<group>"; }; | 33 | 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeVerificationViewController.swift; sourceTree = "<group>"; }; |
34 | 17058D53284A4F670078DD82 /* CodeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; }; | 34 | 17058D53284A4F670078DD82 /* CodeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; }; |
35 | 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fonts + Extension.swift"; sourceTree = "<group>"; }; | 35 | 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fonts + Extension.swift"; sourceTree = "<group>"; }; |
36 | 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Bold.otf"; sourceTree = "<group>"; }; | 36 | 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Bold.otf"; sourceTree = "<group>"; }; |
37 | 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Regular.otf"; sourceTree = "<group>"; }; | 37 | 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Regular.otf"; sourceTree = "<group>"; }; |
38 | - 17287C662848C69600AA7113 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = "../../../../../../Downloads/Sk-Modernist/license.txt"; sourceTree = "<group>"; }; | ||
39 | - 17287C672848C69600AA7113 /* fontsme.com.url */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = fontsme.com.url; path = "../../../../../../Downloads/Sk-Modernist/fontsme.com.url"; sourceTree = "<group>"; }; | ||
40 | 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Mono.otf"; sourceTree = "<group>"; }; | 38 | 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Sk-Modernist-Mono.otf"; sourceTree = "<group>"; }; |
41 | 1729E21C28465162006C7C29 /* PhoneService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneService.swift; sourceTree = "<group>"; }; | 39 | 1729E21C28465162006C7C29 /* PhoneService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneService.swift; sourceTree = "<group>"; }; |
42 | 1729E21E28465595006C7C29 /* PhoneNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneNumberView.swift; sourceTree = "<group>"; }; | 40 | 1729E21E28465595006C7C29 /* PhoneNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneNumberView.swift; sourceTree = "<group>"; }; |
@@ -68,6 +66,92 @@ | @@ -68,6 +66,92 @@ | ||
68 | /* End PBXFrameworksBuildPhase section */ | 66 | /* End PBXFrameworksBuildPhase section */ |
69 | 67 | ||
70 | /* Begin PBXGroup section */ | 68 | /* Begin PBXGroup section */ |
69 | + 00E581B0284F666000E779FB /* Modules */ = { | ||
70 | + isa = PBXGroup; | ||
71 | + children = ( | ||
72 | + 00E581B4284F669600E779FB /* OTPScreen */, | ||
73 | + 00E581B1284F666600E779FB /* VerificationSceen */, | ||
74 | + ); | ||
75 | + path = Modules; | ||
76 | + sourceTree = "<group>"; | ||
77 | + }; | ||
78 | + 00E581B1284F666600E779FB /* VerificationSceen */ = { | ||
79 | + isa = PBXGroup; | ||
80 | + children = ( | ||
81 | + 00E581B3284F667C00E779FB /* ViewController */, | ||
82 | + 00E581B2284F667600E779FB /* View */, | ||
83 | + ); | ||
84 | + path = VerificationSceen; | ||
85 | + sourceTree = "<group>"; | ||
86 | + }; | ||
87 | + 00E581B2284F667600E779FB /* View */ = { | ||
88 | + isa = PBXGroup; | ||
89 | + children = ( | ||
90 | + 1729E21E28465595006C7C29 /* PhoneNumberView.swift */, | ||
91 | + 1732AC7228477BB40042C9F7 /* PickerViewCell.swift */, | ||
92 | + 1732AC70284769B50042C9F7 /* TextFieldWithPadding.swift */, | ||
93 | + 17CF9EF62844EF8B000D8077 /* VerificationView.swift */, | ||
94 | + ); | ||
95 | + path = View; | ||
96 | + sourceTree = "<group>"; | ||
97 | + }; | ||
98 | + 00E581B3284F667C00E779FB /* ViewController */ = { | ||
99 | + isa = PBXGroup; | ||
100 | + children = ( | ||
101 | + 17CF9EE42844ED8F000D8077 /* VerificationViewController.swift */, | ||
102 | + ); | ||
103 | + path = ViewController; | ||
104 | + sourceTree = "<group>"; | ||
105 | + }; | ||
106 | + 00E581B4284F669600E779FB /* OTPScreen */ = { | ||
107 | + isa = PBXGroup; | ||
108 | + children = ( | ||
109 | + 00E581B6284F66B400E779FB /* ViewController */, | ||
110 | + 00E581B5284F66AB00E779FB /* View */, | ||
111 | + ); | ||
112 | + path = OTPScreen; | ||
113 | + sourceTree = "<group>"; | ||
114 | + }; | ||
115 | + 00E581B5284F66AB00E779FB /* View */ = { | ||
116 | + isa = PBXGroup; | ||
117 | + children = ( | ||
118 | + 17058D53284A4F670078DD82 /* CodeVerificationView.swift */, | ||
119 | + ); | ||
120 | + path = View; | ||
121 | + sourceTree = "<group>"; | ||
122 | + }; | ||
123 | + 00E581B6284F66B400E779FB /* ViewController */ = { | ||
124 | + isa = PBXGroup; | ||
125 | + children = ( | ||
126 | + 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */, | ||
127 | + ); | ||
128 | + path = ViewController; | ||
129 | + sourceTree = "<group>"; | ||
130 | + }; | ||
131 | + 00E581B7284F71A700E779FB /* Common */ = { | ||
132 | + isa = PBXGroup; | ||
133 | + children = ( | ||
134 | + 00E581B8284F71AE00E779FB /* CustomUI */, | ||
135 | + ); | ||
136 | + path = Common; | ||
137 | + sourceTree = "<group>"; | ||
138 | + }; | ||
139 | + 00E581B8284F71AE00E779FB /* CustomUI */ = { | ||
140 | + isa = PBXGroup; | ||
141 | + children = ( | ||
142 | + 00E581B9284F71B700E779FB /* Checkbox */, | ||
143 | + ); | ||
144 | + path = CustomUI; | ||
145 | + sourceTree = "<group>"; | ||
146 | + }; | ||
147 | + 00E581B9284F71B700E779FB /* Checkbox */ = { | ||
148 | + isa = PBXGroup; | ||
149 | + children = ( | ||
150 | + 00E581BA284F71CD00E779FB /* Checkbox.swift */, | ||
151 | + ); | ||
152 | + path = Checkbox; | ||
153 | + sourceTree = "<group>"; | ||
154 | + }; | ||
71 | 17287C5E2848AC8800AA7113 /* Fonts + Extension */ = { | 155 | 17287C5E2848AC8800AA7113 /* Fonts + Extension */ = { |
72 | isa = PBXGroup; | 156 | isa = PBXGroup; |
73 | children = ( | 157 | children = ( |
@@ -99,8 +183,8 @@ | @@ -99,8 +183,8 @@ | ||
99 | 17CF9EDF2844ED8F000D8077 /* InterQR-Internship */ = { | 183 | 17CF9EDF2844ED8F000D8077 /* InterQR-Internship */ = { |
100 | isa = PBXGroup; | 184 | isa = PBXGroup; |
101 | children = ( | 185 | children = ( |
102 | - 17CF9EF42844EF55000D8077 /* Views */, | ||
103 | - 17CF9EF52844EF66000D8077 /* Controllers */, | 186 | + 00E581B7284F71A700E779FB /* Common */, |
187 | + 00E581B0284F666000E779FB /* Modules */, | ||
104 | 17CF9EE02844ED8F000D8077 /* AppDelegate.swift */, | 188 | 17CF9EE02844ED8F000D8077 /* AppDelegate.swift */, |
105 | 17CF9EE22844ED8F000D8077 /* SceneDelegate.swift */, | 189 | 17CF9EE22844ED8F000D8077 /* SceneDelegate.swift */, |
106 | 17CF9EE92844ED90000D8077 /* Assets.xcassets */, | 190 | 17CF9EE92844ED90000D8077 /* Assets.xcassets */, |
@@ -112,27 +196,6 @@ | @@ -112,27 +196,6 @@ | ||
112 | path = "InterQR-Internship"; | 196 | path = "InterQR-Internship"; |
113 | sourceTree = "<group>"; | 197 | sourceTree = "<group>"; |
114 | }; | 198 | }; |
115 | - 17CF9EF42844EF55000D8077 /* Views */ = { | ||
116 | - isa = PBXGroup; | ||
117 | - children = ( | ||
118 | - 17CF9EF62844EF8B000D8077 /* VerificationView.swift */, | ||
119 | - 17058D53284A4F670078DD82 /* CodeVerificationView.swift */, | ||
120 | - 1729E21E28465595006C7C29 /* PhoneNumberView.swift */, | ||
121 | - 1732AC7228477BB40042C9F7 /* PickerViewCell.swift */, | ||
122 | - 1732AC70284769B50042C9F7 /* TextFieldWithPadding.swift */, | ||
123 | - ); | ||
124 | - path = Views; | ||
125 | - sourceTree = "<group>"; | ||
126 | - }; | ||
127 | - 17CF9EF52844EF66000D8077 /* Controllers */ = { | ||
128 | - isa = PBXGroup; | ||
129 | - children = ( | ||
130 | - 17CF9EE42844ED8F000D8077 /* VerificationViewController.swift */, | ||
131 | - 17058D51284A4F150078DD82 /* CodeVerificationViewController.swift */, | ||
132 | - ); | ||
133 | - path = Controllers; | ||
134 | - sourceTree = "<group>"; | ||
135 | - }; | ||
136 | 17FD60D82848A2CE00957A3A /* Resources */ = { | 199 | 17FD60D82848A2CE00957A3A /* Resources */ = { |
137 | isa = PBXGroup; | 200 | isa = PBXGroup; |
138 | children = ( | 201 | children = ( |
@@ -144,8 +207,6 @@ | @@ -144,8 +207,6 @@ | ||
144 | 17FD60D92848A56900957A3A /* Fonts */ = { | 207 | 17FD60D92848A56900957A3A /* Fonts */ = { |
145 | isa = PBXGroup; | 208 | isa = PBXGroup; |
146 | children = ( | 209 | children = ( |
147 | - 17287C672848C69600AA7113 /* fontsme.com.url */, | ||
148 | - 17287C662848C69600AA7113 /* license.txt */, | ||
149 | 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */, | 210 | 17287C642848C69600AA7113 /* Sk-Modernist-Bold.otf */, |
150 | 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */, | 211 | 17287C682848C69600AA7113 /* Sk-Modernist-Mono.otf */, |
151 | 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */, | 212 | 17287C652848C69600AA7113 /* Sk-Modernist-Regular.otf */, |
@@ -232,11 +293,9 @@ | @@ -232,11 +293,9 @@ | ||
232 | files = ( | 293 | files = ( |
233 | 17CF9EED2844ED90000D8077 /* LaunchScreen.storyboard in Resources */, | 294 | 17CF9EED2844ED90000D8077 /* LaunchScreen.storyboard in Resources */, |
234 | 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */, | 295 | 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */, |
235 | - 17287C6B2848C69600AA7113 /* license.txt in Resources */, | ||
236 | 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */, | 296 | 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */, |
237 | 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */, | 297 | 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */, |
238 | 17CF9EEA2844ED90000D8077 /* Assets.xcassets in Resources */, | 298 | 17CF9EEA2844ED90000D8077 /* Assets.xcassets in Resources */, |
239 | - 17287C6C2848C69600AA7113 /* fontsme.com.url in Resources */, | ||
240 | ); | 299 | ); |
241 | runOnlyForDeploymentPostprocessing = 0; | 300 | runOnlyForDeploymentPostprocessing = 0; |
242 | }; | 301 | }; |
@@ -299,6 +358,7 @@ | @@ -299,6 +358,7 @@ | ||
299 | 17CF9EE12844ED8F000D8077 /* AppDelegate.swift in Sources */, | 358 | 17CF9EE12844ED8F000D8077 /* AppDelegate.swift in Sources */, |
300 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */, | 359 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */, |
301 | 17CF9EE32844ED8F000D8077 /* SceneDelegate.swift in Sources */, | 360 | 17CF9EE32844ED8F000D8077 /* SceneDelegate.swift in Sources */, |
361 | + 00E581BB284F71CD00E779FB /* Checkbox.swift in Sources */, | ||
302 | 17287C602848AD8D00AA7113 /* Fonts + Extension.swift in Sources */, | 362 | 17287C602848AD8D00AA7113 /* Fonts + Extension.swift in Sources */, |
303 | 17CF9EF72844EF8B000D8077 /* VerificationView.swift in Sources */, | 363 | 17CF9EF72844EF8B000D8077 /* VerificationView.swift in Sources */, |
304 | ); | 364 | ); |
@@ -369,7 +429,7 @@ | @@ -369,7 +429,7 @@ | ||
369 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
370 | GCC_WARN_UNUSED_FUNCTION = YES; | 430 | GCC_WARN_UNUSED_FUNCTION = YES; |
371 | GCC_WARN_UNUSED_VARIABLE = YES; | 431 | GCC_WARN_UNUSED_VARIABLE = YES; |
372 | - IPHONEOS_DEPLOYMENT_TARGET = 15.0; | 432 | + IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
373 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | 433 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
374 | MTL_FAST_MATH = YES; | 434 | MTL_FAST_MATH = YES; |
375 | ONLY_ACTIVE_ARCH = YES; | 435 | ONLY_ACTIVE_ARCH = YES; |
@@ -424,7 +484,7 @@ | @@ -424,7 +484,7 @@ | ||
424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 484 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
425 | GCC_WARN_UNUSED_FUNCTION = YES; | 485 | GCC_WARN_UNUSED_FUNCTION = YES; |
426 | GCC_WARN_UNUSED_VARIABLE = YES; | 486 | GCC_WARN_UNUSED_VARIABLE = YES; |
427 | - IPHONEOS_DEPLOYMENT_TARGET = 15.0; | 487 | + IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
428 | MTL_ENABLE_DEBUG_INFO = NO; | 488 | MTL_ENABLE_DEBUG_INFO = NO; |
429 | MTL_FAST_MATH = YES; | 489 | MTL_FAST_MATH = YES; |
430 | SDKROOT = iphoneos; | 490 | SDKROOT = iphoneos; |
@@ -442,6 +502,7 @@ | @@ -442,6 +502,7 @@ | ||
442 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 502 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
443 | CODE_SIGN_STYLE = Automatic; | 503 | CODE_SIGN_STYLE = Automatic; |
444 | CURRENT_PROJECT_VERSION = 1; | 504 | CURRENT_PROJECT_VERSION = 1; |
505 | + DEVELOPMENT_TEAM = 52KCA3JZ59; | ||
445 | GENERATE_INFOPLIST_FILE = YES; | 506 | GENERATE_INFOPLIST_FILE = YES; |
446 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; | 507 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
447 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 508 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
@@ -457,7 +518,7 @@ | @@ -457,7 +518,7 @@ | ||
457 | PRODUCT_NAME = "$(TARGET_NAME)"; | 518 | PRODUCT_NAME = "$(TARGET_NAME)"; |
458 | SWIFT_EMIT_LOC_STRINGS = YES; | 519 | SWIFT_EMIT_LOC_STRINGS = YES; |
459 | SWIFT_VERSION = 5.0; | 520 | SWIFT_VERSION = 5.0; |
460 | - TARGETED_DEVICE_FAMILY = "1,2"; | 521 | + TARGETED_DEVICE_FAMILY = 1; |
461 | }; | 522 | }; |
462 | name = Debug; | 523 | name = Debug; |
463 | }; | 524 | }; |
@@ -469,6 +530,7 @@ | @@ -469,6 +530,7 @@ | ||
469 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 530 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
470 | CODE_SIGN_STYLE = Automatic; | 531 | CODE_SIGN_STYLE = Automatic; |
471 | CURRENT_PROJECT_VERSION = 1; | 532 | CURRENT_PROJECT_VERSION = 1; |
533 | + DEVELOPMENT_TEAM = 52KCA3JZ59; | ||
472 | GENERATE_INFOPLIST_FILE = YES; | 534 | GENERATE_INFOPLIST_FILE = YES; |
473 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; | 535 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
474 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 536 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
@@ -484,7 +546,7 @@ | @@ -484,7 +546,7 @@ | ||
484 | PRODUCT_NAME = "$(TARGET_NAME)"; | 546 | PRODUCT_NAME = "$(TARGET_NAME)"; |
485 | SWIFT_EMIT_LOC_STRINGS = YES; | 547 | SWIFT_EMIT_LOC_STRINGS = YES; |
486 | SWIFT_VERSION = 5.0; | 548 | SWIFT_VERSION = 5.0; |
487 | - TARGETED_DEVICE_FAMILY = "1,2"; | 549 | + TARGETED_DEVICE_FAMILY = 1; |
488 | }; | 550 | }; |
489 | name = Release; | 551 | name = Release; |
490 | }; | 552 | }; |
1 | +// | ||
2 | +// Checkbox.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Leyter on 07.06.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import Foundation | ||
9 | +import UIKit | ||
10 | +class Checkbox: UIButton { | ||
11 | + | ||
12 | + private let checboxImageView: UIImageView = { | ||
13 | + let obj = UIImageView() | ||
14 | + return obj | ||
15 | + }() | ||
16 | + | ||
17 | + private let checkBoxLabel: UILabel = { | ||
18 | + let obj = UILabel() | ||
19 | + obj.font = .skModernist(type: .regular, ofSize: 15) | ||
20 | + return obj | ||
21 | + }() | ||
22 | + | ||
23 | + override var isSelected: Bool { | ||
24 | + didSet { | ||
25 | + checkBoxLabel.textColor = isSelected ? | ||
26 | + UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1) : | ||
27 | + UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1) | ||
28 | + checboxImageView.image = isSelected ? | ||
29 | + UIImage(named: "OnIndicator") : | ||
30 | + UIImage(named: "OffIndicator") | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + var checkboxTitle: String = "" { | ||
35 | + didSet { | ||
36 | + checkBoxLabel.text = checkboxTitle | ||
37 | + } | ||
38 | + } | ||
39 | + | ||
40 | + override init(frame: CGRect) { | ||
41 | + super.init(frame: frame) | ||
42 | + setup() | ||
43 | + } | ||
44 | + | ||
45 | + required init?(coder: NSCoder) { | ||
46 | + super.init(coder: coder) | ||
47 | + setup() | ||
48 | + } | ||
49 | + | ||
50 | + private func setup() { | ||
51 | + isSelected = false | ||
52 | + | ||
53 | + addSubview(checboxImageView) | ||
54 | + addSubview(checkBoxLabel) | ||
55 | + | ||
56 | + checboxImageView.snp.makeConstraints { make in | ||
57 | + make.leading.equalToSuperview() | ||
58 | + make.top.bottom.equalToSuperview() | ||
59 | + } | ||
60 | + | ||
61 | + checkBoxLabel.snp.makeConstraints { make in | ||
62 | + make.top.bottom.equalToSuperview() | ||
63 | + make.trailing.equalToSuperview() | ||
64 | + make.leading.equalTo(checboxImageView.snp.trailing).offset(5) | ||
65 | + } | ||
66 | + } | ||
67 | +} |
1 | +// | ||
2 | +// CodeVerificationView.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 03.06.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +class CodeVerificationView: UIView { | ||
11 | + | ||
12 | + var containerView: UIView = { | ||
13 | + var obj = UIView() | ||
14 | + return obj | ||
15 | + }() | ||
16 | + var backButton: UIButton = { | ||
17 | + var obj = UIButton() | ||
18 | + obj.setImage(UIImage(named: "BackPointer"), for: .normal) | ||
19 | + obj.backgroundColor = .white | ||
20 | + obj.layer.borderColor = UIColor(red: 224/255, green: 231/255, blue: 232/255, alpha: 1).cgColor | ||
21 | + obj.layer.cornerRadius = 13 | ||
22 | + obj.layer.borderWidth = 1 | ||
23 | + return obj | ||
24 | + }() | ||
25 | + var logoImage: UIImageView = { | ||
26 | + var obj = UIImageView() | ||
27 | + obj.image = UIImage(named: "InterQR") | ||
28 | + return obj | ||
29 | + }() | ||
30 | + var shieldImage: UIImageView = { | ||
31 | + var obj = UIImageView() | ||
32 | + obj.image = UIImage(named: "Lock") | ||
33 | + return obj | ||
34 | + }() | ||
35 | + var descriptionLabel: UILabel = { | ||
36 | + var obj = UILabel() | ||
37 | + obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 35) | ||
38 | + obj.text = "Enter your\nverification code" | ||
39 | + obj.numberOfLines = 2 | ||
40 | + return obj | ||
41 | + }() | ||
42 | + | ||
43 | + var textField: UITextField = { | ||
44 | + let obj = UITextField() | ||
45 | + obj.returnKeyType = .done | ||
46 | + obj.keyboardType = .numberPad | ||
47 | + obj.becomeFirstResponder() | ||
48 | + obj.isHidden = true | ||
49 | + return obj | ||
50 | + }() | ||
51 | + | ||
52 | + var firstDigitLabel: UILabel = { | ||
53 | + let obj = UILabel() | ||
54 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
55 | + obj.textColor = .black | ||
56 | + obj.textAlignment = .center | ||
57 | + obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1) | ||
58 | + obj.layer.cornerRadius = 15 | ||
59 | + obj.clipsToBounds = true | ||
60 | + obj.text | ||
61 | + return obj | ||
62 | + }() | ||
63 | + | ||
64 | + var secondDigitLabel: UILabel = { | ||
65 | + let obj = UILabel() | ||
66 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
67 | + obj.textColor = .black | ||
68 | + obj.textAlignment = .center | ||
69 | + obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1) | ||
70 | + obj.layer.cornerRadius = 15 | ||
71 | + obj.clipsToBounds = true | ||
72 | + obj.text | ||
73 | + return obj | ||
74 | + }() | ||
75 | + | ||
76 | + var thirdDigitLabel: UILabel = { | ||
77 | + let obj = UILabel() | ||
78 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
79 | + obj.textColor = .black | ||
80 | + obj.textAlignment = .center | ||
81 | + obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1) | ||
82 | + obj.layer.cornerRadius = 15 | ||
83 | + obj.clipsToBounds = true | ||
84 | + obj.text | ||
85 | + return obj | ||
86 | + }() | ||
87 | + | ||
88 | + var fourthDigitLabel: UILabel = { | ||
89 | + let obj = UILabel() | ||
90 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
91 | + obj.textColor = .black | ||
92 | + obj.textAlignment = .center | ||
93 | + obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1) | ||
94 | + obj.layer.cornerRadius = 15 | ||
95 | + obj.clipsToBounds = true | ||
96 | + obj.text | ||
97 | + return obj | ||
98 | + }() | ||
99 | + | ||
100 | + var errorAlertLabel: UILabel = { | ||
101 | + var obj = UILabel() | ||
102 | + obj.text = "Please, enter valid verification code" | ||
103 | + obj.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 14) | ||
104 | + obj.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | ||
105 | + obj.isHidden = true | ||
106 | + return obj | ||
107 | + }() | ||
108 | + var verifyButton: UIButton = { | ||
109 | + var obj = UIButton() | ||
110 | + obj.setImage(UIImage(named: "RectangleWithShadow"), for: .normal) | ||
111 | + return obj | ||
112 | + }() | ||
113 | + var verifyLabel: UILabel = { | ||
114 | + var obj = UILabel() | ||
115 | + obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | ||
116 | + obj.textColor = .white | ||
117 | + obj.text = "Verify" | ||
118 | + return obj | ||
119 | + }() | ||
120 | + var tickImage: UIImageView = { | ||
121 | + var obj = UIImageView() | ||
122 | + obj.image = UIImage(named: "Tick") | ||
123 | + return obj | ||
124 | + }() | ||
125 | + override init(frame: CGRect) { | ||
126 | + super.init(frame: frame) | ||
127 | + layout() | ||
128 | + } | ||
129 | + | ||
130 | + required init?(coder: NSCoder) { | ||
131 | + fatalError("init(coder:) has not been implemented") | ||
132 | + } | ||
133 | + | ||
134 | + func layout() { | ||
135 | + addSubview(textField) | ||
136 | + | ||
137 | + backgroundColor = .white | ||
138 | + addSubview(backButton) | ||
139 | + addSubview(logoImage) | ||
140 | + addSubview(shieldImage) | ||
141 | + addSubview(containerView) | ||
142 | + containerView.addSubview(descriptionLabel) | ||
143 | + containerView.addSubview(firstDigitLabel) | ||
144 | + containerView.addSubview(secondDigitLabel) | ||
145 | + containerView.addSubview(thirdDigitLabel) | ||
146 | + containerView.addSubview(fourthDigitLabel) | ||
147 | + containerView.addSubview(errorAlertLabel) | ||
148 | + containerView.addSubview(verifyButton) | ||
149 | + verifyButton.addSubview(verifyLabel) | ||
150 | + verifyButton.addSubview(tickImage) | ||
151 | + | ||
152 | + backButton.snp.makeConstraints { | ||
153 | + $0.top.equalTo(snp.top).offset(66) | ||
154 | + $0.leading.equalTo(snp.leading).offset(22) | ||
155 | + $0.height.width.equalTo(45) | ||
156 | + } | ||
157 | + logoImage.snp.makeConstraints { | ||
158 | + $0.leading.equalTo(backButton.snp.trailing).offset(20) | ||
159 | + $0.centerY.equalTo(backButton) | ||
160 | + } | ||
161 | + shieldImage.snp.makeConstraints { | ||
162 | + $0.top.equalTo(backButton.snp.bottom).offset(25) | ||
163 | + $0.centerX.equalTo(snp.centerX) | ||
164 | + } | ||
165 | + containerView.snp.makeConstraints { | ||
166 | + $0.top.equalTo(shieldImage.snp.bottom).offset(41) | ||
167 | + $0.leading.trailing.equalToSuperview() | ||
168 | + $0.height.equalTo(300) | ||
169 | + } | ||
170 | + descriptionLabel.snp.makeConstraints { | ||
171 | + $0.leading.equalTo(containerView.snp.leading).offset(20) | ||
172 | + $0.top.equalTo(containerView.snp.top) | ||
173 | + } | ||
174 | + firstDigitLabel.snp.makeConstraints { | ||
175 | + $0.leading.equalTo(containerView.snp.leading).offset(25) | ||
176 | + $0.top.equalTo(descriptionLabel.snp.bottom).offset(28) | ||
177 | + $0.height.equalTo(55) | ||
178 | + } | ||
179 | + secondDigitLabel.snp.makeConstraints { | ||
180 | + $0.leading.equalTo(firstDigitLabel.snp.trailing).offset(12) | ||
181 | + $0.centerY.equalTo(firstDigitLabel) | ||
182 | + $0.width.equalTo(firstDigitLabel.snp.width) | ||
183 | + $0.height.equalTo(55) | ||
184 | + } | ||
185 | + thirdDigitLabel.snp.makeConstraints { | ||
186 | + $0.leading.equalTo(secondDigitLabel.snp.trailing).offset(12) | ||
187 | + $0.centerY.equalTo(firstDigitLabel) | ||
188 | + $0.width.equalTo(firstDigitLabel.snp.width) | ||
189 | + $0.height.equalTo(55) | ||
190 | + } | ||
191 | + fourthDigitLabel.snp.makeConstraints { | ||
192 | + $0.leading.equalTo(thirdDigitLabel.snp.trailing).offset(12) | ||
193 | + $0.centerY.equalTo(firstDigitLabel) | ||
194 | + $0.trailing.equalTo(containerView.snp.trailing).offset(-25) | ||
195 | + $0.width.equalTo(firstDigitLabel.snp.width) | ||
196 | + $0.height.equalTo(55) | ||
197 | + } | ||
198 | + errorAlertLabel.snp.makeConstraints { | ||
199 | + $0.top.equalTo(firstDigitLabel.snp.bottom).offset(8) | ||
200 | + $0.leading.equalTo(firstDigitLabel.snp.leading) | ||
201 | + } | ||
202 | + verifyButton.snp.makeConstraints { | ||
203 | + $0.top.equalTo(firstDigitLabel.snp.bottom).offset(67) | ||
204 | + $0.left.right.equalToSuperview() | ||
205 | + } | ||
206 | + verifyLabel.snp.makeConstraints { | ||
207 | + $0.left.equalToSuperview().offset(49) | ||
208 | + $0.top.equalToSuperview().offset(22) | ||
209 | + } | ||
210 | + tickImage.snp.makeConstraints { | ||
211 | + $0.right.equalToSuperview().offset(-47) | ||
212 | + $0.centerY.equalTo(verifyLabel) | ||
213 | + } | ||
214 | + } | ||
215 | +} |
1 | +// | ||
2 | +// CodeVerificationViewController.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 03.06.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +class CodeVerificationViewController: UIViewController { | ||
11 | + | ||
12 | + var otp: String = "" | ||
13 | + | ||
14 | + private let codeView = CodeVerificationView() | ||
15 | + | ||
16 | + override func loadView() { | ||
17 | + view = codeView | ||
18 | + } | ||
19 | + | ||
20 | + override func viewDidLoad() { | ||
21 | + initViewController() | ||
22 | + } | ||
23 | + | ||
24 | + private func initViewController() { | ||
25 | + codeView.textField.delegate = self | ||
26 | + codeView.backButton.addTarget(self, action: #selector(didDismissVC), for: .touchUpInside) | ||
27 | + codeView.verifyButton.addTarget(self, action: #selector(didVerifyCode), for: .touchUpInside) | ||
28 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) | ||
29 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) | ||
30 | + } | ||
31 | + | ||
32 | +// deinit { | ||
33 | +// NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) | ||
34 | +// NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) | ||
35 | +// } | ||
36 | +} | ||
37 | + | ||
38 | +extension CodeVerificationViewController { | ||
39 | + | ||
40 | + @objc func didDismissVC() { | ||
41 | + dismiss(animated: true, completion: nil) | ||
42 | + } | ||
43 | + | ||
44 | + @objc func didVerifyCode() { | ||
45 | + | ||
46 | + codeView.errorAlertLabel.isHidden = false | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + @objc func keyboardWillShow(notification: NSNotification) { | ||
51 | +// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { | ||
52 | +// let keyboardHeight = keyboardFrame.cgRectValue.height | ||
53 | +// // let bottomSpace = | ||
54 | +// if self.view.frame.origin.y == 0 { | ||
55 | +// self.view.frame.origin.y -= keyboardFrame.height | ||
56 | +// } | ||
57 | + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { | ||
58 | + if self.view.frame.origin.y == 0 { | ||
59 | +// self.view.frame.origin.y -= keyboardSize.height - 150 | ||
60 | + codeView.containerView.frame.origin.y -= keyboardSize.height - 150 | ||
61 | + codeView.shieldImage.frame.origin.x += view.frame.origin.x + 100 | ||
62 | + } | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + @objc func keyboardWillHide() { | ||
67 | + if self.view.frame.origin.y != 0 { | ||
68 | + self.view.frame.origin.y = 0 | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | +} | ||
73 | + | ||
74 | +extension CodeVerificationViewController: UITextFieldDelegate { | ||
75 | + | ||
76 | + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | ||
77 | + otp += string | ||
78 | + | ||
79 | + otp.enumerated().forEach { index,item in | ||
80 | + switch index { | ||
81 | + case 0: | ||
82 | + codeView.firstDigitLabel.text = String(item) | ||
83 | + case 1: | ||
84 | + codeView.secondDigitLabel.text = String(item) | ||
85 | + case 2: | ||
86 | + codeView.thirdDigitLabel.text = String(item) | ||
87 | + case 3: | ||
88 | + codeView.fourthDigitLabel.text = String(item) | ||
89 | + codeView.textField.endEditing(true) | ||
90 | + default: | ||
91 | + codeView.textField.endEditing(true) | ||
92 | + } | ||
93 | + } | ||
94 | + | ||
95 | + return true | ||
96 | + } | ||
97 | + | ||
98 | +} |
1 | +// | ||
2 | +// PhoneNumberView.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 31.05.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | +import CoreTelephony | ||
10 | + | ||
11 | +class PhoneNumberView: UIView { | ||
12 | + | ||
13 | + var containerPickerView: UIView = { | ||
14 | + var view = UIView() | ||
15 | + view.backgroundColor = .systemRed | ||
16 | + return view | ||
17 | + }() | ||
18 | + | ||
19 | + var titleButton: UIButton = { | ||
20 | + var obj = UIButton() | ||
21 | + obj.setTitle("Select your country", for: .normal) | ||
22 | + obj.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | ||
23 | + obj.titleLabel?.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 18) | ||
24 | + obj.titleLabel?.textAlignment = .center | ||
25 | + return obj | ||
26 | + }() | ||
27 | + | ||
28 | + var dividingLineView: UIView = { | ||
29 | + var view = UIView() | ||
30 | + view.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1) | ||
31 | + return view | ||
32 | + }() | ||
33 | + | ||
34 | + var phoneNumberPicker: UIPickerView = { | ||
35 | + var picker = UIPickerView() | ||
36 | + return picker | ||
37 | + }() | ||
38 | + | ||
39 | + var selectButton: UIButton = { | ||
40 | + var button = UIButton() | ||
41 | + | ||
42 | + button.backgroundColor = UIColor(red: 2/255, green: 115/255, blue: 185/255, alpha: 1) | ||
43 | + button.clipsToBounds = true | ||
44 | + | ||
45 | + return button | ||
46 | + }() | ||
47 | + | ||
48 | + var selectLabel: UILabel = { | ||
49 | + var label = UILabel() | ||
50 | + label.text = "Select" | ||
51 | + label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | ||
52 | + label.textColor = .white | ||
53 | + return label | ||
54 | + }() | ||
55 | + | ||
56 | + override init(frame: CGRect) { | ||
57 | + super.init(frame: frame) | ||
58 | + layout() | ||
59 | + setup() | ||
60 | + backgroundColor = .white | ||
61 | + } | ||
62 | + | ||
63 | + required init?(coder: NSCoder) { | ||
64 | + fatalError("init(coder:) has not been implemented") | ||
65 | + } | ||
66 | + | ||
67 | + func layout() { | ||
68 | + self.backgroundColor = .white | ||
69 | + addSubview(titleButton) | ||
70 | + addSubview(dividingLineView) | ||
71 | + addSubview(phoneNumberPicker) | ||
72 | + addSubview(selectButton) | ||
73 | + | ||
74 | + selectButton.addSubview(selectLabel) | ||
75 | + | ||
76 | + titleButton.snp.makeConstraints { make in | ||
77 | + make.top.equalToSuperview().offset(20) | ||
78 | + make.leading.trailing.equalToSuperview() | ||
79 | + } | ||
80 | + | ||
81 | + dividingLineView.snp.makeConstraints { | ||
82 | + $0.left.right.equalToSuperview() | ||
83 | + $0.height.equalTo(1) | ||
84 | + $0.top.equalTo(titleButton.snp.bottom).offset(22) | ||
85 | + } | ||
86 | + phoneNumberPicker.snp.makeConstraints { | ||
87 | + $0.left.right.equalToSuperview().inset(5) | ||
88 | + $0.top.equalTo(dividingLineView.snp.bottom).offset(20) | ||
89 | + } | ||
90 | + selectButton.snp.makeConstraints { | ||
91 | + $0.right.equalToSuperview() | ||
92 | + $0.left.equalToSuperview() | ||
93 | + $0.bottom.equalToSuperview() | ||
94 | + $0.height.equalTo(70) | ||
95 | + $0.top.equalTo(phoneNumberPicker.snp.bottom).offset(20) | ||
96 | + } | ||
97 | + selectLabel.snp.makeConstraints { | ||
98 | + $0.centerX.equalTo(selectButton.snp.centerX) | ||
99 | + $0.top.equalTo(selectButton.snp.top).offset(20) | ||
100 | + } | ||
101 | + } | ||
102 | +} | ||
103 | + | ||
104 | +extension PhoneNumberView { | ||
105 | + | ||
106 | + func setup() { | ||
107 | + | ||
108 | + let countryCode: String | ||
109 | + if let carrier = CTTelephonyNetworkInfo().serviceSubscriberCellularProviders?.first?.value, | ||
110 | + let code = carrier.isoCountryCode?.uppercased() { | ||
111 | + countryCode = code | ||
112 | + } else { | ||
113 | + countryCode = "USA" | ||
114 | + } | ||
115 | + | ||
116 | + phoneNumberPicker.selectRow(0, inComponent: 0, animated: true) | ||
117 | + | ||
118 | + phoneNumberPicker.subviews[1].backgroundColor = .clear | ||
119 | + | ||
120 | + } | ||
121 | +} | ||
122 | + |
1 | +// | ||
2 | +// PickerView.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 01.06.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +final class PickerView: UIView { | ||
11 | + | ||
12 | + private let iconView: UIImageView = { | ||
13 | + var obj = UIImageView() | ||
14 | + obj.contentMode = .scaleAspectFill | ||
15 | + obj.layer.cornerRadius = 10 | ||
16 | + return obj | ||
17 | + }() | ||
18 | + private let label: UILabel = { | ||
19 | + var obj = UILabel() | ||
20 | + obj.textColor = UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1) | ||
21 | + obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 15) | ||
22 | + return obj | ||
23 | + }() | ||
24 | + private let countryCode: UILabel = { | ||
25 | + var obj = UILabel() | ||
26 | + obj.textColor = UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1) | ||
27 | + obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 15) | ||
28 | + return obj | ||
29 | + }() | ||
30 | + override init(frame: CGRect) { | ||
31 | + super.init(frame: frame) | ||
32 | + layout() | ||
33 | + } | ||
34 | + | ||
35 | + required init?(coder: NSCoder) { | ||
36 | + super.init(coder: coder) | ||
37 | + layout() | ||
38 | + } | ||
39 | + | ||
40 | + private func layout() { | ||
41 | + addSubview(iconView) | ||
42 | + addSubview(label) | ||
43 | + addSubview(countryCode) | ||
44 | + | ||
45 | + iconView.snp.makeConstraints { make in | ||
46 | + make.leading.equalToSuperview().offset(25) | ||
47 | + make.centerY.equalTo(snp.centerY) | ||
48 | +// make.top.bottom.equalToSuperview() | ||
49 | + make.height.width.equalTo(20) | ||
50 | + } | ||
51 | + | ||
52 | + label.snp.makeConstraints { make in | ||
53 | + make.leading.equalTo(iconView.snp.trailing).offset(20) | ||
54 | + make.top.bottom.equalToSuperview() | ||
55 | + } | ||
56 | + | ||
57 | + countryCode.snp.makeConstraints { make in | ||
58 | + make.trailing.equalToSuperview().offset(-25) | ||
59 | + make.top.bottom.equalToSuperview() | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + static func create(icon: UIImage, title: String, code: String) -> PickerView { | ||
64 | + let numberView = PickerView() | ||
65 | + numberView.iconView.image = icon | ||
66 | + numberView.label.text = title | ||
67 | + numberView.countryCode.text = code | ||
68 | + return numberView | ||
69 | + } | ||
70 | +} |
1 | +// | ||
2 | +// TextFieldWithPadding.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 01.06.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +class TextFieldWithPadding: UITextField { | ||
11 | + | ||
12 | + var textPaddingForEmail = UIEdgeInsets( | ||
13 | + top: 0, | ||
14 | + left: 22, | ||
15 | + bottom: 0, | ||
16 | + right: 22 | ||
17 | + ) | ||
18 | + var textPaddingForPhone = UIEdgeInsets( | ||
19 | + top: 0, | ||
20 | + left: 78, | ||
21 | + bottom: 0, | ||
22 | + right: 22 | ||
23 | + ) | ||
24 | + | ||
25 | + override func textRect(forBounds bounds: CGRect) -> CGRect { | ||
26 | + let rect = super.textRect(forBounds: bounds) | ||
27 | + return rect.inset(by: textPaddingForPhone) | ||
28 | + } | ||
29 | + | ||
30 | + override func editingRect(forBounds bounds: CGRect) -> CGRect { | ||
31 | + let rect = super.editingRect(forBounds: bounds) | ||
32 | + return rect.inset(by: textPaddingForPhone) | ||
33 | + } | ||
34 | +} |
1 | +// | ||
2 | +// VerificationView.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 30.05.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import Foundation | ||
9 | +import UIKit | ||
10 | + | ||
11 | +class VerificationView: UIView { | ||
12 | + | ||
13 | + var isShow: Bool = false | ||
14 | + | ||
15 | + var logoImage: UIImageView = { | ||
16 | + var view = UIImageView() | ||
17 | + view.image = UIImage(named: "InterQR") | ||
18 | + return view | ||
19 | + }() | ||
20 | + var greetingsLabel: UILabel = { | ||
21 | + var label = UILabel() | ||
22 | + label.text = "Hello" | ||
23 | + label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 35) | ||
24 | + return label | ||
25 | + }() | ||
26 | + var verifyLabel: UILabel = { | ||
27 | + var label = UILabel() | ||
28 | + label.text = "Lets verify your \naccount" | ||
29 | + label.numberOfLines = 2 | ||
30 | + label.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 28) | ||
31 | + return label | ||
32 | + }() | ||
33 | + var shieldImage: UIImageView = { | ||
34 | + var view = UIImageView() | ||
35 | + view.image = UIImage(named: "Shield") | ||
36 | + return view | ||
37 | + }() | ||
38 | + var chooseLabel: UILabel = { | ||
39 | + var label = UILabel() | ||
40 | + label.text = "Choose what to start with" | ||
41 | + label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | ||
42 | + label.font = .systemFont(ofSize: 16, weight: .bold) | ||
43 | + return label | ||
44 | + }() | ||
45 | + var emailButton: Checkbox = { | ||
46 | + var button = Checkbox() | ||
47 | + button.checkboxTitle = "Email" | ||
48 | + button.isSelected = true | ||
49 | +// button.setTitle("Email", for: .normal) | ||
50 | +// button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | ||
51 | +// button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | ||
52 | +// button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5) | ||
53 | +// button.setImage(UIImage(named: "OnIndicator"), for: .normal) | ||
54 | +// button.setImage(UIImage(named: "OffIndicator"), for: .selected) | ||
55 | +// button.contentMode = .left | ||
56 | + return button | ||
57 | + }() | ||
58 | + | ||
59 | + var phoneNumberButton: Checkbox = { | ||
60 | + var button = Checkbox() | ||
61 | + button.checkboxTitle = "Phone Number" | ||
62 | +// button.setTitle("Phone Number", for: .normal) | ||
63 | +// button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | ||
64 | +// button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | ||
65 | +// button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5) | ||
66 | +// button.setImage(UIImage(named: "OnIndicator"), for: .selected) | ||
67 | +// button.setImage(UIImage(named: "OffIndicator"), for: .normal) | ||
68 | + return button | ||
69 | + }() | ||
70 | + | ||
71 | + var dividingLineView: UIView = { | ||
72 | + var view = UIView() | ||
73 | + view.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1) | ||
74 | + return view | ||
75 | + }() | ||
76 | + var enterChosenAuthenticatorLabel: UILabel = { | ||
77 | + var label = UILabel() | ||
78 | + label.text = "Enter your email address" | ||
79 | + label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | ||
80 | + return label | ||
81 | + }() | ||
82 | + var emailTextField: UITextField = { | ||
83 | + var textField = UITextField() | ||
84 | + textField.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | ||
85 | + textField.textAlignment = .left | ||
86 | + textField.layer.cornerRadius = 15 | ||
87 | + textField.keyboardType = .emailAddress | ||
88 | + textField.placeholder = "Example: john.doe@gmail.com" | ||
89 | + textField.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | ||
90 | + textField.layer.masksToBounds = true | ||
91 | + textField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 22, height: textField.frame.height)) | ||
92 | + textField.leftViewMode = .always | ||
93 | + return textField | ||
94 | + }() | ||
95 | + var phoneTextField: TextFieldWithPadding = { | ||
96 | + var textField = TextFieldWithPadding() | ||
97 | + textField.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | ||
98 | + textField.textAlignment = .left | ||
99 | + textField.layer.cornerRadius = 15 | ||
100 | + textField.keyboardType = .numberPad | ||
101 | + textField.text = "+1" | ||
102 | + textField.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | ||
103 | + textField.layer.masksToBounds = true | ||
104 | + textField.isHidden = true | ||
105 | + return textField | ||
106 | + }() | ||
107 | + var verificationDescriptionLabel: UILabel = { | ||
108 | + var label = UILabel() | ||
109 | + label.numberOfLines = 0 | ||
110 | + label.text = "Verification code will be sent to your e-mail" | ||
111 | + label.font = UIFont(name: "Sk-Modernist", size: 14) | ||
112 | + label.font = .systemFont(ofSize: 14, weight: .regular) | ||
113 | + return label | ||
114 | + }() | ||
115 | + var continueButton: UIButton = { | ||
116 | + var button = UIButton() | ||
117 | + button.setImage(UIImage(named: "RectangleWithShadow"), for: .normal) | ||
118 | + button.clipsToBounds = true | ||
119 | + button.contentMode = .scaleAspectFit | ||
120 | + button.layer.cornerRadius = 15 | ||
121 | + return button | ||
122 | + }() | ||
123 | + var continueLabel: UILabel = { | ||
124 | + var label = UILabel() | ||
125 | + label.text = "Continue" | ||
126 | + label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | ||
127 | + label.textColor = .white | ||
128 | + return label | ||
129 | + }() | ||
130 | + var pointerImage: UIImageView = { | ||
131 | + var image = UIImageView() | ||
132 | + image.image = UIImage(named: "Pointer") | ||
133 | + return image | ||
134 | + }() | ||
135 | + var phonePickerView: PhoneNumberView = { | ||
136 | + var view = PhoneNumberView() | ||
137 | + view.isUserInteractionEnabled = true | ||
138 | + return view | ||
139 | + }() | ||
140 | + var showPickerButton: UIButton = { | ||
141 | + var button = UIButton() | ||
142 | + button.isHidden = true | ||
143 | + return button | ||
144 | + }() | ||
145 | + var flagPickerView: UIImageView = { | ||
146 | + var image = UIImageView() | ||
147 | + image.image = UIImage(named: "USA") | ||
148 | + image.layer.cornerRadius = 11 | ||
149 | + image.contentMode = .scaleAspectFit | ||
150 | + return image | ||
151 | + }() | ||
152 | + var flagPointerView: UIImageView = { | ||
153 | + var image = UIImageView() | ||
154 | + image.image = UIImage(named: "FlagPointer") | ||
155 | + return image | ||
156 | + }() | ||
157 | + | ||
158 | + override init(frame: CGRect) { | ||
159 | + super.init(frame: frame) | ||
160 | + backgroundColor = .white | ||
161 | + layout() | ||
162 | + } | ||
163 | + | ||
164 | + required init?(coder: NSCoder) { | ||
165 | + fatalError("init(coder:) has not been implemented") | ||
166 | + } | ||
167 | + | ||
168 | + func layout() { | ||
169 | + | ||
170 | + addSubview(logoImage) | ||
171 | + addSubview(greetingsLabel) | ||
172 | + addSubview(verifyLabel) | ||
173 | + addSubview(shieldImage) | ||
174 | + | ||
175 | + addSubview(chooseLabel) | ||
176 | + addSubview(emailButton) | ||
177 | + addSubview(phoneNumberButton) | ||
178 | +// phoneNumberButton.addSubview(pickPhoneLabel) | ||
179 | +// phoneNumberButton.addSubview(phoneNumberIndicatorImage) | ||
180 | + addSubview(dividingLineView) | ||
181 | + | ||
182 | + addSubview(enterChosenAuthenticatorLabel) | ||
183 | + addSubview(emailTextField) | ||
184 | + addSubview(phoneTextField) | ||
185 | + addSubview(verificationDescriptionLabel) | ||
186 | + phoneTextField.addSubview(showPickerButton) | ||
187 | + | ||
188 | + showPickerButton.addSubview(flagPickerView) | ||
189 | + showPickerButton.addSubview(flagPointerView) | ||
190 | + | ||
191 | + addSubview(continueButton) | ||
192 | + continueButton.addSubview(continueLabel) | ||
193 | + continueButton.addSubview(pointerImage) | ||
194 | + | ||
195 | + addSubview(phonePickerView) | ||
196 | + | ||
197 | + logoImage.snp.makeConstraints { | ||
198 | + $0.top.equalTo(snp.top).offset(80) | ||
199 | + $0.left.equalTo(snp.left).offset(27) | ||
200 | + } | ||
201 | + greetingsLabel.snp.makeConstraints { | ||
202 | + $0.top.equalTo(logoImage.snp.bottom).offset(42) | ||
203 | + $0.left.equalTo(snp.left).offset(24) | ||
204 | + } | ||
205 | + shieldImage.snp.makeConstraints { | ||
206 | + $0.right.equalToSuperview() | ||
207 | + $0.top.equalTo(logoImage.snp.bottom).offset(27) | ||
208 | + } | ||
209 | + verifyLabel.snp.makeConstraints { | ||
210 | + $0.left.equalTo(27) | ||
211 | + $0.top.equalTo(greetingsLabel.snp.bottom).offset(10) | ||
212 | + } | ||
213 | + chooseLabel.snp.makeConstraints { | ||
214 | + $0.top.equalTo(shieldImage.snp.bottom).offset(52) | ||
215 | + $0.left.equalTo(snp.left).offset(27) | ||
216 | + } | ||
217 | + emailButton.snp.makeConstraints { | ||
218 | + $0.left.equalTo(snp.left).offset(27) | ||
219 | + $0.top.equalTo(chooseLabel.snp.bottom).offset(29) | ||
220 | + $0.height.equalTo(20) | ||
221 | + } | ||
222 | + phoneNumberButton.snp.makeConstraints { | ||
223 | + $0.top.equalTo(emailButton.snp.top) | ||
224 | + $0.height.equalTo(20) | ||
225 | + $0.left.equalTo(emailButton.snp.right).offset(44) | ||
226 | + } | ||
227 | + dividingLineView.snp.makeConstraints { | ||
228 | + $0.left.right.equalToSuperview() | ||
229 | + $0.top.equalTo(emailButton.snp.bottom).offset(41) | ||
230 | + $0.height.equalTo(1) | ||
231 | + } | ||
232 | + enterChosenAuthenticatorLabel.snp.makeConstraints { | ||
233 | + $0.top.equalTo(dividingLineView.snp.bottom).offset(39) | ||
234 | + $0.left.equalTo(logoImage.snp.left) | ||
235 | + } | ||
236 | + emailTextField.snp.makeConstraints { | ||
237 | + $0.left.equalTo(logoImage.snp.left) | ||
238 | + $0.right.equalTo(snp.right).offset(-27) | ||
239 | + $0.top.equalTo(enterChosenAuthenticatorLabel.snp.bottom).offset(23) | ||
240 | + $0.height.equalTo(57) | ||
241 | + } | ||
242 | + phoneTextField.snp.makeConstraints { | ||
243 | + $0.left.equalTo(logoImage.snp.left) | ||
244 | + $0.right.equalTo(snp.right).offset(-27) | ||
245 | + $0.top.equalTo(enterChosenAuthenticatorLabel.snp.bottom).offset(23) | ||
246 | + $0.height.equalTo(57) | ||
247 | + } | ||
248 | + verificationDescriptionLabel.snp.makeConstraints { | ||
249 | + $0.top.equalTo(emailTextField.snp.bottom).offset(8) | ||
250 | + $0.left.equalTo(snp.left).offset(46) | ||
251 | + $0.right.equalTo(snp.right).offset(-22) | ||
252 | + } | ||
253 | + continueButton.snp.makeConstraints { | ||
254 | + $0.left.equalTo(snp.left) | ||
255 | + $0.right.equalTo(snp.right) | ||
256 | + $0.top.equalTo(emailTextField.snp.bottom).offset(90) | ||
257 | + $0.height.equalTo(125) | ||
258 | + } | ||
259 | + continueLabel.snp.makeConstraints { | ||
260 | + $0.left.equalTo(snp.left).offset(48) | ||
261 | + $0.top.equalTo(continueButton.snp.top).offset(33) | ||
262 | + } | ||
263 | + pointerImage.snp.makeConstraints { | ||
264 | + $0.top.equalTo(continueButton.snp.top).offset(31) | ||
265 | + $0.right.equalTo(snp.right).offset(-51.5) | ||
266 | + } | ||
267 | + phonePickerView.snp.makeConstraints { make in | ||
268 | + make.leading.trailing.equalToSuperview() | ||
269 | + make.height.equalTo(390) | ||
270 | + make.top.equalTo(self.snp.bottom) | ||
271 | + } | ||
272 | + showPickerButton.snp.makeConstraints { | ||
273 | + $0.height.equalTo(22) | ||
274 | + $0.width.equalTo(50) | ||
275 | + $0.left.equalTo(emailTextField.snp.left).offset(22) | ||
276 | + $0.top.equalTo(emailTextField.snp.top).offset(18) | ||
277 | + } | ||
278 | + flagPickerView.snp.makeConstraints { | ||
279 | + $0.left.equalToSuperview() | ||
280 | + $0.top.equalToSuperview() | ||
281 | + $0.size.equalTo(20) | ||
282 | + $0.centerY.equalTo(showPickerButton.snp.centerY) | ||
283 | + } | ||
284 | + flagPointerView.snp.makeConstraints { | ||
285 | + $0.left.equalTo(flagPickerView.snp.right).offset(10) | ||
286 | + $0.centerYWithinMargins.equalTo(flagPickerView.snp.centerYWithinMargins) | ||
287 | + } | ||
288 | + } | ||
289 | + | ||
290 | + @objc func choosePhoneCode() { | ||
291 | + emailTextField.isHidden = true | ||
292 | + phoneTextField.isHidden = false | ||
293 | + phoneNumberButton.isSelected = true | ||
294 | + emailButton.isSelected = true | ||
295 | + phoneNumberButton.image(for: .normal) | ||
296 | + verificationDescriptionLabel.text = "Verification code will be sent to\nyour phone number" | ||
297 | + enterChosenAuthenticatorLabel.text = "Enter your phone number" | ||
298 | + emailTextField.text = "+1" | ||
299 | + showPickerButton.isHidden = false | ||
300 | + emailTextField.keyboardType = .numberPad | ||
301 | + } | ||
302 | + | ||
303 | + @objc func chooseEmail() { | ||
304 | + emailTextField.isHidden = false | ||
305 | + phoneTextField.isHidden = true | ||
306 | + phoneNumberButton.isSelected = false | ||
307 | + emailButton.isSelected = false | ||
308 | + verificationDescriptionLabel.text = "Verification code will be sent to your e-mail" | ||
309 | + enterChosenAuthenticatorLabel.text = "Enter your email address" | ||
310 | + emailTextField.text = "" | ||
311 | + emailTextField.placeholder = "Example: john.doe@gmail.com" | ||
312 | + showPickerButton.isHidden = true | ||
313 | + } | ||
314 | + | ||
315 | + func showPickerView() { | ||
316 | + UIView.animate(withDuration: 0.3) { | ||
317 | + self.phonePickerView.snp.updateConstraints { make in | ||
318 | + make.top.equalTo(self.snp.bottom).offset(-390) | ||
319 | + | ||
320 | + } | ||
321 | + self.layoutIfNeeded() | ||
322 | + } | ||
323 | + | ||
324 | + } | ||
325 | + | ||
326 | + func hidePicerView() { | ||
327 | + UIView.animate(withDuration: 0.3) { | ||
328 | + self.phonePickerView.snp.updateConstraints { make in | ||
329 | + make.top.equalTo(self.snp.bottom).offset(0) | ||
330 | + } | ||
331 | + self.layoutIfNeeded() | ||
332 | + } | ||
333 | + } | ||
334 | +} |
InterQR-Internship/Modules/VerificationSceen/ViewController/VerificationViewController.swift
0 → 100644
1 | +// | ||
2 | +// ViewController.swift | ||
3 | +// InterQR-Internship | ||
4 | +// | ||
5 | +// Created by Дмитрий Тимофеев on 30.05.2022. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +class VerificationViewController: UIViewController { | ||
11 | + | ||
12 | + var isKeyboardAppear = false | ||
13 | + private let mainView = VerificationView() | ||
14 | + | ||
15 | + lazy var phonePickerModels: [PhonePickerModel] = { | ||
16 | + var models: [PhonePickerModel] = [] | ||
17 | + | ||
18 | + for (code, value) in PhoneService.phones | ||
19 | + { | ||
20 | + models.append(.init(code: code, countryCode: value.1, title: value.0, icon: value.2)) | ||
21 | + } | ||
22 | + return models | ||
23 | + }() | ||
24 | + | ||
25 | + deinit { | ||
26 | + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) | ||
27 | + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) | ||
28 | + } | ||
29 | + | ||
30 | + override func loadView() { | ||
31 | + view = mainView | ||
32 | + } | ||
33 | + override func viewDidLoad() { | ||
34 | + super.viewDidLoad() | ||
35 | + initViewController() | ||
36 | + } | ||
37 | + | ||
38 | + | ||
39 | + private func initViewController() { | ||
40 | + mainView.phonePickerView.phoneNumberPicker.delegate = self | ||
41 | + mainView.phonePickerView.phoneNumberPicker.dataSource = self | ||
42 | + mainView.phoneNumberButton.addTarget(self, action: #selector(didCheckboxTapped(_:)), for: .touchUpInside) | ||
43 | + mainView.emailButton.addTarget(self, action: #selector(didCheckboxTapped(_:)), for: .touchUpInside) | ||
44 | + mainView.showPickerButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchUpInside) | ||
45 | + mainView.phonePickerView.selectButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchUpInside) | ||
46 | + mainView.phonePickerView.titleButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchDragInside) | ||
47 | + mainView.continueButton.addTarget(self, action: #selector(didShowCodeVerificationVC), for: .touchUpInside) | ||
48 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) | ||
49 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil) | ||
50 | + } | ||
51 | + | ||
52 | +} | ||
53 | + | ||
54 | +//MARK: helpers and handlers | ||
55 | +extension VerificationViewController { | ||
56 | + | ||
57 | +} | ||
58 | + | ||
59 | +//MARK: targets | ||
60 | +extension VerificationViewController { | ||
61 | + | ||
62 | + @objc private func didCheckboxTapped(_ sender: Checkbox) { | ||
63 | + switch sender { | ||
64 | + case mainView.emailButton : | ||
65 | + mainView.emailTextField.isHidden = false | ||
66 | + mainView.phoneTextField.isHidden = true | ||
67 | + mainView.phoneNumberButton.isSelected = false | ||
68 | + mainView.emailButton.isSelected = true | ||
69 | + mainView.verificationDescriptionLabel.text = "Verification code will be sent to your e-mail" | ||
70 | + mainView.enterChosenAuthenticatorLabel.text = "Enter your email address" | ||
71 | + mainView.emailTextField.text = "" | ||
72 | + mainView.emailTextField.placeholder = "Example: john.doe@gmail.com" | ||
73 | + mainView.showPickerButton.isHidden = true | ||
74 | + case mainView.phoneNumberButton: | ||
75 | + mainView.emailTextField.isHidden = true | ||
76 | + mainView.phoneTextField.isHidden = false | ||
77 | + mainView.phoneNumberButton.isSelected = true | ||
78 | + mainView.emailButton.isSelected = false | ||
79 | + mainView.phoneNumberButton.image(for: .normal) | ||
80 | + mainView.verificationDescriptionLabel.text = "Verification code will be sent to\nyour phone number" | ||
81 | + mainView.enterChosenAuthenticatorLabel.text = "Enter your phone number" | ||
82 | + mainView.emailTextField.text = "+1" | ||
83 | + mainView.showPickerButton.isHidden = false | ||
84 | + mainView.emailTextField.keyboardType = .numberPad | ||
85 | + default : | ||
86 | + return | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + @objc private func didshowPickerButtonTapped(_ sender: UIButton) { | ||
91 | + mainView.isShow ? mainView.showPickerView() : mainView.hidePicerView() | ||
92 | + mainView.isShow.toggle() | ||
93 | + } | ||
94 | + | ||
95 | + @objc private func didShowCodeVerificationVC() { | ||
96 | + let vc = CodeVerificationViewController() | ||
97 | + vc.modalPresentationStyle = .fullScreen | ||
98 | + present(vc, animated: true) | ||
99 | + } | ||
100 | + | ||
101 | + @objc func keyboardWillShow(notification: NSNotification) { | ||
102 | + let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double | ||
103 | + if !isKeyboardAppear { | ||
104 | + UIView.animate(withDuration: duration ?? 0) { | ||
105 | + self.mainView.chooseLabel.snp.updateConstraints { make in | ||
106 | + make.top.equalTo(self.mainView.shieldImage.snp.bottom).offset(0) | ||
107 | + } | ||
108 | + self.mainView.layoutIfNeeded() | ||
109 | + } | ||
110 | + | ||
111 | + isKeyboardAppear = true | ||
112 | + } | ||
113 | + | ||
114 | + } | ||
115 | + | ||
116 | + @objc func keyboardWillHide(notification: NSNotification) { | ||
117 | + let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double | ||
118 | + | ||
119 | + if isKeyboardAppear { | ||
120 | + | ||
121 | + UIView.animate(withDuration: duration ?? 0) { | ||
122 | + self.mainView.chooseLabel.snp.updateConstraints { make in | ||
123 | + make.top.equalTo(self.mainView.shieldImage.snp.bottom).offset(52) | ||
124 | + } | ||
125 | + self.mainView.layoutIfNeeded() | ||
126 | + } | ||
127 | + | ||
128 | + isKeyboardAppear = false | ||
129 | + } | ||
130 | + | ||
131 | + } | ||
132 | +} | ||
133 | + | ||
134 | +//MARK: table view delegate and datasource | ||
135 | +extension VerificationViewController { | ||
136 | + | ||
137 | +} | ||
138 | + | ||
139 | +extension VerificationViewController: UIPickerViewDataSource, UIPickerViewDelegate { | ||
140 | + | ||
141 | + func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1 } | ||
142 | + | ||
143 | + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { | ||
144 | + return phonePickerModels.count | ||
145 | + | ||
146 | + } | ||
147 | + | ||
148 | + func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { | ||
149 | + 60 | ||
150 | + } | ||
151 | + | ||
152 | + // func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { | ||
153 | + // return 130.0 | ||
154 | + // } | ||
155 | + | ||
156 | + func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { | ||
157 | + let model = phonePickerModels[row] | ||
158 | + return PickerView.create(icon: model.icon, title: model.title, code: model.countryCode) | ||
159 | + } | ||
160 | + | ||
161 | + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { | ||
162 | + pickerView.subviews[1].backgroundColor = .clear | ||
163 | + let model = phonePickerModels[row] | ||
164 | + mainView.phoneTextField.text = "\(model.countryCode)" | ||
165 | + mainView.flagPickerView.image = model.icon | ||
166 | + } | ||
167 | +} | ||
168 | + |
@@ -97,7 +97,7 @@ | @@ -97,7 +97,7 @@ | ||
97 | 9716AD15FADF38A93170E034F2BCE457 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Source/ConstraintPriorityTarget.swift; sourceTree = "<group>"; }; | 97 | 9716AD15FADF38A93170E034F2BCE457 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Source/ConstraintPriorityTarget.swift; sourceTree = "<group>"; }; |
98 | 979486118B3E90C08386079D57962701 /* SnapKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SnapKit; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 98 | 979486118B3E90C08386079D57962701 /* SnapKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SnapKit; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
99 | 9AFE619CFFABED07F15D3C2B1C1B48F6 /* Pods-InterQR-Internship.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-InterQR-Internship.release.xcconfig"; sourceTree = "<group>"; }; | 99 | 9AFE619CFFABED07F15D3C2B1C1B48F6 /* Pods-InterQR-Internship.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-InterQR-Internship.release.xcconfig"; sourceTree = "<group>"; }; |
100 | - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; | 100 | + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; |
101 | A1CD432F32277BB93DEAADA626ECEC5B /* SnapKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.release.xcconfig; sourceTree = "<group>"; }; | 101 | A1CD432F32277BB93DEAADA626ECEC5B /* SnapKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.release.xcconfig; sourceTree = "<group>"; }; |
102 | A51E99894F75F00A281BE6A32FBDE495 /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Source/ConstraintView.swift; sourceTree = "<group>"; }; | 102 | A51E99894F75F00A281BE6A32FBDE495 /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Source/ConstraintView.swift; sourceTree = "<group>"; }; |
103 | A7D358AA1606C7B2CDC8555485807E9E /* ConstraintDirectionalInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsetTarget.swift; path = Source/ConstraintDirectionalInsetTarget.swift; sourceTree = "<group>"; }; | 103 | A7D358AA1606C7B2CDC8555485807E9E /* ConstraintDirectionalInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsetTarget.swift; path = Source/ConstraintDirectionalInsetTarget.swift; sourceTree = "<group>"; }; |
@@ -197,7 +197,6 @@ | @@ -197,7 +197,6 @@ | ||
197 | 6A9341666EAC154422A032092A7DC2D7 /* UILayoutSupport+Extensions.swift */, | 197 | 6A9341666EAC154422A032092A7DC2D7 /* UILayoutSupport+Extensions.swift */, |
198 | 843EFF0C650682C304D518A9092EE9FD /* Support Files */, | 198 | 843EFF0C650682C304D518A9092EE9FD /* Support Files */, |
199 | ); | 199 | ); |
200 | - name = SnapKit; | ||
201 | path = SnapKit; | 200 | path = SnapKit; |
202 | sourceTree = "<group>"; | 201 | sourceTree = "<group>"; |
203 | }; | 202 | }; |
@@ -529,7 +528,7 @@ | @@ -529,7 +528,7 @@ | ||
529 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 528 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
530 | GCC_WARN_UNUSED_FUNCTION = YES; | 529 | GCC_WARN_UNUSED_FUNCTION = YES; |
531 | GCC_WARN_UNUSED_VARIABLE = YES; | 530 | GCC_WARN_UNUSED_VARIABLE = YES; |
532 | - IPHONEOS_DEPLOYMENT_TARGET = 15.0; | 531 | + IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
533 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | 532 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
534 | MTL_FAST_MATH = YES; | 533 | MTL_FAST_MATH = YES; |
535 | ONLY_ACTIVE_ARCH = YES; | 534 | ONLY_ACTIVE_ARCH = YES; |
@@ -592,7 +591,7 @@ | @@ -592,7 +591,7 @@ | ||
592 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 591 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
593 | GCC_WARN_UNUSED_FUNCTION = YES; | 592 | GCC_WARN_UNUSED_FUNCTION = YES; |
594 | GCC_WARN_UNUSED_VARIABLE = YES; | 593 | GCC_WARN_UNUSED_VARIABLE = YES; |
595 | - IPHONEOS_DEPLOYMENT_TARGET = 15.0; | 594 | + IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
596 | MTL_ENABLE_DEBUG_INFO = NO; | 595 | MTL_ENABLE_DEBUG_INFO = NO; |
597 | MTL_FAST_MATH = YES; | 596 | MTL_FAST_MATH = YES; |
598 | PRODUCT_NAME = "$(TARGET_NAME)"; | 597 | PRODUCT_NAME = "$(TARGET_NAME)"; |
Please
register
or
login
to post a comment