@novastera-oss/nitro-metamask 0.7.5 → 0.7.7

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.
Files changed (2) hide show
  1. package/app.plugin.js +16 -8
  2. package/package.json +1 -1
package/app.plugin.js CHANGED
@@ -6,13 +6,16 @@ const withMetamaskAppDelegate = (config) => {
6
6
 
7
7
  // Check if AppDelegate is Swift
8
8
  if (modResults.language === 'swift') {
9
- // Check if the method already exists
10
- if (modResults.contents.includes('MetaMaskSDK.sharedInstance?.handleUrl')) {
11
- return config;
9
+ // Migrate stale/incorrect import if present
10
+ if (modResults.contents.includes('import metamask_ios_sdk')) {
11
+ modResults.contents = modResults.contents.replace(
12
+ /import\s+metamask_ios_sdk/g,
13
+ 'import NitroMetamask'
14
+ );
12
15
  }
13
-
14
- // Add import if not present
15
- if (!modResults.contents.includes('import metamask_ios_sdk')) {
16
+
17
+ // Add NitroMetamask import if not present
18
+ if (!modResults.contents.includes('import NitroMetamask')) {
16
19
  // Find the last import statement and add after it
17
20
  const importRegex = /^import\s+.*$/gm;
18
21
  const imports = modResults.contents.match(importRegex);
@@ -21,17 +24,22 @@ const withMetamaskAppDelegate = (config) => {
21
24
  const lastImportIndex = modResults.contents.lastIndexOf(lastImport);
22
25
  modResults.contents =
23
26
  modResults.contents.slice(0, lastImportIndex + lastImport.length) +
24
- '\nimport metamask_ios_sdk' +
27
+ '\nimport NitroMetamask' +
25
28
  modResults.contents.slice(lastImportIndex + lastImport.length);
26
29
  } else {
27
30
  // No imports found, add at the top after the first line
28
31
  const firstLineIndex = modResults.contents.indexOf('\n');
29
32
  modResults.contents =
30
33
  modResults.contents.slice(0, firstLineIndex + 1) +
31
- 'import metamask_ios_sdk\n' +
34
+ 'import NitroMetamask\n' +
32
35
  modResults.contents.slice(firstLineIndex + 1);
33
36
  }
34
37
  }
38
+
39
+ // Check if the method already exists
40
+ if (modResults.contents.includes('MetaMaskSDK.sharedInstance?.handleUrl')) {
41
+ return config;
42
+ }
35
43
 
36
44
  // Add the deep link handler method
37
45
  const deepLinkHandler = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novastera-oss/nitro-metamask",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Native mobile MetaMask wallet integration for React Native. Part of Novastera CRM/ERP platform ecosystem. Provides secure authentication and message signing for Web3 mobile applications.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",