diff --git a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard.png b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard.png new file mode 100644 index 00000000000..15f127b2f04 Binary files /dev/null and b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard.png differ diff --git a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@2x.png b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@2x.png new file mode 100644 index 00000000000..9a6c76ac300 Binary files /dev/null and b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@2x.png differ diff --git a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@3x.png b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@3x.png new file mode 100644 index 00000000000..ef2eecb3e26 Binary files /dev/null and b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Artboard@3x.png differ diff --git a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Contents.json b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Contents.json index 1417bcec298..dd4da49129b 100644 --- a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Contents.json +++ b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/Contents.json @@ -2,7 +2,18 @@ "images" : [ { "idiom" : "universal", - "filename" : "enterpin@2x.pdf" + "filename" : "Artboard.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Artboard@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Artboard@3x.png", + "scale" : "3x" } ], "info" : { diff --git a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/enterpin@2x.pdf b/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/enterpin@2x.pdf deleted file mode 100644 index 01e268aa101..00000000000 Binary files a/Client/Assets/Images.xcassets/WebAuth/enter_pin.imageset/enterpin@2x.pdf and /dev/null differ diff --git a/Client/Frontend/Popup/AlertPopupView.swift b/Client/Frontend/Popup/AlertPopupView.swift index eec0ad3e287..fa5e7f55e9a 100644 --- a/Client/Frontend/Popup/AlertPopupView.swift +++ b/Client/Frontend/Popup/AlertPopupView.swift @@ -21,7 +21,7 @@ class AlertPopupView: PopupView { fileprivate let kPadding: CGFloat = 20.0 init(imageView: UIView?, title: String, message: String, inputType: UIKeyboardType? = nil, - secureInput: Bool = false, inputPlaceholder: String? = nil) { + secureInput: Bool = false, inputPlaceholder: String? = nil, titleWeight: UIFont.Weight = UIFont.Weight.bold, titleSize: CGFloat = 24) { super.init(frame: CGRect.zero) overlayDismisses = false @@ -40,7 +40,7 @@ class AlertPopupView: PopupView { titleLabel = UILabel(frame: CGRect.zero) titleLabel.textColor = BraveUX.GreyJ titleLabel.textAlignment = .center - titleLabel.font = UIFont.systemFont(ofSize: 24, weight: UIFont.Weight.bold) + titleLabel.font = UIFont.systemFont(ofSize: titleSize, weight: titleWeight) titleLabel.text = title titleLabel.numberOfLines = 0 containerView.addSubview(titleLabel) diff --git a/Client/U2FExtensions.swift b/Client/U2FExtensions.swift index 299567d0694..cf55147e9cf 100644 --- a/Client/U2FExtensions.swift +++ b/Client/U2FExtensions.swift @@ -91,22 +91,22 @@ class U2FExtensions: NSObject { /// Show when user has to touch his auth key fileprivate let touchKeyPopup = AlertPopupView(imageView: lottieAnimation(for: "webauth_touch_key"), - title: Strings.touchKeyMessage, message: "") + title: Strings.touchKeyMessage, message: "", titleWeight: .semibold, titleSize: 21) /// Show when user's key hasn't been inserted yet fileprivate let insertKeyPopup = AlertPopupView(imageView: lottieAnimation(for: "webauth_insert_key"), - title: Strings.insertKeyMessage, message: "") + title: Strings.insertKeyMessage, message: "", titleWeight: .semibold, titleSize: 21) /// Show to enter key's pin fileprivate let pinVerificationPopup = AlertPopupView(imageView: UIImageView(image: #imageLiteral(resourceName: "enter_pin")), title: Strings.pinTitle, message: "", inputType: .default, secureInput: true, - inputPlaceholder: Strings.pinPlaceholder) + inputPlaceholder: Strings.pinPlaceholder, titleWeight: .semibold, titleSize: 21) /// Show when key's pin authentication is pending fileprivate let verificationPendingPopup = AlertPopupView(imageView: lottieAnimation(for: "webauth_verify_key"), - title: Strings.verificationPending, message: "") + title: Strings.verificationPending, message: "", titleWeight: .semibold, titleSize: 21) private static func lottieAnimation(for bundleResource: String) -> AnimationView { let animationView = AnimationView(name: bundleResource).then { @@ -650,6 +650,8 @@ class U2FExtensions: NSObject { // This modal is presented when FIDO/FIDO2 APIs are waiting for the security key private func presentInsertKeyModal() { + let currentURL = self.tab?.url?.host ?? "" + insertKeyPopup.update(title: Strings.insertKeyMessage + currentURL) insertKeyPopup.showWithType(showType: .flyUp) } @@ -665,6 +667,8 @@ class U2FExtensions: NSObject { // The modal should be visible for the tab where the U2F API is active if u2fActive && tab?.id == currentTabId && (fido2Service.keyState == .touchKey || u2fService.keyState == .YKFKeyU2FServiceKeyStateTouchKey) { + let currentURL = self.tab?.url?.host ?? "" + touchKeyPopup.update(title: Strings.touchKeyMessage + currentURL) touchKeyPopup.showWithType(showType: .flyUp) return } @@ -673,7 +677,9 @@ class U2FExtensions: NSObject { private func handlePinVerificationRequired(completion: @escaping (Bool) -> Void) { ensureMainThread { + let currentURL = self.tab?.url?.host ?? "" self.pinVerificationPopup.addButton(title: Strings.confirmPin, type: .primary) { [weak self] in + self?.verificationPendingPopup.update(title: Strings.verificationPending + currentURL) self?.verificationPendingPopup.showWithType(showType: .flyUp) return self?.verifyPin(completion: completion) ?? .flyDown } @@ -1173,15 +1179,15 @@ extension Strings { public static let U2FAuthenticationError = NSLocalizedString("U2FAuthenticationError", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Error authenticating your security key", comment: "Error handling U2F authentication.") + tryAgain //Lightning Modals - public static let touchKeyMessage = NSLocalizedString("touchKeyMessage", bundle: Bundle.shared, value: "Touch your key to finish.", comment: "Message for touch key modal.") - public static let insertKeyMessage = NSLocalizedString("insertKeyMessage", bundle: Bundle.shared, value: "Insert your security key.", comment: "Message for touch key modal.") + public static let touchKeyMessage = NSLocalizedString("touchKeyMessage", bundle: Bundle.shared, value: "Touch your key to finish the request for ", comment: "Message for touch key modal.") + public static let insertKeyMessage = NSLocalizedString("insertKeyMessage", bundle: Bundle.shared, value: "Insert your security key for ", comment: "Message for touch key modal.") public static let keyCancel = NSLocalizedString("touchKeyCancel", bundle: Bundle.shared, value: "Cancel", comment: "Text for touch key modal button.") //PIN public static let pinTitle = NSLocalizedString("pinTitle", bundle: Bundle.shared, value: "PIN verification required", comment: "Title for the alert modal when a security key with PIN is inserted.") - public static let pinPlaceholder = NSLocalizedString("pinPlaceholder", bundle: Bundle.shared, value: "Enter your security key PIN", comment: "Placeholder text for PIN") + public static let pinPlaceholder = NSLocalizedString("pinPlaceholder", bundle: Bundle.shared, value: "Enter your PIN", comment: "Placeholder text for PIN") public static let confirmPin = NSLocalizedString("confirmPin", bundle: Bundle.shared, value: "Verify", comment: "Button text to confirm PIN") - public static let verificationPending = NSLocalizedString("verificationPending", bundle: Bundle.shared, value: "Verifying your PIN...", comment: "Title when PIN code is being verified.") + public static let verificationPending = NSLocalizedString("verificationPending", bundle: Bundle.shared, value: "Verifying your PIN for ", comment: "Title when PIN code is being verified.") } extension String {