-
Notifications
You must be signed in to change notification settings - Fork 176
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
Notifications: simplify the flow by removing persistence #2924
Notifications: simplify the flow by removing persistence #2924
Conversation
…eans a bump of minSdk to `24`.
…working as expected
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
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.
Some first remarks. There is a regression regarding shouldIgnoreEventInRoom
, please see my comment.
I keep testing the application.
import javax.inject.Inject | ||
|
||
/** | ||
* Remove notifications.bin file, used to store notification data locally. |
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.
Perfect, thanks!
migration.migrate() | ||
|
||
// Check that the file has been deleted | ||
assertThat(file.exists()).isFalse() |
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 to ensure that the test behaves as expected, I would add
assertThat(file.exists()).isTrue()
before invoking migration.migrate()
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.
if (NotificationConfig.SUPPORT_JOIN_DECLINE_INVITE) { | ||
addAction(rejectInvitationActionFactory.create(inviteNotifiableEvent)) | ||
addAction(acceptInvitationActionFactory.create(inviteNotifiableEvent)) | ||
} |
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.
Thanks for un-commenting this and wrtting the code which does the actions!
@@ -59,16 +59,16 @@ class AndroidMediaPreProcessorTest { | |||
assertThat(data.file.path).endsWith("image.png") | |||
val info = data as MediaUploadInfo.Image | |||
// Computing thumbnailFile is failing with Robolectric | |||
assertThat(info.thumbnailFile).isNull() | |||
assertThat(info.thumbnailFile).isNotNull() |
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.
Maybe remove the comment above?
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.
@Provides | ||
fun provideNotificationCompatManager(@ApplicationContext context: Context): NotificationManagerCompat { | ||
return NotificationManagerCompat.from(context) | ||
} |
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.
Maybe Inject NotificationManagerCompat
at some other places? You can look for NotificationManagerCompat.from
to see where.
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.
} | ||
|
||
override fun count(): Int { | ||
return getAllNotifications().size |
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.
return getAllNotifications().size | |
return getNotificationsForSession(sessionId).size |
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.
...kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt
Show resolved
Hide resolved
...kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt
Show resolved
Hide resolved
...kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt
Show resolved
Hide resolved
val type = when (it) { | ||
is InviteNotifiableEvent -> ProcessedEvent.Type.KEEP | ||
is NotifiableMessageEvent -> when { | ||
it.shouldIgnoreEventInRoom(appState) -> { |
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.
The call to shouldIgnoreEventInRoom
was useful.
Now the notifications for new events are displayed even when the user is currently watching the room timeline.
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.
Oh, true. I'll have to restore it, thanks!
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.
e10832a
to
d7e38cf
Compare
Quality Gate passedIssues Measures |
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.
Thanks for the update!
Fix small issue introduced in #2924.
Type of change
Content
24
, since it's needed to be able to reuseMessagingStyle
notifications and get rid of the persistence.Motivation and context
Having this persistence layer was needed for APIs 21-23, but it means having to handle a lot more logic than needed and ended up causing issues as #609 and probably #790.
While we could spend time trying to fix those issues, it's probably better to just drop support for persistence since the number of users in those Android versions are quite low and once we've bumped the minSdk there's no need to keep supporting our custom persistence layer anymore.
Tests
Any other use case that comes to mind.
Tested devices
Checklist