Allow hiding promotional apps

This commit is contained in:
Rahul Kumar Patel
2021-05-14 02:32:30 +05:30
parent ef2be6f6d9
commit 2cb10c2fd4
5 changed files with 20 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ object Preferences {
const val PREFERENCE_DEFAULT_SELECTED_TAB = "PREFERENCE_DEFAULT_SELECTED_TAB"
const val PREFERENCE_QUICK_EXIT = "PREFERENCE_QUICK_EXIT"
const val PREFERENCE_FOR_YOU = "PREFERENCE_FOR_YOU"
const val PREFERENCE_PROMOTIONAL = "PREFERENCE_PROMOTIONAL"
const val PREFERENCE_SIMILAR = "PREFERENCE_SIMILAR"
const val PREFERENCE_INTRO = "PREFERENCE_INTRO"

View File

@@ -42,6 +42,7 @@ import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
import com.aurora.store.util.Preferences.PREFERENCE_INSECURE_ANONYMOUS
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
import com.aurora.store.util.Preferences.PREFERENCE_PROMOTIONAL
import com.aurora.store.util.Preferences.PREFERENCE_QUICK_EXIT
import com.aurora.store.util.Preferences.PREFERENCE_SIMILAR
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
@@ -171,6 +172,7 @@ class OnboardingActivity : BaseActivity() {
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
save(PREFERENCE_QUICK_EXIT, false)
save(PREFERENCE_FOR_YOU, true)
save(PREFERENCE_PROMOTIONAL, true)
save(PREFERENCE_SIMILAR, true)
/*Installer*/

View File

@@ -31,6 +31,7 @@ import com.aurora.store.data.ViewState
import com.aurora.store.data.network.HttpClient
import com.aurora.store.data.providers.AuthProvider
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
import com.aurora.store.viewmodel.BaseAndroidViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -47,6 +48,10 @@ abstract class BaseClusterViewModel(application: Application) : BaseAndroidViewM
/* Should certainly do it in a better way :(*/
var promotionsAdded: Boolean = false
val showPromotionalApps:Boolean = Preferences.getBoolean(
application,
Preferences.PREFERENCE_PROMOTIONAL
)
lateinit var type: StreamHelper.Type
lateinit var category: StreamHelper.Category
@@ -76,7 +81,7 @@ abstract class BaseClusterViewModel(application: Application) : BaseAndroidViewM
)
//Add promotional cluster
if (!promotionsAdded) {
if (!promotionsAdded && showPromotionalApps) {
val promotionalCluster = promotionalCluster()
newBundle.streamClusters[promotionalCluster.id] = promotionalCluster
promotionsAdded = true

View File

@@ -303,6 +303,8 @@
<string name="pref_ui_quick_exit_desc">"Exit app on single back action"</string>
<string name="pref_ui_no_for_you">"For You Pages"</string>
<string name="pref_ui_no_for_you_desc">"Display For You Pages on home screen"</string>
<string name="pref_ui_no_promotional">"Promotional apps"</string>
<string name="pref_ui_no_promotional_desc">"Display apps promoted by us on home screen"</string>
<string name="pref_ui_similar_apps">"Similar and related apps"</string>
<string name="pref_ui_similar_apps_desc">"Display similar and related clusters on app details page"</string>
<string name="purchase_failed">"Download Failed"</string>

View File

@@ -70,6 +70,15 @@
app:summary="@string/pref_ui_no_for_you_desc"
app:title="@string/pref_ui_no_for_you" />
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="PREFERENCE_PROMOTIONAL"
app:dependency="PREFERENCE_FOR_YOU"
app:disableDependentsState="false"
app:summary="@string/pref_ui_no_promotional_desc"
app:title="@string/pref_ui_no_promotional" />
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"