-
Notifications
You must be signed in to change notification settings - Fork 1
feat!: update to android 15 2025 12 14 #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Permission dialogs may stack causing confusing UX
The checkNotificationPermission() call at line 260 is non-blocking - it either shows an AlertDialog or triggers the system permission request, both of which return immediately. The code then proceeds directly to the battery optimization check at line 263, which may show another AlertDialog. On Android 13+ devices that haven't granted notification permission and haven't dismissed the battery warning, both dialogs can appear simultaneously, stacking on top of each other and confusing users. The battery optimization check needs to be deferred until after the notification permission flow completes.
android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt#L258-L286
CalendarNotification/android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt
Lines 258 to 286 in 6eb1fe7
| else { | |
| // Check notification permission (Android 13+) | |
| checkNotificationPermission() | |
| // if we have essential permissions - now check for power manager optimisations | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !settings.doNotShowBatteryOptimisationWarning) { | |
| if (!powerManager.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID)) { | |
| AlertDialog.Builder(this) | |
| .setTitle(getString(R.string.battery_optimisation_title)) | |
| .setMessage(getString(R.string.battery_optimisation_details)) | |
| .setPositiveButton(getString(R.string.you_can_do_it)) @TargetApi(Build.VERSION_CODES.M) { | |
| _, _ -> | |
| val intent = Intent() | |
| .setAction(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) | |
| .setData(Uri.parse("package:" + BuildConfig.APPLICATION_ID)) | |
| startActivity(intent) | |
| } | |
| .setNeutralButton(getString(R.string.you_can_do_it_later)) { | |
| _, _ -> | |
| } | |
| .setNegativeButton(getString(R.string.you_cannot_do_it)) { | |
| _, _ -> | |
| settings.doNotShowBatteryOptimisationWarning = true | |
| } | |
| .create() | |
| .show() | |
| } |
android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt#L294-L314
CalendarNotification/android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt
Lines 294 to 314 in 6eb1fe7
| */ | |
| private fun checkNotificationPermission() { | |
| if (!PermissionsManager.hasNotificationPermission(this)) { | |
| if (PermissionsManager.shouldShowNotificationRationale(this)) { | |
| AlertDialog.Builder(this) | |
| .setTitle(R.string.notification_permission_title) | |
| .setMessage(R.string.notification_permission_explanation) | |
| .setCancelable(false) | |
| .setPositiveButton(android.R.string.ok) { _, _ -> | |
| PermissionsManager.requestNotificationPermission(this) | |
| } | |
| .setNegativeButton(R.string.cancel) { _, _ -> | |
| // User declined, they won't get notifications | |
| } | |
| .create() | |
| .show() | |
| } else { | |
| PermissionsManager.requestNotificationPermission(this) | |
| } | |
| } | |
| } |
Code Coverage Report
|
📊 Code Coverage Summary
|
maybe kotlin build issue
📊 Code Coverage Summary
|
📊 Code Coverage Summary
|
📊 Code Coverage Summary
|
📊 Code Coverage Summary
|
Note
Updates app for Android 15 (API 35): adds notification channels, POST_NOTIFICATIONS flow, USE_EXACT_ALARM, explicit component exports, and immutable PendingIntents, with supporting tests and Gradle changes.
compileSdkVersion/targetSdkVersionto35inandroid/app/build.gradleandandroid/build.gradle.POST_NOTIFICATIONSandUSE_EXACT_ALARM.android:exportedon activities/receivers/services; adjust runtime receiver registration (Context.RECEIVER_NOT_EXPORTED) on 33+.notification/NotificationChannels.kt; create channels on app start viaGlobalState.NotificationCompat.Buildercalls now supply channel IDs; grouped/summary notifications updated accordingly.pendingIntentFlagCompat()and apply to allPendingIntentusages (notifications, alarms, rescans).SystemUtils.ktto use compatible flags.PermissionsManagerandui/MainActivity.CalendarProvider,CalendarIntents,EditEventActivity,ViewEventActivityNoRecents).NotificationChannelsRobolectricTest,NotificationPermissionRobolectricTest,PendingIntentFlagsRobolectricTest..cursor/plans/*,docs/dev_todo/raise_min_sdk.md, rules update).Written by Cursor Bugbot for commit a0bd611. This will update automatically on new commits. Configure here.