Skip to content

fix: preset wallet pictures not saving on Android release builds - #4708

Open
kaloudis wants to merge 2 commits into
ZeusLN:masterfrom
kaloudis:fix/android-preset-wallet-pictures
Open

kaloudis wants to merge 2 commits into
ZeusLN:masterfrom
kaloudis:fix/android-preset-wallet-pictures

Conversation

@kaloudis

Copy link
Copy Markdown
Contributor

Description

Relates to issue: #4536

Fixes #4536. On Android release builds, none of the built-in wallet pictures could be saved; custom uploads worked. This has been broken since v13.0.0.

Root cause: SetWalletPicture worked out the preset name (preset://<name>) from the image URI returned by Image.resolveAssetSource. React Native builds that URI differently on each platform:

Build Resolved URI Derived name
Metro dev server http://localhost:8081/assets/assets/images/zeus_illustration_1a.jpg?... zeusillustration1a
iOS release file:///…/assets/images/zeus_illustration_1a.jpg zeusillustration1a
Android release assets_images_zeus_illustration_1a (resource identifier, no /) assetsimageszeusillustration1a

getPhoto didn't recognise the Android name and returned '', so the preview and the saved wallet picture came out as an empty circle. History: 02b7d4d renamed the illustrations to use underscores, which broke the old "text after the last _" parsing. 024d1e6 then switched to splitting on /, which works in dev and on iOS but breaks every preset on Android release. Its tests only used dev-server URIs.

Fix:

  • utils/PhotoUtils.ts now keeps a single map from preset name to image, plus the list of presets per backend. The picker passes the name straight through, so names are no longer parsed out of platform-specific URIs.
  • getPhoto strips the assetsimages prefix from values already saved by v13.x Android builds, so those wallets show their picture again without a data migration.
  • SetWalletPicture uses the preset names and drops its duplicated image lists and getPresetName.
  • Tests: every preset offered for every backend must resolve through getPhoto, and the legacy Android values must render.

Not handled: preset://1a-style values saved only by the v13.0.0 alpha builds.

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Configuration change
  • Locales update
  • Quality assurance
  • Other

Checklist

  • I’ve run yarn run tsc and made sure my code compiles correctly
  • I’ve run yarn run lint and made sure my code didn’t contain any problematic patterns
  • I’ve run yarn run prettier and made sure my code is formatted correctly
  • I’ve run yarn run test and made sure all of the tests pass

Testing

If you modified or added a utility file, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms (please specify OS version and phone model/VM):

  • Android
  • iOS

Not yet tested on a device. Still needed on an Android release build: pick a preset, save, and check the picture in the wallet header, the Wallets list and the Menu. Also open a wallet saved with the broken value on v13.x and confirm its picture now appears.

I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):

On-device

  • LDK Node
  • Embedded LND

Remote

  • LND (REST)
  • LND (Lightning Node Connect)
  • Core Lightning (CLNRest)
  • Nostr Wallet Connect
  • LndHub

Locales

  • I’ve added new locale text that requires translations
  • I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo

Third Party Dependencies and Packages

  • Contributors will need to run yarn after this PR is merged in
  • 3rd party dependencies have been modified:
    • verify that package.json and yarn.lock have been properly updated
    • verify that dependencies are installed for both iOS and Android platforms

Other:

  • Changes were made that require an update to the README
  • Changes were made that require an update to onboarding

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown

Test coverage

Metric Coverage Covered/Total vs master
Statements 42.68% 6011/14083 n/a
Branches 39.38% 3506/8902 n/a
Functions 31.72% 801/2525 n/a
Lines 43.05% 5752/13360 n/a

Commit: e12e5b1 | Test run

@kaloudis kaloudis added this to the v13.2.3 milestone Sep 22, 2026
@kaloudis
kaloudis force-pushed the fix/android-preset-wallet-pictures branch from 48003c2 to b90a8a2 Compare September 22, 2026 15:34
SetWalletPicture derived the preset name from the resolved asset URI.
On Android release builds React Native resolves bundled images to a
resource identifier such as `assets_images_zeus_illustration_1a`, which
has no `/`, so the name became `assetsimageszeusillustration1a`. getPhoto
could not match it and returned an empty URI, leaving the wallet picture
blank for every built-in icon since v13.0.0.

Key the presets by name in PhotoUtils and pass the name straight through
from the picker, so no platform-specific URI parsing is involved. Values
already saved with the `assetsimages` prefix are still resolved.

Fixes ZeusLN#4536
@kaloudis
kaloudis force-pushed the fix/android-preset-wallet-pictures branch from b90a8a2 to e12e5b1 Compare September 22, 2026 15:39
@kaloudis kaloudis added Bug Something isn't working Android Android issues Image picker labels Sep 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android Android issues Bug Something isn't working Image picker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot save built-in wallet icon — only custom uploads work

1 participant