no donate notice in changelog when using the app for one of the first times

This commit is contained in:
Philipp Crocoll
2019-10-21 10:33:31 +02:00
parent 3ce1c04cf2
commit efcaa36325

View File

@@ -9,6 +9,7 @@ using Android.Content.PM;
using Android.Content.Res; using Android.Content.Res;
using Android.Graphics; using Android.Graphics;
using Android.OS; using Android.OS;
using Android.Preferences;
using Android.Runtime; using Android.Runtime;
using Android.Text; using Android.Text;
using Android.Text.Method; using Android.Text.Method;
@@ -147,6 +148,19 @@ namespace keepass2android
string versionLog2 = versionLog; string versionLog2 = versionLog;
bool title = true; bool title = true;
if (isFirst) if (isFirst)
{
bool showDonateOption = true;
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);
if (prefs.GetBoolean(ctx.GetString(Resource.String.NoDonationReminder_key), false))
showDonateOption = false;
long usageCount = prefs.GetLong(ctx.GetString(Resource.String.UsageCount_key), 0);
if (usageCount <= 5)
showDonateOption = false;
if (showDonateOption)
{ {
if (versionLog2.EndsWith("\n") == false) if (versionLog2.EndsWith("\n") == false)
versionLog2 += "\n"; versionLog2 += "\n";
@@ -154,10 +168,12 @@ namespace keepass2android
new Java.Lang.Object[]{ctx.Resources.Configuration.Locale.Language, new Java.Lang.Object[]{ctx.Resources.Configuration.Locale.Language,
ctx.PackageName ctx.PackageName
}); });
versionLog2 += " * <a href=\"" + donateUrl versionLog2 += " * <a href=\"" + donateUrl
+ "\">" + + "\">" +
ctx.GetString(Resource.String.ChangeLog_keptDonate) ctx.GetString(Resource.String.ChangeLog_keptDonate)
+ "<a/>"; + "<a/>";
}
isFirst = false; isFirst = false;
} }
foreach (string line in versionLog2.Split('\n')) foreach (string line in versionLog2.Split('\n'))