mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Retry database tasks after signing in.
This commit is contained in:
@@ -30,6 +30,7 @@ import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_DOZE_WHITELISTING;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_PASSWORD;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_UNLOCK;
|
||||
@@ -66,9 +67,15 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
@Nullable Intent data) {
|
||||
super.onActivityResult(request, result, data);
|
||||
if (request == REQUEST_PASSWORD) {
|
||||
// We get RESULT_CANCELED when the account gets deleted or
|
||||
// StartupActivity finishes before entering the password.
|
||||
if (result == RESULT_OK) briarController.startAndBindService();
|
||||
// Recreate the activity so any DB tasks that failed before
|
||||
// signing in can be retried
|
||||
if (result == RESULT_OK) {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
LOG.info("Recreating " + getClass().getSimpleName()
|
||||
+ " after signing in");
|
||||
}
|
||||
recreate();
|
||||
}
|
||||
} else if (request == REQUEST_UNLOCK && result != RESULT_OK) {
|
||||
// We arrive here, if the user presses 'back'
|
||||
// in the Keyguard unlock screen, because UnlockActivity finishes.
|
||||
|
||||
@@ -49,6 +49,7 @@ public class AddContactActivity extends BriarActivity implements
|
||||
|
||||
viewModel = ViewModelProviders.of(this, viewModelFactory)
|
||||
.get(AddContactViewModel.class);
|
||||
viewModel.onCreate();
|
||||
viewModel.getRemoteLinkEntered().observeEvent(this, entered -> {
|
||||
if (entered) {
|
||||
NicknameFragment f = new NicknameFragment();
|
||||
@@ -93,13 +94,11 @@ public class AddContactActivity extends BriarActivity implements
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ public class AddContactViewModel extends AndroidViewModel {
|
||||
super(application);
|
||||
this.contactManager = contactManager;
|
||||
this.dbExecutor = dbExecutor;
|
||||
}
|
||||
|
||||
void onCreate() {
|
||||
loadHandshakeLink();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ public class PendingContactListActivity extends BriarActivity
|
||||
|
||||
viewModel = ViewModelProviders.of(this, viewModelFactory)
|
||||
.get(PendingContactListViewModel.class);
|
||||
viewModel.onCreate();
|
||||
viewModel.getPendingContacts()
|
||||
.observe(this, this::onPendingContactsChanged);
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ public class PendingContactListViewModel extends AndroidViewModel
|
||||
this.rendezvousPoller = rendezvousPoller;
|
||||
this.eventBus = eventBus;
|
||||
this.eventBus.addListener(this);
|
||||
}
|
||||
|
||||
void onCreate() {
|
||||
loadPendingContacts();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user