Skip to content
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

Satscard Integration (Android & iOS) #1269

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

PeteClubSeven
Copy link

@PeteClubSeven PeteClubSeven commented Jan 31, 2024

Hey, this is my implementation of Satscard slot initialization and sweeping. The logic for communicating with Satscards is handled by a separate Flutter plugin which I created. This plugin is relatively simple, it provides an FFI wrapper around Nunchuk's tap-protocol library. Maintenance should be minimal, I created a separate release/breez branch in the plugin repository, this will get updated as Nunchuk update their C++ library. You may wish to fork my plugin if you prefer control over the repository, I could then open PRs when I think there's a bugfix you might need. My plugin is built for NDK 21.4 which other plugins in the app currently depend on however my plugin works with NDK 26+.

This PR doesn't support viewing/sweeping unsealed slots however I wish to add that later and the current balance/sweep UI pages are built to support it already. Each UI page supports vertical scrolling for small displays. The initialize page has fully validated "Spend Code" and "Chain Code" fields. The new Satscard NFC dialog is quite reactive and communicates different success, pending and failure states to the user. Sweeping a Satscard clearly communicates the fees paid by the user including failure conditions such as not having enough balance to deposit, having too high a balance, not meeting the reserve, etc. The "Spend Code" field rejects previously entered incorrect codes, intentionally I chose not to persist these between pages. If a "Chain Code" is not entered then it will be generated by the tap-protocol library.

The PR depends these two other PRs: breez/Breez-Translations#28 & breez/breez#229. This PR supersedes #1258

Here are a selection of images and videos demonstrating the implementation

Videos

initialize.mp4
sweep.mp4
nfc_errors.mp4

iOS Differences

iOS handles NFC differently to Android, it requires a system prompt to be shown and you can't scan the Satscards in the background. As such a new option was added to the Receive option on the home page called "Sweep Satscard" and the NFC status is communicated to the use through the system prompt.

Note: There are some typos in these videos that have already been fixed.

scan_satscard_option.mp4
ios_nfc_messages.mp4

Screenshots

- Allows us to communicate with Satscards
- Performs all necessary Satscard NFC and sweeping actions
- Opens the NFC prompt on iOS so Satscards can be scanned
- Android doesn't need this because we are always scanning for NFC devices in the background
- Allows the user to prepare the next Satscard slot for usage
- Includes the option to specify their own chain code
- Used for displaying the balance of the active Satscard slot and allowing the user to sweep it into their wallet
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.

None yet

1 participant