Skip to content

DROID-3636 Notifications | Firebase device token #2406

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

konstantiniiv
Copy link
Collaborator

@konstantiniiv konstantiniiv commented May 15, 2025


  • I understand that contributing to this repository will require me to agree with the CLA

Description

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 tech-docs
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

@konstantiniiv konstantiniiv requested a review from uburoiubu as a code owner May 15, 2025 12:45
@konstantiniiv konstantiniiv changed the title Droid 3636 firebase messaging service implementation device token DROID-3636 Notifications | Firebase device token May 15, 2025
@konstantiniiv konstantiniiv self-assigned this May 15, 2025
@konstantiniiv konstantiniiv requested a review from Copilot May 15, 2025 13:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates Firebase Messaging for device token retrieval by replacing the legacy SharedPreferences-based implementation. Key changes include:

  • Replacing local token storage with Firebase token retrieval in DeviceTokenStoringServiceImpl.
  • Adding Firebase messaging dependencies in build.gradle.
  • Removing SharedPreferences injection from the DI module.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
device/src/main/java/com/anytypeio/anytype/device/DeviceTokenStoringServiceImpl.kt Refactored token storage to use FirebaseMessaging and removed SharedPreferences usage.
device/build.gradle Added Firebase BOM and Firebase Messaging dependency.
app/src/main/java/com/anytypeio/anytype/di/main/SubscriptionsModule.kt Removed SharedPreferences injection in favor of the new Firebase-based approach.

@konstantiniiv konstantiniiv requested a review from Copilot May 15, 2025 13:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the device token handling to use Firebase Messaging for retrieving the device token, eliminating the dependency on SharedPreferences in favor of real‐time token fetching. Key changes include:

  • Removal of SharedPreferences injection and usage in DeviceTokenStoringServiceImpl.
  • Integration of FirebaseMessaging token retrieval with corresponding success and failure handling.
  • Updates to build.gradle and dependency injection to support Firebase Messaging.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
device/src/main/java/com/anytypeio/anytype/device/DeviceTokenStoringServiceImpl.kt Replaces SharedPreferences token handling with FirebaseMessaging token fetch and updates token accordingly.
device/build.gradle Adds Firebase BOM and Firebase Messaging dependency.
app/src/main/java/com/anytypeio/anytype/di/main/SubscriptionsModule.kt Removes injection of SharedPreferences in favor of the updated token storing service.
Comments suppressed due to low confidence (1)

device/src/main/java/com/anytypeio/anytype/device/DeviceTokenStoringServiceImpl.kt:39

  • [nitpick] Consider renaming 'proceedWithUpdatingToken' to something like 'updateDeviceToken' to more clearly reflect its purpose.
private fun proceedWithUpdatingToken(token: String?) {

@konstantiniiv konstantiniiv merged commit d683042 into main May 15, 2025
3 checks passed
@konstantiniiv konstantiniiv deleted the droid-3636-firebase-messaging-service-implementation-device-token branch May 15, 2025 15:13
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants