Skip to content

Conversation

@FineFindus
Copy link
Collaborator

Drops the VISIBLE option for SponsorBlock, as it provides no additional value and leads to bad UX, as a user is able to see the segment, but able to skip it.
Existing users are migrated to the MANUAL option. To achieve this, new supporting code is introduced, that allows us to automatically migrate preferences.

Ref: #7384 (comment)
Ref: f5c4015
Ref: 9ceb258

Introduces a new function, that checks for preferences, that need to be
migrated, and migrates them if necessary.
Drops the `VISIBLE` option for SponsorBlock, as it provides no additional value
and leads to bad UX, as a user is able to see the segment, but able to skip
it.
Existing users are migrated to the `MANUAL` option.

Ref: libre-tube@f5c4015
Ref: libre-tube@9ceb258
}

// mark as successfully migrated
putInt(PreferenceKeys.PREFERENCE_VERSION, BuildConfig.VERSION_CODE)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's better to use the version code here, or a separate constant, to avoid having the migrations run on every startup for builds where the version is not increased on every update, e.g. Debug/Nightly builds?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to manually increment the number, because not every version will have a preference migration, so it'd run the whole function body unnecessarily with each update even if there's no migration necessary.

Depending on how much we want to over-engineer it: In theory we could build a simple PreferenceMigration class similar to the room migrations and maintain a list of migrations numbered from 1 upwards, see https://github.com/libre-tube/LibreTube/blob/master/app/src/main/java/com/github/libretube/db/AppDatabase.kt. We could then have a PreferenceMigration(1, 2) { override fun onMigrate() {} }, that runs the migration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in c746647.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

This system allows to run migrations even without changing version codes,
allowing for mid-version preferences changes to are applied to debug/nightly
builds.
@FineFindus
Copy link
Collaborator Author

Thinking about it, maybe it also makes sense to combine AUTOMATIC and AUTOMATIC_ONCE as they are nearly identical?

@Bnyro
Copy link
Member

Bnyro commented May 21, 2025

Thinking about it, maybe it also makes sense to combine AUTOMATIC and AUTOMATIC_ONCE as they are nearly identical?

We already have the icon to "temporarily" allow SponsorBlock segments, so the "automatic once" behavior could be achieved by temporarily allowing segments, yes.

It would be confusing for the average people if the segment doesn't skip again and again by default, so AUTOMATIC should be the one to keep if we remove one.

I however think that it'd make sense to make some kind of community poll or open an issue about it to see if there are many users of this feature, because otherwise people will start complaining about yet another removed feature again...

@FineFindus FineFindus merged commit b908dbd into libre-tube:master May 22, 2025
4 of 6 checks passed
@FineFindus FineFindus deleted the feat/remove-sb-view-option branch May 22, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants