Skip to content

Commit 577c98d

Browse files
author
talbmax10
authored
Merge branch 'TeamNewPipe:dev' into feat/add-android-ci-workflow
2 parents b9eb3bd + 9bc8139 commit 577c98d

215 files changed

Lines changed: 2467 additions & 1176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ jobs:
7272
- api-level: 21
7373
target: default
7474
arch: x86
75-
- api-level: 33
76-
target: google_apis # emulator API 33 only exists with Google APIs
75+
- api-level: 35
76+
target: default
7777
arch: x86_64
7878

7979
permissions:

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
<h3 align="center">We are planning to <i>rewrite</i> large chunks of the codebase, to bring about <a href="https://github.com/TeamNewPipe/NewPipe/discussions/10118">a new, modern and stable NewPipe</a>!</h3>
2-
<h4 align="center">Please do <b>not</b> open pull requests for <i>new features</i> now, only bugfix PRs will be accepted.</h4>
1+
<h3 align="center">We are <i>rewriting</i> large chunks of the codebase, to bring about <a href="https://newpipe.net/blog/pinned/announcement/newpipe-0.27.6-rewrite-team-states/#the-refactor">a modern and stable NewPipe</a>! You can download nightly builds <a href="https://github.com/TeamNewPipe/NewPipe-refactor-nightly/releases">here</a>.</h3>
2+
<h4 align="center">Please work on the <code>refactor</code> branch if you want to contribute <i>new features</i>. The current codebase is in maintenance mode and will only receive <i>bugfixes</i>.</h4>
33

44
<p align="center"><a href="https://newpipe.net"><img src="assets/new_pipe_icon_5.png" width="150"></a></p>
55
<h2 align="center"><b>NewPipe</b></h2>
66
<h4 align="center">A libre lightweight streaming front-end for Android.</h4>
77

8-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" height=80/></a></p>
8+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" width=206/></a></p>
99

1010
<p align="center">
1111
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="GitHub NewPipe releases"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>
12-
<a href="https://github.com/TeamNewPipe/NewPipe-nightly/releases" alt="GitHub NewPipe nightly releases">
13-
<img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe-nightly.svg?labelColor=purple&label=dev%20nightly" >
14-
</a>
15-
<a href="https://github.com/TeamNewPipe/NewPipe-refactor-nightly/releases" alt="GitHub NewPipe refactor nightly releases">
16-
<img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe-refactor-nightly.svg?labelColor=purple&label=refactor%20nightly" >
17-
</a>
12+
<a href="https://github.com/TeamNewPipe/NewPipe-nightly/releases" alt="GitHub NewPipe nightly releases"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe-nightly.svg?labelColor=purple&label=dev%20nightly"></a>
13+
<a href="https://github.com/TeamNewPipe/NewPipe-refactor-nightly/releases" alt="GitHub NewPipe refactor nightly releases"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe-refactor-nightly.svg?labelColor=purple&label=refactor%20nightly"></a>
1814
<a href="https://www.gnu.org/licenses/gpl-3.0" alt="License: GPLv3"><img src="https://img.shields.io/badge/License-GPL%20v3-blue.svg"></a>
1915
<a href="https://github.com/TeamNewPipe/NewPipe/actions" alt="Build Status"><img src="https://github.com/TeamNewPipe/NewPipe/actions/workflows/ci.yml/badge.svg?branch=dev&event=push"></a>
2016
<a href="https://hosted.weblate.org/engage/newpipe/" alt="Translation Status"><img src="https://hosted.weblate.org/widgets/newpipe/-/svg-badge.svg"></a>

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ plugins {
1212
}
1313

