Skip to content
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

Supporting images in notifications #4402

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented Nov 3, 2021

Fixes #1697, relies on #4401 refactor

Adds image support to the message notifications

  • Downloads the image as part of the notification event resolving chain
  • Temporarily exposes the image via FileProvider Uri in order to allow the notifications to read and display the image
EXPANDED GROUP WITH TEXT EXPANDED GROUP GROUP COLLAPSED GROUP SUMMARY SINGLE ROOM LIST
Screenshot_20211103_154653 Screenshot_20211103_154629 Screenshot_20211103_154620 Screenshot_20211103_154612 Screenshot_20211103_154705 after-room-list

@github-actions
Copy link

github-actions bot commented Nov 3, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   58s ⏱️ +8s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 1eb544e. ± Comparison against base commit 88fbb8f.

♻️ This comment has been updated with latest results.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One remark, plus:

  • You want to merge that PR into feature/adm/single-transaction-push (and not develop)?
  • Changelog please :)
  • BigPictureStyle does not need to be used (see Render image in notification #1697)?

private suspend fun TimelineEvent.fetchImageIfPresent(session: Session): Uri? {
return when {
root.isEncrypted() && root.mxDecryptionResult == null -> null
root.getClearType() == EventType.MESSAGE -> downloadAndExportImage(session)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should filter on msgtype here, since the attachment is not necessarily an image, be can be anything else. Event.isImageMessage() can help to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will do!

@ouchadam
Copy link
Contributor Author

ouchadam commented Nov 3, 2021

  • You want to merge that PR into feature/adm/single-transaction-push (and not develop)?

It would be great to merge this after feature/adm/single-transaction-push, I split the refactor from the implementation to help with the diff

  • Changelog please :)

👍 will add (was originally planning to add as part of the feature PR

correct, not needed because we're already using the MessageStyle which supports inline images

BigPictureStyle would only work for 1 off notifications meaning we would lose the conversation aspect of the notification

@bmarty
Copy link
Member

bmarty commented Nov 3, 2021

Thanks for the explanations about BigPictureStyle.

I still think there is something strange in your branches since I see this on the other PR:
image
And here:
image
So it looks a bit "crossy"

@ouchadam
Copy link
Contributor Author

ouchadam commented Nov 3, 2021

the branches are

feature/adm/feature-notification-images branched from develop (feature branch)
feature/adm/single-transaction-push branched from the feature branch, contains the noisy refactor
feature/adm/notification-images branched from the refactor, contains the logic to enable images

merging #4401 will automatically update #4402 to point to the feature branch and when #4402 is merged I'll raise the feature PR against develop with the idea that this larger PR doesn't need a code review as it's the combination of the reviewed sub PRs

the main aim is to keep the PR diffs more contained and (hopefully 🤞 ) easier to review

I might create a label for depends on other PR

@ouchadam ouchadam added the Z-Depends-on-PR The PR can be review but not merged as it depends on another PR label Nov 3, 2021
@bmarty
Copy link
Member

bmarty commented Nov 3, 2021

Ah there are 3 branches, my bad

@ouchadam ouchadam force-pushed the feature/adm/notification-images branch from 73a224e to 1eb544e Compare November 4, 2021 10:44
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Base automatically changed from feature/adm/single-transaction-push to feature/adm/feature-notification-images November 5, 2021 15:03
@ouchadam ouchadam removed the Z-Depends-on-PR The PR can be review but not merged as it depends on another PR label Nov 5, 2021
@ouchadam ouchadam merged commit d80ca29 into feature/adm/feature-notification-images Nov 5, 2021
@ouchadam ouchadam deleted the feature/adm/notification-images branch November 5, 2021 15:04
@ouchadam ouchadam mentioned this pull request Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants