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

Feat: Implement Capacitor wallet plugin binding #1646

Merged

Conversation

amadeu2
Copy link
Contributor

@amadeu2 amadeu2 commented Dec 5, 2022

Description of change

This PR implements the Stardust Capacitor wallet plugin for Firefly Mobile.
UPDATE: Now also includes the updates to the latest version of wallet.rs and updates clearLiseners implementation.
The wallet/bindings/swift folder changes was paired with latest updates.

Generated using Create Capacitor plugin:
https://github.com/ionic-team/create-capacitor-plugin

Notice that most of the code is the plugin boilerplate, the native implementation are mainly in this two files:

wallet/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java
wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift

Also in the previous Capacitor wallet plugin the XCFramework which loads the iOS binaries was implemented here:
https://github.com/iotaledger/wallet-ios-internal

This PR implement it inside the plugin folder here:
wallet/bindings/capacitorjs/ios/WalletFramework.xcframework
with the idea to pair with Android implementation and make it easier to update.

Capacitor plugins include a PWA version in addition to the Android and iOS ones. But PWA was removed as we don't need it.

Capacitor plugin docs:
https://capacitorjs.com/docs/plugins/creating-plugins

Links to any relevant issues

fixes issue #1536 #1535 #1786 #1788

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How the change has been tested

cd ~ && git clone https://github.com/amadeu2/wallet.rs && cd wallet.rs
git checkout feat/capacitor-iota-wallet-plugin

To install the plugin in Firefly repository:

git clone https://github.com/iotaledger/firefly
cd firefly/packages/mobile
git checkout test/mobile-stardust
yarn add ~/wallet.rs/wallet/bindings/capacitorjs
CAP_IP=YOUR_LOCAL_IP yarn start android alpha
#or for iOS
CAP_IP=YOUR_LOCAL_IP yarn start ios alpha

Requirements:

  • XCode
  • Android Studio
  • ImageMagick
  • Bash (required for only for Windows Mingw-w64)

#more info here https://discord.com/channels/397872799483428865/930250781649690634/1085668890429902949

Tested on Linux, MacOS and Windows.

How to build Swift binding for mobile:

cd ~/wallet.rs/binding/swift
rustup target add aarch64-apple-ios
rustup target add x86_64-apple-ios
cargo build --target aarch64-apple-ios --release --lib
cargo build --target x86_64-apple-ios --release --lib
cp target/aarch64-apple-ios/release/libiota_wallet.a ../capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework
cp target/x86_64-apple-ios/release/libiota_wallet.a ../capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Brord van Wierst and others added 25 commits December 5, 2022 13:04
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Thoralf-M
Thoralf-M previously approved these changes Mar 20, 2023
rajivshah3
rajivshah3 previously approved these changes Mar 20, 2023
Copy link
Member

@rajivshah3 rajivshah3 left a comment

Choose a reason for hiding this comment

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

Great! 🎉

Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Signed-off-by: Amadeo Marchioni <amadeo.marchioni@iota.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants