From bcafe9a16ec636256b6b3a62732b78f66ea136c2 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 11 Sep 2018 21:06:46 +0200 Subject: improve Updater a bit and try to catch NPE --- src/main/java/de/pixart/messenger/ui/ConversationsActivity.java | 6 ++++-- src/main/java/de/pixart/messenger/ui/UpdaterActivity.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index 9c9949770..92c87063e 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -559,7 +559,9 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio return true; case R.id.action_check_updates: if (xmppConnectionService.hasInternetConnection()) { - if (!installFromUnknownSourceAllowed() && (xmppConnectionService.installedFrom() != null && !xmppConnectionService.installedFrom().equals(PlayStore))) { + if (!installFromUnknownSourceAllowed() && xmppConnectionService.installedFrom() == null) { + openInstallFromUnknownSourcesDialogIfNeeded(); + } else if (!installFromUnknownSourceAllowed() && (xmppConnectionService.installedFrom() != null && !xmppConnectionService.installedFrom().equalsIgnoreCase(PlayStore))) { openInstallFromUnknownSourcesDialogIfNeeded(); } else { UpdateService task = new UpdateService(this, xmppConnectionService.installedFrom(), xmppConnectionService); @@ -950,7 +952,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio Log.d(Config.LOGTAG, "AppUpdater: CurrentTime: " + lastUpdateTime); if (!installFromUnknownSourceAllowed() && Store == null) { openInstallFromUnknownSourcesDialogIfNeeded(); - } else if (Store != null && (Store.equals(PlayStore) || Store.equals(FDroid))) { + } else if (Store != null && (Store.equalsIgnoreCase(PlayStore) || Store.equalsIgnoreCase(FDroid))) { Log.d(Config.LOGTAG, "AppUpdater aborted because app store is " + Store); } else { UpdateService task = new UpdateService(this, Store, xmppConnectionService); diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java index b8a43e25f..f35436df6 100644 --- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java @@ -134,7 +134,7 @@ public class UpdaterActivity extends XmppActivity { //ask for permissions on devices >= SDK 23 if (isStoragePermissionGranted() && isNetworkAvailable(getApplicationContext())) { //start downloading the file using the download manager - if (store.equals(PlayStore)) { + if (store.equalsIgnoreCase(PlayStore)) { Uri uri = Uri.parse("market://details?id=de.pixart.messenger"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, uri); PackageManager manager = getApplicationContext().getPackageManager(); @@ -148,7 +148,7 @@ public class UpdaterActivity extends XmppActivity { startActivity(browserIntent); overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } - } else if (store.equals(FDroid)) { + } else if (store.equalsIgnoreCase(FDroid)) { Uri uri = Uri.parse("https://f-droid.org/de/packages/de.pixart.messenger/"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, uri); PackageManager manager = getApplicationContext().getPackageManager(); -- cgit v1.2.3