Long press about to check for updates

This commit is contained in:
M66B 2019-01-09 19:21:09 +00:00
parent dd61347b95
commit bafcae35e9
1 changed files with 10 additions and 5 deletions

View File

@ -232,6 +232,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
case R.string.menu_setup: case R.string.menu_setup:
onReload(); onReload();
break; break;
case R.string.menu_operations:
onShowLog();
break;
case R.string.menu_faq: case R.string.menu_faq:
onDebugInfo(); onDebugInfo();
break; break;
@ -239,7 +242,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
onCleanup(); onCleanup();
break; break;
case R.string.menu_about: case R.string.menu_about:
onShowLog(); if (Helper.isPlayStoreInstall(ActivityView.this))
return false;
checkUpdate(true);
break; break;
default: default:
return false; return false;
@ -350,7 +355,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
checkFirst(); checkFirst();
checkCrash(); checkCrash();
if (!Helper.isPlayStoreInstall(this)) if (!Helper.isPlayStoreInstall(this))
checkUpdate(); checkUpdate(false);
pgpService = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain"); pgpService = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain");
pgpService.bindToService(); pgpService.bindToService();
@ -606,12 +611,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
String html_url; String html_url;
} }
private void checkUpdate() { private void checkUpdate(boolean always) {
long now = new Date().getTime(); long now = new Date().getTime();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (!prefs.getBoolean("updates", true)) if (!always && !prefs.getBoolean("updates", true))
return; return;
if (prefs.getLong("last_update_check", 0) + UPDATE_INTERVAL > now) if (!always && prefs.getLong("last_update_check", 0) + UPDATE_INTERVAL > now)
return; return;
prefs.edit().putLong("last_update_check", now).apply(); prefs.edit().putLong("last_update_check", now).apply();