@walletconnect/react-native-compat 2.10.5-rc-e12288e → 2.10.5-rc-57761a66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ import type { TurboModule } from "react-native";
2
+ import { TurboModuleRegistry } from "react-native";
3
+
4
+ export interface Spec extends TurboModule {
5
+ isAppInstalled(bundleId?: string): Promise<boolean>;
6
+ getConstants(): {
7
+ applicationName: string;
8
+ applicationId: string;
9
+ };
10
+ }
11
+
12
+ export default TurboModuleRegistry.getEnforcing<Spec>("RNWalletConnectModule");
@@ -0,0 +1,47 @@
1
+ import { NativeModules } from "react-native";
2
+
3
+ const LINKING_ERROR =
4
+ `The package to get the RNWalletConnectModule doesn't seem to be linked. Make sure: \n\n` +
5
+ "- You rebuilt the app after installing the package\n" +
6
+ "- If you are using Expo: install expo-application \n";
7
+
8
+ // @ts-expect-error
9
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
10
+
11
+ const RNWalletConnectModule = isTurboModuleEnabled
12
+ ? require("../module/NativeRNWalletConnectModule").default
13
+ : NativeModules.RNWalletConnectModule;
14
+
15
+ function getExpoModule(): any | undefined {
16
+ try {
17
+ const ExpoApplication = require("expo-application");
18
+
19
+ if (!ExpoApplication) throw new Error();
20
+
21
+ return ExpoApplication;
22
+ } catch {
23
+ throw new Error();
24
+ }
25
+ }
26
+
27
+ function getRNModule(): any | undefined {
28
+ try {
29
+ if (!RNWalletConnectModule) throw new Error();
30
+ return RNWalletConnectModule;
31
+ } catch {
32
+ throw new Error();
33
+ }
34
+ }
35
+
36
+ // Public
37
+ export function getApplicationModule(): any | undefined {
38
+ try {
39
+ return getRNModule();
40
+ } catch (error) {
41
+ try {
42
+ return getExpoModule();
43
+ } catch (error) {
44
+ throw new Error(LINKING_ERROR);
45
+ }
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walletconnect/react-native-compat",
3
3
  "description": "Shims for WalletConnect Protocol in React Native Projects",
4
- "version": "2.10.5-rc-e12288e",
4
+ "version": "2.10.5-rc-57761a66",
5
5
  "author": "WalletConnect, Inc. <walletconnect.com>",
6
6
  "homepage": "https://github.com/walletconnect/walletconnect-monorepo/",
7
7
  "license": "Apache-2.0",
@@ -10,7 +10,7 @@
10
10
  "dist",
11
11
  "android",
12
12
  "ios",
13
- "modules",
13
+ "module",
14
14
  "cpp",
15
15
  "*.podspec",
16
16
  "!ios/build",