From 42fa1c8f19b6b320c1b1bca4cdb61ef214e1e857 Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 16 May 2024 17:03:59 -0300 Subject: [PATCH] Add show Reader card announcement methods to AppPrefs --- .../java/org/wordpress/android/ui/prefs/AppPrefs.java | 9 +++++++++ .../org/wordpress/android/ui/prefs/AppPrefsWrapper.kt | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java index 0396fb813f35..1c472a5e2200 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java @@ -204,6 +204,7 @@ public enum DeletablePrefKey implements PrefKey { SHOULD_HIDE_DYNAMIC_CARD, PINNED_SITE_IDS, READER_READING_PREFERENCES_JSON, + SHOULD_SHOW_READER_ANNOUNCEMENT_CARD, } /** @@ -1780,6 +1781,14 @@ public static void setPinnedSiteLocalIds(@NonNull final String ids) { setString(DeletablePrefKey.PINNED_SITE_IDS, ids); } + public static boolean getShouldShowReaderAnnouncementCard() { + return prefs().getBoolean(DeletablePrefKey.SHOULD_SHOW_READER_ANNOUNCEMENT_CARD.name(), true); + } + + public static void setShouldShowReaderAnnouncementCard(final boolean shouldShow) { + prefs().edit().putBoolean(DeletablePrefKey.SHOULD_SHOW_READER_ANNOUNCEMENT_CARD.name(), shouldShow).apply(); + } + @Nullable public static String getReaderReadingPreferencesJson() { return getString(DeletablePrefKey.READER_READING_PREFERENCES_JSON, null); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefsWrapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefsWrapper.kt index 81714fba6d47..c185a8f8b3e8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefsWrapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefsWrapper.kt @@ -453,6 +453,11 @@ class AppPrefsWrapper @Inject constructor() { fun setBookmarkPostsPseudoIdsUpdated() = AppPrefs.setBookmarkPostsPseudoIdsUpdated() + fun shouldShowReaderAnnouncementCard(): Boolean = AppPrefs.getShouldShowReaderAnnouncementCard() + + fun setShouldShowReaderAnnouncementCard(shouldShow: Boolean) = + AppPrefs.setShouldShowReaderAnnouncementCard(shouldShow) + fun getAllPrefs(): Map = AppPrefs.getAllPrefs() fun setString(prefKey: PrefKey, value: String) {