mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Update Mention UI/UX to match latest designs.
This commit is contained in:
committed by
Greyson Parrelli
parent
d63e5165eb
commit
724f3e872b
@@ -56,7 +56,7 @@ public final class MentionUtil {
|
||||
|
||||
@WorkerThread
|
||||
public static @NonNull UpdatedBodyAndMentions updateBodyAndMentionsWithDisplayNames(@NonNull Context context, @NonNull CharSequence body, @NonNull List<Mention> mentions) {
|
||||
return update(body, mentions, m -> MENTION_STARTER + Recipient.resolved(m.getRecipientId()).getDisplayName(context));
|
||||
return update(body, mentions, m -> MENTION_STARTER + Recipient.resolved(m.getRecipientId()).getMentionDisplayName(context));
|
||||
}
|
||||
|
||||
public static @NonNull UpdatedBodyAndMentions updateBodyAndMentionsWithPlaceholders(@Nullable CharSequence body, @NonNull List<Mention> mentions) {
|
||||
@@ -131,9 +131,6 @@ public final class MentionUtil {
|
||||
|
||||
public static @NonNull String getMentionSettingDisplayValue(@NonNull Context context, @NonNull MentionSetting mentionSetting) {
|
||||
switch (mentionSetting) {
|
||||
case GLOBAL:
|
||||
return context.getString(SignalStore.notificationSettings().isMentionNotifiesMeEnabled() ? R.string.GroupMentionSettingDialog_default_notify_me
|
||||
: R.string.GroupMentionSettingDialog_default_dont_notify_me);
|
||||
case ALWAYS_NOTIFY:
|
||||
return context.getString(R.string.GroupMentionSettingDialog_always_notify_me);
|
||||
case DO_NOT_NOTIFY:
|
||||
|
||||
@@ -279,7 +279,7 @@ public class RecipientDatabase extends Database {
|
||||
}
|
||||
|
||||
public enum MentionSetting {
|
||||
GLOBAL(0), ALWAYS_NOTIFY(1), DO_NOT_NOTIFY(2);
|
||||
ALWAYS_NOTIFY(0), DO_NOT_NOTIFY(1);
|
||||
|
||||
private final int id;
|
||||
|
||||
@@ -336,7 +336,7 @@ public class RecipientDatabase extends Database {
|
||||
GROUPS_V2_CAPABILITY + " INTEGER DEFAULT " + Recipient.Capability.UNKNOWN.serialize() + ", " +
|
||||
STORAGE_SERVICE_ID + " TEXT UNIQUE DEFAULT NULL, " +
|
||||
DIRTY + " INTEGER DEFAULT " + DirtyState.CLEAN.getId() + ", " +
|
||||
MENTION_SETTING + " INTEGER DEFAULT " + MentionSetting.GLOBAL.getId() + ");";
|
||||
MENTION_SETTING + " INTEGER DEFAULT " + MentionSetting.ALWAYS_NOTIFY.getId() + ");";
|
||||
|
||||
private static final String INSIGHTS_INVITEE_LIST = "SELECT " + TABLE_NAME + "." + ID +
|
||||
" FROM " + TABLE_NAME +
|
||||
@@ -1160,7 +1160,7 @@ public class RecipientDatabase extends Database {
|
||||
}
|
||||
|
||||
byte[] storageKey = storageKeyRaw != null ? Base64.decodeOrThrow(storageKeyRaw) : null;
|
||||
byte[] identityKey = identityKeyRaw.transform(Base64::decodeOrThrow).orNull();;
|
||||
byte[] identityKey = identityKeyRaw.transform(Base64::decodeOrThrow).orNull();
|
||||
|
||||
IdentityDatabase.VerifiedStatus identityStatus = identityStatusRaw.transform(IdentityDatabase.VerifiedStatus::forState).or(IdentityDatabase.VerifiedStatus.DEFAULT);
|
||||
|
||||
@@ -2288,7 +2288,7 @@ public class RecipientDatabase extends Database {
|
||||
uuidValues.put(SYSTEM_CONTACT_URI, e164Settings.getSystemContactUri());
|
||||
uuidValues.put(PROFILE_SHARING, uuidSettings.isProfileSharing() || e164Settings.isProfileSharing());
|
||||
uuidValues.put(GROUPS_V2_CAPABILITY, uuidSettings.getGroupsV2Capability() != Recipient.Capability.UNKNOWN ? uuidSettings.getGroupsV2Capability().serialize() : e164Settings.getGroupsV2Capability().serialize());
|
||||
uuidValues.put(MENTION_SETTING, uuidSettings.getMentionSetting() != MentionSetting.GLOBAL ? uuidSettings.getMentionSetting().getId() : e164Settings.getMentionSetting().getId());
|
||||
uuidValues.put(MENTION_SETTING, uuidSettings.getMentionSetting() != MentionSetting.ALWAYS_NOTIFY ? uuidSettings.getMentionSetting().getId() : e164Settings.getMentionSetting().getId());
|
||||
if (uuidSettings.getProfileKey() != null) {
|
||||
updateProfileValuesForMerge(uuidValues, uuidSettings);
|
||||
} else if (e164Settings.getProfileKey() != null) {
|
||||
|
||||
@@ -142,8 +142,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
private static final int REMAPPED_RECORDS = 67;
|
||||
private static final int MENTIONS = 68;
|
||||
private static final int PINNED_CONVERSATIONS = 69;
|
||||
private static final int MENTION_GLOBAL_SETTING_MIGRATION = 70;
|
||||
|
||||
private static final int DATABASE_VERSION = 69;
|
||||
private static final int DATABASE_VERSION = 70;
|
||||
private static final String DATABASE_NAME = "signal.db";
|
||||
|
||||
private final Context context;
|
||||
@@ -997,6 +998,16 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
db.execSQL("CREATE INDEX IF NOT EXISTS thread_pinned_index ON thread (pinned)");
|
||||
}
|
||||
|
||||
if (oldVersion < MENTION_GLOBAL_SETTING_MIGRATION) {
|
||||
ContentValues updateAlways = new ContentValues();
|
||||
updateAlways.put("mention_setting", 0);
|
||||
db.update("recipient", updateAlways, "mention_setting = 1", null);
|
||||
|
||||
ContentValues updateNever = new ContentValues();
|
||||
updateNever.put("mention_setting", 1);
|
||||
db.update("recipient", updateNever, "mention_setting = 2", null);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
||||
Reference in New Issue
Block a user