Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add code to support the new notification system starting with iOS 10 #2207

Merged
merged 13 commits into from
Mar 21, 2019
Merged

Add code to support the new notification system starting with iOS 10 #2207

merged 13 commits into from
Mar 21, 2019

Conversation

fridtjof
Copy link
Contributor

@fridtjof fridtjof commented Jan 31, 2019

WARNING: I couldn't test any of this, because I can't build this app for anything except the simulator (I don't have a paid dev membership - necessary for some capabilities the app has, and also I don't have (for obvious reasons) the entitlements that would allow me to easily receive push notifications from the "official" New Vector push server, which is needed to test any notification related behaviour).
Therefore, I'm kindly asking for someone from the team to test my changes on a device with iOS 10 or higher. Feedback is much appreciated :)

This is the first step in supporting newer notifications features. By using the UserNotifications framework, we will be able to implement new notification features, like titles, grouping and more (see #2208)

Signed-off-by: Fridtjof Mund 2780577+fridtjof@users.noreply.github.com

@manuroe manuroe added this to the Sprint 18 milestone Jan 31, 2019
@manuroe
Copy link
Member

manuroe commented Jan 31, 2019

That's great. Thanks a lot @fridtjof.
It may take a bit of time for us to review and test it. That's why I consider it as a full task and I have added to our next sprint.

Copy link
Contributor

@SBiOSoftWhare SBiOSoftWhare left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, we are close to integrate UserNotifications framework in Riot thanks to you.

You are not obliged to fix all comments especially factorization ones. There are here for the record.

FYI we also have to make some changes on our side before using UserNotifications framework:

Indeed in settings the notification toggle value match -[MXKAccount isPushKitNotificationActive] value. This method rely on -[MXKAccountManager isPushAvailable] that check deprecated local notification API (UIUserNotificationSettings) to know if notifcation are enabled. Now we have to use -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] for this. The problem is that this method is asynchronous, this means that we have to make some rework before using UserNotifications framework and what you've done in this PR.

We also have to check periodically for notification settings changes as they could changed at any time. For example in applicationDidBecomeActive:.

In all cases thank you for your work we will mention you in changelogs when you're PR will be merged, if you are agree.

UNNotification *notification = response.notification;
UNNotificationContent *content = notification.request.content;
if ([[response actionIdentifier] isEqualToString:@"inline-reply"]) {
UNTextInputNotificationResponse *textResponse = (UNTextInputNotificationResponse *) response;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note:
Could be interesting to factorize inline reply code between the two APIs with a method signature like this for example:
- (void)handleNotificationInlineReplyForRoomId:(NSString*)roomId withResponseText:(NSString*)responseText success:(void(^)(NSString *eventId))success failure:(void(^)(NSError *error))failure.

@fridtjof
Copy link
Contributor Author

I forgot to push one slight refactor (8cb6b86) - this duplicates code for now, but is necessary in preparation for using the new notification features imo. I can roll it back and reintroduce it later though, if you (understandably) don't want the code duplication.

@fridtjof
Copy link
Contributor Author

fridtjof commented Mar 14, 2019

I addressed most of the reviews, as it's time for bed now. On each review, I linked the corresponding commit for easy referencing.
I want to add that I'm relatively new to contributing to open source projects, so I appreciate any feedback on how I could improve how I use git(hub) and if there's anything that I should do differently :)

@SBiOSoftWhare
Copy link
Contributor

I addressed most of the reviews, as it's time for bed now. On each review, I linked the corresponding commit for easy referencing.
I want to add that I'm relatively new to contributing to open source projects, so I appreciate any feedback on how I could improve how I use git(hub) and if there's anything that I should do differently :)

Nothing to add, you did a good job all issues has been addressed :) Thank you for your work, I will approve your PR and you will be mentioned in changelog when it will be merged

@SBiOSoftWhare SBiOSoftWhare changed the base branch from develop to riot_2337 March 21, 2019 15:44
@SBiOSoftWhare SBiOSoftWhare merged commit 93af475 into element-hq:riot_2337 Mar 21, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants