mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Improve activate remote wipe explainer
This commit is contained in:
@@ -5,6 +5,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
@@ -41,6 +42,13 @@ public class ActivateRemoteWipeExplainerFragment extends
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_activate_remote_wipe_explainer,
|
||||
container, false);
|
||||
|
||||
TextView titleText = view.findViewById(R.id.textView);
|
||||
titleText.setText(String.format(getString(R.string.remote_wipe_activate_explain_short), viewModel.getContactName()));
|
||||
|
||||
TextView explainText = view.findViewById(R.id.textViewExplain);
|
||||
explainText.setText(String.format(getString(R.string.remote_wipe_activate_explain_long), viewModel.getContactName()));
|
||||
|
||||
Button cancelButton = view.findViewById(R.id.button_cancel);
|
||||
cancelButton.setOnClickListener(e -> viewModel.onCancelClicked());
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@ import android.app.Application;
|
||||
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.db.DatabaseComponent;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.briar.android.remotewipe.RemoteWipeSetupState;
|
||||
import org.briarproject.briar.android.util.UiUtils;
|
||||
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
|
||||
|
||||
import java.text.Normalizer;
|
||||
@@ -20,17 +22,21 @@ import androidx.lifecycle.MutableLiveData;
|
||||
public class ActivateRemoteWipeViewModel extends AndroidViewModel {
|
||||
|
||||
private final RemoteWipeManager remoteWipeManager;
|
||||
private final ContactManager contactManager;
|
||||
private final DatabaseComponent db;
|
||||
private final MutableLiveData<ActivateRemoteWipeState> state = new MutableLiveData<>();
|
||||
private ContactId contactId;
|
||||
private String contactName;
|
||||
|
||||
@Inject
|
||||
public ActivateRemoteWipeViewModel(
|
||||
@NonNull Application application,
|
||||
RemoteWipeManager remoteWipeManager,
|
||||
ContactManager contactManager,
|
||||
DatabaseComponent db) {
|
||||
super(application);
|
||||
this.remoteWipeManager = remoteWipeManager;
|
||||
this.contactManager = contactManager;
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@@ -57,6 +63,16 @@ public class ActivateRemoteWipeViewModel extends AndroidViewModel {
|
||||
|
||||
public void setContactId(ContactId c) {
|
||||
contactId = c;
|
||||
|
||||
try {
|
||||
contactName = UiUtils.getContactDisplayName(contactManager.getContact(c));
|
||||
} catch (DbException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContactName() {
|
||||
return contactName;
|
||||
}
|
||||
|
||||
public void onCancelClicked() {
|
||||
|
||||
@@ -750,8 +750,8 @@
|
||||
<string name="remote_wipe_activate_failure">Failed to send remote wipe signal</string>
|
||||
<string name="remote_wipe_activate_button_confirm">Activate remote wipe</string>
|
||||
<string name="remote_wipe_activate_button_cancel">Cancel</string>
|
||||
<string name="remote_wipe_activate_explain_short">Activate a remote wipe of this contact\'s device</string>
|
||||
<string name="remote_wipe_activate_explain_long">If confirmed by a second contact, sending this signal will remove all briar contacts and messages from this contact\s device.</string>
|
||||
<string name="remote_wipe_activate_explain_short">Activate a remote wipe for %1$s</string>
|
||||
<string name="remote_wipe_activate_explain_long">If confirmed by a second contact, sending this signal will remove all Briar data from %1$s\'s device.</string>
|
||||
|
||||
<!-- Revoke -->
|
||||
<string name="activity_name_revoke_remote_wipe">Revoke Remote Wipe</string>
|
||||
|
||||
Reference in New Issue
Block a user