-
Notifications
You must be signed in to change notification settings - Fork 928
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
Fix NoSuchElementException in notification content plugin #2828
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
fun PluginPoint<VpnEnabledNotificationContentPlugin>.getHighestPriorityPlugin(): VpnEnabledNotificationContentPlugin { | ||
return getPlugins().filter { it.isActive() }.maxBy { it.getPriority().ordinal } | ||
fun PluginPoint<VpnEnabledNotificationContentPlugin>.getHighestPriorityPlugin(): VpnEnabledNotificationContentPlugin? { | ||
return runCatching { getPlugins().filter { it.isActive() }.maxByOrNull { it.getPriority().ordinal } }.getOrNull() |
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.
Is it necessary to wrap this in runCatching? We can also add tests here to check.
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.
Just saw the explanation in Asana. 👍
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.
Nice, added tests
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.
LGTM. 👍
805dadb
to
412eb62
Compare
412eb62
to
30a9439
Compare
Task/Issue URL: https://app.asana.com/0/488551667048375/1203928902312895/f ### Description See [asana task](https://app.asana.com/0/488551667048375/1203928902312895/f) for description ### Steps to test this PR _AppTP Notifications_ - [x] fresh install from this branch - [x] launch app and enable AppTP - [x] verify ongoing notification shows and text is `Scanning for tracking activity… beep… boop` - [x] open any one app that tracks - [x] verify ongoing notification shows and text is `Tracking attempts blocked in 1 app (past hour).` - [x] open any second app that tracks - [x] verify ongoing notification shows and text is `Tracking attempts blocked across 2 apps (past hour).` - [x] Force close the app - [x] notification should disappear - [x] re-open app - [x] verify ongoing notification shows and text is `Tracking attempts blocked across 2 apps (past hour).` - [x] verify tapping on the notification takes the user to AppTP screen
Task/Issue URL: https://app.asana.com/0/488551667048375/1203928902312895/f
Description
See asana task for description
Steps to test this PR
AppTP Notifications
Scanning for tracking activity… beep… boop
Tracking attempts blocked in 1 app (past hour).
Tracking attempts blocked across 2 apps (past hour).
Tracking attempts blocked across 2 apps (past hour).