Add Chat Colors onboarding.

This commit is contained in:
Alex Hart
2021-06-02 13:03:41 -03:00
committed by Cody Henthorne
parent 1eae360470
commit fb817e0c3b
14 changed files with 249 additions and 15 deletions

View File

@@ -9,11 +9,26 @@ internal class ChatColorsValues internal constructor(store: KeyValueStore) : Sig
companion object {
private const val KEY_CHAT_COLORS = "chat_colors.chat_colors"
private const val KEY_CHAT_COLORS_ID = "chat_colors.chat_colors.id"
private const val KEY_CHAT_COLORS_AUTO_TOOLTIP = "chat_colors.auto.tooltip"
private const val KEY_CHAT_COLORS_GRADIENT_TOOLTIP = "chat_colors.gradient.tooltip"
}
override fun onFirstEverAppLaunch() = Unit
override fun getKeysToIncludeInBackup(): MutableList<String> = mutableListOf()
override fun getKeysToIncludeInBackup(): MutableList<String> = mutableListOf(
KEY_CHAT_COLORS,
KEY_CHAT_COLORS_ID,
KEY_CHAT_COLORS_AUTO_TOOLTIP,
KEY_CHAT_COLORS_GRADIENT_TOOLTIP
)
var shouldShowAutoTooltip: Boolean
get() = getBoolean(KEY_CHAT_COLORS_AUTO_TOOLTIP, true)
set(value) = putBoolean(KEY_CHAT_COLORS_AUTO_TOOLTIP, value)
var shouldShowGradientTooltip: Boolean
get() = getBoolean(KEY_CHAT_COLORS_GRADIENT_TOOLTIP, true)
set(value) = putBoolean(KEY_CHAT_COLORS_GRADIENT_TOOLTIP, value)
val hasChatColors: Boolean
@JvmName("hasChatColors")

View File

@@ -15,6 +15,7 @@ public final class OnboardingValues extends SignalStoreValues {
private static final String SHOW_NEW_GROUP = "onboarding.new_group";
private static final String SHOW_INVITE_FRIENDS = "onboarding.invite_friends";
private static final String SHOW_SMS = "onboarding.sms";
private static final String SHOW_APPEARANCE = "onboarding.appearance";
OnboardingValues(@NonNull KeyValueStore store) {
super(store);
@@ -25,6 +26,7 @@ public final class OnboardingValues extends SignalStoreValues {
putBoolean(SHOW_NEW_GROUP, true);
putBoolean(SHOW_INVITE_FRIENDS, true);
putBoolean(SHOW_SMS, true);
putBoolean(SHOW_APPEARANCE, true);
}
@Override
@@ -36,12 +38,14 @@ public final class OnboardingValues extends SignalStoreValues {
setShowNewGroup(false);
setShowInviteFriends(false);
setShowSms(false);
setShowAppearance(false);
}
public boolean hasOnboarding(@NonNull Context context) {
return shouldShowNewGroup() ||
shouldShowInviteFriends() ||
shouldShowSms(context);
shouldShowSms(context) ||
shouldShowAppearance();
}
public void setShowNewGroup(boolean value) {
@@ -67,4 +71,12 @@ public final class OnboardingValues extends SignalStoreValues {
public boolean shouldShowSms(@NonNull Context context) {
return getBoolean(SHOW_SMS, false) && !Util.isDefaultSmsProvider(context) && PhoneNumberFormatter.getLocalCountryCode() != 91;
}
public void setShowAppearance(boolean value) {
putBoolean(SHOW_APPEARANCE, value);
}
public boolean shouldShowAppearance() {
return getBoolean(SHOW_APPEARANCE, false);
}
}