mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Success dialog for deactivate remote wipe
This commit is contained in:
@@ -18,6 +18,7 @@ import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -69,6 +70,7 @@ public class RemoteWipeDisplayFragment extends BaseFragment
|
||||
Button disableRemoteWipeButton = contentView.findViewById(R.id.button_cancel);
|
||||
disableRemoteWipeButton.setOnClickListener(e -> viewModel.onDisableRemoteWipe());
|
||||
|
||||
viewModel.getState().observe(getViewLifecycleOwner(), this::onStateChanged);
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@@ -92,4 +94,21 @@ public class RemoteWipeDisplayFragment extends BaseFragment
|
||||
super.onStop();
|
||||
list.stopPeriodicUpdate();
|
||||
}
|
||||
|
||||
private void onStateChanged(RemoteWipeSetupState state) {
|
||||
if (state.equals(RemoteWipeSetupState.DISABLED)) {
|
||||
showDisabledDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void showDisabledDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext(),
|
||||
R.style.BriarDialogTheme);
|
||||
builder.setTitle(R.string.remote_wipe_disable_success);
|
||||
builder.setPositiveButton(R.string.ok,
|
||||
(dialog, which) -> viewModel.onSuccessDismissed());
|
||||
builder.setIcon(R.drawable.ic_baseline_done_outline_24);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ public enum RemoteWipeSetupState {
|
||||
SUCCESS,
|
||||
FINISHED,
|
||||
SELECTING,
|
||||
MODIFY
|
||||
MODIFY,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
@@ -112,10 +112,11 @@ public class RemoteWipeSetupViewModel extends ContactsViewModel {
|
||||
public void onDisableRemoteWipe() {
|
||||
try {
|
||||
db.transaction(false, remoteWipeManager::revokeAll);
|
||||
state.postValue(RemoteWipeSetupState.DISABLED);
|
||||
} catch (DbException | FormatException e) {
|
||||
e.printStackTrace();
|
||||
state.postValue(RemoteWipeSetupState.FINISHED);
|
||||
}
|
||||
state.postValue(RemoteWipeSetupState.FINISHED);
|
||||
}
|
||||
|
||||
public void setupRemoteWipe(Collection<ContactId> wipers)
|
||||
|
||||
@@ -774,6 +774,7 @@
|
||||
<string name="remote_wipe_revoke_success">Remote wipe status revoked</string>
|
||||
<string name="remote_wipe_modify_contacts">Change remote wipers</string>
|
||||
<string name="remote_wipe_disable">Disable remote wipe</string>
|
||||
<string name="remote_wipe_disable_success">Remote wipe is disabled</string>
|
||||
|
||||
<string name="remote_wipe_confirm_received">Briar data has been wiped from %1$s\'s device. They will be unreachable until they recover their account.</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user