From bed3b18312174edd1f8972d34bcb1e2bc22418c0 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 29 Jan 2018 21:07:33 +0100 Subject: check if app is installedFromPlayStore and use upcoming playstore site for updates --- .../de/pixart/messenger/ui/ConversationActivity.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/pixart/messenger/ui/ConversationActivity.java') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index b7018b58c..274b51d8a 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -483,7 +483,7 @@ public class ConversationActivity extends XmppActivity menuInviteContact.setVisible(false); menuAttach.setVisible(false); menuClearHistory.setVisible(false); - if (installedFromFDroid()) { + if (xmppConnectionService.installedFromFDroid()) { menuUpdater.setVisible(false); } else { menuUpdater.setVisible(true); @@ -523,14 +523,6 @@ public class ConversationActivity extends XmppActivity return super.onCreateOptionsMenu(menu); } - private boolean installedFromFDroid() { - final PackageManager packageManager = this.getPackageManager(); - final String packageID = BuildConfig.APPLICATION_ID; - final String installedFrom = packageManager.getInstallerPackageName(packageID); - Log.d(Config.LOGTAG, "Messenger installed from " + installedFrom); - return installedFrom != null && installedFrom.contains("fdroid"); - } - private Runnable addOmemoDebuggerRunnable = new Runnable() { @Override public void run() { @@ -1386,7 +1378,7 @@ public class ConversationActivity extends XmppActivity if (xmppConnectionService.getAccounts().size() != 0) { if (xmppConnectionService.hasInternetConnection()) { if (xmppConnectionService.isWIFI() || (xmppConnectionService.isMobile() && !xmppConnectionService.isMobileRoaming())) { - if (!installedFromFDroid()) { + if (!xmppConnectionService.installedFromFDroid()) { AppUpdate(); } } @@ -1432,10 +1424,11 @@ public class ConversationActivity extends XmppActivity if (!ExceptionHelper.checkForCrash(this, this.xmppConnectionService) && !mRedirected.get()) { openBatteryOptimizationDialogIfNeeded(); + if (!xmppConnectionService.installedFromFDroid() && !xmppConnectionService.installedFromPlayStore()) { + openInstallFromUnknownSourcesDialogIfNeeded(); + } } - if (!installedFromFDroid()) { - openInstallFromUnknownSourcesDialogIfNeeded(); - } + if (isConversationsOverviewVisable() && isConversationsOverviewHideable()) { xmppConnectionService.getNotificationService().setOpenConversation(null); } else { -- cgit v1.2.3