@gfean/react-native-bundle-drop 0.3.7 → 0.3.8

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.
@@ -5,6 +5,7 @@ NS_ASSUME_NONNULL_BEGIN
5
5
  @interface BundleDropLocator : NSObject
6
6
 
7
7
  + (nullable NSURL *)bundleURL;
8
+ + (unsigned long long)fileSizeAtURL:(NSURL *)url NS_SWIFT_NAME(fileSize(at:));
8
9
 
9
10
  @end
10
11
 
@@ -0,0 +1,21 @@
1
+ #import "BundleDropLocator.h"
2
+
3
+ #if __has_include(<BundleDrop/BundleDrop-Swift.h>)
4
+ #import <BundleDrop/BundleDrop-Swift.h>
5
+ #else
6
+ #import "BundleDrop-Swift.h"
7
+ #endif
8
+
9
+ @implementation BundleDropLocator
10
+
11
+ + (nullable NSURL *)bundleURL
12
+ {
13
+ return [BundleDropLocatorCore bundleURL];
14
+ }
15
+
16
+ + (unsigned long long)fileSizeAtURL:(NSURL *)url
17
+ {
18
+ return [BundleDropLocatorCore fileSizeAt:url];
19
+ }
20
+
21
+ @end
@@ -1,6 +1,6 @@
1
1
  import Foundation
2
2
 
3
- @objc(BundleDropLocator) public final class BundleDropLocator: NSObject {
3
+ @objc(BundleDropLocatorCore) public final class BundleDropLocatorCore: NSObject {
4
4
 
5
5
  static let binaryVersionKey = "BundleDropBinaryVersion"
6
6
 
@@ -14,7 +14,7 @@ final class BundleDropModule: NSObject {
14
14
  _ resolve: @escaping RCTPromiseResolveBlock,
15
15
  rejecter reject: @escaping RCTPromiseRejectBlock
16
16
  ) {
17
- if let url = BundleDropLocator.bundleURL() {
17
+ if let url = BundleDropLocatorCore.bundleURL() {
18
18
  print("📦 Found downloaded bundle at: \(url.path)")
19
19
  resolve(url.path)
20
20
  return
@@ -29,7 +29,7 @@ final class BundleDropModule: NSObject {
29
29
  resolve: @escaping RCTPromiseResolveBlock,
30
30
  reject: @escaping RCTPromiseRejectBlock
31
31
  ) {
32
- UserDefaults.standard.set(enabled, forKey: BundleDropLocator.otaEnabledKey)
32
+ UserDefaults.standard.set(enabled, forKey: BundleDropLocatorCore.otaEnabledKey)
33
33
  resolve(nil)
34
34
  }
35
35
 
@@ -41,12 +41,12 @@ final class BundleDropModule: NSObject {
41
41
  return
42
42
  }
43
43
 
44
- guard let url = BundleDropLocator.bundleURL() else {
44
+ guard let url = BundleDropLocatorCore.bundleURL() else {
45
45
  print("⚠️ No downloaded bundle found; skipping restart.")
46
46
  return
47
47
  }
48
48
 
49
- let size = BundleDropLocator.fileSize(at: url)
49
+ let size = BundleDropLocatorCore.fileSize(at: url)
50
50
  if size < 1024 {
51
51
  print("⚠️ Bundle exists but looks invalid (size=\(size)). Skipping restart.")
52
52
  return
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gfean/react-native-bundle-drop",
3
- "version": "0.3.7",
4
- "nativeVersion": "0.3.7",
3
+ "version": "0.3.8",
4
+ "nativeVersion": "0.3.8",
5
5
  "description": "Over-the-air (OTA) updates for React Native — ship fixes instantly, no App Store or Play Store delays",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",