diff --git a/src/keepass2android/GroupBaseActivity.cs b/src/keepass2android/GroupBaseActivity.cs index 3036063e..c7a451c9 100644 --- a/src/keepass2android/GroupBaseActivity.cs +++ b/src/keepass2android/GroupBaseActivity.cs @@ -54,7 +54,7 @@ namespace keepass2android { Resource.Id.insert_element, 20 }, { Resource.Id.autofill_infotext, 10 }, { Resource.Id.notification_info_android8_infotext, 10 }, - { Resource.Id.infotext, 11 }, + { Resource.Id.infotext, 9 }, { Resource.Id.select_other_entry, 20}, { Resource.Id.add_url_entry, 20}, }; @@ -239,14 +239,113 @@ namespace keepass2android AppTask.SetupGroupBaseActivityButtons(this); UpdateAutofillInfo(); - UpdateAndroid8NotificationInfo(); + UpdateInfotexts(); RefreshIfDirty(); } + private void UpdateInfotexts() + { + + string lastInfoText; + if (IsTimeForInfotext(out lastInfoText) && (FindViewById(Resource.Id.info_head) != null)) + { + + FingerprintUnlockMode um; + Enum.TryParse(_prefs.GetString(Database.GetFingerprintModePrefKey(App.Kp2a.GetDb().Ioc), ""), out um); + bool isFingerprintEnabled = (um == FingerprintUnlockMode.FullUnlock); + + string masterKeyKey = "MasterKey" + isFingerprintEnabled; + string emergencyKey = "Emergency"; + string backupKey = "Backup"; + + List applicableInfoTextKeys = new List { masterKeyKey }; + + if (App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc).UserShouldBackup) + { + applicableInfoTextKeys.Add(backupKey); + } + if (App.Kp2a.GetDb().Entries.Count > 15) + { + applicableInfoTextKeys.Add(emergencyKey); + } + + List enabledInfoTextKeys = new List(); + foreach (string key in applicableInfoTextKeys) + { + if (!InfoTextWasDisabled(key)) + enabledInfoTextKeys.Add(key); + } + + if (enabledInfoTextKeys.Any()) + { + string infoTextKey = "", infoHead = "", infoMain = "", infoNote = ""; + + if (enabledInfoTextKeys.Count > 1) + { + foreach (string key in enabledInfoTextKeys) + if (key == lastInfoText) + { + enabledInfoTextKeys.Remove(key); + break; + } + infoTextKey = enabledInfoTextKeys[new Random().Next(enabledInfoTextKeys.Count)]; + } + + if (infoTextKey == masterKeyKey) + { + infoHead = GetString(Resource.String.masterkey_infotext_head); + infoMain = GetString(Resource.String.masterkey_infotext_main); + if (isFingerprintEnabled) + infoNote = GetString(Resource.String.masterkey_infotext_fingerprint_note); + } + else if (infoTextKey == emergencyKey) + { + infoHead = GetString(Resource.String.emergency_infotext_head); + infoMain = GetString(Resource.String.emergency_infotext_main); + } + else if (infoTextKey == backupKey) + { + infoHead = GetString(Resource.String.backup_infotext_head); + infoMain = GetString(Resource.String.backup_infotext_main); + infoNote = GetString(Resource.String.backup_infotext_note, GetString(Resource.String.menu_app_settings), GetString(Resource.String.menu_db_settings), GetString(Resource.String.export_prefs)); + } + + + + FindViewById(Resource.Id.info_head).Text = infoHead; + FindViewById(Resource.Id.info_main).Text = infoMain; + var additionalInfoText = FindViewById(Resource.Id.info_additional); + additionalInfoText.Text = infoNote; + additionalInfoText.Visibility = string.IsNullOrEmpty(infoNote) ? ViewStates.Gone : ViewStates.Visible; + + if (infoTextKey != "") + { + + RegisterInfoTextDisplay(infoTextKey); + FindViewById(Resource.Id.info_ok).Click += (sender, args) => + { + UpdateBottomBarElementVisibility(Resource.Id.infotext, false); + }; + FindViewById(Resource.Id.info_dont_show_again).Click += (sender, args) => + { + UpdateBottomBarElementVisibility(Resource.Id.infotext, false); + DisableInfoTextDisplay(infoTextKey); + }; + + UpdateBottomBarElementVisibility(Resource.Id.infotext, true); + } + + } + + + + } + } + private void UpdateAndroid8NotificationInfo(bool hideForever = false) { const string prefsKey = "DidShowAndroid8NotificationInfo"; @@ -257,6 +356,10 @@ namespace keepass2android _prefs.Edit().PutBoolean(prefsKey, true).Commit(); canShowNotificationInfo = false; } + if (canShowNotificationInfo) + { + RegisterInfoTextDisplay("Android8Notification"); //this ensures that we don't show the general info texts too soon + } UpdateBottomBarElementVisibility(Resource.Id.notification_info_android8_infotext, canShowNotificationInfo); @@ -413,100 +516,6 @@ namespace keepass2android - string lastInfoText; - if (IsTimeForInfotext(out lastInfoText) && (FindViewById(Resource.Id.info_head) != null)) - { - - FingerprintUnlockMode um; - Enum.TryParse(_prefs.GetString(Database.GetFingerprintModePrefKey(App.Kp2a.GetDb().Ioc), ""), out um); - bool isFingerprintEnabled = (um == FingerprintUnlockMode.FullUnlock); - - string masterKeyKey = "MasterKey" + isFingerprintEnabled; - string emergencyKey = "Emergency"; - string backupKey = "Backup"; - - List applicableInfoTextKeys = new List {masterKeyKey}; - - if (App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc).UserShouldBackup) - { - applicableInfoTextKeys.Add(backupKey); - } - if (App.Kp2a.GetDb().Entries.Count > 15) - { - applicableInfoTextKeys.Add(emergencyKey); - } - - List enabledInfoTextKeys = new List(); - foreach (string key in applicableInfoTextKeys) - { - if (!InfoTextWasDisabled(key)) - enabledInfoTextKeys.Add(key); - } - - if (enabledInfoTextKeys.Any()) - { - string infoTextKey = "", infoHead = "", infoMain = "", infoNote = ""; - - if (enabledInfoTextKeys.Count > 1) - { - foreach (string key in enabledInfoTextKeys) - if (key == lastInfoText) - { - enabledInfoTextKeys.Remove(key); - break; - } - infoTextKey = enabledInfoTextKeys[new Random().Next(enabledInfoTextKeys.Count)]; - } - - if (infoTextKey == masterKeyKey) - { - infoHead = GetString(Resource.String.masterkey_infotext_head); - infoMain = GetString(Resource.String.masterkey_infotext_main); - if (isFingerprintEnabled) - infoNote = GetString(Resource.String.masterkey_infotext_fingerprint_note); - } - else if (infoTextKey == emergencyKey) - { - infoHead = GetString(Resource.String.emergency_infotext_head); - infoMain = GetString(Resource.String.emergency_infotext_main); - } - else if (infoTextKey == backupKey) - { - infoHead = GetString(Resource.String.backup_infotext_head); - infoMain = GetString(Resource.String.backup_infotext_main); - infoNote = GetString(Resource.String.backup_infotext_note, GetString(Resource.String.menu_app_settings), GetString(Resource.String.menu_db_settings), GetString(Resource.String.export_prefs)); - } - - - - FindViewById(Resource.Id.info_head).Text = infoHead; - FindViewById(Resource.Id.info_main).Text = infoMain; - var additionalInfoText = FindViewById(Resource.Id.info_additional); - additionalInfoText.Text = infoNote; - additionalInfoText.Visibility = string.IsNullOrEmpty(infoNote) ? ViewStates.Gone : ViewStates.Visible; - - if (infoTextKey != "") - { - - RegisterInfoTextDisplay(infoTextKey); - FindViewById(Resource.Id.info_ok).Click += (sender, args) => - { - UpdateBottomBarElementVisibility(Resource.Id.infotext, false); - }; - FindViewById(Resource.Id.info_dont_show_again).Click += (sender, args) => - { - UpdateBottomBarElementVisibility(Resource.Id.infotext, false); - DisableInfoTextDisplay(infoTextKey); - }; - - UpdateBottomBarElementVisibility(Resource.Id.infotext, true); - } - - } - - - - } @@ -576,6 +585,11 @@ namespace keepass2android } } + if (canShowAutofillInfo) + { + RegisterInfoTextDisplay("AutofillSuggestion"); //this ensures that we don't show the general info texts too soon + + } UpdateBottomBarElementVisibility(Resource.Id.autofill_infotext, canShowAutofillInfo); } diff --git a/src/keepass2android/Properties/AndroidManifest_net.xml b/src/keepass2android/Properties/AndroidManifest_net.xml index 40b35a1f..9dddc0bc 100644 --- a/src/keepass2android/Properties/AndroidManifest_net.xml +++ b/src/keepass2android/Properties/AndroidManifest_net.xml @@ -1,6 +1,6 @@  diff --git a/src/keepass2android/Resources/values-de/strings.xml b/src/keepass2android/Resources/values-de/strings.xml index af38e02c..9af0bff7 100644 --- a/src/keepass2android/Resources/values-de/strings.xml +++ b/src/keepass2android/Resources/values-de/strings.xml @@ -864,7 +864,6 @@ Erstes öffentliches Release Kennwort + OTP Secret (Recovery-Modus) Passwort + Challenge-Response Passwort + Challenge-Response-Secret (Recovery-Modus) - Password + Challenge-Response for KeepassXC database Fehler bei Zertifikatsvalidierung ignorieren diff --git a/src/keepass2android/Resources/values/strings.xml b/src/keepass2android/Resources/values/strings.xml index 09acef7a..05ad1e62 100644 --- a/src/keepass2android/Resources/values/strings.xml +++ b/src/keepass2android/Resources/values/strings.xml @@ -733,13 +733,19 @@ Show soft keyboard for password input when fingerprint scan is active. - Version 1.05-pre1\n + Version 1.05\n * Use notification channels for Android 8, allowing configuration through system settings\n * Show entry icon in notication\n * Use Adaptive Icons for Android 8, use round launcher icon for Android 7\n * Allow to activate search upon unlock (see settings)\n - * Change the way files are written through Storage Access Framework, fixes issues with updating files on Google Drive opened through System file picker\n - * add some info texts to avoid some common misunderstandings\n + * Changed the way files are written through Storage Access Framework, fixes issues with updating files on Google Drive opened through System file picker\n + * Added some info texts to avoid some common misunderstandings\n + * Create local backups of successfully opened databases to reduce risk of data loss\n + * Updated JSch to support more recent SSH ciphers\n + * Allow to edit connection settings, e.g. when WebDav password changed\n + * Added support for Yubikey Neo\'s static password mode\n + * Allow to disable Autofill suggestion\n + * Fixed data leakage to logcat\n * bug fixes\n @@ -1086,7 +1092,6 @@ Initial public release Password + OTP secret (recovery mode) Password + Challenge-Response Password + Challenge-Response secret (recovery mode) - Password + Challenge-Response for KeepassXC database Ignore certificate validation failures