@column-org/wallet-sdk 1.1.5 → 1.1.6
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.
package/package.json
CHANGED
package/src/index.native.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ColumnWalletSDK } from '../../ColumnWalletSDK';
|
|
2
|
+
import { ColumnSDKConfig } from '../../ColumnShared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced SDK Class specifically for React Native / Expo environments
|
|
6
|
+
*/
|
|
7
|
+
export class ColumnWalletNative extends ColumnWalletSDK {
|
|
8
|
+
constructor(config: ColumnSDKConfig) {
|
|
9
|
+
const detectedConfig = ColumnWalletNative.autoDetectMetadata(config);
|
|
10
|
+
super(detectedConfig);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private static autoDetectMetadata(config: ColumnSDKConfig): ColumnSDKConfig {
|
|
14
|
+
const detectedConfig = { ...config };
|
|
15
|
+
|
|
16
|
+
// 1. Try to detect App Name and Description from Expo Constants
|
|
17
|
+
try {
|
|
18
|
+
// We use require to avoid hard dependency if not in Expo
|
|
19
|
+
const Constants = require('expo-constants').default;
|
|
20
|
+
const expoConfig = Constants.expoConfig || Constants.manifest;
|
|
21
|
+
|
|
22
|
+
if (!detectedConfig.appName && expoConfig?.name) {
|
|
23
|
+
detectedConfig.appName = expoConfig.name;
|
|
24
|
+
}
|
|
25
|
+
if (!detectedConfig.appDescription && expoConfig?.description) {
|
|
26
|
+
detectedConfig.appDescription = expoConfig.description;
|
|
27
|
+
}
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// expo-constants not available or failed
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 2. Try to auto-detect the Redirect Link (Deep Link Scheme) using Expo Linking
|
|
33
|
+
try {
|
|
34
|
+
if (!detectedConfig.redirectLink) {
|
|
35
|
+
const Linking = require('expo-linking');
|
|
36
|
+
detectedConfig.redirectLink = Linking.createURL('');
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// expo-linking not available or failed
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return detectedConfig;
|
|
43
|
+
}
|
|
44
|
+
}
|