avoid showing infotexts after showing android 8 specific texts, update changelog, change version number for actual 1.05-pre3 release

This commit is contained in:
Philipp Crocoll
2018-06-02 06:36:36 +02:00
parent 9e80013e28
commit e7ad6e32e3
4 changed files with 120 additions and 102 deletions

View File

@@ -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<TextView>(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<string> applicableInfoTextKeys = new List<string> { masterKeyKey };
if (App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc).UserShouldBackup)
{
applicableInfoTextKeys.Add(backupKey);
}
if (App.Kp2a.GetDb().Entries.Count > 15)
{
applicableInfoTextKeys.Add(emergencyKey);
}
List<string> enabledInfoTextKeys = new List<string>();
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<TextView>(Resource.Id.info_head).Text = infoHead;
FindViewById<TextView>(Resource.Id.info_main).Text = infoMain;
var additionalInfoText = FindViewById<TextView>(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<TextView>(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<string> applicableInfoTextKeys = new List<string> {masterKeyKey};
if (App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc).UserShouldBackup)
{
applicableInfoTextKeys.Add(backupKey);
}
if (App.Kp2a.GetDb().Entries.Count > 15)
{
applicableInfoTextKeys.Add(emergencyKey);
}
List<string> enabledInfoTextKeys = new List<string>();
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<TextView>(Resource.Id.info_head).Text = infoHead;
FindViewById<TextView>(Resource.Id.info_main).Text = infoMain;
var additionalInfoText = FindViewById<TextView>(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);
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="113"
android:versionCode="114"
android:versionName="1.05-pre3"
package="keepass2android.keepass2android"
android:installLocation="auto">

View File

@@ -864,7 +864,6 @@ Erstes öffentliches Release</string>
<item>Kennwort + OTP Secret (Recovery-Modus)</item>
<item>Passwort + Challenge-Response</item>
<item>Passwort + Challenge-Response-Secret (Recovery-Modus)</item>
<item>Password + Challenge-Response for KeepassXC database</item>
</string-array>
<string-array name="AcceptAllServerCertificates_options">
<item>Fehler bei Zertifikatsvalidierung ignorieren</item>

View File

@@ -733,13 +733,19 @@
<string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string>
<string name="ChangeLog_1_05">
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
</string>
@@ -1086,7 +1092,6 @@ Initial public release
<item>Password + OTP secret (recovery mode)</item>
<item>Password + Challenge-Response</item>
<item>Password + Challenge-Response secret (recovery mode)</item>
<item>Password + Challenge-Response for KeepassXC database</item>
</string-array>
<string-array name="AcceptAllServerCertificates_options">
<item>Ignore certificate validation failures</item>