Page MenuHomePhabricator

[Cashtab] Prompt native users when a store update is available
ClosedPublic

Authored by bytesofman on Fri, Aug 14, 12:38.

Details

Summary

On Android launches, compare the installed app version to the published Play Store listing (falling back to cashtab.com native-latest.json). If the install is behind, show a dismissable modal with Update (opens the Play Store listing) and Later. iOS is a no-op: there is no App Store listing yet, so we do not look up or prompt.

Test Plan
  • cd cashtab && npm test -- --watchAll=false src/helpers/__tests__/appVersion.test.ts src/services/__tests__/storeVersionService.test.ts src/components/App/__tests__/AppUpdatePrompt.test.tsx
  • Build an Android APK whose versionName is behind the Play Store listing; launch the app and confirm the Update available modal. Update opens the Play Store listing. Later dismisses for the rest of the session. Web and extension builds do not show the modal.

image.png (1×570 px, 189 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed.
CodeRabbit Review

Diff : committed changes only
Compare : HEAD → master
Directory : work
────────────────────────────────────────

(\(\
(• .•) Code review is a dish best served cold. Like a carrot.

────────────────────────────────────────────────────────────────────────

major [Functional Correctness]
→ ]8;;vscode://file//work/cashtab/src/services/storeVersionService.ts:218cashtab/src/services/storeVersionService.ts:218-235]8;;

Make the iOS fallback usable.

On Line 228, getIosUpdateUrl() receives no trackViewUrl, so it always
returns an empty string. Line 229 then returns null. Therefore, iOS can
never use native-latest.json when the iTunes lookup fails.

Define a verified static iOS store listing URL and use it for the iOS
fallback. Update the test at Lines 177-189 to expect the fallback result.

────────────────────────────────────────
Review complete
1 finding ✔

Major 1

12 files reviewed:

  • cashtab/public/native-latest.json
  • cashtab/scripts/sync-manifest-version.cjs
  • cashtab/src/components/App/App.tsx
  • cashtab/src/components/App/AppUpdatePrompt.tsx
  • cashtab/src/components/App/__tests__/AppUpdatePrompt.test.tsx
  • cashtab/src/components/Common/AndroidWebAppBanner.tsx
  • cashtab/src/components/Common/Modal.tsx
  • cashtab/src/constants/store.ts
  • cashtab/src/helpers/__tests__/appVersion.test.ts
  • cashtab/src/helpers/appVersion.ts

... and 2 more files
────────────────────────────────────────

Print all AI prompts: coderabbit review --show-prompts

bytesofman edited the test plan for this revision. (Show Details)
Fabien added a subscriber: Fabien.
Fabien added inline comments.
cashtab/src/services/storeVersionService.ts
184 ↗(On Diff #60880)

itunes really? what year is this?

Joke apart tested against one of my apps and it works

This revision is now accepted and ready to land.Sat, Aug 15, 20:45
bytesofman added inline comments.
cashtab/src/services/storeVersionService.ts
184 ↗(On Diff #60880)

lmao. i'll clean this up anyway.

will get an ios app out eventually tho I should prob get a macbook first.

bytesofman marked an inline comment as done.

Drop unused iTunes/iOS store lookup; iOS is a no-op until there is an App Store listing.

Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed.
CodeRabbit Review

Diff : committed changes only
Compare : HEAD → master
Directory : work
────────────────────────────────────────

(\(\
(• .•) I had to scroll so far I hit the heat death of the universe.

────────────────────────────────────────────────────────────────────────

minor [Functional Correctness]
→ ]8;;vscode://file//work/cashtab/src/services/storeVersionService.ts:235cashtab/src/services/storeVersionService.ts:235-243]8;;

Handle a fulfilled launch failure.

When AppLauncher.openUrl resolves with completed: false, call
window.open as the fallback. The current try branch treats this result
as success.

────────────────────────────────────────────────────────────────────────

minor [Stability & Availability]
→ ]8;;vscode://file//work/cashtab/src/components/App/AppUpdatePrompt.tsx:59cashtab/src/components/App/AppUpdatePrompt.tsx:59-69]8;;

Handle listener-registration rejection.

When CapacitorApp.addListener rejects, the .then chain produces an
unhandled rejection. Add a rejection handler. Add a test for a rejecting
mockAddListener.

────────────────────────────────────────
Review complete
2 findings ✔

Minor 2

12 files reviewed:

  • cashtab/public/native-latest.json
  • cashtab/scripts/sync-manifest-version.cjs
  • cashtab/src/components/App/App.tsx
  • cashtab/src/components/App/AppUpdatePrompt.tsx
  • cashtab/src/components/App/__tests__/AppUpdatePrompt.test.tsx
  • cashtab/src/components/Common/AndroidWebAppBanner.tsx
  • cashtab/src/components/Common/Modal.tsx
  • cashtab/src/constants/store.ts
  • cashtab/src/helpers/__tests__/appVersion.test.ts
  • cashtab/src/helpers/appVersion.ts

... and 2 more files
────────────────────────────────────────

Print all AI prompts: coderabbit review --show-prompts