@viettelpost/react-native-ota 0.1.1 → 0.1.2

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.
@@ -52,7 +52,7 @@ public final class OTAUpdateBundleResolver: NSObject {
52
52
  }
53
53
  }
54
54
 
55
- @objc func getOTADirectoryPath() throws -> String {
55
+ @objc public func getOTADirectoryPath() throws -> String {
56
56
  let directoryURL = try otaDirectoryURL()
57
57
  try fileManager.createDirectory(
58
58
  at: directoryURL,
@@ -63,7 +63,7 @@ public final class OTAUpdateBundleResolver: NSObject {
63
63
  }
64
64
 
65
65
  // Manual test hook: the bundle file must already be copied into private OTA storage.
66
- @objc func prepareManualInstall(_ bundleVersion: String) throws -> NSNumber {
66
+ @objc public func prepareManualInstall(_ bundleVersion: String) throws -> NSNumber {
67
67
  let normalizedVersion = bundleVersion.trimmingCharacters(in: .whitespacesAndNewlines)
68
68
  guard !normalizedVersion.isEmpty else {
69
69
  throw NSError(
@@ -93,7 +93,7 @@ public final class OTAUpdateBundleResolver: NSObject {
93
93
  }
94
94
 
95
95
  // Manual test hook: promote only the pending bundle that actually launched.
96
- @objc func markSuccess() throws -> NSNumber {
96
+ @objc public func markSuccess() throws -> NSNumber {
97
97
  var metadata = try storage.readMetadata()
98
98
  guard metadata.status == statusPending,
99
99
  let pendingVersion = metadata.pendingBundleVersion,
@@ -121,7 +121,7 @@ public final class OTAUpdateBundleResolver: NSObject {
121
121
  return true as NSNumber
122
122
  }
123
123
 
124
- @objc func copyBundleFromDocuments(_ bundleVersion: String, fileName: String) throws -> NSNumber {
124
+ @objc public func copyBundleFromDocuments(_ bundleVersion: String, fileName: String) throws -> NSNumber {
125
125
  let normalizedVersion = bundleVersion.trimmingCharacters(in: .whitespacesAndNewlines)
126
126
  let normalizedFileName = fileName.trimmingCharacters(in: .whitespacesAndNewlines)
127
127
  guard !normalizedVersion.isEmpty, !normalizedFileName.isEmpty else {
@@ -160,7 +160,7 @@ public final class OTAUpdateBundleResolver: NSObject {
160
160
  return true as NSNumber
161
161
  }
162
162
 
163
- @objc func getCurrentBundleInfoJSONString() throws -> String {
163
+ @objc public func getCurrentBundleInfoJSONString() throws -> String {
164
164
  let metadata = try storage.readMetadata()
165
165
  let info = currentBundleInfo(for: metadata)
166
166
  let data = try encoder.encode(info)
@@ -17,8 +17,8 @@ struct OTADiskUsage: Codable {
17
17
  }
18
18
 
19
19
  @objc(OTAUpdateCleanup)
20
- final class OTAUpdateCleanup: NSObject {
21
- @objc static let shared = OTAUpdateCleanup()
20
+ public final class OTAUpdateCleanup: NSObject {
21
+ @objc public static let shared = OTAUpdateCleanup()
22
22
 
23
23
  private let fileManager: FileManager
24
24
  private let encoder: JSONEncoder
@@ -69,7 +69,7 @@ final class OTAUpdateCleanup: NSObject {
69
69
  }
70
70
  }
71
71
 
72
- @objc func cleanupOTAStorage() throws -> NSNumber {
72
+ @objc public func cleanupOTAStorage() throws -> NSNumber {
73
73
  let metadata = try storage.readMetadata()
74
74
  var keepVersions = Set<String>()
75
75
  if !isEmbeddedVersion(metadata.activeBundleVersion) {
@@ -89,7 +89,7 @@ final class OTAUpdateCleanup: NSObject {
89
89
  return didCleanup as NSNumber
90
90
  }
91
91
 
92
- @objc func getOTADiskUsageJSONString() throws -> String {
92
+ @objc public func getOTADiskUsageJSONString() throws -> String {
93
93
  let usage = try getOTADiskUsage()
94
94
  let data = try encoder.encode(usage)
95
95
  guard let json = String(data: data, encoding: .utf8) else {
@@ -55,8 +55,8 @@ private struct OTAUpdatePayload {
55
55
  }
56
56
 
57
57
  @objc(OTAUpdateDownloader)
58
- final class OTAUpdateDownloader: NSObject {
59
- @objc static let shared = OTAUpdateDownloader()
58
+ public final class OTAUpdateDownloader: NSObject {
59
+ @objc public static let shared = OTAUpdateDownloader()
60
60
 
61
61
  private let storage = OTAUpdateStorage.shared
62
62
  private let fileManager = FileManager.default
@@ -87,7 +87,7 @@ final class OTAUpdateDownloader: NSObject {
87
87
  private let reasonTempAssetsNotFoundForVerify = "temp_assets_not_found_for_verify"
88
88
  private let signatureMismatchMessage = "OTA signature mismatch. Check that version, platform, fileName, lowercase sha256, and assetsSha256 when assets are included exactly match the signed payload."
89
89
 
90
- @objc func downloadAndInstallBundle(_ updateJson: String, completion: @escaping (NSNumber?, NSError?) -> Void) {
90
+ @objc public func downloadAndInstallBundle(_ updateJson: String, completion: @escaping (NSNumber?, NSError?) -> Void) {
91
91
  DispatchQueue.global(qos: .utility).async {
92
92
  do {
93
93
  _ = try self.downloadBundle(updateJson)
@@ -99,7 +99,7 @@ final class OTAUpdateDownloader: NSObject {
99
99
  }
100
100
  }
101
101
 
102
- @objc func getDownloadInfo(_ version: String) throws -> String {
102
+ @objc public func getDownloadInfo(_ version: String) throws -> String {
103
103
  let normalizedVersion = try normalizeVersion(version)
104
104
  let tempBundleURL = try tempBundleURL(version: normalizedVersion)
105
105
  let finalBundleURL = try finalBundleURL(version: normalizedVersion)
@@ -6,7 +6,7 @@
6
6
  #import "ReactNativeOta-Swift.h"
7
7
  #import <ReactNativeOtaSpec/ReactNativeOtaSpec.h>
8
8
 
9
- @interface OTAUpdateModule : NSObject <NativeOTAUpdateSpec>
9
+ @interface OTAUpdateModule : NSObject <NativeReactNativeOtaSpec>
10
10
  @end
11
11
 
12
12
  @implementation OTAUpdateModule
@@ -183,7 +183,7 @@ static NSString *OTARejectMessageFromError(NSError *error, NSString *fallbackMes
183
183
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
184
184
  (const facebook::react::ObjCTurboModule::InitParams &)params
185
185
  {
186
- return std::make_shared<facebook::react::NativeOTAUpdateSpecJSI>(params);
186
+ return std::make_shared<facebook::react::NativeReactNativeOtaSpecJSI>(params);
187
187
  }
188
188
 
189
189
  @end
@@ -1,8 +1,8 @@
1
1
  import Foundation
2
2
 
3
3
  @objc(OTAUpdateStorage)
4
- final class OTAUpdateStorage: NSObject {
5
- @objc static let shared = OTAUpdateStorage()
4
+ public final class OTAUpdateStorage: NSObject {
5
+ @objc public static let shared = OTAUpdateStorage()
6
6
 
7
7
  private let encoder: JSONEncoder
8
8
  private let decoder: JSONDecoder
@@ -15,7 +15,7 @@ final class OTAUpdateStorage: NSObject {
15
15
  super.init()
16
16
  }
17
17
 
18
- @objc func getMetadataJSONString() throws -> String {
18
+ @objc public func getMetadataJSONString() throws -> String {
19
19
  let metadata = try readMetadata()
20
20
  let data = try encoder.encode(metadata)
21
21
  guard let jsonString = String(data: data, encoding: .utf8) else {
@@ -24,7 +24,7 @@ final class OTAUpdateStorage: NSObject {
24
24
  return jsonString
25
25
  }
26
26
 
27
- @objc func resetMetadata() throws -> NSNumber {
27
+ @objc public func resetMetadata() throws -> NSNumber {
28
28
  try writeMetadata(.default())
29
29
  return true as NSNumber
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viettelpost/react-native-ota",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "ViettelPost React Native OTA runtime and deploy CLI",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -16,6 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.resources = "ios/ota_public_key.pem"
17
17
  s.swift_version = "5.0"
18
18
  s.requires_arc = true
19
+ s.dependency "ZIPFoundation", "~> 0.9"
19
20
 
20
21
  install_modules_dependencies(s)
21
22
  end