@hot-updater/react-native 0.14.0 → 0.15.0

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.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;
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;
@@ -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
- fallbackURL = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
37
- #endif
38
- if (fallbackURL) {
39
- NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fallbackURL path] error:nil];
40
- buildDate = attributes[NSFileModificationDate];
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
  }
@@ -442,4 +440,4 @@ RCT_EXPORT_METHOD(updateBundle:(NSString *)bundleId zipUrl:(NSString *)zipUrlStr
442
440
  }
443
441
  #endif
444
442
 
445
- @end
443
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
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.14.0",
85
- "@hot-updater/core": "0.14.0"
84
+ "@hot-updater/js": "0.15.0",
85
+ "@hot-updater/core": "0.15.0"
86
86
  },
87
87
  "scripts": {
88
88
  "build": "rslib build",
package/src/native.ts CHANGED
@@ -98,10 +98,8 @@ 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
- const minBundleId = getMinBundleId();
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