-
Notifications
You must be signed in to change notification settings - Fork 867
Fixing grouped notification causing malformed url #4320
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
| call = call, | ||
| mode = null).apply { | ||
| flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP | ||
| data = Uri.parse("foobar://$call.callId") |
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.
there was a small string interop error here $call.callId instead of ${call.callId}, I wonder if it could have been causing some issues with the outgoing call notification 🤔
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.
Good catch! IDK about an issue fix here. It's OutgoingRingingCallNotification, @ganfra any idea?
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.
Don't think it's actually used
| // pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that | ||
| contentIntent.data = Uri.parse("foobar://" + inviteNotifiableEvent.eventId) | ||
| setContentIntent(PendingIntent.getActivity(context, 0, contentIntent, 0)) | ||
| contentIntent.makeUnique(inviteNotifiableEvent.eventId) |
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.
I think the comment above (// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that) is important.
This comes from Riot-Android
@BillCarsonFr can give his POV maybe?
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.
👍 would be great for some more context
I've still kept the uniqueness but now its from the intent.extras rather than the intent.data since the deeplink mechanism is reading from intent.data
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.
* Determine if two intents are the same for the purposes of intent
* resolution (filtering). That is, if their action, data, type, identity,
* class, and categories are the same. This does <em>not</em> compare
* any extra data included in the intents. Note that technically when actually
* matching against an {@link IntentFilter} the identifier is ignored, while here
* it is directly compared for equality like the other fields.
which means the extra is not enough to provide uniqueness 😢
android 29 provides a way to set a unique Id directly onto the intent which would work for pending intents but we need to support earlier versions.
I'll revert these changes and instead replace foobar:// with a constant which gets filtered by the intent handling
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
- fixes malformed url errors appearing for uri we only create to force uniqueness in the notifications
8d0a22f to
06b3cc3
Compare
| handlePermalink(permalinkData, deepLink, context, navigationInterceptor, buildTask) | ||
| return when { | ||
| deepLink == null -> false | ||
| deepLink.isIgnored() -> true |
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.
this is the fix, we're marking ignored deeplinks as handled to avoid attempting to handle them
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, not your fault, but this is where a doc would help, to understand what returning false or true means...
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.
I'm happy to fix in this PR or a separate one, will also use the opportunity to add some 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.
No hurry, can you just fix the commented out code issue and add a changelog file so I can prepare release 1.3.5. Thanks!
bmarty
left a comment
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 you, LGTM
| // the action must be unique else the parameters are ignored | ||
| quickReplyIntent.action = QUICK_LAUNCH_ACTION | ||
| quickReplyIntent.data = Uri.parse("foobar://$roomId") | ||
| quickReplyIntent.data = _root_ide_package_.im.vector.app.core.extensions.createIgnoredUri($roomId") |
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.
Strange change in this (commented out) code
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.
🤔 totally missed that, I guess android studio didn't like auto extracting within the commented code
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.
Yes, probably
| handlePermalink(permalinkData, deepLink, context, navigationInterceptor, buildTask) | ||
| return when { | ||
| deepLink == null -> false | ||
| deepLink.isIgnored() -> true |
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, not your fault, but this is where a doc would help, to understand what returning false or true means...
|
This PR will be merged, so I'm not requiring new changes here.
Can't we use this new API with |
😄 I think that would be the only advantage, we would have to support an extra code branch in the notifications and deeplinks 😢 |
Fixing #4267
We're attaching unhandled URIs to our notification data payload which the home screen then attempts to parse and fails.
These
Intent.dataURIs are needed because they enforce uniqueness of the intents (extras are not evaluated byIntent.filterEquals), android 29 introduces a dedicatedIntent.identifieraimed at handling this case but we'll have to wait awhile until 29 becomes the minimum version.For the time being this PR extracts the URI schema and filters it within the HomeActivity deeplink handling.