@hot-updater/react-native 0.14.0 → 0.15.1
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/dist/index.d.ts +3 -2
- package/dist/index.js +2 -5
- package/dist/index.mjs +2 -5
- package/dist/native.d.ts +1 -1
- package/ios/HotUpdater/HotUpdater.mm +11 -10
- package/package.json +3 -3
- package/src/checkForUpdate.ts +1 -1
- package/src/index.ts +2 -1
- package/src/native.ts +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -47,8 +47,9 @@ export declare const HotUpdater: {
|
|
|
47
47
|
* Fetches the current release channel of the app.
|
|
48
48
|
*
|
|
49
49
|
* By default, if no channel is specified, the app is assigned to the 'production' channel.
|
|
50
|
+
* If the app is running in development mode, the channel will be `null`.
|
|
50
51
|
*
|
|
51
|
-
* @returns {string} The current release channel of the app
|
|
52
|
+
* @returns {string | null} The current release channel of the app
|
|
52
53
|
*
|
|
53
54
|
* @example
|
|
54
55
|
* ```ts
|
|
@@ -56,7 +57,7 @@ export declare const HotUpdater: {
|
|
|
56
57
|
* console.log(`Current channel: ${channel}`);
|
|
57
58
|
* ```
|
|
58
59
|
*/
|
|
59
|
-
getChannel: () => string;
|
|
60
|
+
getChannel: () => string | null;
|
|
60
61
|
/**
|
|
61
62
|
* Adds a listener to HotUpdater events.
|
|
62
63
|
*
|
package/dist/index.js
CHANGED
|
@@ -124,10 +124,7 @@ var __webpack_exports__ = {};
|
|
|
124
124
|
const constants = HotUpdaterNative.getConstants();
|
|
125
125
|
return constants.MIN_BUNDLE_ID;
|
|
126
126
|
};
|
|
127
|
-
const getBundleId = ()=>
|
|
128
|
-
const minBundleId = getMinBundleId();
|
|
129
|
-
return minBundleId.localeCompare(HotUpdater.HOT_UPDATER_BUNDLE_ID) >= 0 ? minBundleId : HotUpdater.HOT_UPDATER_BUNDLE_ID;
|
|
130
|
-
};
|
|
127
|
+
const getBundleId = ()=>HotUpdater.HOT_UPDATER_BUNDLE_ID === NIL_UUID ? getMinBundleId() : HotUpdater.HOT_UPDATER_BUNDLE_ID;
|
|
131
128
|
const getChannel = ()=>HotUpdater.CHANNEL;
|
|
132
129
|
async function checkForUpdate(options) {
|
|
133
130
|
if (__DEV__) return null;
|
|
@@ -152,7 +149,7 @@ var __webpack_exports__ = {};
|
|
|
152
149
|
bundleId: currentBundleId,
|
|
153
150
|
platform,
|
|
154
151
|
minBundleId,
|
|
155
|
-
channel
|
|
152
|
+
channel: channel ?? void 0
|
|
156
153
|
}, options.requestHeaders, options.onError);
|
|
157
154
|
}
|
|
158
155
|
const runUpdateProcess = async ({ reloadOnForceUpdate = true, ...checkForUpdateOptions })=>{
|
package/dist/index.mjs
CHANGED
|
@@ -99,10 +99,7 @@ const getMinBundleId = ()=>{
|
|
|
99
99
|
const constants = HotUpdaterNative.getConstants();
|
|
100
100
|
return constants.MIN_BUNDLE_ID;
|
|
101
101
|
};
|
|
102
|
-
const getBundleId = ()=>
|
|
103
|
-
const minBundleId = getMinBundleId();
|
|
104
|
-
return minBundleId.localeCompare(HotUpdater.HOT_UPDATER_BUNDLE_ID) >= 0 ? minBundleId : HotUpdater.HOT_UPDATER_BUNDLE_ID;
|
|
105
|
-
};
|
|
102
|
+
const getBundleId = ()=>HotUpdater.HOT_UPDATER_BUNDLE_ID === NIL_UUID ? getMinBundleId() : HotUpdater.HOT_UPDATER_BUNDLE_ID;
|
|
106
103
|
const getChannel = ()=>HotUpdater.CHANNEL;
|
|
107
104
|
async function checkForUpdate(options) {
|
|
108
105
|
if (__DEV__) return null;
|
|
@@ -127,7 +124,7 @@ async function checkForUpdate(options) {
|
|
|
127
124
|
bundleId: currentBundleId,
|
|
128
125
|
platform,
|
|
129
126
|
minBundleId,
|
|
130
|
-
channel
|
|
127
|
+
channel: channel ?? void 0
|
|
131
128
|
}, options.requestHeaders, options.onError);
|
|
132
129
|
}
|
|
133
130
|
const runUpdateProcess = async ({ reloadOnForceUpdate = true, ...checkForUpdateOptions })=>{
|
package/dist/native.d.ts
CHANGED
|
@@ -34,4 +34,4 @@ export declare const getMinBundleId: () => string;
|
|
|
34
34
|
* @returns {Promise<string>} Resolves with the current version id or null if not available.
|
|
35
35
|
*/
|
|
36
36
|
export declare const getBundleId: () => string;
|
|
37
|
-
export declare const getChannel: () => string;
|
|
37
|
+
export declare const getChannel: () => string | null;
|
|
@@ -27,18 +27,15 @@ RCT_EXPORT_MODULE();
|
|
|
27
27
|
static NSString *uuid = nil;
|
|
28
28
|
static dispatch_once_t onceToken;
|
|
29
29
|
dispatch_once(&onceToken, ^{
|
|
30
|
-
NSDate *buildDate = nil;
|
|
31
|
-
NSURL *fallbackURL = nil;
|
|
32
30
|
#if DEBUG
|
|
33
31
|
uuid = @"00000000-0000-0000-0000-000000000000";
|
|
34
32
|
return;
|
|
35
33
|
#else
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
// __DATE__, __TIME__ is compile-time
|
|
35
|
+
NSString *compileDateStr = [NSString stringWithFormat:@"%s %s", __DATE__, __TIME__];
|
|
36
|
+
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
|
37
|
+
[formatter setDateFormat:@"MMM d yyyy HH:mm:ss"];
|
|
38
|
+
NSDate *buildDate = [formatter dateFromString:compileDateStr];
|
|
42
39
|
if (!buildDate) {
|
|
43
40
|
uuid = @"00000000-0000-0000-0000-000000000000";
|
|
44
41
|
return;
|
|
@@ -74,6 +71,7 @@ RCT_EXPORT_MODULE();
|
|
|
74
71
|
bytes[6], bytes[7],
|
|
75
72
|
bytes[8], bytes[9],
|
|
76
73
|
bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]];
|
|
74
|
+
#endif
|
|
77
75
|
});
|
|
78
76
|
return uuid;
|
|
79
77
|
}
|
|
@@ -414,7 +412,10 @@ RCT_EXPORT_MODULE();
|
|
|
414
412
|
RCT_EXPORT_METHOD(reload) {
|
|
415
413
|
NSLog(@"HotUpdater requested a reload");
|
|
416
414
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
417
|
-
|
|
415
|
+
NSURL *bundleURL = [HotUpdater bundleURL];
|
|
416
|
+
if (bundleURL) {
|
|
417
|
+
[super.bridge setValue:bundleURL forKey:@"bundleURL"];
|
|
418
|
+
}
|
|
418
419
|
RCTTriggerReloadCommandListeners(@"HotUpdater requested a reload");
|
|
419
420
|
});
|
|
420
421
|
}
|
|
@@ -442,4 +443,4 @@ RCT_EXPORT_METHOD(updateBundle:(NSString *)bundleId zipUrl:(NSString *)zipUrlStr
|
|
|
442
443
|
}
|
|
443
444
|
#endif
|
|
444
445
|
|
|
445
|
-
@end
|
|
446
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"use-sync-external-store": "1.4.0",
|
|
84
|
-
"@hot-updater/js": "0.
|
|
85
|
-
"@hot-updater/core": "0.
|
|
84
|
+
"@hot-updater/js": "0.15.1",
|
|
85
|
+
"@hot-updater/core": "0.15.1"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "rslib build",
|
package/src/checkForUpdate.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -67,8 +67,9 @@ export const HotUpdater = {
|
|
|
67
67
|
* Fetches the current release channel of the app.
|
|
68
68
|
*
|
|
69
69
|
* By default, if no channel is specified, the app is assigned to the 'production' channel.
|
|
70
|
+
* If the app is running in development mode, the channel will be `null`.
|
|
70
71
|
*
|
|
71
|
-
* @returns {string} The current release channel of the app
|
|
72
|
+
* @returns {string | null} The current release channel of the app
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
74
75
|
* ```ts
|
package/src/native.ts
CHANGED
|
@@ -98,13 +98,11 @@ export const getMinBundleId = (): string => {
|
|
|
98
98
|
* @returns {Promise<string>} Resolves with the current version id or null if not available.
|
|
99
99
|
*/
|
|
100
100
|
export const getBundleId = (): string => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return minBundleId.localeCompare(HotUpdater.HOT_UPDATER_BUNDLE_ID) >= 0
|
|
104
|
-
? minBundleId
|
|
101
|
+
return HotUpdater.HOT_UPDATER_BUNDLE_ID === NIL_UUID
|
|
102
|
+
? getMinBundleId()
|
|
105
103
|
: HotUpdater.HOT_UPDATER_BUNDLE_ID;
|
|
106
104
|
};
|
|
107
105
|
|
|
108
|
-
export const getChannel = (): string => {
|
|
106
|
+
export const getChannel = (): string | null => {
|
|
109
107
|
return HotUpdater.CHANNEL;
|
|
110
108
|
};
|