mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Start SetupActivity in same task, finish other activities.
This commit is contained in:
@@ -62,11 +62,10 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onActivityResult(int request, int result, Intent data) {
|
||||
super.onActivityResult(request, result, data);
|
||||
if (request == REQUEST_PASSWORD && result == RESULT_OK) {
|
||||
// PasswordActivity finishes when password was entered correctly.
|
||||
// When back button is pressed there, it will bring itself back,
|
||||
// so that we never arrive here with a result that is not OK.
|
||||
briarController.startAndBindService();
|
||||
if (request == REQUEST_PASSWORD) {
|
||||
// The result can be RESULT_CANCELED if there's no account
|
||||
if (result == RESULT_OK) briarController.startAndBindService();
|
||||
else finish();
|
||||
} else if (request == REQUEST_UNLOCK && result != RESULT_OK) {
|
||||
// We arrive here, if the user presses 'back'
|
||||
// in the Keyguard unlock screen, because UnlockActivity finishes.
|
||||
@@ -81,13 +80,16 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (!briarController.accountSignedIn()) {
|
||||
if (!briarController.accountSignedIn() && !isFinishing()) {
|
||||
// Also check that the activity isn't finishing already.
|
||||
// This is possible if we finished in onActivityResult().
|
||||
// Launching another PasswordActivity would cause a loop.
|
||||
Intent i = new Intent(this, PasswordActivity.class);
|
||||
startActivityForResult(i, REQUEST_PASSWORD);
|
||||
} else if (lockManager.isLocked() && !isFinishing()) {
|
||||
// Also check that the activity isn't finishing already.
|
||||
// This is possible if finishing in onActivityResult().
|
||||
// Failure to do this check would cause an UnlockActivity loop.
|
||||
// This is possible if we finished in onActivityResult().
|
||||
// Lauching another UnlockActivity would cause a loop.
|
||||
Intent i = new Intent(this, UnlockActivity.class);
|
||||
startActivityForResult(i, REQUEST_UNLOCK);
|
||||
} else if (SDK_INT >= 23) {
|
||||
|
||||
@@ -23,8 +23,6 @@ import org.briarproject.briar.api.android.AndroidNotificationManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
@@ -54,8 +52,8 @@ public class PasswordActivity extends BaseActivity {
|
||||
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
|
||||
|
||||
if (!accountManager.accountExists()) {
|
||||
// TODO: Finish instead of deleting account?
|
||||
deleteAccount();
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,10 +112,9 @@ public class PasswordActivity extends BaseActivity {
|
||||
|
||||
private void deleteAccount() {
|
||||
accountManager.deleteAccount();
|
||||
startActivity(new Intent(this, SetupActivity.class));
|
||||
setResult(RESULT_CANCELED);
|
||||
Intent i = new Intent(this, SetupActivity.class);
|
||||
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(i);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void onSignInClick(View v) {
|
||||
|
||||
Reference in New Issue
Block a user