Skip to content

Force upgrade#368

Open
OluRemiFour wants to merge 10 commits into
ChainForgee:mainfrom
OluRemiFour:force-upgrade
Open

Force upgrade#368
OluRemiFour wants to merge 10 commits into
ChainForgee:mainfrom
OluRemiFour:force-upgrade

Conversation

@OluRemiFour

Copy link
Copy Markdown

Closes #300

Summary

Mobile App (app/mobile/)

  • Updated src/services/updateService.ts :

    • Added getAuthToken , setAuthToken , clearAuthToken functions for handling authentication tokens
    • Updated fetchVersionInfo to send auth token in headers if available
    • Added handling for 401 Unauthorized errors, throwing a specific error for UpdateContext to handle
  • Updated src/contexts/UpdateContext.tsx :

    • Added handling for 401 errors: refreshes auth token (via refreshAuthToken mock) and retries checkUpdates once
    • Tracks retry count to avoid infinite loops
  • Added src/tests/updateContext.test.tsx :

    • Integration tests simulating stale token (401)
    • Verifies token refresh and retry behavior
    • Verifies no infinite loops (only 1 retry)

Backend (app/backend/)

  • Updated src/app.controller.ts :
    • Added GET /mobile/version endpoint that returns version information (latest version, min required, release notes, store links)
      These changes ensure that when the /mobile/version endpoint returns a 401 due to a stale token, the app automatically refreshes the token and retries without requiring manual restart.

Testing

# example
npm test

Screenshots

Checklist

  • Tests added or updated for new/changed behavior
  • Existing tests pass
  • No secrets, keys, or seed phrases committed
  • Follows the coding conventions in the relevant service README
  • PR is focused on a single concern

@OluRemiFour

Copy link
Copy Markdown
Author

Done, Close: #368

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.

Force-upgrade flow with graceful rehydrate

1 participant