Add "You can pull to filter" tip.

This commit is contained in:
Alex Hart
2023-01-04 09:57:14 -04:00
committed by Greyson Parrelli
parent 43fe789807
commit 296a113c65
20 changed files with 297 additions and 117 deletions

View File

@@ -7,9 +7,12 @@ import java.util.List;
public class UiHints extends SignalStoreValues {
private static final int NEVER_DISPLAY_PULL_TO_FILTER_TIP_THRESHOLD = 3;
private static final String HAS_SEEN_GROUP_SETTINGS_MENU_TOAST = "uihints.has_seen_group_settings_menu_toast";
private static final String HAS_CONFIRMED_DELETE_FOR_EVERYONE_ONCE = "uihints.has_confirmed_delete_for_everyone_once";
private static final String HAS_SET_OR_SKIPPED_USERNAME_CREATION = "uihints.has_set_or_skipped_username_creation";
private static final String NEVER_DISPLAY_PULL_TO_FILTER_TIP = "uihints.never_display_pull_to_filter_tip";
UiHints(@NonNull KeyValueStore store) {
super(store);
@@ -22,7 +25,7 @@ public class UiHints extends SignalStoreValues {
@Override
@NonNull List<String> getKeysToIncludeInBackup() {
return Collections.emptyList();
return Collections.singletonList(NEVER_DISPLAY_PULL_TO_FILTER_TIP);
}
public void markHasSeenGroupSettingsMenuToast() {
@@ -48,4 +51,21 @@ public class UiHints extends SignalStoreValues {
public void markHasSetOrSkippedUsernameCreation() {
putBoolean(HAS_SET_OR_SKIPPED_USERNAME_CREATION, true);
}
public void resetNeverDisplayPullToRefreshCount() {
putInteger(NEVER_DISPLAY_PULL_TO_FILTER_TIP, 0);
}
public boolean canDisplayPullToFilterTip() {
return getNeverDisplayPullToFilterTip() < NEVER_DISPLAY_PULL_TO_FILTER_TIP_THRESHOLD;
}
public void incrementNeverDisplayPullToFilterTip() {
int inc = Math.min(NEVER_DISPLAY_PULL_TO_FILTER_TIP_THRESHOLD, getNeverDisplayPullToFilterTip() + 1);
putInteger(NEVER_DISPLAY_PULL_TO_FILTER_TIP, inc);
}
private int getNeverDisplayPullToFilterTip() {
return getInteger(NEVER_DISPLAY_PULL_TO_FILTER_TIP, 0);
}
}