Update safety number UI.
This commit is contained in:
parent
f24020e7b7
commit
6c94be70dc
6 changed files with 115 additions and 0 deletions
|
@ -62,6 +62,7 @@ public interface BindableConversationItem extends Unbindable {
|
|||
void onVoiceNoteSeekTo(@NonNull Uri uri, double position);
|
||||
void onGroupMigrationLearnMoreClicked(@NonNull GroupMigrationMembershipChange membershipChange);
|
||||
void onDecryptionFailedLearnMoreClicked();
|
||||
void onSafetyNumberLearnMoreClicked(@NonNull Recipient recipient);
|
||||
void onJoinGroupCallClicked();
|
||||
void onInviteFriendsToGroupClicked(@NonNull GroupId.V2 groupId);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.app.Activity;
|
|||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -70,6 +71,7 @@ import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
|||
import org.thoughtcrime.securesms.LoggingFragment;
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.VerifyIdentityActivity;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.components.ConversationScrollToView;
|
||||
import org.thoughtcrime.securesms.components.ConversationTypingView;
|
||||
|
@ -148,6 +150,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
@ -1433,6 +1436,33 @@ public class ConversationFragment extends LoggingFragment {
|
|||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSafetyNumberLearnMoreClicked(@NonNull Recipient recipient) {
|
||||
AlertDialog dialog = new AlertDialog.Builder(requireContext())
|
||||
.setView(R.layout.safety_number_changed_learn_more_dialog)
|
||||
.setPositiveButton(R.string.ConversationFragment_verify, (d, w) -> {
|
||||
SimpleTask.run(getLifecycle(), () -> {
|
||||
return DatabaseFactory.getIdentityDatabase(requireContext()).getIdentity(recipient.getId());
|
||||
}, identityRecord -> {
|
||||
if (identityRecord.isPresent()) {
|
||||
startActivity(VerifyIdentityActivity.newIntent(requireContext(), identityRecord.get()));
|
||||
}});
|
||||
d.dismiss();
|
||||
})
|
||||
.setNegativeButton(R.string.ConversationFragment_not_now, (d, w) -> {
|
||||
d.dismiss();
|
||||
})
|
||||
.create();
|
||||
dialog.setOnShowListener(d -> {
|
||||
TextView title = Objects.requireNonNull(dialog.findViewById(R.id.safety_number_learn_more_title));
|
||||
TextView body = Objects.requireNonNull(dialog.findViewById(R.id.safety_number_learn_more_body));
|
||||
|
||||
title.setText(getString(R.string.ConversationFragment_your_safety_number_with_s_changed, recipient.getDisplayName(requireContext())));
|
||||
body.setText(getString(R.string.ConversationFragment_your_safety_number_with_s_changed_likey_because_they_reinstalled_signal, recipient.getDisplayName(requireContext())));
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
@Override
|
||||
public void onJoinGroupCallClicked() {
|
||||
CommunicationActions.startVideoCall(requireActivity(), recipient.get());
|
||||
|
|
|
@ -216,6 +216,14 @@ public final class ConversationUpdateItem extends LinearLayout
|
|||
eventListener.onDecryptionFailedLearnMoreClicked();
|
||||
}
|
||||
});
|
||||
} else if (conversationMessage.getMessageRecord().isIdentityUpdate()) {
|
||||
actionButton.setText(R.string.ConversationUpdateItem_learn_more);
|
||||
actionButton.setVisibility(VISIBLE);
|
||||
actionButton.setOnClickListener(v -> {
|
||||
if (batchSelected.isEmpty() && eventListener != null) {
|
||||
eventListener.onSafetyNumberLearnMoreClicked(conversationRecipient);
|
||||
}
|
||||
});
|
||||
} else if (conversationMessage.getMessageRecord().isGroupCall()) {
|
||||
UpdateDescription updateDescription = MessageRecord.getGroupCallUpdateDescription(getContext(), conversationMessage.getMessageRecord().getBody(), true);
|
||||
Collection<UUID> uuids = updateDescription.getMentioned();
|
||||
|
|
36
app/src/main/res/drawable/safety_number_change_banner.xml
Normal file
36
app/src/main/res/drawable/safety_number_change_banner.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="110dp"
|
||||
android:viewportWidth="200"
|
||||
android:viewportHeight="110">
|
||||
<path
|
||||
android:pathData="M39.3,15.1L12.9,15C9.1,15 6,18.1 6,21.9L5.9,88C5.9,91.8 9,94.9 12.8,94.9L39.1,95C42.9,95 46,91.9 46,88.1L46.2,22C46.2,18.2 43.1,15.1 39.3,15.1ZM42.8,88.1C42.8,90.1 41.1,91.8 39.1,91.8L12.7,91.7C10.7,91.7 9,90 9,88L9.1,21.9C9.1,19.9 10.8,18.2 12.8,18.2L39.2,18.3C41.2,18.3 42.9,20 42.9,22L42.8,88.1Z"
|
||||
android:fillColor="#C6C6C6"/>
|
||||
<path
|
||||
android:pathData="M187.3,15.1L160.9,15C157.1,15 154,18.1 154,21.9L153.9,88C153.9,91.8 157,94.9 160.8,94.9L187.2,95C191,95 194.1,91.9 194.1,88.1L194.2,22C194.2,18.2 191.1,15.1 187.3,15.1ZM190.8,88.1C190.8,90.1 189.1,91.8 187.1,91.8L160.7,91.7C158.7,91.7 157,90 157,88L157.1,21.9C157.1,19.9 158.8,18.2 160.8,18.2L187.2,18.3C189.2,18.3 190.9,20 190.9,22L190.8,88.1Z"
|
||||
android:fillColor="#C6C6C6"/>
|
||||
<path
|
||||
android:pathData="M126,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M136,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M146,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M54,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M64,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M74,56m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
||||
android:fillColor="#848484"/>
|
||||
<path
|
||||
android:pathData="M100,56m-18,0a18,18 0,1 1,36 0a18,18 0,1 1,-36 0"
|
||||
android:fillColor="#2C6BED"/>
|
||||
<path
|
||||
android:pathData="M100,59.631L95.435,55.066L96.565,53.934L100,57.369L108.9,48.469C102.689,48.127 100,45 100,45C100,45 97,48.5 90,48.5C90,59.5 95.6,64.4 100,67C104.142,64.5 109.568,59.84 109.962,49.67L100,59.631Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:importantForAccessibility="no"
|
||||
app:srcCompat="@drawable/safety_number_change_banner" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/safety_number_learn_more_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
style="@style/Signal.Text.Headline"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="20sp"
|
||||
tools:text="Your safety number with Peter Parker changed"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/safety_number_learn_more_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Body"
|
||||
tools:text="Your Safety Number with Peter Parker changed, likely because they reinstalled Signal or changed devices. Tap Verify to confirm the new safety number. This is optional."/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -355,6 +355,10 @@
|
|||
<string name="ConversationFragment__review_requests_carefully">Review requests carefully</string>
|
||||
<string name="ConversationFragment__signal_found_another_contact_with_the_same_name">Signal found another contact with the same name.</string>
|
||||
<string name="ConversationFragment_contact_us">Contact us</string>
|
||||
<string name="ConversationFragment_verify">Verify</string>
|
||||
<string name="ConversationFragment_not_now">Not now</string>
|
||||
<string name="ConversationFragment_your_safety_number_with_s_changed">Your safety number with %s changed</string>
|
||||
<string name="ConversationFragment_your_safety_number_with_s_changed_likey_because_they_reinstalled_signal">Your Safety Number with %s changed, likely because they reinstalled Signal or changed devices. Tap Verify to confirm the new safety number. This is optional.</string>
|
||||
|
||||
<!-- ConversationListActivity -->
|
||||
<string name="ConversationListActivity_there_is_no_browser_installed_on_your_device">There is no browser installed on your device.</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue