|
@@ -687,3 +687,506 @@ public class CustomNavigationController: UINavigationController {
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+public class DialogUnableAccess: UIViewController {
|
|
|
+
|
|
|
+ public let content = "To verify your identity for signing in on a new device, we need access to your main device. Please turn on your primary device. If it's not accessible, contact us to undergo a KYC verification process.".localized()
|
|
|
+
|
|
|
+ public override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ self.view.backgroundColor = .black.withAlphaComponent(0.5)
|
|
|
+
|
|
|
+ let container = UIView()
|
|
|
+ self.view.addSubview(container)
|
|
|
+ container.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, right: self.view.rightAnchor, paddingTop: 30, paddingLeft: 20, paddingRight: 20)
|
|
|
+ container.layer.cornerRadius = 20.0
|
|
|
+ container.clipsToBounds = true
|
|
|
+ container.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let title = UILabel()
|
|
|
+ title.text = "Unable to access your primary device".localized()
|
|
|
+ title.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ title.numberOfLines = 0
|
|
|
+ title.textAlignment = .center
|
|
|
+ title.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ container.addSubview(title)
|
|
|
+ title.anchor(top: container.topAnchor, paddingTop: 15, centerX: container.centerXAnchor, width: 270)
|
|
|
+
|
|
|
+ let imageWarning = UIImageView(image: UIImage(named: "pb_security_warning", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageWarning)
|
|
|
+ imageWarning.anchor(top: container.topAnchor, right: title.leftAnchor, paddingTop: 10, paddingRight: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let imageChat = UIImageView(image: UIImage(named: "pb_startup_iconsuffix", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageChat)
|
|
|
+ imageChat.anchor(top: container.topAnchor, left: title.rightAnchor, paddingTop: 10, paddingLeft: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let contentS = UILabel()
|
|
|
+ contentS.text = content
|
|
|
+ contentS.font = .systemFont(ofSize: 12)
|
|
|
+ contentS.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ contentS.numberOfLines = 0
|
|
|
+ container.addSubview(contentS)
|
|
|
+ contentS.anchor(top: title.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 15, paddingLeft: 15, paddingRight: 10)
|
|
|
+
|
|
|
+ let buttonKYC = UIButton(type: .custom)
|
|
|
+ let backgroundImageKYC = resizeImage(image: UIImage(named: "pb_security_kyc_center", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonKYC.setBackgroundImage(backgroundImageKYC, for: .normal)
|
|
|
+ buttonKYC.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonKYC.addTarget(self, action: #selector(kycTapped), for: .touchUpInside)
|
|
|
+ buttonKYC.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonKYC)
|
|
|
+ buttonKYC.anchor(top: contentS.bottomAnchor, paddingTop: 15, centerX: container.centerXAnchor, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonTryAgain = UIButton(type: .custom)
|
|
|
+ let backgroundImageTryAgain = resizeImage(image: UIImage(named: "pb_security_try_again", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonTryAgain.setBackgroundImage(backgroundImageTryAgain, for: .normal)
|
|
|
+ buttonTryAgain.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonTryAgain.addTarget(self, action: #selector(tryAgainTapped), for: .touchUpInside)
|
|
|
+ buttonTryAgain.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonTryAgain)
|
|
|
+ buttonTryAgain.anchor(top: contentS.bottomAnchor, right: buttonKYC.leftAnchor, paddingTop: 15, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonCancel = UIButton(type: .custom)
|
|
|
+ let backgroundImageCancel = resizeImage(image: UIImage(named: "pb_security_cancel", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonCancel.setBackgroundImage(backgroundImageCancel, for: .normal)
|
|
|
+ buttonCancel.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonCancel.addTarget(self, action: #selector(cancelTapped), for: .touchUpInside)
|
|
|
+ buttonCancel.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonCancel)
|
|
|
+ buttonCancel.anchor(top: contentS.bottomAnchor, left: buttonKYC.rightAnchor, paddingTop: 15, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let footer = UILabel()
|
|
|
+ footer.text = "We value your security".localized()
|
|
|
+ footer.font = .systemFont(ofSize: 12)
|
|
|
+ footer.textColor = .gray
|
|
|
+ footer.numberOfLines = 0
|
|
|
+ container.addSubview(footer)
|
|
|
+ footer.anchor(top: buttonCancel.bottomAnchor, bottom: container.bottomAnchor, right: container.rightAnchor, paddingBottom: 5, paddingRight: 10)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func kycTapped() {
|
|
|
+ print("kycTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func tryAgainTapped() {
|
|
|
+ print("tryAgainTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func cancelTapped() {
|
|
|
+ print("cancelTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+public class DialogVerifyYou: UIViewController {
|
|
|
+
|
|
|
+ public let content = "To help keep your Account safe, We wants to make sure it's really you trying to Sign-In\n\nA secure notification containing a verification code was just sent to your main Device".localized()
|
|
|
+ let textFieldCode = UITextField()
|
|
|
+
|
|
|
+ public override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ self.view.backgroundColor = .black.withAlphaComponent(0.5)
|
|
|
+
|
|
|
+ let container = UIView()
|
|
|
+ self.view.addSubview(container)
|
|
|
+ container.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, right: self.view.rightAnchor, paddingTop: 30, paddingLeft: 20, paddingRight: 20)
|
|
|
+ container.layer.cornerRadius = 20.0
|
|
|
+ container.clipsToBounds = true
|
|
|
+ container.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let title = UILabel()
|
|
|
+ title.text = "Verify it's you".localized()
|
|
|
+ title.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ title.numberOfLines = 0
|
|
|
+ title.textAlignment = .center
|
|
|
+ title.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ container.addSubview(title)
|
|
|
+ title.anchor(top: container.topAnchor, paddingTop: 15, centerX: container.centerXAnchor, maxWidth: 270)
|
|
|
+
|
|
|
+ let imageAsk = UIImageView(image: UIImage(named: "pb_security_ask", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageAsk)
|
|
|
+ imageAsk.anchor(top: container.topAnchor, right: title.leftAnchor, paddingTop: 10, paddingRight: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let imageChat = UIImageView(image: UIImage(named: "pb_startup_iconsuffix", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageChat)
|
|
|
+ imageChat.anchor(top: container.topAnchor, right: container.rightAnchor, paddingTop: 10, paddingRight: 20, width: 30, height: 30)
|
|
|
+
|
|
|
+ let contentS = UILabel()
|
|
|
+ contentS.text = content
|
|
|
+ contentS.font = .systemFont(ofSize: 12)
|
|
|
+ contentS.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ contentS.numberOfLines = 0
|
|
|
+ container.addSubview(contentS)
|
|
|
+ contentS.anchor(top: title.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 15, paddingLeft: 15, paddingRight: 10)
|
|
|
+
|
|
|
+ let containerText = UIView()
|
|
|
+ container.addSubview(containerText)
|
|
|
+ containerText.anchor(top: contentS.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 10, paddingLeft: 15, paddingRight: 15, height: 40)
|
|
|
+ containerText.layer.cornerRadius = 8.0
|
|
|
+ containerText.clipsToBounds = true
|
|
|
+ containerText.layer.borderWidth = 3
|
|
|
+ containerText.layer.borderColor = UIColor.blueTextField.cgColor
|
|
|
+
|
|
|
+ let containerEnterCode = UIView()
|
|
|
+ container.addSubview(containerEnterCode)
|
|
|
+ containerEnterCode.anchor(top: contentS.bottomAnchor, left: container.leftAnchor, paddingTop: 2, paddingLeft: 30, height: 20, maxWidth: 150)
|
|
|
+ containerEnterCode.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let titleEnterCode = UILabel()
|
|
|
+ containerEnterCode.addSubview(titleEnterCode)
|
|
|
+ titleEnterCode.text = "Enter Code".localized()
|
|
|
+ titleEnterCode.font = .systemFont(ofSize: 12, weight: .medium)
|
|
|
+ titleEnterCode.textColor = .blueTextField
|
|
|
+ titleEnterCode.textAlignment = .center
|
|
|
+ titleEnterCode.anchor(top: containerEnterCode.topAnchor, left: containerEnterCode.leftAnchor, bottom: containerEnterCode.bottomAnchor, right: containerEnterCode.rightAnchor, paddingLeft: 10, paddingRight: 10)
|
|
|
+
|
|
|
+ let buttonSubmit = UIButton(type: .custom)
|
|
|
+ containerText.addSubview(buttonSubmit)
|
|
|
+ buttonSubmit.anchor(top: containerText.topAnchor, bottom: containerText.bottomAnchor, right: containerText.rightAnchor, paddingTop: 5, paddingBottom: 5, paddingRight: 5, width: 100)
|
|
|
+ buttonSubmit.backgroundColor = .blueTextField
|
|
|
+ buttonSubmit.setTitle("Submit".localized(), for: .normal)
|
|
|
+ buttonSubmit.titleLabel?.font = .systemFont(ofSize: 10, weight: .medium)
|
|
|
+ buttonSubmit.layer.cornerRadius = 5.0
|
|
|
+ buttonSubmit.clipsToBounds = true
|
|
|
+ buttonSubmit.addTarget(self, action: #selector(submitTapped), for: .touchUpInside)
|
|
|
+
|
|
|
+ container.addSubview(textFieldCode)
|
|
|
+ textFieldCode.anchor(top: contentS.bottomAnchor, left: container.leftAnchor, right: buttonSubmit.leftAnchor, paddingTop: 20, paddingLeft: 25, paddingRight: 5, height: 25)
|
|
|
+ textFieldCode.keyboardType = .numberPad
|
|
|
+
|
|
|
+ let footer = UILabel()
|
|
|
+ footer.text = "We value your security".localized()
|
|
|
+ footer.font = .systemFont(ofSize: 12)
|
|
|
+ footer.textColor = .gray
|
|
|
+ footer.numberOfLines = 0
|
|
|
+ container.addSubview(footer)
|
|
|
+ footer.anchor(top: containerText.bottomAnchor, bottom: container.bottomAnchor, right: container.rightAnchor, paddingTop: 8, paddingBottom: 5, paddingRight: 10)
|
|
|
+
|
|
|
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissView))
|
|
|
+ tapGesture.cancelsTouchesInView = false
|
|
|
+ self.view.addGestureRecognizer(tapGesture)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func submitTapped() {
|
|
|
+ print("submitTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func dismissView() {
|
|
|
+ if textFieldCode.isFirstResponder {
|
|
|
+ textFieldCode.resignFirstResponder()
|
|
|
+ } else {
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+public class DialogSignIn: UIViewController {
|
|
|
+
|
|
|
+ public var valueDevice = "Galaxy S21 Ultra 5G"
|
|
|
+ public var valueTime = "14:02"
|
|
|
+ public var valueLocation = "Surakarta, Central Java"
|
|
|
+
|
|
|
+ public override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ self.view.backgroundColor = .black.withAlphaComponent(0.5)
|
|
|
+
|
|
|
+ let container = UIView()
|
|
|
+ self.view.addSubview(container)
|
|
|
+ container.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, right: self.view.rightAnchor, paddingTop: 30, paddingLeft: 20, paddingRight: 20)
|
|
|
+ container.layer.cornerRadius = 20.0
|
|
|
+ container.clipsToBounds = true
|
|
|
+ container.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let title = UILabel()
|
|
|
+ title.text = "New Sign-In Detected".localized()
|
|
|
+ title.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ title.numberOfLines = 0
|
|
|
+ title.textAlignment = .center
|
|
|
+ title.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ container.addSubview(title)
|
|
|
+ title.anchor(top: container.topAnchor, paddingTop: 15, centerX: container.centerXAnchor, maxWidth: 270)
|
|
|
+
|
|
|
+ let imageWarning = UIImageView(image: UIImage(named: "pb_security_warning", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageWarning)
|
|
|
+ imageWarning.anchor(top: container.topAnchor, right: title.leftAnchor, paddingTop: 10, paddingRight: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let imageChat = UIImageView(image: UIImage(named: "pb_startup_iconsuffix", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageChat)
|
|
|
+ imageChat.anchor(top: container.topAnchor, right: container.rightAnchor, paddingTop: 10, paddingRight: 20, width: 30, height: 30)
|
|
|
+
|
|
|
+ let lang = UserDefaults.standard.string(forKey: "i18n_language")
|
|
|
+ let sContent1 = "We detected a new Sign-In to your Account".localized()
|
|
|
+ let sContent2 = "Device".localized()
|
|
|
+ let sContent3 = "Time".localized()
|
|
|
+ let sContent4 = "Location".localized()
|
|
|
+ let sContent5 = "Your Account is at risk if this wasn't you.".localized()
|
|
|
+ let fullString = sContent1 + "\n\u{2022}\u{00a0}\u{00a0}" + sContent2 + String(repeating: "\u{00a0}", count: (lang == "id" ? 6 : 10)) + ": " + valueDevice + "\n\u{2022}\u{00a0}\u{00a0}" + sContent3 + String(repeating: "\u{00a0}", count: 13) + ": " + valueTime + "\n\u{2022}\u{00a0}\u{00a0}" + sContent4 + String(repeating: "\u{00a0}", count: (lang == "id" ? 13 : 6)) + ": " + valueLocation + "\n\n" + sContent5;
|
|
|
+ let contentFull = NSMutableAttributedString(string: fullString)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12)], range: NSRange(location: 0, length: fullString.count))
|
|
|
+ if let range = fullString.range(of: valueDevice) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12, weight: .medium)], range: NSRange(location: index, length: valueDevice.count))
|
|
|
+ }
|
|
|
+ if let range = fullString.range(of: valueTime) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12, weight: .medium)], range: NSRange(location: index, length: valueTime.count))
|
|
|
+ }
|
|
|
+ if let range = fullString.range(of: valueLocation) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12, weight: .medium)], range: NSRange(location: index, length: valueLocation.count))
|
|
|
+ }
|
|
|
+
|
|
|
+ let contentS = UILabel()
|
|
|
+ contentS.attributedText = contentFull
|
|
|
+ contentS.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ contentS.numberOfLines = 0
|
|
|
+ container.addSubview(contentS)
|
|
|
+ contentS.anchor(top: title.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 15, paddingLeft: 15, paddingRight: 10)
|
|
|
+
|
|
|
+ let buttonCC = UIButton(type: .custom)
|
|
|
+ let backgroundImageKYC = resizeImage(image: UIImage(named: "pb_startup_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonCC.setBackgroundImage(backgroundImageKYC, for: .normal)
|
|
|
+ buttonCC.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonCC.addTarget(self, action: #selector(ccTapped), for: .touchUpInside)
|
|
|
+ buttonCC.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonCC)
|
|
|
+ buttonCC.anchor(top: contentS.bottomAnchor, paddingTop: 10, centerX: container.centerXAnchor, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonVerify = UIButton(type: .custom)
|
|
|
+ let backgroundImageTryAgain = resizeImage(image: UIImage(named: "pb_security_verify_device", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonVerify.setBackgroundImage(backgroundImageTryAgain, for: .normal)
|
|
|
+ buttonVerify.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonVerify.addTarget(self, action: #selector(verifyTapped), for: .touchUpInside)
|
|
|
+ buttonVerify.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonVerify)
|
|
|
+ buttonVerify.anchor(top: contentS.bottomAnchor, right: buttonCC.leftAnchor, paddingTop: 10, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonBlock = UIButton(type: .custom)
|
|
|
+ let backgroundImageCancel = resizeImage(image: UIImage(named: "pb_security_block_device", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonBlock.setBackgroundImage(backgroundImageCancel, for: .normal)
|
|
|
+ buttonBlock.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonBlock.addTarget(self, action: #selector(blockTapped), for: .touchUpInside)
|
|
|
+ buttonBlock.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonBlock)
|
|
|
+ buttonBlock.anchor(top: contentS.bottomAnchor, left: buttonCC.rightAnchor, paddingTop: 10, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let footer = UILabel()
|
|
|
+ footer.text = "We value your security".localized()
|
|
|
+ footer.font = .systemFont(ofSize: 12)
|
|
|
+ footer.textColor = .gray
|
|
|
+ footer.numberOfLines = 0
|
|
|
+ container.addSubview(footer)
|
|
|
+ footer.anchor(top: buttonBlock.bottomAnchor, bottom: container.bottomAnchor, right: container.rightAnchor, paddingBottom: 5, paddingRight: 10)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func ccTapped() {
|
|
|
+ print("kycTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func verifyTapped() {
|
|
|
+ print("tryAgainTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func blockTapped() {
|
|
|
+ print("cancelTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+public class DialogVerificationCode: UIViewController {
|
|
|
+
|
|
|
+ public var valueDevice = "Galaxy S21 Ultra 5G"
|
|
|
+ public var valueAccount = "1001001234."
|
|
|
+ public var valueCode = "900214"
|
|
|
+
|
|
|
+ public override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ self.view.backgroundColor = .black.withAlphaComponent(0.5)
|
|
|
+
|
|
|
+ let container = UIView()
|
|
|
+ self.view.addSubview(container)
|
|
|
+ container.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, right: self.view.rightAnchor, paddingTop: 30, paddingLeft: 20, paddingRight: 20)
|
|
|
+ container.layer.cornerRadius = 20.0
|
|
|
+ container.clipsToBounds = true
|
|
|
+ container.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let title = UILabel()
|
|
|
+ title.text = "Nexilis Verification Code".localized()
|
|
|
+ title.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ title.numberOfLines = 0
|
|
|
+ title.textAlignment = .center
|
|
|
+ title.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ container.addSubview(title)
|
|
|
+ title.anchor(top: container.topAnchor, paddingTop: 15, centerX: container.centerXAnchor, maxWidth: 270)
|
|
|
+
|
|
|
+ let imageInfo = UIImageView(image: UIImage(named: "pb_security_information", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageInfo)
|
|
|
+ imageInfo.anchor(top: container.topAnchor, right: title.leftAnchor, paddingTop: 10, paddingRight: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let imageMail = UIImageView(image: UIImage(named: "pb_security_message", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageMail)
|
|
|
+ imageMail.anchor(top: container.topAnchor, right: container.rightAnchor, paddingTop: 10, paddingRight: 20, width: 30, height: 30)
|
|
|
+
|
|
|
+ let sContent1 = "We received a request to verify the Sign-In from".localized()
|
|
|
+ let sContent2 = "to your Account".localized()
|
|
|
+ let sContent3 = "Your Nexilis verification code is".localized()
|
|
|
+ let sContent4 = "(do not forward or give this code to anyone)".localized()
|
|
|
+ let sContent5 = "If you did not request this code, it is possible that someone else is trying to access the Account.".localized()
|
|
|
+ let fullString = sContent1 + " " + valueDevice + " " + sContent2 + " " + valueAccount + " " + sContent3 + ":\n\n" + valueCode + " " + sContent4 + "\n\n" + sContent5;
|
|
|
+ let contentFull = NSMutableAttributedString(string: fullString)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12), .foregroundColor: (self.traitCollection.userInterfaceStyle == .dark ? UIColor.white : UIColor.black)], range: NSRange(location: 0, length: fullString.count))
|
|
|
+ if let range = fullString.range(of: valueDevice) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 12, weight: .medium)], range: NSRange(location: index, length: valueDevice.count))
|
|
|
+ }
|
|
|
+ if let range = fullString.range(of: valueAccount) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.foregroundColor: UIColor.blueTextField], range: NSRange(location: index, length: valueAccount.count))
|
|
|
+ }
|
|
|
+ if let range = fullString.range(of: valueCode) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.font: UIFont.systemFont(ofSize: 18, weight: .medium)], range: NSRange(location: index, length: valueCode.count))
|
|
|
+ }
|
|
|
+ if let range = fullString.range(of: sContent4) {
|
|
|
+ let index = fullString.distance(from: fullString.startIndex, to: range.lowerBound)
|
|
|
+ contentFull.addAttributes([.foregroundColor: UIColor.systemRed], range: NSRange(location: index, length: sContent4.count))
|
|
|
+ }
|
|
|
+
|
|
|
+ let contentS = UILabel()
|
|
|
+ contentS.attributedText = contentFull
|
|
|
+ contentS.numberOfLines = 0
|
|
|
+ container.addSubview(contentS)
|
|
|
+ contentS.anchor(top: title.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 15, paddingLeft: 15, paddingRight: 10)
|
|
|
+
|
|
|
+ let footer = UILabel()
|
|
|
+ footer.text = "We value your security".localized()
|
|
|
+ footer.font = .systemFont(ofSize: 12)
|
|
|
+ footer.textColor = .gray
|
|
|
+ footer.numberOfLines = 0
|
|
|
+ container.addSubview(footer)
|
|
|
+ footer.anchor(top: contentS.bottomAnchor, bottom: container.bottomAnchor, right: container.rightAnchor, paddingTop: 10, paddingBottom: 5, paddingRight: 10)
|
|
|
+
|
|
|
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissView))
|
|
|
+ tapGesture.cancelsTouchesInView = false
|
|
|
+ self.view.addGestureRecognizer(tapGesture)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func dismissView() {
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+public class DialogSecurityShield: UIViewController {
|
|
|
+
|
|
|
+ public override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ self.view.backgroundColor = .black.withAlphaComponent(0.5)
|
|
|
+
|
|
|
+ let container = UIView()
|
|
|
+ self.view.addSubview(container)
|
|
|
+ container.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, right: self.view.rightAnchor, paddingTop: 30, paddingLeft: 20, paddingRight: 20)
|
|
|
+ container.layer.cornerRadius = 20.0
|
|
|
+ container.clipsToBounds = true
|
|
|
+ container.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : .white
|
|
|
+
|
|
|
+ let title = UILabel()
|
|
|
+ title.text = "Your Account is Protected".localized()
|
|
|
+ title.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ title.numberOfLines = 0
|
|
|
+ title.textAlignment = .center
|
|
|
+ title.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ container.addSubview(title)
|
|
|
+ title.anchor(top: container.topAnchor, paddingTop: 15, centerX: container.centerXAnchor, maxWidth: 270)
|
|
|
+
|
|
|
+ let imageWarning = UIImageView(image: UIImage(named: "pb_security_warning_green", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageWarning)
|
|
|
+ imageWarning.anchor(top: container.topAnchor, right: title.leftAnchor, paddingTop: 10, paddingRight: 5, width: 30, height: 30)
|
|
|
+
|
|
|
+ let imageChat = UIImageView(image: UIImage(named: "pb_startup_iconsuffix", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
|
+ container.addSubview(imageChat)
|
|
|
+ imageChat.anchor(top: container.topAnchor, right: container.rightAnchor, paddingTop: 10, paddingRight: 20, width: 30, height: 30)
|
|
|
+
|
|
|
+ let sContent1 = "Security Shield has been activated for your Peace of Mind...".localized()
|
|
|
+ let sContent2 = "Account & Transaction Protection".localized()
|
|
|
+ let sContent3 = "Early Threat Detection".localized()
|
|
|
+ let sContent4 = "Emergency Data Control".localized()
|
|
|
+ let sContent5 = "Please feel free to contact us for more information.".localized()
|
|
|
+ let fullString = sContent1 + "\n\u{2022}" + String(repeating: "\u{00a0}", count: 2) + sContent2 + "\n\u{2022}" + String(repeating: "\u{00a0}", count: 2) + sContent3 + "\n\u{2022}" + String(repeating: "\u{00a0}", count: 2) + sContent4 + "\n" + sContent5;
|
|
|
+
|
|
|
+ let contentS = UILabel()
|
|
|
+ contentS.text = fullString
|
|
|
+ contentS.textColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ contentS.numberOfLines = 0
|
|
|
+ contentS.font = .systemFont(ofSize: 12)
|
|
|
+ container.addSubview(contentS)
|
|
|
+ contentS.anchor(top: title.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor, paddingTop: 15, paddingLeft: 15, paddingRight: 10)
|
|
|
+
|
|
|
+ let buttonCC = UIButton(type: .custom)
|
|
|
+ let backgroundImageKYC = resizeImage(image: UIImage(named: "pb_startup_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonCC.setBackgroundImage(backgroundImageKYC, for: .normal)
|
|
|
+ buttonCC.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonCC.addTarget(self, action: #selector(ccTapped), for: .touchUpInside)
|
|
|
+ buttonCC.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonCC)
|
|
|
+ buttonCC.anchor(top: contentS.bottomAnchor, paddingTop: 10, centerX: container.centerXAnchor, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonActive = UIButton(type: .custom)
|
|
|
+ let backgroundImageTryAgain = resizeImage(image: UIImage(named: "pb_startup_activate", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonActive.setBackgroundImage(backgroundImageTryAgain, for: .normal)
|
|
|
+ buttonActive.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonActive.addTarget(self, action: #selector(activateTapped), for: .touchUpInside)
|
|
|
+ buttonActive.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonActive)
|
|
|
+ buttonActive.anchor(top: contentS.bottomAnchor, right: buttonCC.leftAnchor, paddingTop: 10, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let buttonDeactive = UIButton(type: .custom)
|
|
|
+ let backgroundImageCancel = resizeImage(image: UIImage(named: "pb_startup_deactivate", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: UIScreen.main.bounds.width / 3 - 20, height: 35))
|
|
|
+ buttonDeactive.setBackgroundImage(backgroundImageCancel, for: .normal)
|
|
|
+ buttonDeactive.imageView?.contentMode = .scaleAspectFill
|
|
|
+ buttonDeactive.addTarget(self, action: #selector(deactiveTapped), for: .touchUpInside)
|
|
|
+ buttonDeactive.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ container.addSubview(buttonDeactive)
|
|
|
+ buttonDeactive.anchor(top: contentS.bottomAnchor, left: buttonCC.rightAnchor, paddingTop: 10, width: UIScreen.main.bounds.width / 3 - 20, height: 35)
|
|
|
+
|
|
|
+ let footer = UILabel()
|
|
|
+ footer.text = "We value your security".localized()
|
|
|
+ footer.font = .systemFont(ofSize: 12)
|
|
|
+ footer.textColor = .gray
|
|
|
+ footer.numberOfLines = 0
|
|
|
+ container.addSubview(footer)
|
|
|
+ footer.anchor(top: buttonDeactive.bottomAnchor, bottom: container.bottomAnchor, right: container.rightAnchor, paddingBottom: 5, paddingRight: 10)
|
|
|
+
|
|
|
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissView))
|
|
|
+ tapGesture.cancelsTouchesInView = false
|
|
|
+ self.view.addGestureRecognizer(tapGesture)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func ccTapped() {
|
|
|
+ print("kycTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func activateTapped() {
|
|
|
+ print("tryAgainTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func deactiveTapped() {
|
|
|
+ print("cancelTapped")
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func dismissView() {
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+}
|