2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-21 17:47:50 +00:00

Remove DEBUG statements and don't replace yt trending with live

You can use this command to test instead:

adb shell run-as org.schabi.newpipe.debug.pr12450 'sed -i '"'"'s#<int name="last_used_preferences_version" value="8" />#<int name="last_used_preferences_version" value="6" />#'"'"' shared_prefs/org.schabi.newpipe.debug.pr12450_preferences.xml' && adb shell run-as org.schabi.newpipe.debug.pr12450 'sed -i '"'"'s#\]}</string>#,{\&quot;tab_id\&quot;:5,\&quot;service_id\&quot;:0,\&quot;kiosk_id\&quot;:\&quot;Trending\&quot;},{\&quot;tab_id\&quot;:5,\&quot;service_id\&quot;:1,\&quot;kiosk_id\&quot;:\&quot;Top 50\&quot;}]}</string>#'"'"' shared_prefs/org.schabi.newpipe.debug.pr12450_preferences.xml'
This commit is contained in:
Stypox 2025-07-28 21:47:26 +02:00
parent 7cecd11f72
commit 8400a9ae8e
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 11 additions and 25 deletions

View File

@ -21,7 +21,6 @@ import org.schabi.newpipe.settings.tabs.Tab;
import org.schabi.newpipe.settings.tabs.TabsManager;
import org.schabi.newpipe.util.DeviceUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -173,7 +172,7 @@ public final class SettingMigrations {
&& kioskTab.getKioskServiceId() == SoundCloud.getServiceId()
&& kioskTab.getKioskId().equals("Top 50")))
.collect(Collectors.toUnmodifiableList());
if (tabs.size() != cleanedTabs.size() || DEBUG) { // TODO: remove debug condition
if (tabs.size() != cleanedTabs.size()) {
tabsManager.saveTabs(cleanedTabs);
// create an AlertDialog to inform the user about the change
MigrationManager.addMigrationInfo(uiContext ->
@ -198,31 +197,19 @@ public final class SettingMigrations {
// and is thus updated automatically.
final TabsManager tabsManager = TabsManager.getManager(context);
final List<Tab> tabs = tabsManager.getTabs();
final boolean hadYtTrendingTab = tabs.stream()
.anyMatch(tab -> !(tab instanceof Tab.KioskTab kioskTab
final List<Tab> cleanedTabs = tabs.stream()
.filter(tab -> !(tab instanceof Tab.KioskTab kioskTab
&& kioskTab.getKioskServiceId() == YouTube.getServiceId()
&& kioskTab.getKioskId().equals("Trending")));
if (hadYtTrendingTab) {
final List<Tab> cleanedTabs = new ArrayList<>();
for (final Tab tab : tabs) {
if (tab instanceof Tab.KioskTab kioskTab
&& kioskTab.getKioskServiceId() == YouTube.getServiceId()
&& kioskTab.getKioskId().equals("Trending")) {
// replace the YouTube Trending tab with the new live kiosk tab
// TODO: use the correct kiosk ID for the live kiosk tab
cleanedTabs.add(new Tab.KioskTab(YouTube.getServiceId(), "Live"));
} else {
cleanedTabs.add(tab);
}
}
&& kioskTab.getKioskId().equals("Trending")))
.collect(Collectors.toUnmodifiableList());
if (tabs.size() != cleanedTabs.size()) {
tabsManager.saveTabs(cleanedTabs);
}
final boolean hasDefaultTrendingTab = tabs.stream()
.anyMatch(tab -> tab instanceof Tab.DefaultKioskTab);
// TODO: remove debugging code
if (hadYtTrendingTab || hasDefaultTrendingTab || newVersion == VERSION) {
if (tabs.size() != cleanedTabs.size() || hasDefaultTrendingTab) {
// User is informed about the change
MigrationManager.addMigrationInfo(uiContext ->
MigrationManager.createMigrationInfoDialog(
@ -261,14 +248,13 @@ public final class SettingMigrations {
// setup migrations and check if there is something to do
sp = PreferenceManager.getDefaultSharedPreferences(context);
final String lastPrefVersionKey = context.getString(R.string.last_used_preferences_version);
//final int lastPrefVersion = sp.getInt(lastPrefVersionKey, 0);
final int lastPrefVersion = 6; // TODO: remove this line after testing
final int lastPrefVersion = sp.getInt(lastPrefVersionKey, 0);
// no migration to run, already up to date
if (App.getApp().isFirstRun()) {
sp.edit().putInt(lastPrefVersionKey, VERSION).apply();
return;
} else if (lastPrefVersion == VERSION && !DEBUG) { // TODO: remove DEBUG check
} else if (lastPrefVersion == VERSION) {
return;
}
@ -320,7 +306,7 @@ public final class SettingMigrations {
* the current settings version.
*/
private boolean shouldMigrate(final int currentVersion) {
return oldVersion >= currentVersion || newVersion == VERSION;
return oldVersion >= currentVersion;
}
protected abstract void migrate(@NonNull Context context);

View File

@ -867,7 +867,7 @@
<string name="migration_info_6_7_title">SoundCloud Top 50 page removed</string>
<string name="migration_info_6_7_message">SoundCloud has discontinued the original Top 50 charts. The corresponding tab has been removed from your main page.</string>
<string name="migration_info_7_8_title">YouTube combined trending removed</string>
<string name="migration_info_7_8_message">YouTube has discontinued the combined trending page as of 21st July 2025. NewPipe replaced the default trending page with the trending livestreams.\n\nYou can also select different ones in the content settings.</string>
<string name="migration_info_7_8_message">YouTube has discontinued the combined trending page as of 21st July 2025. NewPipe replaced the default trending page with the trending livestreams.\n\nYou can also select different trending pages in \"Settings > Content > Content of main page\".</string>
<string name="gaming">Gaming</string>
<string name="music">Music</string>
<string name="movies">Movies</string>