Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId = "co.adityarajput.notifilter"
minSdk = 29
targetSdk = 36
versionCode = 16
versionName = "4.1.0"
versionCode = 17
versionName = "4.1.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sealed class Action {
fun isOfType(it: Action) = this::class == it::class

companion object {
val entries = listOf(DISMISS, TAP_NOTIFICATION, TAP_BUTTON(""), BATCH(3), DELAY)
val entries by lazy { listOf(DISMISS, TAP_NOTIFICATION, TAP_BUTTON(""), BATCH(3), DELAY) }

fun fromString(value: String) = when {
value == "DISMISS" -> DISMISS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,15 @@ class NotificationListener : NotificationListenerService() {
if (sbn.notification.flags and FLAG_GROUP_SUMMARY != 0) {
Logger.d(
"NotificationListener.onNotificationPosted",
"Ignoring group summary notification",
"Ignoring group summary notification $sbn",
)
return
}

Logger.d(
"NotificationListener.onNotificationPosted",
"Received $sbn with extras ${sbn.notification.extras}",
)
val notification = Notification(sbn)
Logger.d("NotificationListener.onNotificationPosted", "Received $notification")

Expand All @@ -127,7 +131,15 @@ class NotificationListener : NotificationListenerService() {
when (filter.action) {
is Action.DISMISS ->
if (sbn.isClearable) {
cancelNotification(sbn.key)
try {
cancelNotification(sbn.key)
} catch (e: Throwable) {
Logger.e(
"NotificationListener.onNotificationPosted",
"Failed to dismiss notification",
e,
)
}
} else {
Logger.d("NotificationListener.onNotificationPosted", "Is unclearable")
snoozeNotification(sbn.key, 5 * 60 * 60 * 1000L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import androidx.compose.ui.text.style.TextDecoration
import androidx.lifecycle.viewmodel.compose.viewModel
import co.adityarajput.notifilter.R
import co.adityarajput.notifilter.data.models.*
import co.adityarajput.notifilter.utils.Logger
import co.adityarajput.notifilter.utils.filterFirst
import co.adityarajput.notifilter.utils.getFirst
import co.adityarajput.notifilter.utils.hasAccessibilityServicePermission
Expand Down Expand Up @@ -542,7 +543,17 @@ private fun ActionPage(viewModel: UpsertFilterViewModel) {
) {
ErrorText(R.string.accessibility_service_description)
Button(
{ context.startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)) },
{
try {
context.startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
} catch (e: Exception) {
Logger.e(
"UpsertFilterScreen",
"Error opening accessibility settings",
e,
)
}
},
Modifier.align(Alignment.CenterHorizontally),
colors = ButtonDefaults.buttonColors(contentColor = MaterialTheme.colorScheme.onPrimaryContainer),
) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">NotiFilter</string>
<string name="app_name_launcher">NotiFilter</string>
<string name="app_version">4.1.0</string>
<string name="app_version">4.1.1</string>

<string name="no_filters">No filters added.\nTap + to get started.</string>
<string name="on_weekdays">"on weekdays "</string>
Expand Down
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
• fix: Untangle cyclical initialization of Action