diff --git a/MoppApp/MoppApp/AlertUtil.swift b/MoppApp/MoppApp/AlertUtil.swift index 72f5e479..aede2db8 100644 --- a/MoppApp/MoppApp/AlertUtil.swift +++ b/MoppApp/MoppApp/AlertUtil.swift @@ -51,6 +51,24 @@ class AlertUtil { return alert } + static func messageAlertWithLinkAndActionButton(message: String?, okButtonTitle: String? = "OK", additionalInfoButtonTitle: String? = nil, actionButtonTitle: String? = nil, okButtonAction: ((UIAlertAction) -> Void)?, actionButtonAction: ((UIAlertAction) -> Void)? = nil) -> UIAlertController { + var messageNoLink: String? = message + if let messageText = message { + messageNoLink = messageText.removeFirstLinkFromMessage() + } + let okButton = okButtonTitle ?? L(.actionOk) + let alert = UIAlertController(title: messageNoLink, message: nil, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: actionButtonTitle, style: .destructive, handler: actionButtonAction)) + if let linkInUrl: String = message?.getFirstLinkInMessage() { + if let alertActionUrl: UIAlertAction = UIAlertAction().getLinkAlert(title: additionalInfoButtonTitle, message: linkInUrl), !alertActionUrl.title.isNilOrEmpty { + alert.addAction(alertActionUrl) + } + } + alert.addAction(UIAlertAction(title: okButton, style: .default, handler: okButtonAction)) + + return alert + } + static func errorMessageDialog(_ notification: Notification, topViewController: UIViewController) { guard let userInfo = notification.userInfo else { return } let error = userInfo[kErrorKey] as? NSError diff --git a/MoppApp/MoppApp/DefaultsHelper.swift b/MoppApp/MoppApp/DefaultsHelper.swift index b8899061..fdcd7fcb 100644 --- a/MoppApp/MoppApp/DefaultsHelper.swift +++ b/MoppApp/MoppApp/DefaultsHelper.swift @@ -82,6 +82,7 @@ fileprivate let kProxySetting = "kProxySetting" fileprivate let kProxyHost = "kProxyHost" fileprivate let kProxyPort = "kProxyPort" fileprivate let kProxyUsername = "kProxyUsername" +fileprivate let kNfcShowCanMessage = "kNfcShowCanMessage" class DefaultsHelper { @@ -380,4 +381,13 @@ class DefaultsHelper return UserDefaults.standard.value(forKey: kProxyUsername) as? String } } + + class var nfcShowCanMessage: Bool { + set { + UserDefaults.standard.set(newValue, forKey: kNfcShowCanMessage) + } + get { + return UserDefaults.standard.bool(forKey: kNfcShowCanMessage) + } + } } diff --git a/MoppApp/MoppApp/DiagnosticsViewController.swift b/MoppApp/MoppApp/DiagnosticsViewController.swift index 99154949..16221f27 100644 --- a/MoppApp/MoppApp/DiagnosticsViewController.swift +++ b/MoppApp/MoppApp/DiagnosticsViewController.swift @@ -454,7 +454,7 @@ class DiagnosticsViewController: MoppViewController, UIDocumentPickerDelegate { private func handleFileLoggingSwitchChanged() { if oneTimeLoggingSwitch.isOn { oneTimeLoggingSwitch.accessibilityUserInputLabels = [L(.voiceControlDisableLogGeneration)] - let messageAlert = AlertUtil.messageAlertWithLink(message: L(.diagnosticsRestartToActivateLogging), additionalInfoButtonTitle: L(.diagnosticsOneTimeLoggingReadMore)) { _ in + let messageAlert = AlertUtil.messageAlertWithLink(message: L(.diagnosticsRestartToActivateLogging), additionalInfoButtonTitle: L(.actionReadMore)) { _ in FileLogUtil.enableLogging() } present(messageAlert, animated: true) diff --git a/MoppApp/MoppApp/LocalizationKeys.swift b/MoppApp/MoppApp/LocalizationKeys.swift index f550ec2d..45be57df 100644 --- a/MoppApp/MoppApp/LocalizationKeys.swift +++ b/MoppApp/MoppApp/LocalizationKeys.swift @@ -77,6 +77,7 @@ enum LocKey : String case actionDelete = "action-delete" case actionSign = "action-sign" case actionDecrypt = "action-decrypt" + case actionDialogDontShowAgain = "action-dialog-dont-show-again" case fileImportTitle = "file-import-title" case fileImportTitleAccessibility = "file-import-title-accessibility" case addresseeImportTitle = "addressee-import-title" @@ -187,6 +188,7 @@ enum LocKey : String case nfcCertExpired = "nfc-cert-expired" case nfcWrongPin1 = "nfc-wrong-pin1" case nfcWrongPin2 = "nfc-wrong-pin2" + case nfcCanInfo = "nfc-can-info" case containerSignTitle = "container-sign-title" case containerEncryptionTitle = "container-encryption-title" case containerDecryptionTitle = "container-decryption-title" @@ -361,7 +363,7 @@ enum LocKey : String case diagnosticsActivateOneTimeLogging = "diagnostics-activate-one-time-logging" case diagnosticsSaveLog = "diagnostics-save-log" case diagnosticsRestartToActivateLogging = "diagnostics-restart-to-active-logging" - case diagnosticsOneTimeLoggingReadMore = "diagnostics-one-time-logging-read-more" + case actionReadMore = "action-read-more" case diagnosticsAppVersion = "diagnostics-app-version" case diagnosticsIosVersion = "diagnostics-ios-version" case diagnosticsLibrariesLabel = "diagnostics-libraries-label" diff --git a/MoppApp/MoppApp/NFCEditViewController.swift b/MoppApp/MoppApp/NFCEditViewController.swift index 9ee619b8..4a9430e0 100644 --- a/MoppApp/MoppApp/NFCEditViewController.swift +++ b/MoppApp/MoppApp/NFCEditViewController.swift @@ -91,6 +91,8 @@ class NFCEditViewController : MoppViewController, TokenFlowSigning { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + let nfcSupported = NFCTagReaderSession.readingAvailable + if let canNumber = canTextField.text { if !canNumber.isEmpty && canNumber.count != 6 { setCANErrorText() @@ -100,6 +102,21 @@ class NFCEditViewController : MoppViewController, TokenFlowSigning { } else { setCANDefaultText() } + + if !DefaultsHelper.nfcShowCanMessage && nfcSupported { + let nfcCanInfoMessageAlert = AlertUtil.messageAlertWithLinkAndActionButton( + message: L(.nfcCanInfo), + additionalInfoButtonTitle: L(.actionReadMore), + actionButtonTitle: L(.actionDialogDontShowAgain), + okButtonAction: {_ in }, + actionButtonAction: { _ in + DefaultsHelper.nfcShowCanMessage = true + }) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in + guard let sself = self else { return } + sself.present(nfcCanInfoMessageAlert, animated: true) + } + } } @objc func dismissKeyboard(_ notification: NSNotification) { diff --git a/MoppApp/MoppApp/en.lproj/Localizable.strings b/MoppApp/MoppApp/en.lproj/Localizable.strings index 2412f96a..96413d29 100755 --- a/MoppApp/MoppApp/en.lproj/Localizable.strings +++ b/MoppApp/MoppApp/en.lproj/Localizable.strings @@ -121,6 +121,8 @@ "action-delete" = "Remove"; "action-sign" = "Sign"; "action-decrypt" = "Decrypt"; +"action-dialog-dont-show-again" = "Don't show again"; +"action-read-more" = "Read more here"; // *** Signed containers *** @@ -250,6 +252,7 @@ "nfc-cert-expired" = "An expired certificate cannot be used for signing"; "nfc-wrong-pin2" = "Wrong PIN2. Remaining attempts: %d"; "nfc-wrong-pin1" = "Wrong PIN1. Remaining attempts: %d"; +"nfc-can-info" = "NFC signing uses the CAN number. NFC may lock up if CAN is entered incorrectly multiple times. https://www.id.ee/en/article/digital-signing-in-ria-digidoc-mobile-application/"; "role-and-address" = "Role and address"; "role-and-address-title" = "Enter your role and address info"; "role-and-address-role-title" = "Role / resolution"; @@ -351,6 +354,7 @@ "my-eid-wrong-code-message" = "Wrong %@ code. You can try 2 more times."; "my-eid-wrong-code-message-singular" = "Wrong %@ code. You can try 1 more time."; "my-eid-code-blocked-message" = "%1$@ has been blocked because %1$@ code has been entered incorrectly 3 times. Unblock to reuse %1$@."; + // *** My eID info bullets *** "my-eid-info-bullet-same-codes-warning" = "New %1$@ must be different from current %1$@."; "my-eid-info-bullet-auth-cert-info" = "PIN1 code is used for authentication."; @@ -361,6 +365,7 @@ "my-eid-info-bullet-pin2-blocked-warning" = "If PIN2 is inserted incorrectly 3 times, the signing certificate will be blocked and it will be impossible to use ID-card for digital signatures, until it is unblocked via the PUK code."; "my-eid-info-bullet-puk-unblock-info" = "PUK code is used for unblocking the certificates when PIN1 or PIN2 has been entered 3 times incorrectly."; "my-eid-info-bullet-puk-blocked-warning" = "If you forget the PUK code or the certificates remain blocked, you have to visit the service center to obtain new codes."; + "my-eid-change-code-title" = "Change %@"; "my-eid-unblock-code-title" = "Unblock %@"; "my-eid-current-code-label" = "CURRENT %@ CODE"; @@ -424,7 +429,6 @@ "diagnostics-activate-one-time-logging" = "Enable one-time log generation"; "diagnostics-save-log" = "SAVE LOG"; "diagnostics-restart-to-active-logging" = "Restart RIA DigiDoc to activate logging. https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/"; -"diagnostics-one-time-logging-read-more" = "Read more here"; "diagnostics-app-version" = "Application version"; "diagnostics-ios-version" = "OS"; "diagnostics-libraries-label" = "Libraries:"; diff --git a/MoppApp/MoppApp/et.lproj/Localizable.strings b/MoppApp/MoppApp/et.lproj/Localizable.strings index ec27b606..2ca56427 100755 --- a/MoppApp/MoppApp/et.lproj/Localizable.strings +++ b/MoppApp/MoppApp/et.lproj/Localizable.strings @@ -122,6 +122,8 @@ "action-delete" = "Eemalda"; "action-sign" = "Allkirjasta"; "action-decrypt" = "Dekrüpteeri"; +"action-dialog-dont-show-again" = "Ära rohkem näita"; +"action-read-more" = "Loe täpsemalt siit"; // *** Signed containers *** @@ -251,6 +253,7 @@ "nfc-cert-expired" = "Aegunud sertifikaati ei saa kasutada allkirjastamiseks"; "nfc-wrong-pin2" = "Vale PIN2. Katseid jäänud: %d"; "nfc-wrong-pin1" = "Vale PIN1. Katseid jäänud: %d"; +"nfc-can-info" = "NFC allkirjastamisel kasutatakse CAN numbrit. Mitmekordsel CANi valesti sisestamisel võib NFC lukustuda. https://www.id.ee/artikkel/digiallkirjastamine-ria-digidoc-mobiilirakenduses/"; "role-and-address" = "Roll ja aadress"; "role-and-address-title" = "Sisesta oma roll ja aadress"; "role-and-address-role-title" = "Roll / resolutsioon"; @@ -352,6 +355,7 @@ "my-eid-wrong-code-message" = "Vale %@-kood. Saad veel proovida 2 korda."; "my-eid-wrong-code-message-singular" = "Vale %@-kood. Saad veel proovida 1 kord."; "my-eid-code-blocked-message" = "%1$@ on blokeeritud, kuna %1$@-koodi on sisestatud 3 korda valesti. Tühista blokeering, et %1$@ taas kasutada."; + // *** My eID info bullets *** "my-eid-info-bullet-same-codes-warning" = "Uus %@ peab olema erinev eelmisest."; "my-eid-info-bullet-auth-cert-info" = "PIN1-koodi kasutatakse isikutuvastamiseks."; @@ -362,6 +366,7 @@ "my-eid-info-bullet-pin2-blocked-warning" = "Kui sisestad PIN2-koodi kolm korda valesti, siis allkirjastamise sertifikaat blokeeritakse ning ID-kaarti pole võimalik allkirjastamiseks kasutada enne blokeeringu tühistamist PUK-koodi abil."; "my-eid-info-bullet-puk-unblock-info" = "PUK-koodi abil saab tühistada sertifikaadi blokeeringu, kui PIN1- või PIN2-koodi on 3 korda järjest valesti sisestatud."; "my-eid-info-bullet-puk-blocked-warning" = "Kui peale vahetamist PUK-kood ununeb ja sertifikaat jääb blokeerituks kolme vale PIN1 või PIN2 sisestamise järel, siis ainus võimalus ID-kaart jälle tööle saada on pöörduda klienditeeninduspunkti poole."; + "my-eid-change-code-title" = "%@-koodi vahetus"; "my-eid-unblock-code-title" = "%@ lahti blokeerimine"; "my-eid-current-code-label" = "KEHTIV %@-KOOD"; @@ -425,7 +430,6 @@ "diagnostics-activate-one-time-logging" = "Aktiveeri ühekordne logifaili genereerimine"; "diagnostics-save-log" = "SALVESTA LOGIFAIL"; "diagnostics-restart-to-active-logging" = "Logimise aktiveerimiseks taaskäivita RIA DigiDoc. https://www.id.ee/artikkel/logifaili-genereerimine-digidoc4-kliendis/"; -"diagnostics-one-time-logging-read-more" = "Loe täpsemalt siit"; "diagnostics-app-version" = "Rakenduse versioon"; "diagnostics-ios-version" = "Operatsioonisüsteem"; "diagnostics-libraries-label" = "Teegid:"; diff --git a/MoppApp/MoppApp/ru.lproj/Localizable.strings b/MoppApp/MoppApp/ru.lproj/Localizable.strings index 5615deb5..47fcb187 100644 --- a/MoppApp/MoppApp/ru.lproj/Localizable.strings +++ b/MoppApp/MoppApp/ru.lproj/Localizable.strings @@ -118,6 +118,8 @@ "action-delete" = "Удалить"; "action-sign" = "Подписать"; "action-decrypt" = "Дешифровать"; +"action-dialog-dont-show-again" = "Больше не показывать"; +"action-read-more" = "Подробнее читайте здесь"; // *** Signed containers *** @@ -251,6 +253,7 @@ "nfc-cert-expired" = "Сертификат с истекшим сроком действия не может быть использован для подписи"; "nfc-wrong-pin2" = "Неверный PIN2-код. Оставшиеся попытки: %d"; "nfc-wrong-pin1" = "Неверный PIN1-код. Оставшиеся попытки: %d"; +"nfc-can-info" = "При подписании через NFC используется номер CAN. NFC может заблокироваться, если CAN введен неправильно несколько раз. https://www.id.ee/ru/artikkel/czifrovoe-podpisanie-v-mobilnom-prilozhenii-ria-digidoc/"; "role-and-address" = "Роль и адрес"; "role-and-address-title" = "Введите свою роль и адрес"; "role-and-address-role-title" = "Роль / pезолюция"; @@ -352,6 +355,7 @@ "my-eid-wrong-code-message" = "Неверный %@-код. Вы можете попробовать ещё 2 раз."; "my-eid-wrong-code-message-singular" = "Неверный %@-код. Вы можете попробовать ещё 1 раз."; "my-eid-code-blocked-message" = "%1$@ заблокирован, потому что %1$@-код был введён неверно 3 раза. Разблокируйте, чтобы использовать %1$@."; + // *** My eID info bullets *** "my-eid-info-bullet-same-codes-warning" = "Новый %1$@ должен отличаться от предыдущего %1$@."; "my-eid-info-bullet-auth-cert-info" = "PIN1-код используется для идентификации."; @@ -362,6 +366,7 @@ "my-eid-info-bullet-pin2-blocked-warning" = "Если PIN2 введён 3 раза неверно, тогда блокируется сертификат цифровой подписи и использовать ID-карту для цифровой подписи невозможно, пока блокировка не снята PUK-кодом."; "my-eid-info-bullet-puk-unblock-info" = "PUK-код используется для разблокирования сертификатов, когда PIN1 или PIN2 были неверно введены 3 раза."; "my-eid-info-bullet-puk-blocked-warning" = "Если Вы забудете PUK-код или сертификаты остануться заблокированными, необходимо посетить центр обслуживания для получения новых кодов."; + "my-eid-change-code-title" = "Изменить %@"; "my-eid-unblock-code-title" = "Разблокировать %@"; "my-eid-current-code-label" = "ДЕЙСТВУЮЩИЙ %@-КОД"; @@ -425,7 +430,6 @@ "diagnostics-activate-one-time-logging" = "Активировать одноразовое создание лог-файла"; "diagnostics-save-log" = "СОХРАНИТЬ ЛОГ-ФАЙЛ"; "diagnostics-restart-to-active-logging" = "Перезапустите RIA DigiDoc, чтобы активировать ведение журнала. https://www.id.ee/ru/artikkel/generirovanie-log-fajla-v-kliente-digidoc4/"; -"diagnostics-one-time-logging-read-more" = "Подробнее читайте здесь"; "diagnostics-app-version" = "Версия приложения"; "diagnostics-ios-version" = "Операционная система"; "diagnostics-libraries-label" = "Библиотеки:";