mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add support for displaying both ACI and e164 safety numbers.
This commit is contained in:
@@ -109,6 +109,7 @@ public final class FeatureFlags {
|
||||
private static final String CDS_COMPAT_MODE = "global.cds.return_acis_without_uaks";
|
||||
private static final String CONVERSATION_FRAGMENT_V2 = "android.conversationFragmentV2";
|
||||
|
||||
private static final String SAFETY_NUMBER_ACI = "global.safetyNumberAci";
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
* remotely, place it in here.
|
||||
@@ -167,7 +168,8 @@ public final class FeatureFlags {
|
||||
AD_HOC_CALLING,
|
||||
SVR2_KILLSWITCH,
|
||||
CDS_COMPAT_MODE,
|
||||
CONVERSATION_FRAGMENT_V2
|
||||
CONVERSATION_FRAGMENT_V2,
|
||||
SAFETY_NUMBER_ACI
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -233,7 +235,8 @@ public final class FeatureFlags {
|
||||
MAX_ATTACHMENT_SIZE_BYTES,
|
||||
SVR2_KILLSWITCH,
|
||||
CDS_COMPAT_MODE,
|
||||
CONVERSATION_FRAGMENT_V2
|
||||
CONVERSATION_FRAGMENT_V2,
|
||||
SAFETY_NUMBER_ACI
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -340,6 +343,14 @@ public final class FeatureFlags {
|
||||
return getBoolean(VERIFY_V2, false);
|
||||
}
|
||||
|
||||
/** Whether or not we show the ACI safety number as the default initial safety number. */
|
||||
public static boolean showAciSafetyNumberAsDefault() {
|
||||
long estimatedServerTimeSeconds = (System.currentTimeMillis() - SignalStore.misc().getLastKnownServerTimeOffset()) / 1000;
|
||||
long flagEnableTimeSeconds = getLong(SAFETY_NUMBER_ACI, Long.MAX_VALUE);
|
||||
|
||||
return estimatedServerTimeSeconds > flagEnableTimeSeconds;
|
||||
}
|
||||
|
||||
/** The raw client expiration JSON string. */
|
||||
public static String clientExpiration() {
|
||||
return getString(CLIENT_EXPIRATION, null);
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.libsignal.protocol.IdentityKey;
|
||||
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.verify.VerifyIdentityActivity;
|
||||
|
||||
public class VerifySpan extends ClickableSpan {
|
||||
|
||||
private final Context context;
|
||||
private final RecipientId recipientId;
|
||||
private final IdentityKey identityKey;
|
||||
|
||||
public VerifySpan(@NonNull Context context, @NonNull IdentityKeyMismatch mismatch) {
|
||||
this.context = context;
|
||||
this.recipientId = mismatch.getRecipientId(context);
|
||||
this.identityKey = mismatch.getIdentityKey();
|
||||
}
|
||||
|
||||
public VerifySpan(@NonNull Context context, @NonNull RecipientId recipientId, @NonNull IdentityKey identityKey) {
|
||||
this.context = context;
|
||||
this.recipientId = recipientId;
|
||||
this.identityKey = identityKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
context.startActivity(VerifyIdentityActivity.newIntent(context, recipientId, identityKey, false));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user