@jimrising/easymerchantsdk-react-native 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +304 -0
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +2636 -0
- package/ios/Pods/ViewControllers/BaseVC.swift +141 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +3347 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +46 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +47 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +46 -0
- package/ios/Pods/ViewControllers/CountryListVC.swift +435 -0
- package/ios/Pods/ViewControllers/CustomOverlay.swift +199 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +307 -0
- package/ios/Pods/ViewControllers/GrailPayVC.swift +244 -0
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +2066 -0
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +272 -0
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +85 -0
- package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +11025 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
- package/ios/Pods/ViewControllers/PaymentInformation/RecurringTVC.swift +40 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +81 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +81 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +188 -0
- package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +167 -0
- package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +629 -0
- package/ios/easymerchantsdk.podspec +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CityListTVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 12/08/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class CityListTVC: UITableViewCell {
|
|
11
|
+
|
|
12
|
+
@IBOutlet weak var viewCell: UIView!
|
|
13
|
+
@IBOutlet weak var lblCityName: UILabel!
|
|
14
|
+
|
|
15
|
+
override func awakeFromNib() {
|
|
16
|
+
super.awakeFromNib()
|
|
17
|
+
|
|
18
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
19
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
20
|
+
lblCityName.textColor = uiColor
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
24
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
25
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
26
|
+
lblCityName.font = UIFont.systemFont(ofSize: fontSize)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Set background color for the main view
|
|
30
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
31
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
32
|
+
self.contentView.backgroundColor = uiColor
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override func layoutSubviews() {
|
|
37
|
+
super.layoutSubviews()
|
|
38
|
+
|
|
39
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
40
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
41
|
+
self.contentView.backgroundColor = uiColor
|
|
42
|
+
viewCell?.backgroundColor = uiColor // Prevents crash if viewCell is nil
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CountryListTVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 12/08/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class CountryListTVC: UITableViewCell {
|
|
11
|
+
|
|
12
|
+
@IBOutlet weak var lblCountryName: UILabel!
|
|
13
|
+
@IBOutlet weak var viewCell: UIView!
|
|
14
|
+
|
|
15
|
+
override func awakeFromNib() {
|
|
16
|
+
super.awakeFromNib()
|
|
17
|
+
|
|
18
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
19
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
20
|
+
lblCountryName.textColor = uiColor
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
24
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
25
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
26
|
+
lblCountryName.font = UIFont.systemFont(ofSize: fontSize)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Set background color for the main view
|
|
30
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
31
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
32
|
+
self.contentView.backgroundColor = uiColor
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override func layoutSubviews() {
|
|
38
|
+
super.layoutSubviews()
|
|
39
|
+
|
|
40
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
41
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
42
|
+
self.contentView.backgroundColor = uiColor
|
|
43
|
+
viewCell?.backgroundColor = uiColor // Prevents crash if viewCell is nil
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// StateListTVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 12/08/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class StateListTVC: UITableViewCell {
|
|
11
|
+
|
|
12
|
+
@IBOutlet weak var lblStateName: UILabel!
|
|
13
|
+
@IBOutlet weak var viewCell: UIView!
|
|
14
|
+
|
|
15
|
+
override func awakeFromNib() {
|
|
16
|
+
super.awakeFromNib()
|
|
17
|
+
|
|
18
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
19
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
20
|
+
lblStateName.textColor = uiColor
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
24
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
25
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
26
|
+
lblStateName.font = UIFont.systemFont(ofSize: fontSize)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Set background color for the main view
|
|
30
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
31
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
32
|
+
self.contentView.backgroundColor = uiColor
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override func layoutSubviews() {
|
|
37
|
+
super.layoutSubviews()
|
|
38
|
+
|
|
39
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
40
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
41
|
+
self.contentView.backgroundColor = uiColor
|
|
42
|
+
viewCell?.backgroundColor = uiColor // Prevents crash if viewCell is nil
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CountryListVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 26/11/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
protocol CountryListVCDelegate: AnyObject {
|
|
11
|
+
func didSelectCountry(_ country: Country)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class CountryListVC: UIViewController {
|
|
15
|
+
|
|
16
|
+
@IBOutlet var viewClass: UIView!
|
|
17
|
+
@IBOutlet weak var searchBarCountry: UISearchBar!
|
|
18
|
+
@IBOutlet weak var tblViewCountry: UITableView!
|
|
19
|
+
@IBOutlet weak var viewSearch: UIView!
|
|
20
|
+
|
|
21
|
+
var list: [Country] = [Country]()
|
|
22
|
+
var searchList: [Country] = [Country]()
|
|
23
|
+
|
|
24
|
+
weak var delegate: CountryListVCDelegate?
|
|
25
|
+
|
|
26
|
+
override func viewDidLoad() {
|
|
27
|
+
super.viewDidLoad()
|
|
28
|
+
// Remove top and bottom lines (background/shadow)
|
|
29
|
+
if let searchBar = self.searchBarCountry {
|
|
30
|
+
searchBar.backgroundImage = UIImage() // Removes background line
|
|
31
|
+
searchBar.layer.borderWidth = 0
|
|
32
|
+
searchBar.layer.borderColor = UIColor.clear.cgColor
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
36
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
37
|
+
self.view.backgroundColor = uiColor
|
|
38
|
+
self.searchBarCountry.backgroundColor = uiColor
|
|
39
|
+
self.searchBarCountry.barTintColor = uiColor
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
43
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
44
|
+
searchBarCountry.tintColor = uiColor
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
48
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
49
|
+
searchBarCountry.searchTextField.textColor = uiColor
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
53
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
54
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
55
|
+
searchBarCountry.searchTextField.font = UIFont.systemFont(ofSize: fontSize)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if let secondaryFontColor = UserStoreSingleton.shared.secondary_font_col,
|
|
59
|
+
let uiColor = UIColor(hex: secondaryFontColor) {
|
|
60
|
+
// Set placeholder text color
|
|
61
|
+
let placeholderAttributes: [NSAttributedString.Key: Any] = [
|
|
62
|
+
.foregroundColor: uiColor
|
|
63
|
+
]
|
|
64
|
+
searchBarCountry.searchTextField.attributedPlaceholder = NSAttributedString(
|
|
65
|
+
string: searchBarCountry.searchTextField.placeholder ?? "Search here",
|
|
66
|
+
attributes: placeholderAttributes
|
|
67
|
+
)
|
|
68
|
+
// Set search icon color
|
|
69
|
+
searchBarCountry.searchTextField.leftView?.tintColor = uiColor
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if let searchBar = self.searchBarCountry {
|
|
73
|
+
searchBar.backgroundImage = UIImage() // Removes background line
|
|
74
|
+
searchBar.layer.borderWidth = 0
|
|
75
|
+
searchBar.layer.borderColor = UIColor.clear.cgColor
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
tblViewCountry.delegate = self
|
|
79
|
+
tblViewCountry.dataSource = self
|
|
80
|
+
|
|
81
|
+
searchBarCountry.delegate = self
|
|
82
|
+
|
|
83
|
+
self.navigationItem.title = "Select Country"
|
|
84
|
+
self.tblViewCountry.separatorStyle = .none
|
|
85
|
+
configuration()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
func configuration() {
|
|
89
|
+
for code in NSLocale.isoCountryCodes {
|
|
90
|
+
let id = NSLocale.localeIdentifier(fromComponents: [NSLocale.Key.countryCode.rawValue: code])
|
|
91
|
+
let name = NSLocale(localeIdentifier: "en_US").displayName(forKey: NSLocale.Key.identifier, value: id)
|
|
92
|
+
let locale = NSLocale.init(localeIdentifier: id)
|
|
93
|
+
|
|
94
|
+
let countryCode = locale.object(forKey: NSLocale.Key.countryCode)
|
|
95
|
+
let currencyCode = locale.object(forKey: NSLocale.Key.currencyCode)
|
|
96
|
+
let currencySymbol = locale.object(forKey: NSLocale.Key.currencySymbol)
|
|
97
|
+
|
|
98
|
+
if name != nil {
|
|
99
|
+
let model = Country()
|
|
100
|
+
model.name = name
|
|
101
|
+
model.countryCode = countryCode as? String
|
|
102
|
+
model.currencyCode = currencyCode as? String
|
|
103
|
+
model.currencySymbol = currencySymbol as? String
|
|
104
|
+
model.flag = String.flag(for: code)
|
|
105
|
+
model.extensionCode = NSLocale().extensionCode(countryCode: model.countryCode)
|
|
106
|
+
list.append(model)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
self.searchList = self.list
|
|
110
|
+
self.tblViewCountry.reloadData()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@IBAction func actionBtnClose(_ sender: UIButton) {
|
|
114
|
+
self.navigationController?.popViewController(animated: true)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
extension String {
|
|
120
|
+
|
|
121
|
+
static func flag(for code: String) -> String? {
|
|
122
|
+
func isLowercaseASCIIScalar(_ scalar: Unicode.Scalar) -> Bool {
|
|
123
|
+
return scalar.value >= 0x61 && scalar.value <= 0x7A
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
func regionalIndicatorSymbol(for scalar: Unicode.Scalar) -> Unicode.Scalar {
|
|
127
|
+
precondition(isLowercaseASCIIScalar(scalar))
|
|
128
|
+
return Unicode.Scalar(scalar.value + (0x1F1E6 - 0x61))!
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let lowercaseCode = code.lowercased()
|
|
132
|
+
guard lowercaseCode.count == 2 else { return nil }
|
|
133
|
+
guard lowercaseCode.unicodeScalars.reduce(true, { accum, scalar in accum && isLowercaseASCIIScalar(scalar)}) else { return nil }
|
|
134
|
+
let indicatorSymbol = lowercaseCode.unicodeScalars.map({regionalIndicatorSymbol(for: $0)})
|
|
135
|
+
return String(indicatorSymbol.map({ Character($0)}))
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
extension NSLocale {
|
|
140
|
+
func extensionCode(countryCode: String?) -> String? {
|
|
141
|
+
let prefixCodes = [
|
|
142
|
+
"AF":"93",
|
|
143
|
+
"AL":"355",
|
|
144
|
+
"DZ":"213",
|
|
145
|
+
"AS":"1",
|
|
146
|
+
"AD":"376",
|
|
147
|
+
"AO":"244",
|
|
148
|
+
"AI":"1",
|
|
149
|
+
"AG":"1",
|
|
150
|
+
"AR":"54",
|
|
151
|
+
"AM":"374",
|
|
152
|
+
"AW":"297",
|
|
153
|
+
"AU":"61",
|
|
154
|
+
"AT":"43",
|
|
155
|
+
"AZ":"994",
|
|
156
|
+
"BS":"1",
|
|
157
|
+
"BH":"973",
|
|
158
|
+
"BD":"880",
|
|
159
|
+
"BB":"1",
|
|
160
|
+
"BY":"375",
|
|
161
|
+
"BE":"32",
|
|
162
|
+
"BZ":"501",
|
|
163
|
+
"BJ":"229",
|
|
164
|
+
"BM":"1",
|
|
165
|
+
"BT":"975",
|
|
166
|
+
"BA":"387",
|
|
167
|
+
"BW":"267",
|
|
168
|
+
"BR":"55",
|
|
169
|
+
"IO":"246",
|
|
170
|
+
"BG":"359",
|
|
171
|
+
"BF":"226",
|
|
172
|
+
"BI":"257",
|
|
173
|
+
"KH":"855",
|
|
174
|
+
"CM":"237",
|
|
175
|
+
"CA":"1",
|
|
176
|
+
"CV":"238",
|
|
177
|
+
"KY":"345",
|
|
178
|
+
"CF":"236",
|
|
179
|
+
"TD":"235",
|
|
180
|
+
"CL":"56",
|
|
181
|
+
"CN":"86",
|
|
182
|
+
"CX":"61",
|
|
183
|
+
"CO":"57",
|
|
184
|
+
"KM":"269",
|
|
185
|
+
"CG":"242",
|
|
186
|
+
"CK":"682",
|
|
187
|
+
"CR":"506",
|
|
188
|
+
"HR":"385",
|
|
189
|
+
"CU":"53",
|
|
190
|
+
"CY":"537",
|
|
191
|
+
"CZ":"420",
|
|
192
|
+
"DK":"45",
|
|
193
|
+
"DJ":"253",
|
|
194
|
+
"DM":"1",
|
|
195
|
+
"DO":"1",
|
|
196
|
+
"EC":"593",
|
|
197
|
+
"EG":"20",
|
|
198
|
+
"SV":"503",
|
|
199
|
+
"GQ":"240",
|
|
200
|
+
"ER":"291",
|
|
201
|
+
"EE":"372",
|
|
202
|
+
"ET":"251",
|
|
203
|
+
"FO":"298",
|
|
204
|
+
"FJ":"679",
|
|
205
|
+
"FI":"358",
|
|
206
|
+
"FR":"33",
|
|
207
|
+
"GF":"594",
|
|
208
|
+
"PF":"689",
|
|
209
|
+
"GA":"241",
|
|
210
|
+
"GM":"220",
|
|
211
|
+
"GE":"995",
|
|
212
|
+
"DE":"49",
|
|
213
|
+
"GH":"233",
|
|
214
|
+
"GI":"350",
|
|
215
|
+
"GR":"30",
|
|
216
|
+
"GL":"299",
|
|
217
|
+
"GD":"1",
|
|
218
|
+
"GP":"590",
|
|
219
|
+
"GU":"1",
|
|
220
|
+
"GT":"502",
|
|
221
|
+
"GN":"224",
|
|
222
|
+
"GW":"245",
|
|
223
|
+
"GY":"595",
|
|
224
|
+
"HT":"509",
|
|
225
|
+
"HN":"504",
|
|
226
|
+
"HU":"36",
|
|
227
|
+
"IS":"354",
|
|
228
|
+
"IN":"91",
|
|
229
|
+
"ID":"62",
|
|
230
|
+
"IQ":"964",
|
|
231
|
+
"IE":"353",
|
|
232
|
+
"IL":"972",
|
|
233
|
+
"IT":"39",
|
|
234
|
+
"JM":"1",
|
|
235
|
+
"JP":"81",
|
|
236
|
+
"JO":"962",
|
|
237
|
+
"KZ":"77",
|
|
238
|
+
"KE":"254",
|
|
239
|
+
"KI":"686",
|
|
240
|
+
"KW":"965",
|
|
241
|
+
"KG":"996",
|
|
242
|
+
"LV":"371",
|
|
243
|
+
"LB":"961",
|
|
244
|
+
"LS":"266",
|
|
245
|
+
"LR":"231",
|
|
246
|
+
"LI":"423",
|
|
247
|
+
"LT":"370",
|
|
248
|
+
"LU":"352",
|
|
249
|
+
"MG":"261",
|
|
250
|
+
"MW":"265",
|
|
251
|
+
"MY":"60",
|
|
252
|
+
"MV":"960",
|
|
253
|
+
"ML":"223",
|
|
254
|
+
"MT":"356",
|
|
255
|
+
"MH":"692",
|
|
256
|
+
"MQ":"596",
|
|
257
|
+
"MR":"222",
|
|
258
|
+
"MU":"230",
|
|
259
|
+
"YT":"262",
|
|
260
|
+
"MX":"52",
|
|
261
|
+
"MC":"377",
|
|
262
|
+
"MN":"976",
|
|
263
|
+
"ME":"382",
|
|
264
|
+
"MS":"1",
|
|
265
|
+
"MA":"212",
|
|
266
|
+
"MM":"95",
|
|
267
|
+
"NA":"264",
|
|
268
|
+
"NR":"674",
|
|
269
|
+
"NP":"977",
|
|
270
|
+
"NL":"31",
|
|
271
|
+
"AN":"599",
|
|
272
|
+
"NC":"687",
|
|
273
|
+
"NZ":"64",
|
|
274
|
+
"NI":"505",
|
|
275
|
+
"NE":"227",
|
|
276
|
+
"NG":"234",
|
|
277
|
+
"NU":"683",
|
|
278
|
+
"NF":"672",
|
|
279
|
+
"MP":"1",
|
|
280
|
+
"NO":"47",
|
|
281
|
+
"OM":"968",
|
|
282
|
+
"PK":"92",
|
|
283
|
+
"PW":"680",
|
|
284
|
+
"PA":"507",
|
|
285
|
+
"PG":"675",
|
|
286
|
+
"PY":"595",
|
|
287
|
+
"PE":"51",
|
|
288
|
+
"PH":"63",
|
|
289
|
+
"PL":"48",
|
|
290
|
+
"PT":"351",
|
|
291
|
+
"PR":"1",
|
|
292
|
+
"QA":"974",
|
|
293
|
+
"RO":"40",
|
|
294
|
+
"RW":"250",
|
|
295
|
+
"WS":"685",
|
|
296
|
+
"SM":"378",
|
|
297
|
+
"SA":"966",
|
|
298
|
+
"SN":"221",
|
|
299
|
+
"RS":"381",
|
|
300
|
+
"SC":"248",
|
|
301
|
+
"SL":"232",
|
|
302
|
+
"SG":"65",
|
|
303
|
+
"SK":"421",
|
|
304
|
+
"SI":"386",
|
|
305
|
+
"SB":"677",
|
|
306
|
+
"ZA":"27",
|
|
307
|
+
"GS":"500",
|
|
308
|
+
"ES":"34",
|
|
309
|
+
"LK":"94",
|
|
310
|
+
"SD":"249",
|
|
311
|
+
"SR":"597",
|
|
312
|
+
"SZ":"268",
|
|
313
|
+
"SE":"46",
|
|
314
|
+
"CH":"41",
|
|
315
|
+
"TJ":"992",
|
|
316
|
+
"TH":"66",
|
|
317
|
+
"TG":"228",
|
|
318
|
+
"TK":"690",
|
|
319
|
+
"TO":"676",
|
|
320
|
+
"TT":"1",
|
|
321
|
+
"TN":"216",
|
|
322
|
+
"TR":"90",
|
|
323
|
+
"TM":"993",
|
|
324
|
+
"TC":"1",
|
|
325
|
+
"TV":"688",
|
|
326
|
+
"UG":"256",
|
|
327
|
+
"UA":"380",
|
|
328
|
+
"AE":"971",
|
|
329
|
+
"GB":"44",
|
|
330
|
+
"US":"1",
|
|
331
|
+
"UY":"598",
|
|
332
|
+
"UZ":"998",
|
|
333
|
+
"VU":"678",
|
|
334
|
+
"WF":"681",
|
|
335
|
+
"YE":"967",
|
|
336
|
+
"ZM":"260",
|
|
337
|
+
"ZW":"263",
|
|
338
|
+
"BO":"591",
|
|
339
|
+
"BN":"673",
|
|
340
|
+
"CC":"61",
|
|
341
|
+
"CD":"243",
|
|
342
|
+
"CI":"225",
|
|
343
|
+
"FK":"500",
|
|
344
|
+
"GG":"44",
|
|
345
|
+
"VA":"379",
|
|
346
|
+
"HK":"852",
|
|
347
|
+
"IR":"98",
|
|
348
|
+
"IM":"44",
|
|
349
|
+
"JE":"44",
|
|
350
|
+
"KP":"850",
|
|
351
|
+
"KR":"82",
|
|
352
|
+
"LA":"856",
|
|
353
|
+
"LY":"218",
|
|
354
|
+
"MO":"853",
|
|
355
|
+
"MK":"389",
|
|
356
|
+
"FM":"691",
|
|
357
|
+
"MD":"373",
|
|
358
|
+
"MZ":"258",
|
|
359
|
+
"PS":"970",
|
|
360
|
+
"PN":"872",
|
|
361
|
+
"RE":"262",
|
|
362
|
+
"RU":"7",
|
|
363
|
+
"BL":"590",
|
|
364
|
+
"SH":"290",
|
|
365
|
+
"KN":"1",
|
|
366
|
+
"LC":"1",
|
|
367
|
+
"MF":"590",
|
|
368
|
+
"PM":"508",
|
|
369
|
+
"VC":"1",
|
|
370
|
+
"ST":"239",
|
|
371
|
+
"SO":"252",
|
|
372
|
+
"SJ":"47",
|
|
373
|
+
"SY":"963",
|
|
374
|
+
"TW":"886",
|
|
375
|
+
"TZ":"255",
|
|
376
|
+
"TL":"670",
|
|
377
|
+
"VE":"58",
|
|
378
|
+
"VN":"84",
|
|
379
|
+
"VG":"284",
|
|
380
|
+
"VI":"340"
|
|
381
|
+
]
|
|
382
|
+
|
|
383
|
+
let countryDialingCode = prefixCodes[countryCode ?? "IN"] ?? nil
|
|
384
|
+
return countryDialingCode
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
extension CountryListVC: UITableViewDelegate, UITableViewDataSource {
|
|
389
|
+
|
|
390
|
+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
391
|
+
return self.searchList.count
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
395
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
|
|
396
|
+
cell?.textLabel?.text = "\(self.searchList[indexPath.row].flag!) \(self.searchList[indexPath.row].name!)"
|
|
397
|
+
|
|
398
|
+
// Apply color from UserStoreSingleton
|
|
399
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
400
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
401
|
+
cell?.textLabel?.textColor = uiColor
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
405
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
406
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
407
|
+
cell?.textLabel?.font = UIFont.systemFont(ofSize: fontSize)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return cell!
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
414
|
+
let selectedCountry = self.searchList[indexPath.row]
|
|
415
|
+
delegate?.didSelectCountry(selectedCountry)
|
|
416
|
+
self.navigationController?.popViewController(animated: true)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
extension CountryListVC: UISearchBarDelegate {
|
|
422
|
+
|
|
423
|
+
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
|
424
|
+
self.searchList = self.list
|
|
425
|
+
self.tblViewCountry.reloadData()
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
|
|
429
|
+
self.searchList = searchText.isEmpty ? list: list.filter({ (model) -> Bool in
|
|
430
|
+
return model.name!.range(of: searchText, options: .caseInsensitive, range: nil, locale: nil) != nil
|
|
431
|
+
})
|
|
432
|
+
self.tblViewCountry.reloadData()
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|