Skip to content

Commit f17155b

Browse files
authored
Merge branch 'TeamNewPipe:dev' into exo182
2 parents eea4f0f + cd0e585 commit f17155b

41 files changed

Lines changed: 660 additions & 664 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.

app/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ android {
1515
applicationId "org.schabi.newpipe"
1616
resValue "string", "app_name", "NewPipe"
1717
minSdk 21
18-
targetSdk 29
18+
targetSdk 33
1919
versionCode 991
2020
versionName "0.24.1"
2121

@@ -107,7 +107,7 @@ ext {
107107
groupieVersion = '2.10.1'
108108
markwonVersion = '4.6.2'
109109

110-
leakCanaryVersion = '2.5'
110+
leakCanaryVersion = '2.9.1'
111111
stethoVersion = '1.6.0'
112112
mockitoVersion = '4.0.0'
113113
assertJVersion = '3.23.1'
@@ -179,7 +179,7 @@ sonar {
179179

180180
dependencies {
181181
/** Desugaring **/
182-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
182+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
183183

184184
/** NewPipe libraries **/
185185
// You can use a local version by uncommenting a few lines in settings.gradle
@@ -259,14 +259,14 @@ dependencies {
259259
implementation "io.noties.markwon:linkify:${markwonVersion}"
260260

261261
// Crash reporting
262-
implementation "ch.acra:acra-core:5.9.3"
262+
implementation "ch.acra:acra-core:5.9.7"
263263

264264
// Properly restarting
265265
implementation 'com.jakewharton:process-phoenix:2.1.2'
266266

267267
// Reactive extensions for Java VM
268-
implementation "io.reactivex.rxjava3:rxjava:3.0.13"
269-
implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
268+
implementation "io.reactivex.rxjava3:rxjava:3.1.5"
269+
implementation "io.reactivex.rxjava3:rxandroid:3.0.2"
270270
// RxJava binding APIs for Android UI widgets
271271
implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0"
272272

app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.schabi.newpipe.util
22

33
import android.content.Context
4-
import android.util.SparseArray
54
import android.view.View
65
import android.view.View.GONE
76
import android.view.View.INVISIBLE
87
import android.view.View.VISIBLE
98
import android.widget.Spinner
9+
import androidx.collection.SparseArrayCompat
1010
import androidx.test.core.app.ApplicationProvider
1111
import androidx.test.ext.junit.runners.AndroidJUnit4
1212
import androidx.test.filters.MediumTest
@@ -39,9 +39,7 @@ class StreamItemAdapterTest {
3939
@Test
4040
fun videoStreams_noSecondaryStream() {
4141
val adapter = StreamItemAdapter<VideoStream, AudioStream>(
42-
context,
43-
getVideoStreams(true, true, true, true),
44-
null
42+
getVideoStreams(true, true, true, true)
4543
)
4644

4745
spinner.adapter = adapter
@@ -54,7 +52,6 @@ class StreamItemAdapterTest {
5452
@Test
5553
fun videoStreams_hasSecondaryStream() {
5654
val adapter = StreamItemAdapter(
57-
context,
5855
getVideoStreams(false, true, false, true),
5956
getAudioStreams(false, true, false, true)
6057
)
@@ -69,7 +66,6 @@ class StreamItemAdapterTest {
6966
@Test
7067
fun videoStreams_Mixed() {
7168
val adapter = StreamItemAdapter(
72-
context,
7369
getVideoStreams(true, true, true, true, true, false, true, true),
7470
getAudioStreams(false, true, false, false, false, true, true, true)
7571
)
@@ -88,7 +84,6 @@ class StreamItemAdapterTest {
8884
@Test
8985
fun subtitleStreams_noIcon() {
9086
val adapter = StreamItemAdapter<SubtitlesStream, Stream>(
91-
context,
9287
StreamItemAdapter.StreamSizeWrapper(
9388
(0 until 5).map {
9489
SubtitlesStream.Builder()
@@ -99,8 +94,7 @@ class StreamItemAdapterTest {
9994
.build()
10095
},
10196
context
102-
),
103-
null
97+
)
10498
)
10599
spinner.adapter = adapter
106100
for (i in 0 until spinner.count) {
@@ -111,7 +105,6 @@ class StreamItemAdapterTest {
111105
@Test
112106
fun audioStreams_noIcon() {
113107
val adapter = StreamItemAdapter<AudioStream, Stream>(
114-
context,
115108
StreamItemAdapter.StreamSizeWrapper(
116109
(0 until 5).map {
117110
AudioStream.Builder()
@@ -122,8 +115,7 @@ class StreamItemAdapterTest {
122115
.build()
123116
},
124117
context
125-
),
126-
null
118+
)
127119
)
128120
spinner.adapter = adapter
129121
for (i in 0 until spinner.count) {
@@ -200,7 +192,7 @@ class StreamItemAdapterTest {
200192
* Helper function that builds a secondary stream list.
201193
*/
202194
private fun <T : Stream> getSecondaryStreamsFromList(streams: List<T?>) =
203-
SparseArray<SecondaryStreamHelper<T>?>(streams.size).apply {
195+
SparseArrayCompat<SecondaryStreamHelper<T>?>(streams.size).apply {
204196
streams.forEachIndexed { index, stream ->
205197
val secondaryStreamHelper: SecondaryStreamHelper<T>? = stream?.let {
206198
SecondaryStreamHelper(

app/src/main/AndroidManifest.xml

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
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.POST_NOTIFICATIONS"/>
1213

1314
<uses-feature
1415
android:name="android.hardware.touchscreen"
@@ -24,11 +25,12 @@
2425
android:icon="@mipmap/ic_launcher"
2526
android:label="@string/app_name"
2627
android:logo="@mipmap/ic_launcher"
27-
android:theme="@style/OpeningTheme"
2828
android:resizeableActivity="true"
29+
android:theme="@style/OpeningTheme"
2930
tools:ignore="AllowBackup">
3031
<activity
3132
android:name=".MainActivity"
33+
android:exported="true"
3234
android:label="@string/app_name"
3335
android:launchMode="singleTask">
3436
<intent-filter>
@@ -39,15 +41,17 @@
3941
</intent-filter>
4042
</activity>
4143

42-
<receiver android:name="androidx.media.session.MediaButtonReceiver">
44+
<receiver
45+
android:name="androidx.media.session.MediaButtonReceiver"
46+
android:exported="true">
4347
<intent-filter>
4448
<action android:name="android.intent.action.MEDIA_BUTTON" />
4549
</intent-filter>
4650
</receiver>
4751

4852
<service
4953
android:name=".player.PlayerService"
50-
android:exported="false"
54+
android:exported="true"
5155
android:foregroundServiceType="mediaPlayback">
5256
<intent-filter>
5357
<action android:name="android.intent.action.MEDIA_BUTTON" />
@@ -56,15 +60,18 @@
5660

5761
<activity
5862
android:name=".player.PlayQueueActivity"
63+
android:exported="false"
5964
android:label="@string/title_activity_play_queue"
6065
android:launchMode="singleTask" />
6166

6267
<activity
6368
android:name=".settings.SettingsActivity"
69+
android:exported="false"
6470
android:label="@string/settings" />
6571

6672
<activity
6773
android:name=".about.AboutActivity"
74+
android:exported="false"
6875
android:label="@string/title_activity_about" />
6976

7077
<service android:name=".local.subscription.services.SubscriptionsImportService" />
@@ -73,6 +80,7 @@
7380

7481
<activity
7582
android:name=".PanicResponderActivity"
83+
android:exported="true"
7684
android:launchMode="singleInstance"
7785
android:noHistory="true"
7886
android:theme="@android:style/Theme.NoDisplay">
@@ -85,20 +93,26 @@
8593

8694
<activity
8795
android:name=".ExitActivity"
96+
android:exported="false"
8897
android:label="@string/general_error"
8998
android:theme="@android:style/Theme.NoDisplay" />
90-
<activity android:name=".error.ErrorActivity" />
99+
100+
<activity
101+
android:name=".error.ErrorActivity"
102+
android:exported="false" />
91103

92104
<!-- giga get related -->
93105
<activity
94106
android:name=".download.DownloadActivity"
107+
android:exported="false"
95108
android:label="@string/app_name"
96109
android:launchMode="singleTask" />
97110

98111
<service android:name="us.shandian.giga.service.DownloadManagerService" />
99112

100113
<activity
101114
android:name=".util.FilePickerActivityHelper"
115+
android:exported="true"
102116
android:label="@string/app_name"
103117
android:theme="@style/FilePickerThemeDark">
104118
<intent-filter>
@@ -109,6 +123,7 @@
109123

110124
<activity
111125
android:name=".error.ReCaptchaActivity"
126+
android:exported="false"
112127
android:label="@string/recaptcha" />
113128

114129
<provider
@@ -124,6 +139,7 @@
124139
<activity
125140
android:name=".RouterActivity"
126141
android:excludeFromRecents="true"
142+
android:exported="true"
127143
android:label="@string/preferred_open_action_share_menu_title"
128144
android:taskAffinity=""
129145
android:theme="@style/RouterActivityThemeDark">
@@ -353,30 +369,30 @@
353369

354370
<!-- Bandcamp filter for tracks, albums and playlists -->
355371
<intent-filter>
356-
<action android:name="android.intent.action.VIEW"/>
357-
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
358-
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
372+
<action android:name="android.intent.action.VIEW" />
373+
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
374+
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
359375

360-
<category android:name="android.intent.category.DEFAULT"/>
361-
<category android:name="android.intent.category.BROWSABLE"/>
376+
<category android:name="android.intent.category.DEFAULT" />
377+
<category android:name="android.intent.category.BROWSABLE" />
362378

363-
<data android:scheme="http"/>
364-
<data android:scheme="https"/>
365-
<data android:host="*.bandcamp.com"/>
379+
<data android:scheme="http" />
380+
<data android:scheme="https" />
381+
<data android:host="*.bandcamp.com" />
366382
</intent-filter>
367383

368384
<!-- Bandcamp filter for radio -->
369385
<intent-filter>
370-
<action android:name="android.intent.action.VIEW"/>
371-
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
372-
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
386+
<action android:name="android.intent.action.VIEW" />
387+
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
388+
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
373389

374-
<category android:name="android.intent.category.DEFAULT"/>
375-
<category android:name="android.intent.category.BROWSABLE"/>
390+
<category android:name="android.intent.category.DEFAULT" />
391+
<category android:name="android.intent.category.BROWSABLE" />
376392

377-
<data android:scheme="http"/>
378-
<data android:scheme="https"/>
379-
<data android:sspPattern="bandcamp.com/?show=*"/>
393+
<data android:scheme="http" />
394+
<data android:scheme="https" />
395+
<data android:sspPattern="bandcamp.com/?show=*" />
380396
</intent-filter>
381397

382398
</activity>
@@ -385,11 +401,17 @@
385401
android:exported="false" />
386402

387403
<!-- opting out of sending metrics to Google in Android System WebView -->
388-
<meta-data android:name="android.webkit.WebView.MetricsOptOut" android:value="true" />
404+
<meta-data
405+
android:name="android.webkit.WebView.MetricsOptOut"
406+
android:value="true" />
389407
<!-- see https://github.com/TeamNewPipe/NewPipe/issues/3947 -->
390408
<!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
391-
<meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
409+
<meta-data
410+
android:name="com.samsung.android.keepalive.density"
411+
android:value="true" />
392412
<!-- Version >= 3.0. DeX Dual Mode support -->
393-
<meta-data android:name="com.samsung.android.multidisplay.keep_process_alive" android:value="true"/>
413+
<meta-data
414+
android:name="com.samsung.android.multidisplay.keep_process_alive"
415+
android:value="true" />
394416
</application>
395417
</manifest>

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ protected void onCreate(final Bundle savedInstanceState) {
157157
}
158158
openMiniPlayerUponPlayerStarted();
159159

160-
// Schedule worker for checking for new streams and creating corresponding notifications
161-
// if this is enabled by the user.
162-
NotificationWorker.initialize(this);
160+
if (PermissionHelper.checkPostNotificationsPermission(this,
161+
PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE)) {
162+
// Schedule worker for checking for new streams and creating corresponding notifications
163+
// if this is enabled by the user.
164+
NotificationWorker.initialize(this);
165+
}
163166
}
164167

165168
@Override
@@ -599,6 +602,9 @@ public void onRequestPermissionsResult(final int requestCode,
599602
((VideoDetailFragment) fragment).openDownloadDialog();
600603
}
601604
break;
605+
case PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE:
606+
NotificationWorker.initialize(this);
607+
break;
602608
}
603609
}
604610

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe;
22

3+
import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase;
34
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
45

56
import android.content.Context;
@@ -10,6 +11,7 @@
1011
import androidx.fragment.app.FragmentManager;
1112

1213
import org.schabi.newpipe.database.stream.model.StreamEntity;
14+
import org.schabi.newpipe.download.DownloadDialog;
1315
import org.schabi.newpipe.local.dialog.PlaylistDialog;
1416
import org.schabi.newpipe.player.playqueue.PlayQueue;
1517
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
@@ -75,6 +77,14 @@ public static void openPopupMenu(final PlayQueue playQueue,
7577
shareText(context, item.getTitle(), item.getUrl(),
7678
item.getThumbnailUrl());
7779
return true;
80+
case R.id.menu_item_download:
81+
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), item.getUrl(),
82+
info -> {
83+
final DownloadDialog downloadDialog = new DownloadDialog(context,
84+
info);
85+
downloadDialog.show(fragmentManager, "downloadDialog");
86+
});
87+
return true;
7888
}
7989
return false;
8090
});

0 commit comments

Comments
 (0)