diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index 901defc0..9a54d33e 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -7565,7 +7565,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 10; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; @@ -7605,7 +7605,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 10; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; diff --git a/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift b/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift index d88e1132..51b5f91f 100644 --- a/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift +++ b/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift @@ -97,6 +97,7 @@ class ExistingUserKycViewController: UIViewController { @IBOutlet weak var termsWebView: WKWebView! // MARK: VC's Life cycle + var isURLLoaded = false override func viewDidLoad() { super.viewDidLoad() @@ -105,6 +106,7 @@ class ExistingUserKycViewController: UIViewController { self.termsWebView.load(URLRequest(url: url)) self.termsWebView.scrollView.bounces = false setup() + setWebViewDelegate() } override func viewWillAppear(_ animated: Bool) { @@ -780,3 +782,27 @@ extension ExistingUserKycViewController: ImageCropperDelegate { self.alert(type: .error, message: error.localizedDescription) } } + +extension ExistingUserKycViewController: WKNavigationDelegate, UIScrollViewDelegate { + + func setWebViewDelegate() { + termsWebView.scrollView.delegate = self + termsWebView.navigationDelegate = self + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + + isURLLoaded = true + } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + + if isURLLoaded { + if scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height) { + checkButton.isEnabled = true + } else if scrollView.contentOffset.y < scrollView.contentSize.height { + checkButton.isEnabled = false + } + } + } +} diff --git a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift index 3049d03d..f7f54f9b 100644 --- a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift +++ b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift @@ -117,11 +117,13 @@ class KYCVerifyStep1ViewController: UIViewController { @IBOutlet weak var termsWebView: WKWebView! // MARK: VC's Life cycle + var isURLLoaded = false override func viewDidLoad() { super.viewDidLoad() self.isFirst = (self.step == .first) setup() + setWebViewDelegate() } override func viewWillAppear(_ animated: Bool) { @@ -988,3 +990,26 @@ extension KYCVerifyStep1ViewController: ImageCropperDelegate { self.alert(type: .error, message: error.localizedDescription) } } +extension KYCVerifyStep1ViewController: WKNavigationDelegate, UIScrollViewDelegate { + + func setWebViewDelegate() { + termsWebView.scrollView.delegate = self + termsWebView.navigationDelegate = self + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + + isURLLoaded = true + } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + + if isURLLoaded { + if scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height) { + checkButton.isEnabled = true + } else if scrollView.contentOffset.y < scrollView.contentSize.height { + checkButton.isEnabled = false + } + } + } +} diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift index a87dcfe0..a2b01fb2 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift @@ -50,6 +50,7 @@ class TermsAndConditionViewController: UIViewController { @IBOutlet weak var webView: WKWebView! @IBOutlet weak var agreementButton: UIButton! // MARK: VC's Life cycle + var isURLLoaded = false override func viewDidLoad() { super.viewDidLoad() @@ -57,6 +58,7 @@ class TermsAndConditionViewController: UIViewController { self.webView.load(URLRequest(url: url)) self.webView.scrollView.bounces = false self.setup() + self.setWebViewDelegate() } // MARK: IBActions @@ -151,3 +153,27 @@ extension TermsAndConditionViewController: TermsAndConditionViewInterface { } } } + +extension TermsAndConditionViewController: WKNavigationDelegate, UIScrollViewDelegate { + + func setWebViewDelegate() { + webView.scrollView.delegate = self + webView.navigationDelegate = self + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + + isURLLoaded = true + } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + + if isURLLoaded { + if scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height) { + agreementButton.isEnabled = true + } else if scrollView.contentOffset.y < scrollView.contentSize.height { + agreementButton.isEnabled = false + } + } + } +} diff --git a/GME Remit/Utilities/MultiMediaManager.swift b/GME Remit/Utilities/MultiMediaManager.swift index 2ab21cf7..0962b1cb 100644 --- a/GME Remit/Utilities/MultiMediaManager.swift +++ b/GME Remit/Utilities/MultiMediaManager.swift @@ -65,7 +65,9 @@ class MultiMediaManager: NSObject { } let cancelAction = UIAlertAction(title: "cancel_text".localized(), style: .cancel, handler: nil) alertController.addAction(cameraAction) - alertController.addAction(galleryAction) + if DevicePlatform.isSimulator { + alertController.addAction(galleryAction) + } alertController.addAction(cancelAction) alertController.modalPresentationStyle = .overFullScreen @@ -202,3 +204,14 @@ struct PermissionHelper { } } +struct DevicePlatform { + static var isSimulator: Bool { + #if targetEnvironment(simulator) + // We're on the simulator + return true + #else + // We're on a device + return false + #endif + } +}