@jimrising/easymerchantsdk-react-native 1.2.0 → 1.2.2

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.
Files changed (26) hide show
  1. package/.idea/caches/deviceStreaming.xml +209 -0
  2. package/.idea/workspace.xml +193 -0
  3. package/README.md +1 -1
  4. package/ios/Classes/EasyMerchantSdk.m +4 -4
  5. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +233 -0
  6. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +1137 -0
  7. package/ios/Pods/ViewControllers/BaseVC.swift +126 -0
  8. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +803 -0
  9. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +46 -0
  10. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +47 -0
  11. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +46 -0
  12. package/ios/Pods/ViewControllers/CountryListVC.swift +404 -0
  13. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +239 -0
  14. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +1134 -0
  15. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +159 -0
  16. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +90 -0
  17. package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
  18. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +5160 -0
  19. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
  20. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +77 -0
  21. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
  22. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +76 -0
  23. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +184 -0
  24. package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
  25. package/ios/easymerchantsdk.podspec +1 -1
  26. package/package.json +1 -1
@@ -0,0 +1,126 @@
1
+ //
2
+ // BaseVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 12/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class BaseVC: UIViewController {
11
+
12
+ private let activityIndicator: UIActivityIndicatorView? = nil
13
+ private var overlayView: UIView?
14
+
15
+ override func viewDidLoad() {
16
+ super.viewDidLoad()
17
+ }
18
+
19
+ func addOverlayView() {
20
+ guard let keyWindowScene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene,
21
+ let keyWindow = keyWindowScene.windows.first(where: { $0.isKeyWindow }) else {
22
+ return
23
+ }
24
+ DispatchQueue.main.async {
25
+ let overlayView = UIView(frame: keyWindow.bounds)
26
+ overlayView.backgroundColor = UIColor.black.withAlphaComponent(0.3)
27
+ keyWindow.addSubview(overlayView)
28
+ self.overlayView = overlayView
29
+ }
30
+ }
31
+
32
+ func removeOverlayView() {
33
+ DispatchQueue.main.async {
34
+ self.overlayView?.removeFromSuperview()
35
+ self.overlayView = nil
36
+ }
37
+ }
38
+
39
+ func showLoadingIndicator() {
40
+ DispatchQueue.main.async {
41
+ let activityIndicator = UIActivityIndicatorView(style: .large)
42
+ activityIndicator.center = self.view.center
43
+ activityIndicator.hidesWhenStopped = true
44
+ activityIndicator.startAnimating()
45
+
46
+ self.addOverlayView()
47
+ self.view.addSubview(activityIndicator)
48
+ }
49
+ }
50
+
51
+ func hideLoadingIndicator() {
52
+ DispatchQueue.main.async {
53
+ // Find and remove the activity indicator from its superview
54
+ for subview in self.view.subviews {
55
+ if let activityIndicator = subview as? UIActivityIndicatorView {
56
+ activityIndicator.stopAnimating()
57
+ self.removeOverlayView()
58
+ activityIndicator.removeFromSuperview()
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ // MARK: - Toast Method
65
+ func showToast(message: String, duration: Double = 3.0) {
66
+ DispatchQueue.main.async { [weak self] in
67
+ guard let self = self else { return }
68
+
69
+ let toastLabel = UILabel()
70
+ toastLabel.text = message
71
+ toastLabel.textColor = UIColor.white
72
+ toastLabel.backgroundColor = UIColor.black.withAlphaComponent(0.7)
73
+ toastLabel.textAlignment = .center
74
+ toastLabel.font = UIFont.systemFont(ofSize: 14)
75
+ toastLabel.numberOfLines = 0
76
+ toastLabel.alpha = 0.0
77
+ toastLabel.layer.cornerRadius = 10
78
+ toastLabel.clipsToBounds = true
79
+
80
+ // Set the position of the toast
81
+ let toastWidth: CGFloat = min(self.view.frame.width - 40, 250)
82
+ let toastHeight: CGFloat = 50
83
+ toastLabel.frame = CGRect(x: (self.view.frame.width - toastWidth) / 2,
84
+ y: self.view.frame.height - 100,
85
+ width: toastWidth,
86
+ height: toastHeight)
87
+
88
+ self.view.addSubview(toastLabel)
89
+
90
+ UIView.animate(withDuration: 0.5, animations: {
91
+ toastLabel.alpha = 1.0
92
+ }) { _ in
93
+ UIView.animate(withDuration: 0.5, delay: duration, options: .curveEaseOut, animations: {
94
+ toastLabel.alpha = 0.0
95
+ }) { _ in
96
+ toastLabel.removeFromSuperview()
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ func showAlert(title: String = "Alert", message: String, actionTitle: String = "OK", handler: ((UIAlertAction) -> Void)? = nil) {
103
+ DispatchQueue.main.async {
104
+ let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
105
+ let action = UIAlertAction(title: actionTitle, style: .default, handler: handler)
106
+ alert.addAction(action)
107
+ self.present(alert, animated: true, completion: nil)
108
+ }
109
+ }
110
+
111
+ // Helper function to validate email format using regex
112
+ func isValidEmail(_ email: String) -> Bool {
113
+ let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
114
+ let emailPred = NSPredicate(format: "SELF MATCHES %@", emailRegEx)
115
+ return emailPred.evaluate(with: email)
116
+ }
117
+ }
118
+
119
+ extension String {
120
+ func matches(_ pattern: String) -> Bool {
121
+ return NSPredicate(format: "SELF MATCHES %@", pattern).evaluate(with: self)
122
+ }
123
+ }
124
+
125
+
126
+