diff --git a/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java index 25be71b8..0c7ba784 100644 --- a/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -24,4 +24,6 @@ private CompatUtils() {} public static boolean isImeVisible(View view) { return false; } + + public static void grantNotificationPermissionIfNeeded(Activity activity) {} } \ No newline at end of file diff --git a/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java index 25be71b8..0c7ba784 100644 --- a/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -24,4 +24,6 @@ private CompatUtils() {} public static boolean isImeVisible(View view) { return false; } + + public static void grantNotificationPermissionIfNeeded(Activity activity) {} } \ No newline at end of file diff --git a/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java index 347e0c03..31330f4b 100644 --- a/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -16,7 +16,7 @@ package com.farmerbb.taskbar.util; // Utility class meant for compatibility between the Android-x86 version of Taskbar (compiled with SDK 28) -// and the Play Store version of Taskbar (compiled with SDK 30). +// and the Play Store version of Taskbar (compiled with SDK 34). // TODO Do not make changes to this file without making corresponding changes to the Android-x86 version. import android.os.Build; @@ -31,4 +31,6 @@ public static boolean isImeVisible(View view) { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && view.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); } + + public static void grantNotificationPermissionIfNeeded(Activity activity) {} } \ No newline at end of file diff --git a/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java index 347e0c03..31330f4b 100644 --- a/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -16,7 +16,7 @@ package com.farmerbb.taskbar.util; // Utility class meant for compatibility between the Android-x86 version of Taskbar (compiled with SDK 28) -// and the Play Store version of Taskbar (compiled with SDK 30). +// and the Play Store version of Taskbar (compiled with SDK 34). // TODO Do not make changes to this file without making corresponding changes to the Android-x86 version. import android.os.Build; @@ -31,4 +31,6 @@ public static boolean isImeVisible(View view) { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && view.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); } + + public static void grantNotificationPermissionIfNeeded(Activity activity) {} } \ No newline at end of file diff --git a/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java index 347e0c03..3dcee136 100644 --- a/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -1,4 +1,4 @@ -/* Copyright 2020 Braden Farmer +/* Copyright 2024 Braden Farmer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,12 @@ package com.farmerbb.taskbar.util; // Utility class meant for compatibility between the Android-x86 version of Taskbar (compiled with SDK 28) -// and the Play Store version of Taskbar (compiled with SDK 30). +// and the Play Store version of Taskbar (compiled with SDK 34). // TODO Do not make changes to this file without making corresponding changes to the Android-x86 version. +import android.Manifest; +import android.app.Activity; +import android.content.pm.PackageManager; import android.os.Build; import android.view.View; import android.view.WindowInsets; @@ -31,4 +34,11 @@ public static boolean isImeVisible(View view) { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && view.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); } + + public static void grantNotificationPermissionIfNeeded(Activity activity) { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU + && activity.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) { + activity.requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, 42); + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java index 00031aea..1061ad1c 100644 --- a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java +++ b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java @@ -56,6 +56,7 @@ import com.farmerbb.taskbar.service.TaskbarService; import com.farmerbb.taskbar.helper.GlobalHelper; import com.farmerbb.taskbar.helper.FreeformHackHelper; +import com.farmerbb.taskbar.util.CompatUtils; import com.farmerbb.taskbar.util.DependencyUtils; import com.farmerbb.taskbar.helper.LauncherHelper; import com.farmerbb.taskbar.util.U; @@ -237,9 +238,10 @@ private void proceedWithAppLaunch(Bundle savedInstanceState) { } navigateTo(new ManageAppDataFragment()); - } else if(!getIntent().hasExtra("theme_change")) + } else if(!getIntent().hasExtra("theme_change")) { + CompatUtils.grantNotificationPermissionIfNeeded(this); navigateTo(new AboutFragment()); - else + } else navigateTo(new AppearanceFragment()); } else try { Fragment oldFragment = getFragmentManager().findFragmentById(R.id.fragmentContainer); diff --git a/app/src/playstore/AndroidManifest.xml b/app/src/playstore/AndroidManifest.xml index b75a2dde..f95fd938 100644 --- a/app/src/playstore/AndroidManifest.xml +++ b/app/src/playstore/AndroidManifest.xml @@ -50,6 +50,7 @@ + diff --git a/build.gradle b/build.gradle index 46333897..829b64b7 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:${AGP_VERSION}" - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.5' } }