Update link preview settings and add some UI polish.

This commit is contained in:
Greyson Parrelli
2020-08-13 13:50:38 -04:00
parent 676356e800
commit ace1b8ee71
20 changed files with 336 additions and 37 deletions

View File

@@ -0,0 +1,27 @@
package org.thoughtcrime.securesms.keyvalue;
import androidx.annotation.NonNull;
public final class SettingsValues extends SignalStoreValues {
public static final String LINK_PREVIEWS = "settings.link_previews";
SettingsValues(@NonNull KeyValueStore store) {
super(store);
}
@Override
void onFirstEverAppLaunch() {
getStore().beginWrite()
.putBoolean(LINK_PREVIEWS, true)
.apply();
}
public boolean isLinkPreviewsEnabled() {
return getBoolean(LINK_PREVIEWS, false);
}
public void setLinkPreviewsEnabled(boolean enabled) {
putBoolean(LINK_PREVIEWS, enabled);
}
}

View File

@@ -24,6 +24,7 @@ public final class SignalStore {
private final MiscellaneousValues misc;
private final InternalValues internalValues;
private final EmojiValues emojiValues;
private final SettingsValues settingsValues;
private SignalStore() {
this.store = ApplicationDependencies.getKeyValueStore();
@@ -37,6 +38,7 @@ public final class SignalStore {
this.misc = new MiscellaneousValues(store);
this.internalValues = new InternalValues(store);
this.emojiValues = new EmojiValues(store);
this.settingsValues = new SettingsValues(store);
}
public static void onFirstEverAppLaunch() {
@@ -49,6 +51,7 @@ public final class SignalStore {
tooltips().onFirstEverAppLaunch();
misc().onFirstEverAppLaunch();
internalValues().onFirstEverAppLaunch();
settings().onFirstEverAppLaunch();
}
public static @NonNull KbsValues kbsValues() {
@@ -91,6 +94,10 @@ public final class SignalStore {
return INSTANCE.emojiValues;
}
public static @NonNull SettingsValues settings() {
return INSTANCE.settingsValues;
}
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AuthorizationCache() {
return new GroupsV2AuthorizationSignalStoreCache(getStore());
}