diff --git a/app/build.gradle b/app/build.gradle
index 72a03e063..6978fec57 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,14 +8,14 @@ plugins {
}
android {
- compileSdk 32
+ compileSdk 33
namespace 'org.schabi.newpipe'
defaultConfig {
applicationId "org.schabi.newpipe"
resValue "string", "app_name", "NewPipe"
minSdk 21
- targetSdk 29
+ targetSdk 33
versionCode 991
versionName "0.24.1"
@@ -107,7 +107,7 @@ ext {
groupieVersion = '2.10.1'
markwonVersion = '4.6.2'
- leakCanaryVersion = '2.5'
+ leakCanaryVersion = '2.9.1'
stethoVersion = '1.6.0'
mockitoVersion = '4.0.0'
assertJVersion = '3.23.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3ca19e8c0..3e987abdb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,6 +9,7 @@
+
@@ -39,7 +41,9 @@
-
+
@@ -47,7 +51,7 @@
@@ -56,15 +60,18 @@
@@ -73,6 +80,7 @@
@@ -85,13 +93,18 @@
-
+
+
@@ -99,6 +112,7 @@
@@ -109,6 +123,7 @@
@@ -353,30 +369,30 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
@@ -385,11 +401,17 @@
android:exported="false" />
-
+
-
+
-
+
diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java
index 0f82c8a9f..73a81450e 100644
--- a/app/src/main/java/org/schabi/newpipe/MainActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java
@@ -157,9 +157,12 @@ public class MainActivity extends AppCompatActivity {
}
openMiniPlayerUponPlayerStarted();
- // Schedule worker for checking for new streams and creating corresponding notifications
- // if this is enabled by the user.
- NotificationWorker.initialize(this);
+ if (PermissionHelper.checkPostNotificationsPermission(this,
+ PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE)) {
+ // Schedule worker for checking for new streams and creating corresponding notifications
+ // if this is enabled by the user.
+ NotificationWorker.initialize(this);
+ }
}
@Override
@@ -599,6 +602,9 @@ public class MainActivity extends AppCompatActivity {
((VideoDetailFragment) fragment).openDownloadDialog();
}
break;
+ case PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE:
+ NotificationWorker.initialize(this);
+ break;
}
}
diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt
index 666ea6a46..a540c0ab0 100644
--- a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt
+++ b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt
@@ -160,15 +160,15 @@ class PopupPlayerGestureListener(
}
}
- override fun onLongPress(e: MotionEvent?) {
+ override fun onLongPress(e: MotionEvent) {
playerUi.updateScreenSize()
playerUi.checkPopupPositionBounds()
playerUi.changePopupSize(playerUi.screenWidth)
}
override fun onFling(
- e1: MotionEvent?,
- e2: MotionEvent?,
+ e1: MotionEvent,
+ e2: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean {
diff --git a/app/src/main/java/org/schabi/newpipe/util/PermissionHelper.java b/app/src/main/java/org/schabi/newpipe/util/PermissionHelper.java
index f3151ec8b..f47494770 100644
--- a/app/src/main/java/org/schabi/newpipe/util/PermissionHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/util/PermissionHelper.java
@@ -21,6 +21,7 @@ import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.NewPipeSettings;
public final class PermissionHelper {
+ public static final int POST_NOTIFICATIONS_REQUEST_CODE = 779;
public static final int DOWNLOAD_DIALOG_REQUEST_CODE = 778;
public static final int DOWNLOADS_REQUEST_CODE = 777;
@@ -71,8 +72,7 @@ public final class PermissionHelper {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(activity,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
- requestCode);
+ new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, requestCode);
// PERMISSION_WRITE_STORAGE is an
// app-defined int constant. The callback method gets the
@@ -83,6 +83,18 @@ public final class PermissionHelper {
return true;
}
+ public static boolean checkPostNotificationsPermission(final Activity activity,
+ final int requestCode) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
+ && ContextCompat.checkSelfPermission(activity,
+ Manifest.permission.POST_NOTIFICATIONS)
+ != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(activity,
+ new String[] {Manifest.permission.POST_NOTIFICATIONS}, requestCode);
+ return false;
+ }
+ return true;
+ }
/**
* In order to be able to draw over other apps,