diff --git a/sdk/libportal-react-native/android/build.gradle b/sdk/libportal-react-native/android/build.gradle index 94e2835..c4cb755 100644 --- a/sdk/libportal-react-native/android/build.gradle +++ b/sdk/libportal-react-native/android/build.gradle @@ -93,6 +93,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "net.java.dev.jna:jna:5.14.0@aar" - implementation "xyz.twenty_two:libportal-android:0.1.0-SNAPSHOT@aar" + implementation "xyz.twenty-two:libportal-android:0.2.1-SNAPSHOT@aar" } diff --git a/sdk/libportal-react-native/android/src/main/java/xyz/twenty_two/react_native/LibportalReactNativeModule.kt b/sdk/libportal-react-native/android/src/main/java/xyz/twenty_two/react_native/LibportalReactNativeModule.kt index 25fd91d..ab1111b 100644 --- a/sdk/libportal-react-native/android/src/main/java/xyz/twenty_two/react_native/LibportalReactNativeModule.kt +++ b/sdk/libportal-react-native/android/src/main/java/xyz/twenty_two/react_native/LibportalReactNativeModule.kt @@ -162,6 +162,18 @@ class LibportalReactNativeModule(reactContext: ReactApplicationContext) : } } + @ReactMethod + fun showMnemonic(promise: Promise) { + try { + scope.launch { + instance!!.showMnemonic() + promise.resolve(null) + } + } catch (e: Exception) { + promise.reject(e) + } + } + @ReactMethod fun displayAddress(index: Int, promise: Promise) { try { diff --git a/sdk/libportal-react-native/example/android/build.gradle b/sdk/libportal-react-native/example/android/build.gradle index 96090e4..6b2f0df 100644 --- a/sdk/libportal-react-native/example/android/build.gradle +++ b/sdk/libportal-react-native/example/android/build.gradle @@ -1,9 +1,9 @@ buildscript { ext { - buildToolsVersion = "33.0.1" + buildToolsVersion = "34.0.0" minSdkVersion = 21 - compileSdkVersion = 33 - targetSdkVersion = 33 + compileSdkVersion = 34 + targetSdkVersion = 34 ndkVersion = "23.1.7779620" kotlinVersion = "1.8.0" } diff --git a/sdk/libportal-react-native/ios/LibportalReactNative.mm b/sdk/libportal-react-native/ios/LibportalReactNative.mm index 9360aa1..56ef1e7 100644 --- a/sdk/libportal-react-native/ios/LibportalReactNative.mm +++ b/sdk/libportal-react-native/ios/LibportalReactNative.mm @@ -39,6 +39,9 @@ @interface RCT_EXTERN_MODULE(LibportalReactNative, NSObject) RCT_EXTERN_METHOD(resume: (RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) +RCT_EXTERN_METHOD(showMnemonic: (RCTPromiseResolveBlock)resolve + withRejecter:(RCTPromiseRejectBlock)reject) + RCT_EXTERN_METHOD(displayAddress: (nonnull NSNumber)index withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) diff --git a/sdk/libportal-react-native/ios/LibportalReactNative.swift b/sdk/libportal-react-native/ios/LibportalReactNative.swift index 8e076f3..65c8a12 100644 --- a/sdk/libportal-react-native/ios/LibportalReactNative.swift +++ b/sdk/libportal-react-native/ios/LibportalReactNative.swift @@ -155,6 +155,18 @@ class LibportalReactNative: NSObject { } } } + + @objc func showMnemonic(_ resolve: @escaping RCTPromiseResolveBlock, withRejecter reject: @escaping RCTPromiseRejectBlock) -> Void { + Task { + do { + try await self.sdk?.showMnemonic() + resolve(nil) + } + catch { + reject("Error", error.localizedDescription, error) + } + } + } @objc func displayAddress(_ index: NSNumber, withResolver resolve: @escaping RCTPromiseResolveBlock, withRejecter reject: @escaping RCTPromiseRejectBlock) -> Void { let index = UInt32(truncating: index) diff --git a/sdk/libportal-react-native/src/index.tsx b/sdk/libportal-react-native/src/index.tsx index 474bba9..c70d6bd 100644 --- a/sdk/libportal-react-native/src/index.tsx +++ b/sdk/libportal-react-native/src/index.tsx @@ -62,6 +62,10 @@ export class PortalSdk { return LibportalReactNative.resume(); } + showMnemonic(): Promise { + return LibportalReactNative.showMnemonic(); + } + displayAddress(index: number): Promise { return LibportalReactNative.displayAddress(index); }