Fix crash when updating to new SponsorBlock system

This commit is contained in:
Bnyro 2023-06-19 14:19:35 +02:00
parent a764e3a7b3
commit 881873e34d
2 changed files with 11 additions and 11 deletions

View File

@ -84,10 +84,10 @@ object PlayerHelper {
fun getSponsorBlockCategories(): MutableMap<String, SbSkipOptions> { fun getSponsorBlockCategories(): MutableMap<String, SbSkipOptions> {
val categories: MutableMap<String, SbSkipOptions> = mutableMapOf() val categories: MutableMap<String, SbSkipOptions> = mutableMapOf()
for (cat in SPONSOR_CATEGORIES){ for (category in SPONSOR_CATEGORIES){
val state = PreferenceHelper.getString(cat + "_category_key", "off").uppercase() val state = PreferenceHelper.getString(category + "_category", "off").uppercase()
if (SbSkipOptions.valueOf(state) != SbSkipOptions.OFF){ if (SbSkipOptions.valueOf(state) != SbSkipOptions.OFF){
categories[cat] = SbSkipOptions.valueOf(state) categories[category] = SbSkipOptions.valueOf(state)
} }
} }
return categories return categories

View File

@ -28,50 +28,50 @@
<PreferenceCategory app:title="@string/category_segments"> <PreferenceCategory app:title="@string/category_segments">
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="sponsor_category_key" app:key="sponsor_category"
app:summary="@string/category_sponsor_description" app:summary="@string/category_sponsor_description"
app:title="@string/category_sponsor" app:title="@string/category_sponsor"
app:defaultValue="automatic"/> app:defaultValue="automatic"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="selfpromo_category_key" app:key="selfpromo_category"
app:summary="@string/category_selfpromo_description" app:summary="@string/category_selfpromo_description"
app:title="@string/category_selfpromo" app:title="@string/category_selfpromo"
app:defaultValue="automatic"/> app:defaultValue="automatic"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="interaction_category_key" app:key="interaction_category"
app:summary="@string/category_interaction_description" app:summary="@string/category_interaction_description"
app:title="@string/category_interaction" app:title="@string/category_interaction"
app:defaultValue="off"/> app:defaultValue="off"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="intro_category_key" app:key="intro_category"
app:summary="@string/category_intro_description" app:summary="@string/category_intro_description"
app:title="@string/category_intro" app:title="@string/category_intro"
app:defaultValue="off"/> app:defaultValue="off"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="outro_category_key" app:key="outro_category"
app:summary="@string/category_outro_description" app:summary="@string/category_outro_description"
app:title="@string/category_outro" app:title="@string/category_outro"
app:defaultValue="off"/> app:defaultValue="off"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="filler_category_key" app:key="filler_category"
app:summary="@string/category_filler_description" app:summary="@string/category_filler_description"
app:title="@string/category_filler" app:title="@string/category_filler"
app:defaultValue="off"/> app:defaultValue="off"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="music_offtopic_category_key" app:key="music_offtopic_category"
app:summary="@string/category_music_offtopic_description" app:summary="@string/category_music_offtopic_description"
app:title="@string/category_music_offtopic" app:title="@string/category_music_offtopic"
app:defaultValue="off"/> app:defaultValue="off"/>
<com.github.libretube.ui.views.SbSpinnerPreference <com.github.libretube.ui.views.SbSpinnerPreference
app:key="preview_category_key" app:key="preview_category"
app:summary="@string/category_preview_description" app:summary="@string/category_preview_description"
app:title="@string/category_preview" app:title="@string/category_preview"
app:defaultValue="off"/> app:defaultValue="off"/>