[PR #3176] [PM-7631] Handle new FCMv1 format #4074

Closed
opened 2025-11-26 23:40:17 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/bitwarden/android/pull/3176

State: closed
Merged: Yes


Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Google is deprecating their legacy FCM endpoints (GCM), so migrate to FCMv1 as outlined by Microsoft:

https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-gcm-to-fcm

ref: https://github.com/bitwarden/server/pull/3917

(old) GCM format:

{
  "data": {
    "data": {
      "type": 1,
      "payload": "JSON_Data"
    }
  }
}

(new) FCM format:

{
  "message": {
    "data": {
      "type": "1",
      "payload": "JSON_Data"
    }
  }
}

Code changes

  • FirebaseMessagingService.cs: Update remote message parsing to account for GCM and FCM message formats. GCM is detected and kept as-is. FCM is detected and re-constructed into a JObject to match the existing GCM format.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
**Original Pull Request:** https://github.com/bitwarden/android/pull/3176 **State:** closed **Merged:** Yes --- ## Type of change - [ ] Bug fix - [x] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective Google is deprecating their legacy FCM endpoints (GCM), so migrate to FCMv1 as outlined by Microsoft: https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-gcm-to-fcm ref: https://github.com/bitwarden/server/pull/3917 (old) GCM format: ``` { "data": { "data": { "type": 1, "payload": "JSON_Data" } } } ``` (new) FCM format: ``` { "message": { "data": { "type": "1", "payload": "JSON_Data" } } } ``` ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **FirebaseMessagingService.cs:** Update remote message parsing to account for GCM and FCM message formats. GCM is detected and kept as-is. FCM is detected and re-constructed into a JObject to match the existing GCM format. ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team
GiteaMirror added the pull-request label 2025-11-26 23:40:17 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#4074