@vanikya/ota-react-native 0.2.8 → 0.2.10

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.
@@ -36,7 +36,7 @@ android {
36
36
  }
37
37
  }
38
38
 
39
- lintOptions {
39
+ lint {
40
40
  abortOnError false
41
41
  }
42
42
  }
package/app.plugin.js CHANGED
@@ -1,12 +1,10 @@
1
- const { withMainApplication, withAppDelegate, withDangerousMod } = require('@expo/config-plugins');
2
- const fs = require('fs');
3
- const path = require('path');
1
+ const { withMainApplication, withAppDelegate } = require('@expo/config-plugins');
4
2
 
5
3
  /**
6
4
  * OTA Update Expo Config Plugin
7
5
  *
8
6
  * This plugin modifies the native code to enable OTA bundle loading:
9
- * - Android: Modifies bundle loading for both old and new architecture
7
+ * - Android: Modifies MainApplication.kt to override getJSBundleFile and getBundleAssetName
10
8
  * - iOS: Modifies bundleURL() in AppDelegate.swift
11
9
  */
12
10
 
@@ -15,7 +13,7 @@ function withOTAUpdateAndroid(config) {
15
13
  let contents = config.modResults.contents;
16
14
 
17
15
  // Check if already modified
18
- if (contents.includes('OTAUpdateHelper') || contents.includes('com.otaupdate')) {
16
+ if (contents.includes('OTAUpdateHelper')) {
19
17
  console.log('[OTAUpdate] Android: OTAUpdateHelper already present, skipping');
20
18
  return config;
21
19
  }
@@ -34,20 +32,14 @@ function withOTAUpdateAndroid(config) {
34
32
  let injected = false;
35
33
 
36
34
  // ============================================================
37
- // Strategy 1: Expo New Architecture with ReactNativeHostWrapper
38
- // Look for: ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
39
- // We need to modify the reactNativeHost to include our bundle override
40
- // AND add a bundleAssetName override to return null when OTA bundle exists
35
+ // Strategy 1: Look for DefaultReactNativeHost and add overrides
36
+ // This works for both old and new architecture Expo apps
41
37
  // ============================================================
42
- const expoNewArchPattern = /ReactNativeHostWrapper\.createReactHost\s*\(\s*applicationContext\s*,\s*reactNativeHost\s*\)/;
43
- if (expoNewArchPattern.test(contents)) {
44
- console.log('[OTAUpdate] Android: Detected Expo New Architecture pattern');
38
+ const defaultHostPattern = /(object\s*:\s*DefaultReactNativeHost\s*\([^)]*\)\s*\{)/;
39
+ if (defaultHostPattern.test(contents)) {
40
+ console.log('[OTAUpdate] Android: Detected DefaultReactNativeHost');
45
41
 
46
- // For Expo new arch, we need to add getBundleAssetName override
47
- // to return null when OTA bundle exists (this forces it to use getJSBundleFile)
48
- const defaultHostPattern = /(object\s*:\s*DefaultReactNativeHost\s*\([^)]*\)\s*\{)/;
49
- if (defaultHostPattern.test(contents)) {
50
- const bundleOverride = `
42
+ const bundleOverride = `
51
43
  override fun getJSBundleFile(): String? {
52
44
  return OTAUpdateHelper.getJSBundleFile(applicationContext)
53
45
  }
@@ -61,41 +53,13 @@ function withOTAUpdateAndroid(config) {
61
53
  return super.getBundleAssetName()
62
54
  }
63
55
  `;
64
- contents = contents.replace(defaultHostPattern, `$1${bundleOverride}`);
65
- console.log('[OTAUpdate] Android: Injected getJSBundleFile and getBundleAssetName overrides');
66
- injected = true;
67
- }
68
- }
69
-
70
- // ============================================================
71
- // Strategy 2: Standard DefaultReactNativeHost pattern
72
- // ============================================================
73
- if (!injected) {
74
- const defaultHostPattern = /(object\s*:\s*DefaultReactNativeHost\s*\([^)]*\)\s*\{)/;
75
- if (defaultHostPattern.test(contents)) {
76
- console.log('[OTAUpdate] Android: Detected DefaultReactNativeHost');
77
-
78
- const bundleOverride = `
79
- override fun getJSBundleFile(): String? {
80
- return OTAUpdateHelper.getJSBundleFile(applicationContext)
81
- }
82
-
83
- override fun getBundleAssetName(): String? {
84
- val otaBundle = OTAUpdateHelper.getJSBundleFile(applicationContext)
85
- if (otaBundle != null) {
86
- return null
87
- }
88
- return super.getBundleAssetName()
89
- }
90
- `;
91
- contents = contents.replace(defaultHostPattern, `$1${bundleOverride}`);
92
- console.log('[OTAUpdate] Android: Injected bundle overrides');
93
- injected = true;
94
- }
56
+ contents = contents.replace(defaultHostPattern, `$1${bundleOverride}`);
57
+ console.log('[OTAUpdate] Android: Injected getJSBundleFile and getBundleAssetName overrides');
58
+ injected = true;
95
59
  }
96
60
 
97
61
  // ============================================================
98
- // Strategy 3: Look for getUseDeveloperSupport and insert before it
62
+ // Strategy 2: Look for getUseDeveloperSupport and insert before it
99
63
  // ============================================================
100
64
  if (!injected) {
101
65
  const devSupportPattern = /([ \t]*)(override\s+fun\s+getUseDeveloperSupport\s*\(\s*\))/;
@@ -103,5 +103,5 @@ var _verification = require("./utils/verification");
103
103
  // Utilities
104
104
 
105
105
  // Version info
106
- const VERSION = exports.VERSION = '0.2.8';
106
+ const VERSION = exports.VERSION = '0.2.10';
107
107
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_OTAProvider","require","_OTADebugPanel","_useOTAUpdate","_api","_storage","_verification","VERSION","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AAUA,IAAAG,IAAA,GAAAH,OAAA;AAQA,IAAAI,QAAA,GAAAJ,OAAA;AAGA,IAAAK,aAAA,GAAAL,OAAA;AA7BA;;AAIA;;AAGA;;AAUA;;AAoBA;AACO,MAAMM,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_OTAProvider","require","_OTADebugPanel","_useOTAUpdate","_api","_storage","_verification","VERSION","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AAUA,IAAAG,IAAA,GAAAH,OAAA;AAQA,IAAAI,QAAA,GAAAJ,OAAA;AAGA,IAAAK,aAAA,GAAAL,OAAA;AA7BA;;AAIA;;AAGA;;AAUA;;AAoBA;AACO,MAAMM,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,QAAQ","ignoreList":[]}
@@ -10,5 +10,5 @@ export { OTAApiClient, getDeviceInfo } from './utils/api';
10
10
  export { UpdateStorage, getStorageAdapter } from './utils/storage';
11
11
  export { calculateHash, verifyBundleHash, verifySignature, verifyBundle } from './utils/verification';
12
12
  // Version info
13
- export const VERSION = '0.2.8';
13
+ export const VERSION = '0.2.10';
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OTAProvider","useOTA","withOTA","UpdateBanner","OTADebugPanel","useOTAUpdate","OTAApiClient","getDeviceInfo","UpdateStorage","getStorageAdapter","calculateHash","verifyBundleHash","verifySignature","verifyBundle","VERSION"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAAEC,YAAY,QAAQ,eAAe;AAG1E;AACA,SAASC,aAAa,QAAQ,4BAA4B;;AAE1D;AACA,SAASC,YAAY,QAAQ,sBAAsB;AASnD;AACA,SAASC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAQzD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAGlE,SACEC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,QACP,sBAAsB;AAG7B;AACA,OAAO,MAAMC,OAAO,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["OTAProvider","useOTA","withOTA","UpdateBanner","OTADebugPanel","useOTAUpdate","OTAApiClient","getDeviceInfo","UpdateStorage","getStorageAdapter","calculateHash","verifyBundleHash","verifySignature","verifyBundle","VERSION"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAAEC,YAAY,QAAQ,eAAe;AAG1E;AACA,SAASC,aAAa,QAAQ,4BAA4B;;AAE1D;AACA,SAASC,YAAY,QAAQ,sBAAsB;AASnD;AACA,SAASC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAQzD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAGlE,SACEC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,QACP,sBAAsB;AAG7B;AACA,OAAO,MAAMC,OAAO,GAAG,QAAQ","ignoreList":[]}
@@ -9,5 +9,5 @@ export { UpdateStorage, getStorageAdapter } from './utils/storage';
9
9
  export type { StoredUpdate, StorageAdapter } from './utils/storage';
10
10
  export { calculateHash, verifyBundleHash, verifySignature, verifyBundle, } from './utils/verification';
11
11
  export type { VerificationResult } from './utils/verification';
12
- export declare const VERSION = "0.2.8";
12
+ export declare const VERSION = "0.2.10";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,GACnB,MA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1
1
  {
2
2
  "name": "@vanikya/ota-react-native",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "OTA Update SDK for React Native apps - self-hosted CodePush/EAS Updates alternative",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
package/src/index.ts CHANGED
@@ -36,4 +36,4 @@ export {
36
36
  export type { VerificationResult } from './utils/verification';
37
37
 
38
38
  // Version info
39
- export const VERSION = '0.2.8';
39
+ export const VERSION = '0.2.10';