Skip to content

feat: node-gcm deprecation#32208

Merged
ggazzo merged 21 commits intodevelopfrom
feat/fcm-deprecation
Apr 23, 2024
Merged

feat: node-gcm deprecation#32208
ggazzo merged 21 commits intodevelopfrom
feat/fcm-deprecation

Conversation

@Gustrb
Copy link
Copy Markdown
Contributor

@Gustrb Gustrb commented Apr 15, 2024

Proposed changes (including videos or screenshots)

Currently, we are using a library called node-gcm to send native notifications via firebase. Unfortunately Firebase is deprecating a series of libraries related to notifications (see https://firebase.google.com/support/faq?hl=pt-br#fcm-23-deprecation), and, because of this, the library we used to use is not going to be updated, mostly in favor of using the oficial firebase SDK.
We discussed about the use of the oficial package, but the oficial package bundles up every firebase feature inside a huge library, even though we just use a comically small subset of the features (sending notifications).
Therefore, we decided on not using the Firebase SDK and just using HTTP requests to send native notifications.

Backportability

This feature is tricky on this regard, because this API is going to stop working, so we need to add a feature flag (using a setting for it), because everyone who is using supported versions of Rocket.Chat need native notifications to work, so we add a flag called Push_UseLegacy, if it is set to true, we will use the old api (using node-gcm), if it is false, it is going to use our HTTP wrapper on the notification service.

Issue(s)

#32124

Steps to test or reproduce

First, it will be needed a way to connect a mobile device into the local server, you can choose whatever way you want, I am using a tunneling application called ngrok.
So, first I will start the application, on port 3000 (default) and then I will start ngrok there, you can do it like this:

$ ngrok http http://localhost:3000

After running the command, you will have a terminal interface, and you will see the URL the application is forwarding your local webserver, copy that value or save it somewhere, it will be needed later!
(it is a weird URL, something like: https://9d8c-191-243-134-83.ngrok-free.app)

So now, to test it you will need a test build of the application, please @ me on open, I can send you the build I am using 😎

Download the build and install it on your device.
Open the app, and it will ask you for the URL of the workspace, in this field, please, put the forwarded URL by ngrok.

Ok, so now, most of the config on the mobile side is done, now there are a few config's needed to enable the new notification provider:
1 - Go to settings>push
2 - Disable Push_UseLegacy
3 - Get the credentials JSON and paste it into Push_google_api_credentials

No we should be ready to go!
Just create a new user on your phone (don't have to, but it will be easier), and now, go on your workspace open in your computer, and ping the new user in the #general channel, you should get a notification on your phobe

Further comments

I've used https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?hl=pt-br to type out the request type 😛

CONN-73

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 15, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2024

🦋 Changeset detected

Latest commit: 31b1c1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 32 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/models Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-video-conf Major
@rocket.chat/uikit-playground Patch
@rocket.chat/web-ui-registration Major
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.85%. Comparing base (a8e1a46) to head (d5290a2).
Report is 1 commits behind head on develop.

❗ Current head d5290a2 differs from pull request most recent head 31b1c1e. Consider uploading reports for the commit 31b1c1e to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #32208      +/-   ##
===========================================
- Coverage    55.43%   54.85%   -0.59%     
===========================================
  Files         2330     2276      -54     
  Lines        51376    50409     -967     
  Branches     10514    10271     -243     
===========================================
- Hits         28479    27650     -829     
+ Misses       20409    20288     -121     
+ Partials      2488     2471      -17     
Flag Coverage Δ
e2e 53.76% <ø> (-1.09%) ⬇️
unit 74.92% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@Gustrb Gustrb changed the title feat: node-gcm deprecation [WIP] feat: node-gcm deprecation Apr 19, 2024
@Gustrb Gustrb marked this pull request as ready for review April 19, 2024 04:31
@Gustrb Gustrb requested a review from a team as a code owner April 19, 2024 04:31
@debdutdeb debdutdeb self-requested a review April 19, 2024 04:48
@Gustrb Gustrb requested a review from pierre-lehnen-rc April 19, 2024 11:47
@Gustrb Gustrb added this to the 6.8 milestone Apr 19, 2024
@Gustrb Gustrb requested a review from pierre-lehnen-rc April 19, 2024 17:56
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Apr 23, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 23, 2024
@ggazzo ggazzo merged commit 863d7eb into develop Apr 23, 2024
@ggazzo ggazzo deleted the feat/fcm-deprecation branch April 23, 2024 12:44
gabriellsh added a commit that referenced this pull request Apr 23, 2024
…engagementMDM

* 'develop' of github.com:RocketChat/Rocket.Chat:
  chore: including x.com hostname to Twitter oembed (#32267)
  feat: node-gcm deprecation (#32208)
  chore: Deprecate mute/unmute meteor methods and convert to endpoint (#31811)
  fix:  Wrong Business hours validations between different weeks (#32287)
  chore: Force logout live clients on E2EE keys reset changes (#32291)
  ci: skip update version message for TEST_MODE=true (#32293)
@sampaiodiego
Copy link
Copy Markdown
Member

/patch

@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.7.3

dionisio-bot bot pushed a commit that referenced this pull request May 17, 2024
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented May 17, 2024

Pull request #32448 added to Project: "Patch 6.7.3"

@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.6.8

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented May 17, 2024

Sorry, I couldn't do that backport because of conflicts. Could you please solve them?

you can do so by running the following commands:

git fetch
git checkout backport-6.6.8-32208
git cherry-pick 863d7ebaef70037720309591ddd84a683da6342b
// solve the conflict
git push

after that just run /backport 6.6.8 again

sampaiodiego pushed a commit that referenced this pull request May 17, 2024
@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.6.8

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented May 17, 2024

Pull request #32449 added to Project: "Patch 6.6.8"

@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.5.7

1 similar comment
@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.5.7

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented May 17, 2024

Sorry, I couldn't do that backport because of conflicts. Could you please solve them?

you can do so by running the following commands:

git fetch
git checkout backport-6.5.7-32208
git cherry-pick 863d7ebaef70037720309591ddd84a683da6342b
// solve the conflict
git push

after that just run /backport 6.5.7 again

sampaiodiego pushed a commit that referenced this pull request May 17, 2024
@sampaiodiego
Copy link
Copy Markdown
Member

/backport 6.5.7

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented May 17, 2024

Pull request #32450 added to Project: "Patch 6.5.7"

sampaiodiego pushed a commit that referenced this pull request May 17, 2024
sampaiodiego pushed a commit that referenced this pull request May 17, 2024
sampaiodiego pushed a commit that referenced this pull request May 17, 2024
dionisio-bot bot pushed a commit that referenced this pull request May 17, 2024
sampaiodiego pushed a commit that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants