diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-09-11 21:06:46 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-09-11 21:06:46 +0200 |
commit | bcafe9a16ec636256b6b3a62732b78f66ea136c2 (patch) | |
tree | e45ec5f604ad4f17f99e3d1fde1d92ecfd052472 /src/main | |
parent | d3294d94361d2bef850ad42992c14590c46c154d (diff) |
improve Updater a bit and try to catch NPE
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationsActivity.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/UpdaterActivity.java | 4 |
2 files changed, 6 insertions, 4 deletions
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(); |