Skip to content

fix: refresh push token from settings - WPB-27858 - #5021

Merged
samwyndham merged 4 commits into
developfrom
mo/refresh-push-token-from-settings
Aug 12, 2026
Merged

fix: refresh push token from settings - WPB-27858#5021
samwyndham merged 4 commits into
developfrom
mo/refresh-push-token-from-settings

Conversation

@MohamadJaara

@MohamadJaara MohamadJaara commented Jul 16, 2026

Copy link
Copy Markdown
Member
BugWPB-27858 [iOS] Reset Push Notification Tool re-uploads cached token

Issue

nse is not triggered at all in the background despite the logs showing the post request for the push token returning 200 11 times

my theory is the token is stale the btn only upload the same cached token over and over again, this change will make it so the cache is cleared and the app ask the system for the current token

Testing

login and click the "Reset Push Notifications Token" btn


Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

Copilot AI review requested due to automatic review settings July 16, 2026 19:27
@MohamadJaara MohamadJaara reopened this Jul 16, 2026
@MohamadJaara
MohamadJaara marked this pull request as draft July 16, 2026 19:29
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Test Results

3 073 tests   3 046 ✅  3m 39s ⏱️
  438 suites     27 💤
    2 files        0 ❌

Results for commit 7e6d667.

♻️ This comment has been updated with latest results.

Summary: workflow run #31489007772
Allure report (download zip): html-report-32726-mo_refresh-push-token-from-settings

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 “Reset Push Notifications Token” action in Advanced Settings to explicitly clear the cached APNS push token before re-triggering push token configuration, addressing cases where repeated uploads may reuse a stale cached token and prevent expected background behavior (e.g., NSE not being triggered).

Changes:

  • Switch the Advanced Settings reset action from validatePushToken() to the new refreshPushToken() API.
  • Add ZMUserSession.refreshPushToken() to clear PushTokenStorage.pushToken and re-run push token configuration.
  • Add a unit test to verify the cached push token is cleared and token configuration is invoked.

Reviewed changes

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

File Description
wire-ios/Wire-iOS/Sources/UserInterface/Settings/CellDescriptors/SettingsCellDescriptorFactory+Advanced.swift Updates the settings action to call refreshPushToken() when resetting the push token.
wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+Push.swift Adds refreshPushToken() to clear the cached token and re-trigger push token configuration.
wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests+PushNotifications.swift Adds a unit test covering the new refresh behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@netbe

netbe commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

@MohamadJaara what logs do you refer to ?

@MohamadJaara

MohamadJaara commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@MohamadJaara what logs do you refer to ?

will send em to you in 1:1

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@MohamadJaara
MohamadJaara marked this pull request as ready for review July 23, 2026 15:45
@MohamadJaara
MohamadJaara marked this pull request as draft July 23, 2026 15:45
@samwyndham

Copy link
Copy Markdown
Collaborator

Closing this for now but will check this PR for https://wearezeta.atlassian.net/browse/WPB-26944

@samwyndham samwyndham closed this Aug 3, 2026
@samwyndham samwyndham changed the title fix: refresh push token from settings fix: refresh push token from settings - WPB-27858 Aug 7, 2026
@samwyndham

Copy link
Copy Markdown
Collaborator

Re-opening with specific ticket number

@samwyndham samwyndham reopened this Aug 7, 2026

@samwyndham samwyndham left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work @MohamadJaara. I did just a tiny change to remove the old validatePushToken() method which is no longer needed.

@samwyndham
samwyndham marked this pull request as ready for review August 11, 2026 11:57
@samwyndham
samwyndham requested a review from johnxnguyen August 11, 2026 11:58
@samwyndham samwyndham self-assigned this Aug 11, 2026
@samwyndham
samwyndham enabled auto-merge August 11, 2026 13:13
@samwyndham
samwyndham added this pull request to the merge queue Aug 12, 2026
Merged via the queue into develop with commit 1147adc Aug 12, 2026
12 checks passed
@samwyndham
samwyndham deleted the mo/refresh-push-token-from-settings branch August 12, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants