-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Replace notifications library with using platform APIs directly, on Android #2884
Conversation
Thanks @kunall17 ! Glad the instructions were helpful, too. Initial comments:
That logic has a very different job -- when the user presses a notification (for the main/"content" action, not our extra "clear" action), this is what receives that intent so we can pass it on to the JS code. That's what the job of ProxyService is in the library. As a result, if you run this commit and try receiving a notification and pressing it, I expect it won't work. I want to cut out that logic too (that's step 3 in the issue), but it should be in a separate commit, and of course each commit should leave things in a working state.
|
Before getting into the ID refresh, let's focus on steps 1-4. The first two bullets, and the last bullet, in my comment above are the major ones. |
5bf991a
to
0ac642d
Compare
Yeah, I've changed upon that.
Done that
No the tools:selector don't work in manifest and application tag, I tried it out. For this one
I have read for the GcmReceive, the category name of the intent filter should be same as the package name. But I tested it out for both of the package name's for the category name and it worked. I'll make this commit seperate and add links for this.
The CLEAR action works in all the commits, and I'll test the other narrowing thing as well. |
f883acc
to
6f2381a
Compare
Updated the branch @gnprice , tested both the clear action button and the narrowing to a message on dead and running state, both are working. bc6eb98 Replaces the hardcoded value of category name in the filter, but it isn't required as this was only for the projects having minSdkVersion lower than 16. So this commit can be omitted. |
Thanks again @kunall17 !
(cont'd) |
Hmm, interesting. Good find!
This is also an example of the kind of change I'd love to merge right up front, while the rest of the PR might still be in progress. (still reading) |
|
Add android/app/{.classpath, .project & .settings} to gitignore
No functional change, implements the ProxyService from the library repo to Zulip project. This adds tools:node="remove" in the Manifest to remove the registration of service which is made by the wix notifications library The bundle passing is the same
8e0d3ee
to
d669f7c
Compare
@gnprice Thanks for the comments above, I've updated the PR, and this has become a huge PR now :) |
I've re written the proxy service as
I've re written most of the parts, but someplaces it can be the same,
Static because this should be a singleton object and there should be only 1 of this in the whole application.
Yeah, that could be another commit. |
While moving the code I did like very negligible changes and in the further commits there are changes like the sound and the notification compat changes
Yes there were some deprecated functions before so I had to use the if condition, in the compat library there is a function which supports all the library and I suspect it's doing the same thing. |
d669f7c
to
b6155c4
Compare
This would make sure there is only 1 instance running in the whole application and help in getting a reference of this object from files
This moves the clearing of conversations in the ProxyService rather than the MainApplication and clears out a lot of logic from the MainApplication file Makes the converstaion LinkedHashMap a static object to have only 1 object of this data structure in the entire application and easily access this object in services
Uses merge rule markers in the manifest to eliminate the services and receivers which were added by the library And implement the services in our AndroidManifest.xml. This is for removing the libary completely in the future commits
This is a service which extends GcmListenerService and recieves the incoming GCM messages and send the message to be displayed as a notification
to custom implemented service. This has no visible changes only changes the service which was used to generate and display the notification.
This would simplify the setSound conditional logic for different API versions.
Generates GCM token using the sender ID stored in the AndroidManifest using an IntentService called GCMIdRefreshHandler. An additional service extended by InstanceIDListenerService is used to call the intent when the token is automatically updated by the google servers. In the JS side a function called refreshToken can be called via tha GcmTokenRefreshReactModule module and when the refresh process is completed, it is emitted into a notificationGcmTokenRefreshed event which can be collected in the JS module
Notification is saved on the native threads and is recieved by the javascript thread by the getInitialNotification using the ZulipNotificationModule
On notification pressed while running state, java emits a notification bundle to the listener called `notificationOpened`
Also removes the services which were patched in the manifest file
b6155c4
to
b6eee02
Compare
Thanks for the review @gnprice, if you're free some time, could we discuss how can it be improved as I'm interested in taking a fresh start on this PR? |
Fixes #2877
The last part of refreshing the ID's is still going on
Thanks for the instructions in the issues @gnprice