mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Reactions UX polish.
This commit is contained in:
committed by
Greyson Parrelli
parent
0950235ccd
commit
9d3764c5d9
@@ -0,0 +1,35 @@
|
||||
package org.thoughtcrime.securesms.keyvalue;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiUtil;
|
||||
|
||||
public class EmojiValues extends SignalStoreValues {
|
||||
|
||||
private static final String PREFIX = "emojiPref__";
|
||||
|
||||
EmojiValues(@NonNull KeyValueStore store) {
|
||||
super(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
void onFirstEverAppLaunch() {
|
||||
|
||||
}
|
||||
|
||||
public void setPreferredVariation(@NonNull String emoji) {
|
||||
String canonical = EmojiUtil.getCanonicalRepresentation(emoji);
|
||||
|
||||
if (canonical.equals(emoji)) {
|
||||
getStore().beginWrite().remove(PREFIX + canonical).apply();
|
||||
} else {
|
||||
putString(PREFIX + canonical, emoji);
|
||||
}
|
||||
}
|
||||
|
||||
public @NonNull String getPreferredVariation(@NonNull String emoji) {
|
||||
String canonical = EmojiUtil.getCanonicalRepresentation(emoji);
|
||||
|
||||
return getString(PREFIX + canonical, emoji);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public final class SignalStore {
|
||||
private final TooltipValues tooltipValues;
|
||||
private final MiscellaneousValues misc;
|
||||
private final InternalValues internalValues;
|
||||
private final EmojiValues emojiValues;
|
||||
|
||||
private SignalStore() {
|
||||
this.store = ApplicationDependencies.getKeyValueStore();
|
||||
@@ -36,6 +37,7 @@ public final class SignalStore {
|
||||
this.tooltipValues = new TooltipValues(store);
|
||||
this.misc = new MiscellaneousValues(store);
|
||||
this.internalValues = new InternalValues(store);
|
||||
this.emojiValues = new EmojiValues(store);
|
||||
}
|
||||
|
||||
public static void onFirstEverAppLaunch() {
|
||||
@@ -86,6 +88,10 @@ public final class SignalStore {
|
||||
return INSTANCE.internalValues;
|
||||
}
|
||||
|
||||
public static @NonNull EmojiValues emojiValues() {
|
||||
return INSTANCE.emojiValues;
|
||||
}
|
||||
|
||||
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AuthorizationCache() {
|
||||
return new GroupsV2AuthorizationSignalStoreCache(getStore());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user