@hot-updater/react-native 0.19.8 → 0.19.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.
@@ -68,6 +68,9 @@ android {
68
68
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
69
69
  consumerProguardFiles 'proguard-rules.pro'
70
70
  buildConfigField "long", "BUILD_TIMESTAMP", "${System.currentTimeMillis()}L"
71
+
72
+ def minBundleId = project.hasProperty("MIN_BUNDLE_ID") ? project.properties["MIN_BUNDLE_ID"] : null
73
+ buildConfigField "String", "MIN_BUNDLE_ID", minBundleId == null ? "\"null\"" : "\"${minBundleId}\""
71
74
  }
72
75
 
73
76
  buildFeatures {
@@ -69,10 +69,16 @@ class HotUpdaterImpl(
69
69
  }
70
70
 
71
71
  /**
72
- * Generates a bundle ID based on build timestamp
72
+ * Get minimum bundle ID string
73
73
  * @return The minimum bundle ID string
74
74
  */
75
- fun getMinBundleId(): String =
75
+ fun getMinBundleId(): String = BuildConfig.MIN_BUNDLE_ID.takeIf { it != "null" } ?: generateMinBundleIdFromBuildTimestamp()
76
+
77
+ /**
78
+ * Generates a bundle ID based on build timestamp
79
+ * @return The generated minimum bundle ID string
80
+ */
81
+ private fun generateMinBundleIdFromBuildTimestamp(): String =
76
82
  try {
77
83
  val buildTimestampMs = BuildConfig.BUILD_TIMESTAMP
78
84
  val bytes =
@@ -10,7 +10,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
10
10
  * When an update exists and the bundle is being downloaded, this component will block access
11
11
  * to the entry point and show download progress.
12
12
  *
13
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#fallback-component}
13
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#fallback-component}
14
14
  *
15
15
  * ```tsx
16
16
  * HotUpdater.wrap({
@@ -42,7 +42,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
42
42
  /**
43
43
  * Callback function that is called when the update process is completed.
44
44
  *
45
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#onupdateprocesscompleted}
45
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#onupdateprocesscompleted}
46
46
  */
47
47
  onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
48
48
  }
@@ -10,7 +10,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
10
10
  * When an update exists and the bundle is being downloaded, this component will block access
11
11
  * to the entry point and show download progress.
12
12
  *
13
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#fallback-component}
13
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#fallback-component}
14
14
  *
15
15
  * ```tsx
16
16
  * HotUpdater.wrap({
@@ -42,7 +42,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
42
42
  /**
43
43
  * Callback function that is called when the update process is completed.
44
44
  *
45
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#onupdateprocesscompleted}
45
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#onupdateprocesscompleted}
46
46
  */
47
47
  onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
48
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.19.8",
3
+ "version": "0.19.10",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -119,12 +119,13 @@
119
119
  "react-native": "0.79.1",
120
120
  "react-native-builder-bob": "^0.40.10",
121
121
  "typescript": "^5.8.3",
122
- "hot-updater": "0.19.8"
122
+ "hot-updater": "0.19.10"
123
123
  },
124
124
  "dependencies": {
125
125
  "use-sync-external-store": "1.5.0",
126
- "@hot-updater/core": "0.19.8",
127
- "@hot-updater/js": "0.19.8"
126
+ "@hot-updater/core": "0.19.10",
127
+ "@hot-updater/js": "0.19.10",
128
+ "@hot-updater/plugin-core": "0.19.10"
128
129
  },
129
130
  "scripts": {
130
131
  "build": "bob build && tsc -p plugin/tsconfig.json",
@@ -39,6 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
+ var plugin_core_1 = require("@hot-updater/plugin-core");
42
43
  var config_plugins_1 = require("expo/config-plugins");
43
44
  var hot_updater_1 = require("hot-updater");
44
45
  var package_json_1 = __importDefault(require("../../package.json"));
@@ -207,26 +208,46 @@ var withHotUpdaterConfigAsync = function (props) { return function (config) {
207
208
  var modifiedConfig = config;
208
209
  // === iOS: Add channel and fingerprint to Info.plist ===
209
210
  modifiedConfig = (0, config_plugins_1.withInfoPlist)(modifiedConfig, function (cfg) { return __awaiter(void 0, void 0, void 0, function () {
210
- var ios;
211
+ var fingerprintHash, config, ios;
211
212
  return __generator(this, function (_a) {
212
213
  switch (_a.label) {
213
- case 0: return [4 /*yield*/, getFingerprint()];
214
+ case 0:
215
+ fingerprintHash = null;
216
+ return [4 /*yield*/, (0, plugin_core_1.loadConfig)(null)];
214
217
  case 1:
218
+ config = _a.sent();
219
+ if (!(config.updateStrategy !== "appVersion")) return [3 /*break*/, 3];
220
+ return [4 /*yield*/, getFingerprint()];
221
+ case 2:
215
222
  ios = (_a.sent()).ios;
223
+ fingerprintHash = ios.hash;
224
+ _a.label = 3;
225
+ case 3:
216
226
  cfg.modResults.HOT_UPDATER_CHANNEL = channel;
217
- cfg.modResults.HOT_UPDATER_FINGERPRINT_HASH = ios.hash;
227
+ if (fingerprintHash) {
228
+ cfg.modResults.HOT_UPDATER_FINGERPRINT_HASH = fingerprintHash;
229
+ }
218
230
  return [2 /*return*/, cfg];
219
231
  }
220
232
  });
221
233
  }); });
222
234
  // === Android: Add channel and fingerprint to strings.xml ===
223
235
  modifiedConfig = (0, config_plugins_1.withStringsXml)(modifiedConfig, function (cfg) { return __awaiter(void 0, void 0, void 0, function () {
224
- var android;
236
+ var fingerprintHash, config, android;
225
237
  return __generator(this, function (_a) {
226
238
  switch (_a.label) {
227
- case 0: return [4 /*yield*/, getFingerprint()];
239
+ case 0:
240
+ fingerprintHash = null;
241
+ return [4 /*yield*/, (0, plugin_core_1.loadConfig)(null)];
228
242
  case 1:
243
+ config = _a.sent();
244
+ if (!(config.updateStrategy !== "appVersion")) return [3 /*break*/, 3];
245
+ return [4 /*yield*/, getFingerprint()];
246
+ case 2:
229
247
  android = (_a.sent()).android;
248
+ fingerprintHash = android.hash;
249
+ _a.label = 3;
250
+ case 3:
230
251
  // Ensure resources object exists
231
252
  if (!cfg.modResults.resources) {
232
253
  cfg.modResults.resources = {};
@@ -244,16 +265,21 @@ var withHotUpdaterConfigAsync = function (props) { return function (config) {
244
265
  },
245
266
  _: channel,
246
267
  });
247
- // Remove existing hot_updater_fingerprint_hash entry if it exists
248
- cfg.modResults.resources.string = cfg.modResults.resources.string.filter(function (item) { return !(item.$ && item.$.name === "hot_updater_fingerprint_hash"); });
249
- // Add the new hot_updater_fingerprint_hash entry
250
- cfg.modResults.resources.string.push({
251
- $: {
252
- name: "hot_updater_fingerprint_hash",
253
- moduleConfig: "true",
254
- },
255
- _: android.hash,
256
- });
268
+ if (fingerprintHash) {
269
+ // Remove existing hot_updater_fingerprint_hash entry if it exists
270
+ cfg.modResults.resources.string =
271
+ cfg.modResults.resources.string.filter(function (item) {
272
+ return !(item.$ && item.$.name === "hot_updater_fingerprint_hash");
273
+ });
274
+ // Add the new hot_updater_fingerprint_hash entry
275
+ cfg.modResults.resources.string.push({
276
+ $: {
277
+ name: "hot_updater_fingerprint_hash",
278
+ moduleConfig: "true",
279
+ },
280
+ _: fingerprintHash,
281
+ });
282
+ }
257
283
  return [2 /*return*/, cfg];
258
284
  }
259
285
  });
package/src/wrap.tsx CHANGED
@@ -19,7 +19,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
19
19
  * When an update exists and the bundle is being downloaded, this component will block access
20
20
  * to the entry point and show download progress.
21
21
  *
22
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#fallback-component}
22
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#fallback-component}
23
23
  *
24
24
  * ```tsx
25
25
  * HotUpdater.wrap({
@@ -51,7 +51,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
51
51
  /**
52
52
  * Callback function that is called when the update process is completed.
53
53
  *
54
- * @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#onupdateprocesscompleted}
54
+ * @see {@link https://hot-updater.dev/guide/hot-updater/wrap.html#onupdateprocesscompleted}
55
55
  */
56
56
  onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
57
57
  }