mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Buttons on remote wipe display fragment
This commit is contained in:
@@ -63,8 +63,11 @@ public class RemoteWipeDisplayFragment extends BaseFragment
|
||||
.onSuccess(adapter::submitList)
|
||||
);
|
||||
|
||||
Button button = contentView.findViewById(R.id.button_change);
|
||||
button.setOnClickListener(e -> viewModel.onModifyWipers());
|
||||
Button changeWipersButton = contentView.findViewById(R.id.button_change);
|
||||
changeWipersButton.setOnClickListener(e -> viewModel.onModifyWipers());
|
||||
|
||||
Button disableRemoteWipeButton = contentView.findViewById(R.id.button_cancel);
|
||||
disableRemoteWipeButton.setOnClickListener(e -> viewModel.onDisableRemoteWipe());
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.briarproject.briar.api.conversation.ConversationManager;
|
||||
import org.briarproject.briar.api.identity.AuthorManager;
|
||||
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
|
||||
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -107,6 +108,16 @@ public class RemoteWipeSetupViewModel extends ContactsViewModel {
|
||||
state.postValue(RemoteWipeSetupState.MODIFY);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void onDisableRemoteWipe() {
|
||||
try {
|
||||
db.transaction(false, remoteWipeManager::revokeAll);
|
||||
} catch (DbException | FormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
state.postValue(RemoteWipeSetupState.FINISHED);
|
||||
}
|
||||
|
||||
public void setupRemoteWipe(Collection<ContactId> wipers)
|
||||
throws DbException, FormatException {
|
||||
db.transaction(false, txn -> {
|
||||
|
||||
@@ -11,22 +11,47 @@
|
||||
android:paddingBottom="@dimen/margin_medium"
|
||||
tools:ignore="VectorDrawableCompat">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_change"
|
||||
<TextView
|
||||
android:id="@+id/text_view_explain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/remote_wipe_modify_contacts"
|
||||
android:gravity="center"
|
||||
android:text="@string/remote_wipe_display_explain"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
tools:layout_editor_absoluteX="16dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_cancel"
|
||||
style="@style/BriarButtonFlat.Negative.Tiny"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/remote_wipe_disable"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/button_change"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_change"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toBottomOf="@id/text_view_explain" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_change"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/remote_wipe_modify_contacts"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_cancel"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_view_explain" />
|
||||
|
||||
<org.briarproject.briar.android.view.BriarRecyclerView
|
||||
android:id="@+id/wiperList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_change"
|
||||
|
||||
@@ -740,6 +740,7 @@
|
||||
<string name="remote_wipe_setup_failed">Failed to set up remote wipe</string>
|
||||
<string name="remote_wipe_setup_explain_title">Setup remote wipe function</string>
|
||||
<string name="remote_wipe_setup_explain_long">You can choose a set of trusted contacts who are able to activate a remote wipe of all Briar data.\nThe wipe may be activated by any two contacts from the set.</string>
|
||||
<string name="remote_wipe_display_explain">Any two of these trusted contacts may activate a wipe of all Briar data from your device.</string>
|
||||
|
||||
<!-- Settings menu -->
|
||||
<string name="pref_remote_wipe_summary">Allow trusted contacts to activate an account wipe remotely</string>
|
||||
@@ -772,6 +773,7 @@
|
||||
<string name="revoke_remote_wipe">Revoke remote wipe status</string>
|
||||
<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_confirm_received">Briar data has been wiped from %1$s\'s device. They will be unreachable until they recover their account.</string>
|
||||
|
||||
|
||||
@@ -65,6 +65,12 @@
|
||||
<item name="android:minWidth">@dimen/button_size</item>
|
||||
</style>
|
||||
|
||||
<style name="BriarButtonFlat.Negative.Tiny" parent="BriarButtonFlat.Negative">
|
||||
<item name="android:textSize">@dimen/text_size_tiny</item>
|
||||
<item name="android:padding">@dimen/margin_medium</item>
|
||||
<item name="android:minWidth">@dimen/button_size</item>
|
||||
</style>
|
||||
|
||||
<style name="Divider">
|
||||
<item name="android:background">@color/divider</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user