1414
android {
15-
compileSdk 34
15+
compileSdk 36
1616
namespace 'org.schabi.newpipe'
1717

1818
defaultConfig {
1919
applicationId "org.schabi.newpipe"
2020
resValue "string", "app_name", "NewPipe"
2121
minSdk 21
22-
targetSdk 33
22+
targetSdk 35
2323
if (System.properties.containsKey('versionCodeOverride')) {
2424
versionCode System.getProperty('versionCodeOverride') as Integer
2525
} else {
26-
versionCode 1004
26+
versionCode 1005
2727
}
28-
versionName "0.27.7"
28+
versionName "0.28.0"
2929
if (System.properties.containsKey('versionNameSuffix')) {
3030
versionNameSuffix System.getProperty('versionNameSuffix')
3131
}
@@ -209,12 +209,12 @@ dependencies {
209209
// Or you can use a commit you pushed to GitHub by just replacing TeamNewPipe with your GitHub
210210
// name and the commit hash with the commit hash of the (pushed) commit you want to test
211211
// This works thanks to JitPack: https://jitpack.io/
212-
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
212+
implementation 'com.github.TeamNewPipe:nanojson:e9d656ddb49a412a5a0a5d5ef20ca7ef09549996'
213213
// WORKAROUND: if you get errors with the NewPipeExtractor dependency, replace `v0.24.3` with
214214
// the corresponding commit hash, since JitPack sometimes deletes artifacts.
215215
// If there’s already a git hash, just add more of it to the end (or remove a letter)
216216
// to cause jitpack to regenerate the artifact.
217-
implementation 'com.github.TeamNewPipe.NewPipeExtractor:NewPipeExtractor:v0.24.6'
217+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.24.8'
218218
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
219219

220220
/** Checkstyle **/
@@ -225,7 +225,7 @@ dependencies {
225225
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
226226

227227
/** AndroidX **/
228-
implementation 'androidx.appcompat:appcompat:1.6.1'
228+
implementation 'androidx.appcompat:appcompat:1.7.1'
229229
implementation 'androidx.cardview:cardview:1.0.0'
230230
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
231231
implementation 'androidx.core:core-ktx:1.12.0'
@@ -280,7 +280,7 @@ dependencies {
280280
implementation "com.github.lisawray.groupie:groupie-viewbinding:${groupieVersion}"
281281

282282
// Image loading
283-
//noinspection GradleDependency --> 2.8 is the last version, not 2.71828!
283+
//noinspection NewerVersionAvailable,GradleDependency --> 2.8 is the last version, not 2.71828!
284284
implementation "com.squareup.picasso:picasso:2.8"
285285

286286
// Markdown library for Android

app/src/main/AndroidManifest.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1010
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
1111
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
12+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
13+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
1214
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1315

1416
<!-- We need to be able to open links in the browser on API 30+ -->
@@ -57,6 +59,15 @@
5759
</intent-filter>
5860
</receiver>
5961

62+
<service
63+
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
64+
android:enabled="false"
65+
android:exported="false">
66+
<meta-data
67+
android:name="autoStoreLocales"
68+
android:value="true" />
69+
</service>
70+
6071
<service
6172
android:name=".player.PlayerService"
6273
android:exported="true"
@@ -87,7 +98,8 @@
8798

8899
<service android:name=".local.subscription.services.SubscriptionsImportService" />
89100
<service android:name=".local.subscription.services.SubscriptionsExportService" />
90-
<service android:name=".local.feed.service.FeedLoadService" />
101+
<service android:name=".local.feed.service.FeedLoadService"
102+
android:foregroundServiceType="dataSync" />
91103

92104
<activity
93105
android:name=".PanicResponderActivity"
@@ -119,7 +131,8 @@
119131
android:label="@string/app_name"
120132
android:launchMode="singleTask" />
121133

122-
<service android:name="us.shandian.giga.service.DownloadManagerService" />
134+
<service android:name="us.shandian.giga.service.DownloadManagerService"
135+
android:foregroundServiceType="dataSync" />
123136

124137
<activity
125138
android:name=".util.FilePickerActivityHelper"

app/src/main/java/org/schabi/newpipe/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void onCreate() {
102102
NewPipe.init(getDownloader(),
103103
Localization.getPreferredLocalization(this),
104104
Localization.getPreferredContentCountry(this));
105-
Localization.initPrettyTime(Localization.resolvePrettyTime(getApplicationContext()));
105+
Localization.initPrettyTime(Localization.resolvePrettyTime());
106106

107107
BridgeStateSaverInitializer.init(this);
108108
StateSaver.init(this);

app/src/main/java/org/schabi/newpipe/DownloaderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
public final class DownloaderImpl extends Downloader {
3131
public static final String USER_AGENT =
32-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0";
32+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0";
3333
public static final String YOUTUBE_RESTRICTED_MODE_COOKIE_KEY =
3434
"youtube_restricted_mode_key";
3535
public static final String YOUTUBE_RESTRICTED_MODE_COOKIE = "PREF=f2=8000000";

app/src/main/java/org/schabi/newpipe/MainActivity.java

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
package org.schabi.newpipe;
2222

23-
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
24-
2523
import android.content.BroadcastReceiver;
2624
import android.content.Context;
2725
import android.content.Intent;
@@ -50,6 +48,7 @@
5048
import androidx.appcompat.app.ActionBarDrawerToggle;
5149
import androidx.appcompat.app.AppCompatActivity;
5250
import androidx.core.app.ActivityCompat;
51+
import androidx.core.content.ContextCompat;
5352
import androidx.core.view.GravityCompat;
5453
import androidx.drawerlayout.widget.DrawerLayout;
5554
import androidx.fragment.app.Fragment;
@@ -81,6 +80,7 @@
8180
import org.schabi.newpipe.player.helper.PlayerHolder;
8281
import org.schabi.newpipe.player.playqueue.PlayQueue;
8382
import org.schabi.newpipe.settings.UpdateSettingsFragment;
83+
import org.schabi.newpipe.settings.migration.MigrationManager;
8484
import org.schabi.newpipe.util.Constants;
8585
import org.schabi.newpipe.util.DeviceUtils;
8686
import org.schabi.newpipe.util.KioskTranslator;
@@ -141,6 +141,7 @@ protected void onCreate(final Bundle savedInstanceState) {
141141
+ "savedInstanceState = [" + savedInstanceState + "]");
142142
}
143143

144+
Localization.migrateAppLanguageSettingIfNecessary(getApplicationContext());
144145
ThemeHelper.setDayNightMode(this);
145146
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
146147

@@ -157,7 +158,6 @@ protected void onCreate(final Bundle savedInstanceState) {
157158
}
158159
}
159160

160-
assureCorrectAppLanguage(this);
161161
super.onCreate(savedInstanceState);
162162
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
163163
sharedPrefEditor = sharedPreferences.edit();
@@ -196,7 +196,7 @@ protected void onCreate(final Bundle savedInstanceState) {
196196
UpdateSettingsFragment.askForConsentToUpdateChecks(this);
197197
}
198198

199-
Localization.migrateAppLanguageSettingIfNecessary(getApplicationContext());
199+
MigrationManager.showUserInfoIfPresent(this);
200200
}
201201

202202
@Override
@@ -264,19 +264,6 @@ public void onDrawerClosed(final View drawerView) {
264264
*/
265265
private void addDrawerMenuForCurrentService() throws ExtractionException {
266266
//Tabs
267-
final int currentServiceId = ServiceHelper.getSelectedServiceId(this);
268-
final StreamingService service = NewPipe.getService(currentServiceId);
269-
270-
int kioskMenuItemId = 0;
271-
272-
for (final String ks : service.getKioskList().getAvailableKiosks()) {
273-
drawerLayoutBinding.navigation.getMenu()
274-
.add(R.id.menu_tabs_group, kioskMenuItemId, 0, KioskTranslator
275-
.getTranslatedKioskName(ks, this))
276-
.setIcon(KioskTranslator.getKioskIcon(ks));
277-
kioskMenuItemId++;
278-
}
279-
280267
drawerLayoutBinding.navigation.getMenu()
281268
.add(R.id.menu_tabs_group, ITEM_ID_SUBSCRIPTIONS, ORDER,
282269
R.string.tab_subscriptions)
@@ -294,6 +281,20 @@ private void addDrawerMenuForCurrentService() throws ExtractionException {
294281
.add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history)
295282
.setIcon(R.drawable.ic_history);
296283

284+
//Kiosks
285+
final int currentServiceId = ServiceHelper.getSelectedServiceId(this);
286+
final StreamingService service = NewPipe.getService(currentServiceId);
287+
288+
int kioskMenuItemId = 0;
289+
290+
for (final String ks : service.getKioskList().getAvailableKiosks()) {
291+
drawerLayoutBinding.navigation.getMenu()
292+
.add(R.id.menu_kiosks_group, kioskMenuItemId, 0, KioskTranslator
293+
.getTranslatedKioskName(ks, this))
294+
.setIcon(KioskTranslator.getKioskIcon(ks));
295+
kioskMenuItemId++;
296+
}
297+
297298
//Settings and About
298299
drawerLayoutBinding.navigation.getMenu()
299300
.add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings)
@@ -313,10 +314,13 @@ private boolean drawerItemSelected(final MenuItem item) {
313314
changeService(item);
314315
break;
315316
case R.id.menu_tabs_group:
317+
tabSelected(item);
318+
break;
319+
case R.id.menu_kiosks_group:
316320
try {
317-
tabSelected(item);
321+
kioskSelected(item);
318322
} catch (final Exception e) {
319-
ErrorUtil.showUiErrorSnackbar(this, "Selecting main page tab", e);
323+
ErrorUtil.showUiErrorSnackbar(this, "Selecting drawer kiosk", e);
320324
}
321325
break;
322326
case R.id.menu_options_about_group:
@@ -340,7 +344,7 @@ private void changeService(final MenuItem item) {
340344
.setChecked(true);
341345
}
342346

343-
private void tabSelected(final MenuItem item) throws ExtractionException {
347+
private void tabSelected(final MenuItem item) {
344348
switch (item.getItemId()) {
345349
case ITEM_ID_SUBSCRIPTIONS:
346350
NavigationHelper.openSubscriptionFragment(getSupportFragmentManager());
@@ -357,18 +361,19 @@ private void tabSelected(final MenuItem item) throws ExtractionException {
357361
case ITEM_ID_HISTORY:
358362
NavigationHelper.openStatisticFragment(getSupportFragmentManager());
359363
break;
360-
default:
361-
final StreamingService currentService = ServiceHelper.getSelectedService(this);
362-
int kioskMenuItemId = 0;
363-
for (final String kioskId : currentService.getKioskList().getAvailableKiosks()) {
364-
if (kioskMenuItemId == item.getItemId()) {
365-
NavigationHelper.openKioskFragment(getSupportFragmentManager(),
366-
currentService.getServiceId(), kioskId);
367-
break;
368-
}
369-
kioskMenuItemId++;
370-
}
364+
}
365+
}
366+
367+
private void kioskSelected(final MenuItem item) throws ExtractionException {
368+
final StreamingService currentService = ServiceHelper.getSelectedService(this);
369+
int kioskMenuItemId = 0;
370+
for (final String kioskId : currentService.getKioskList().getAvailableKiosks()) {
371+
if (kioskMenuItemId == item.getItemId()) {
372+
NavigationHelper.openKioskFragment(getSupportFragmentManager(),
373+
currentService.getServiceId(), kioskId);
371374
break;
375+
}
376+
kioskMenuItemId++;
372377
}
373378
}
374379

@@ -409,6 +414,7 @@ private void toggleServices() {
409414

410415
drawerLayoutBinding.navigation.getMenu().removeGroup(R.id.menu_services_group);
411416
drawerLayoutBinding.navigation.getMenu().removeGroup(R.id.menu_tabs_group);
417+
drawerLayoutBinding.navigation.getMenu().removeGroup(R.id.menu_kiosks_group);
412418
drawerLayoutBinding.navigation.getMenu().removeGroup(R.id.menu_options_about_group);
413419

414420
// Show up or down arrow
@@ -502,9 +508,8 @@ protected void onDestroy() {
502508

503509
@Override
504510
protected void onResume() {
505-
assureCorrectAppLanguage(this);
506511
// Change the date format to match the selected language on resume
507-
Localization.initPrettyTime(Localization.resolvePrettyTime(getApplicationContext()));
512+
Localization.initPrettyTime(Localization.resolvePrettyTime());
508513
super.onResume();
509514

510515
// Close drawer on return, and don't show animation,
@@ -892,7 +897,8 @@ public void onReceive(final Context context, final Intent intent) {
892897
};
893898
final IntentFilter intentFilter = new IntentFilter();
894899
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
895-
registerReceiver(broadcastReceiver, intentFilter);
900+
ContextCompat.registerReceiver(this, broadcastReceiver, intentFilter,
901+
ContextCompat.RECEIVER_EXPORTED);
896902

897903
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
898904
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.

app/src/main/java/org/schabi/newpipe/RouterActivity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
import org.schabi.newpipe.util.Constants;
8585
import org.schabi.newpipe.util.DeviceUtils;
8686
import org.schabi.newpipe.util.ExtractorHelper;
87-
import org.schabi.newpipe.util.Localization;
8887
import org.schabi.newpipe.util.NavigationHelper;
8988
import org.schabi.newpipe.util.PermissionHelper;
9089
import org.schabi.newpipe.util.ThemeHelper;
@@ -132,7 +131,6 @@ protected void onCreate(final Bundle savedInstanceState) {
132131
ThemeHelper.setDayNightMode(this);
133132
setTheme(ThemeHelper.isLightThemeSelected(this)
134133
? R.style.RouterActivityThemeLight : R.style.RouterActivityThemeDark);
135-
Localization.assureCorrectAppLanguage(this);
136134

137135
// Pass-through touch events to background activities
138136
// so that our transparent window won't lock UI in the mean time

app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ import org.schabi.newpipe.BuildConfig
1616
import org.schabi.newpipe.R
1717
import org.schabi.newpipe.databinding.ActivityAboutBinding
1818
import org.schabi.newpipe.databinding.FragmentAboutBinding
19-
import org.schabi.newpipe.util.Localization
2019
import org.schabi.newpipe.util.ThemeHelper
2120
import org.schabi.newpipe.util.external_communication.ShareUtils
2221

2322
class AboutActivity : AppCompatActivity() {
2423

2524
override fun onCreate(savedInstanceState: Bundle?) {
26-
Localization.assureCorrectAppLanguage(this)
2725
super.onCreate(savedInstanceState)
2826
ThemeHelper.setTheme(this)
2927
title = getString(R.string.title_activity_about)

app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import org.schabi.newpipe.R
1919
import org.schabi.newpipe.databinding.FragmentLicensesBinding
2020
import org.schabi.newpipe.databinding.ItemSoftwareComponentBinding
2121
import org.schabi.newpipe.ktx.parcelableArrayList
22-
import org.schabi.newpipe.util.Localization
2322
import org.schabi.newpipe.util.external_communication.ShareUtils
2423

2524
/**
@@ -100,7 +99,6 @@ class LicenseFragment : Fragment() {
10099
val webView = WebView(context)
101100
webView.loadData(webViewData, "text/html; charset=UTF-8", "base64")
102101

103-
Localization.assureCorrectAppLanguage(context)
104102
val builder = AlertDialog.Builder(requireContext())
105103
.setTitle(softwareComponent.name)
106104
.setView(webView)

0 commit comments

Comments
 (0)