mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Temporary subscription workarounds
This commit is contained in:
parent
290d2ceb50
commit
ff914bbdf4
4 changed files with 25 additions and 4 deletions
|
@ -216,6 +216,9 @@ class Settings : FragmentedStorageFileJson() {
|
|||
@Serializable(with = FlexibleBooleanSerializer::class)
|
||||
var fetchOnAppBoot: Boolean = true;
|
||||
|
||||
@FormField(R.string.fetch_on_tab_opened, FieldForm.TOGGLE, R.string.fetch_on_tab_opened_description, 6)
|
||||
var fetchOnTabOpen: Boolean = true;
|
||||
|
||||
@FormField(R.string.background_update, FieldForm.DROPDOWN, R.string.experimental_background_update_for_subscriptions_cache, 7)
|
||||
@DropdownFieldOptionsId(R.array.background_interval)
|
||||
var subscriptionsBackgroundUpdateInterval: Int = 0;
|
||||
|
@ -246,6 +249,9 @@ class Settings : FragmentedStorageFileJson() {
|
|||
@FormField(R.string.track_playtime_locally, FieldForm.TOGGLE, R.string.track_playtime_locally_description, 10)
|
||||
var allowPlaytimeTracking: Boolean = true;
|
||||
|
||||
|
||||
@FormField(R.string.always_reload_from_cache, FieldForm.TOGGLE, R.string.always_reload_from_cache_description, 11)
|
||||
var alwaysReloadFromCache: Boolean = false;
|
||||
}
|
||||
|
||||
@FormField(R.string.player, "group", R.string.change_behavior_of_the_player, 4)
|
||||
|
|
|
@ -83,7 +83,7 @@ class ChannelContentCache {
|
|||
val items = validStores.flatMap { it.getItems() }
|
||||
.sortedByDescending { it.datetime };
|
||||
|
||||
return DedupContentPager(PlatformContentPager(items, Math.min(150, items.size)), StatePlatform.instance.getEnabledClients().map { it.id });
|
||||
return DedupContentPager(PlatformContentPager(items, Math.min(30, items.size)), StatePlatform.instance.getEnabledClients().map { it.id });
|
||||
}
|
||||
|
||||
fun uncacheContent(content: SerializedPlatformContent) {
|
||||
|
|
|
@ -121,7 +121,7 @@ class SubscriptionsFeedFragment : MainFragment() {
|
|||
recyclerData.lastLoad.getNowDiffSeconds() > 60 ) {
|
||||
recyclerData.lastLoad = OffsetDateTime.now();
|
||||
|
||||
if(StateSubscriptions.instance.getOldestUpdateTime().getNowDiffMinutes() > 5)
|
||||
if(StateSubscriptions.instance.getOldestUpdateTime().getNowDiffMinutes() > 5 && Settings.instance.subscriptions.fetchOnTabOpen)
|
||||
loadResults(false);
|
||||
else if(recyclerData.results.size == 0)
|
||||
loadCache();
|
||||
|
@ -193,7 +193,15 @@ class SubscriptionsFeedFragment : MainFragment() {
|
|||
|
||||
return@TaskHandler resp;
|
||||
})
|
||||
.success { loadedResult(it); }
|
||||
.success {
|
||||
if(!Settings.instance.subscriptions.alwaysReloadFromCache)
|
||||
loadedResult(it);
|
||||
else {
|
||||
finishRefreshLayoutLoader();
|
||||
setLoading(false);
|
||||
loadCache();
|
||||
}
|
||||
} //TODO: Remove
|
||||
.exception<RateLimitException> {
|
||||
fragment.lifecycleScope.launch(Dispatchers.IO) {
|
||||
val subs = StateSubscriptions.instance.getSubscriptions();
|
||||
|
@ -256,7 +264,10 @@ class SubscriptionsFeedFragment : MainFragment() {
|
|||
else null;
|
||||
_filterSettings.save();
|
||||
};
|
||||
loadResults(false)
|
||||
if(Settings.instance.subscriptions.fetchOnTabOpen) //TODO: Do this different, temporary workaround
|
||||
loadResults(false);
|
||||
else
|
||||
loadCache();
|
||||
}
|
||||
|
||||
override fun filterResults(results: List<IPlatformContent>): List<IPlatformContent> {
|
||||
|
|
|
@ -315,6 +315,10 @@
|
|||
<string name="app_language">App Language</string>
|
||||
<string name="may_require_restart">May require restart</string>
|
||||
<string name="fetch_on_app_boot">Fetch on app boot</string>
|
||||
<string name="fetch_on_tab_opened">Fetch on tab opened</string>
|
||||
<string name="fetch_on_tab_opened_description">Fetch new results when the tab is opened (if no results yet, disabling is not recommended unless you have issues)</string>
|
||||
<string name="always_reload_from_cache">Always reload from cache</string>
|
||||
<string name="always_reload_from_cache_description">This is not recommended, but a possible workaround for some issues.</string>
|
||||
<string name="get_answers_to_common_questions">Get answers to common questions</string>
|
||||
<string name="give_feedback_on_the_application">Give feedback on the application</string>
|
||||
<string name="info">Info</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue