summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2020-12-28 18:43:33 +0100
committercyBerta <cyberta@riseup.net>2020-12-28 18:43:33 +0100
commit73efd90a7bb170481ae827e8ae0523daed992b40 (patch)
tree11d7fb850369a39a6ee3e8bc31d4f49b5e466ef9 /app/src
parent00f449b80ea1704d1772e580e4ce16beac5039bf (diff)
no need to use onActivityResult in InstallActivity during installation it won't be called
Diffstat (limited to 'app/src')
-rw-r--r--app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java16
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Constants.java3
2 files changed, 3 insertions, 16 deletions
diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java
index 028f47bc..6629425c 100644
--- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java
+++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java
@@ -31,7 +31,6 @@ import java.io.File;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.utils.PreferenceHelper;
-import static se.leap.bitmaskclient.Constants.REQUEST_CODE_INSTALL_UPDATE;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_REQUEST_UPDATE;
import static se.leap.bitmaskclient.appUpdate.DownloadConnector.APP_TYPE;
import static se.leap.bitmaskclient.appUpdate.FileProviderUtil.getUriFor;
@@ -46,7 +45,6 @@ public class InstallActivity extends Activity {
requestPermissionAndInstall();
}
-
private void requestPermissionAndInstall() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !this.getPackageManager().canRequestPackageInstalls()) {
startActivityForResult(new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:"+getPackageName())),
@@ -65,7 +63,8 @@ public class InstallActivity extends Activity {
installIntent.setDataAndType(getUriFor(this.getApplicationContext(), update), APP_TYPE);
installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
- this.startActivityForResult(installIntent, REQUEST_CODE_INSTALL_UPDATE);
+ this.startActivity(installIntent);
+ finish();
}
}
@@ -79,17 +78,6 @@ public class InstallActivity extends Activity {
Toast.makeText(this, getString(R.string.version_update_error_permissions), Toast.LENGTH_LONG).show();
finish();
}
- } else if (requestCode == REQUEST_CODE_INSTALL_UPDATE) {
- switch (resultCode) {
- case RESULT_OK:
- Toast.makeText(this, "Update successful.", Toast.LENGTH_LONG).show();
- break;
- case RESULT_CANCELED:
- case RESULT_FIRST_USER:
- Toast.makeText(this, getString(R.string.version_update_error), Toast.LENGTH_LONG).show();
- break;
- }
- finish();
}
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java
index 5fcaba2f..1d364074 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java
@@ -49,8 +49,7 @@ public interface Constants {
int REQUEST_CODE_SWITCH_PROVIDER = 1;
int REQUEST_CODE_LOG_IN = 2;
int REQUEST_CODE_ADD_PROVIDER = 3;
- int REQUEST_CODE_INSTALL_UPDATE = 4;
- int REQUEST_CODE_REQUEST_UPDATE = 5;
+ int REQUEST_CODE_REQUEST_UPDATE = 4;
//////////////////////////////////////////////