-
Notifications
You must be signed in to change notification settings - Fork 146
Issue/woomob 1909 add new local feature flag for woo notifications disabled by #15157
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
Merged
JorgeMucientes
merged 12 commits into
trunk
from
issue/woomob-1909-add-new-local-feature-flag-for-woo-notifications-disabled-by
Jan 16, 2026
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3a71ea0
Adds new PN feature flag
JorgeMucientes 971a4d1
Use new PN registration endpoint when feature flag enabled
JorgeMucientes 064447f
Revert accidental change
JorgeMucientes 309742f
Add new PushNotificationRepository to register device using new endpoint
JorgeMucientes 7b5983c
Remove deprecated annotation
JorgeMucientes d3fc945
Fix detekt indentation issues
JorgeMucientes d825a1c
Fix existing unit tests
JorgeMucientes bb33147
Merge branch 'trunk' into issue/woomob-1909-add-new-local-feature-fla…
JorgeMucientes 2851e9e
Remove unneeded TODO comment
JorgeMucientes fe9f03d
Ensure FCM token is not empty before registering PN token
JorgeMucientes aa1a156
Add extra log
JorgeMucientes 67b77dd
Merge branch 'trunk' into issue/woomob-1909-add-new-local-feature-fla…
JorgeMucientes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
.../src/main/kotlin/com/woocommerce/android/notifications/push/PushNotificationRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.woocommerce.android.notifications.push | ||
|
|
||
| import com.woocommerce.android.AppPrefsWrapper | ||
| import com.woocommerce.android.BuildConfig | ||
| import com.woocommerce.android.extensions.orNullIfEmpty | ||
| import com.woocommerce.android.tools.SelectedSite | ||
| import com.woocommerce.android.util.WooLog | ||
| import org.wordpress.android.fluxc.network.rest.wpcom.wc.pushnotifications.PushNotificationsStore | ||
| import java.util.UUID | ||
| import javax.inject.Inject | ||
|
|
||
| class PushNotificationRepository @Inject constructor( | ||
| private val pushNotificationsStore: PushNotificationsStore, | ||
| private val selectedSite: SelectedSite, | ||
| private val appPrefsWrapper: AppPrefsWrapper | ||
| ) { | ||
| suspend fun registerPushToken(token: String) { | ||
| WooLog.d( | ||
| tag = WooLog.T.NOTIFS, | ||
| message = "Registering FCM token in Woo Core instance${if (BuildConfig.DEBUG) ": $token" else ""}" | ||
| ) | ||
| selectedSite.getIfExists()?.let { | ||
| val uuid = appPrefsWrapper.wooCorePushDeviceUUID.orNullIfEmpty() ?: generateAndStoreUUID() | ||
| pushNotificationsStore.registerPushToken( | ||
| site = it, | ||
| token = token, | ||
| deviceUuid = uuid // TODO review we need to add any extra info to the uuid | ||
| ) | ||
| // TODO ensure any WP.com token already registered is removed | ||
| } | ||
|
JorgeMucientes marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| private fun generateAndStoreUUID(): String { | ||
| return UUID.randomUUID().toString().also { | ||
| appPrefsWrapper.wooCorePushDeviceUUID = it | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ enum class FeatureFlag { | |
| ORDER_CREATION_AUTO_TAX_RATE, | ||
| BOOKINGS_MVP, | ||
| POS_REFUNDS, | ||
| WOO_POS_LOCAL_CATALOG_FILE_APPROACH; | ||
| WOO_POS_LOCAL_CATALOG_FILE_APPROACH, | ||
| WOO_PUSH_NOTIFICATIONS_SYSTEM; | ||
|
|
||
| fun isEnabled(context: Context? = null): Boolean { | ||
| return when (this) { | ||
|
|
@@ -26,7 +27,8 @@ enum class FeatureFlag { | |
| BOOKINGS_MVP, | ||
| POS_REFUNDS -> PackageUtils.isDebugBuild() | ||
|
|
||
| WOO_POS_LOCAL_CATALOG_FILE_APPROACH -> false | ||
| WOO_POS_LOCAL_CATALOG_FILE_APPROACH, | ||
| WOO_PUSH_NOTIFICATIONS_SYSTEM -> false | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disabled by default for now to avoid breaking PN for all devs until the endpoint starts working |
||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we are reusing the existing logic to create the device UUID. Asked Hannah here: https://wp.me/pe5sF9-4OM#comment-5081 if the current strategy is good enough.