Skip to content

Commit 8400a9a

Browse files
committed
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'
1 parent 7cecd11 commit 8400a9a

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

app/src/main/java/org/schabi/newpipe/settings/migration/SettingMigrations.java

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.schabi.newpipe.settings.tabs.TabsManager;
2222
import org.schabi.newpipe.util.DeviceUtils;
2323

24-
import java.util.ArrayList;
2524
import java.util.Collections;
2625
import java.util.HashSet;
2726
import java.util.List;
@@ -173,7 +172,7 @@ protected void migrate(@NonNull final Context context) {
173172
&& kioskTab.getKioskServiceId() == SoundCloud.getServiceId()
174173
&& kioskTab.getKioskId().equals("Top 50")))
175174
.collect(Collectors.toUnmodifiableList());
176-
if (tabs.size() != cleanedTabs.size() || DEBUG) { // TODO: remove debug condition
175+
if (tabs.size() != cleanedTabs.size()) {
177176
tabsManager.saveTabs(cleanedTabs);
178177
// create an AlertDialog to inform the user about the change
179178
MigrationManager.addMigrationInfo(uiContext ->
@@ -198,31 +197,19 @@ protected void migrate(@NonNull final Context context) {
198197
// and is thus updated automatically.
199198
final TabsManager tabsManager = TabsManager.getManager(context);
200199
final List<Tab> tabs = tabsManager.getTabs();
201-
final boolean hadYtTrendingTab = tabs.stream()
202-
.anyMatch(tab -> !(tab instanceof Tab.KioskTab kioskTab
203-
&& kioskTab.getKioskServiceId() == YouTube.getServiceId()
204-
&& kioskTab.getKioskId().equals("Trending")));
205-
if (hadYtTrendingTab) {
206-
final List<Tab> cleanedTabs = new ArrayList<>();
207-
for (final Tab tab : tabs) {
208-
if (tab instanceof Tab.KioskTab kioskTab
200+
final List<Tab> cleanedTabs = tabs.stream()
201+
.filter(tab -> !(tab instanceof Tab.KioskTab kioskTab
209202
&& kioskTab.getKioskServiceId() == YouTube.getServiceId()
210-
&& kioskTab.getKioskId().equals("Trending")) {
211-
// replace the YouTube Trending tab with the new live kiosk tab
212-
// TODO: use the correct kiosk ID for the live kiosk tab
213-
cleanedTabs.add(new Tab.KioskTab(YouTube.getServiceId(), "Live"));
214-
} else {
215-
cleanedTabs.add(tab);
216-
}
217-
}
203+
&& kioskTab.getKioskId().equals("Trending")))
204+
.collect(Collectors.toUnmodifiableList());
205+
if (tabs.size() != cleanedTabs.size()) {
218206
tabsManager.saveTabs(cleanedTabs);
219207
}
220208

221209
final boolean hasDefaultTrendingTab = tabs.stream()
222210
.anyMatch(tab -> tab instanceof Tab.DefaultKioskTab);
223211

224-
// TODO: remove debugging code
225-
if (hadYtTrendingTab || hasDefaultTrendingTab || newVersion == VERSION) {
212+
if (tabs.size() != cleanedTabs.size() || hasDefaultTrendingTab) {
226213
// User is informed about the change
227214
MigrationManager.addMigrationInfo(uiContext ->
228215
MigrationManager.createMigrationInfoDialog(
@@ -261,14 +248,13 @@ static void runMigrationsIfNeeded(@NonNull final Context context) {
261248
// setup migrations and check if there is something to do
262249
sp = PreferenceManager.getDefaultSharedPreferences(context);
263250
final String lastPrefVersionKey = context.getString(R.string.last_used_preferences_version);
264-
//final int lastPrefVersion = sp.getInt(lastPrefVersionKey, 0);
265-
final int lastPrefVersion = 6; // TODO: remove this line after testing
251+
final int lastPrefVersion = sp.getInt(lastPrefVersionKey, 0);
266252

267253
// no migration to run, already up to date
268254
if (App.getApp().isFirstRun()) {
269255
sp.edit().putInt(lastPrefVersionKey, VERSION).apply();
270256
return;
271-
} else if (lastPrefVersion == VERSION && !DEBUG) { // TODO: remove DEBUG check
257+
} else if (lastPrefVersion == VERSION) {
272258
return;
273259
}
274260

@@ -320,7 +306,7 @@ protected Migration(final int oldVersion, final int newVersion) {
320306
* the current settings version.
321307
*/
322308
private boolean shouldMigrate(final int currentVersion) {
323-
return oldVersion >= currentVersion || newVersion == VERSION;
309+
return oldVersion >= currentVersion;
324310
}
325311

326312
protected abstract void migrate(@NonNull Context context);

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@
867867
<string name="migration_info_6_7_title">SoundCloud Top 50 page removed</string>
868868
<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>
869869
<string name="migration_info_7_8_title">YouTube combined trending removed</string>
870-
<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>
870+
<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>
871871
<string name="gaming">Gaming</string>
872872
<string name="music">Music</string>
873873
<string name="movies">Movies</string>

0 commit comments

Comments
 (0)