Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,25 @@ protected void migrate(@NonNull final Context context) {
}
};

private static final Migration MIGRATION_8_9 = new Migration(8, 9) {
@Override
protected void migrate(@NonNull final Context context) {
// Support for courses and podcasts tabs were added.
// If the user changed the displayed tabs the new ones need to be added to the list
// of displayed tabs.
final Set<String> enabledTabs = sp.getStringSet(context.getString(
R.string.show_channel_tabs_key), null);
if (enabledTabs != null) {
enabledTabs.add(context.getString(R.string.show_channel_tabs_courses));
enabledTabs.add(context.getString(R.string.show_channel_tabs_podcasts));
sp.edit()
.putStringSet(context.getString(R.string.show_channel_tabs_key),
enabledTabs)
.apply();
}
}
};

/**
* List of all implemented migrations.
* <p>
Expand All @@ -236,12 +255,13 @@ protected void migrate(@NonNull final Context context) {
MIGRATION_5_6,
MIGRATION_6_7,
MIGRATION_7_8,
MIGRATION_8_9,
};

/**
* Version number for preferences. Must be incremented every time a migration is necessary.
*/
private static final int VERSION = 8;
private static final int VERSION = 9;


static void runMigrationsIfNeeded(@NonNull final Context context) {
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/org/schabi/newpipe/util/ChannelTabHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static boolean isStreamsTab(final String tab) {
case ChannelTabs.LIKES:
case ChannelTabs.SHORTS:
case ChannelTabs.LIVESTREAMS:
case ChannelTabs.PODCASTS:
case ChannelTabs.COURSES:
return true;
default:
return false;
Expand Down Expand Up @@ -65,6 +67,10 @@ private static int getShowTabKey(final String tab) {
return R.string.show_channel_tabs_albums;
case ChannelTabs.LIKES:
return R.string.show_channel_tabs_likes;
case ChannelTabs.PODCASTS:
return R.string.show_channel_tabs_podcasts;
case ChannelTabs.COURSES:
return R.string.show_channel_tabs_courses;
default:
return -1;
}
Expand All @@ -83,6 +89,10 @@ private static int getFetchFeedTabKey(final String tab) {
return R.string.fetch_channel_tabs_livestreams;
case ChannelTabs.LIKES:
return R.string.fetch_channel_tabs_likes;
case ChannelTabs.PODCASTS:
return R.string.fetch_channel_tabs_podcasts;
case ChannelTabs.COURSES:
return R.string.fetch_channel_tabs_courses;
default:
return -1;
}
Expand All @@ -107,6 +117,10 @@ public static int getTranslationKey(final String tab) {
return R.string.channel_tab_albums;
case ChannelTabs.LIKES:
return R.string.channel_tab_likes;
case ChannelTabs.PODCASTS:
return R.string.channel_tab_podcasts;
case ChannelTabs.COURSES:
return R.string.channel_tab_courses;
default:
return R.string.unknown_content;
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@
<string name="show_channel_tabs_playlists">show_channel_tabs_playlists</string>
<string name="show_channel_tabs_albums">show_channel_tabs_albums</string>
<string name="show_channel_tabs_likes">show_channel_tabs_likes</string>
<string name="show_channel_tabs_podcasts">show_channel_tabs_podcasts</string>
<string name="show_channel_tabs_courses">show_channel_tabs_courses</string>
<string name="show_channel_tabs_about">show_channel_tabs_about</string>
<string-array name="show_channel_tabs_value_list">
<item>@string/show_channel_tabs_videos</item>
Expand All @@ -307,6 +309,8 @@
<item>@string/show_channel_tabs_playlists</item>
<item>@string/show_channel_tabs_albums</item>
<item>@string/show_channel_tabs_likes</item>
<item>@string/show_channel_tabs_podcasts</item>
<item>@string/show_channel_tabs_courses</item>
<item>@string/show_channel_tabs_about</item>
</string-array>
<string-array name="show_channel_tabs_description_list">
Expand All @@ -318,6 +322,8 @@
<item>@string/channel_tab_playlists</item>
<item>@string/channel_tab_albums</item>
<item>@string/channel_tab_likes</item>
<item>@string/channel_tab_podcasts</item>
<item>@string/channel_tab_courses</item>
<item>@string/channel_tab_about</item>
</string-array>
<string name="show_search_suggestions_key">show_search_suggestions</string>
Expand Down Expand Up @@ -396,19 +402,25 @@
<string name="fetch_channel_tabs_shorts">fetch_channel_tabs_shorts</string>
<string name="fetch_channel_tabs_livestreams">fetch_channel_tabs_livestreams</string>
<string name="fetch_channel_tabs_likes">fetch_channel_tabs_likes</string>
<string name="fetch_channel_tabs_podcasts">fetch_channel_tabs_podcasts</string>
<string name="fetch_channel_tabs_courses">fetch_channel_tabs_courses</string>
<string-array name="feed_fetch_channel_tabs_value_list">
<item>@string/fetch_channel_tabs_videos</item>
<item>@string/fetch_channel_tabs_tracks</item>
<item>@string/fetch_channel_tabs_shorts</item>
<item>@string/fetch_channel_tabs_livestreams</item>
<item>@string/fetch_channel_tabs_likes</item>
<item>@string/fetch_channel_tabs_podcasts</item>
<item>@string/fetch_channel_tabs_courses</item>
</string-array>
<string-array name="feed_fetch_channel_tabs_description_list">
<item>@string/channel_tab_videos</item>
<item>@string/channel_tab_tracks</item>
<item>@string/channel_tab_shorts</item>
<item>@string/channel_tab_livestreams</item>
<item>@string/channel_tab_likes</item>
<item>@string/channel_tab_podcasts</item>
<item>@string/channel_tab_courses</item>
</string-array>

<string name="import_export_data_path">import_export_data_path</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@
<string name="channel_tab_playlists">Playlists</string>
<string name="channel_tab_albums">Albums</string>
<string name="channel_tab_likes">Likes</string>
<string name="channel_tab_podcasts">Podcasts</string>
<string name="channel_tab_courses">Courses</string>
<string name="channel_tab_about">About</string>
<string name="show_channel_tabs">Channel tabs</string>
<string name="show_channel_tabs_summary">What tabs are shown on the channel pages</string>
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ teamnewpipe-nanojson = "e9d656ddb49a412a5a0a5d5ef20ca7ef09549996"
# the corresponding commit hash, since JitPack sometimes deletes artifacts.
# If there’s already a git hash, just add more of it to the end (or remove a letter)
# to cause jitpack to regenerate the artifact.
teamnewpipe-newpipe-extractor = "4de221bf67ec0bf8dbdf573fbc9d4412a8561cb0"
teamnewpipe-newpipe-extractor = "4b70576661aadf663a935df5b904a43147d9fc50"
viewpager2 = "1.1.0"
webkit = "1.15.0" # New versions require minSdk 24
work = "2.11.2"
Expand Down
Loading