@blueid/access-capacitor 0.102.0 → 0.105.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/BlueidAccessCapacitor.podspec +2 -1
- package/dist/esm/BlueCore_pb.d.ts +8 -0
- package/dist/esm/BlueCore_pb.js +10 -0
- package/dist/esm/BlueCore_pb.js.map +1 -1
- package/dist/esm/BlueSDK_pb.d.ts +48 -0
- package/dist/esm/BlueSDK_pb.js +12 -0
- package/dist/esm/BlueSDK_pb.js.map +1 -1
- package/dist/plugin.cjs.js +22 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +22 -0
- package/dist/plugin.js.map +1 -1
- package/ios/CBlueIDAccess.xcframework/ios-arm64/Headers/core/BlueCore.pb.h +2 -0
- package/ios/CBlueIDAccess.xcframework/ios-arm64/libCBlueIDAccess.a +0 -0
- package/ios/CBlueIDAccess.xcframework/ios-arm64_x86_64-simulator/Headers/core/BlueCore.pb.h +2 -0
- package/ios/CBlueIDAccess.xcframework/ios-arm64_x86_64-simulator/libCBlueIDAccess.a +0 -0
- package/ios/CBlueIDAccess.xcframework/macos-arm64_x86_64/Headers/core/BlueCore.pb.h +2 -0
- package/ios/CBlueIDAccess.xcframework/macos-arm64_x86_64/libCBlueIDAccess.a +0 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueAPI.swift +7 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueAPIProtocol.swift +13 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueAccess.swift +12 -24
- package/ios/Plugin/BlueIDAccessSDK/BlueCommands.swift +3 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueCore.pb.swift +8 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueDFU/BlueDFUPeripheralService.swift +73 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueDFU/BlueUpdateAccessDeviceFirmwareCommand.swift +226 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueDevices.swift +24 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueError.swift +1 -1
- package/ios/Plugin/BlueIDAccessSDK/BlueFetch.swift +10 -2
- package/ios/Plugin/BlueIDAccessSDK/BlueModal/BlueModal.swift +30 -5
- package/ios/Plugin/BlueIDAccessSDK/BlueModal/{BlueSynchronizeAccessDeviceModalSession.swift → BlueStepProgressModalSession.swift} +4 -4
- package/ios/Plugin/BlueIDAccessSDK/BlueModal/{BlueSynchronizeAccessDeviceModalView.swift → BlueStepProgressModalView.swift} +98 -66
- package/ios/Plugin/BlueIDAccessSDK/BlueSDK.pb.swift +216 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueTaskRunner.swift +34 -3
- package/ios/Plugin/BlueIDAccessSDK/BlueZip.swift +30 -0
- package/package.json +1 -1
|
@@ -32,16 +32,32 @@ public class BlueTask {
|
|
|
32
32
|
var result: Any? = nil
|
|
33
33
|
var error: Error? = nil
|
|
34
34
|
var status: CurrentValueSubject<BlueTaskStatus, Never>
|
|
35
|
+
var progress: CurrentValueSubject<Float, Never>?
|
|
35
36
|
|
|
36
|
-
let handler: (BlueSerialTaskRunner) async throws -> BlueTaskResult
|
|
37
|
+
let handler: (BlueTask, BlueSerialTaskRunner) async throws -> BlueTaskResult
|
|
38
|
+
let cancelHandler: (() -> Void)?
|
|
37
39
|
|
|
38
|
-
init(
|
|
40
|
+
init(
|
|
41
|
+
id: AnyHashable,
|
|
42
|
+
label: String,
|
|
43
|
+
failable: Bool = false,
|
|
44
|
+
status: BlueTaskStatus = .ready,
|
|
45
|
+
error: Error? = nil,
|
|
46
|
+
progress: Float? = nil,
|
|
47
|
+
cancelHandler: (() -> Void)? = nil,
|
|
48
|
+
handler: @escaping (BlueTask, BlueSerialTaskRunner) async throws -> BlueTaskResult
|
|
49
|
+
) {
|
|
39
50
|
self.id = id
|
|
40
51
|
self.label = label
|
|
41
52
|
self.failable = failable
|
|
42
53
|
self.error = error
|
|
43
54
|
self.status = .init(status)
|
|
44
55
|
self.handler = handler
|
|
56
|
+
self.cancelHandler = cancelHandler
|
|
57
|
+
|
|
58
|
+
if let progress = progress {
|
|
59
|
+
self.progress = CurrentValueSubject(progress)
|
|
60
|
+
}
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
var errorDescription: String? {
|
|
@@ -53,6 +69,16 @@ public class BlueTask {
|
|
|
53
69
|
self.status.send(status)
|
|
54
70
|
}
|
|
55
71
|
}
|
|
72
|
+
|
|
73
|
+
func updateProgress(_ progress: Float) {
|
|
74
|
+
blueRunInMainThread {
|
|
75
|
+
self.progress?.send(progress)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func cancel() {
|
|
80
|
+
self.cancelHandler?()
|
|
81
|
+
}
|
|
56
82
|
}
|
|
57
83
|
|
|
58
84
|
public class BlueSerialTaskRunner: BlueTaskRunner {
|
|
@@ -61,6 +87,7 @@ public class BlueSerialTaskRunner: BlueTaskRunner {
|
|
|
61
87
|
private var failed: Bool = false
|
|
62
88
|
private var cancelled: Bool = false
|
|
63
89
|
private var sucessful: Bool = false
|
|
90
|
+
private var currentTask: BlueTask? = nil
|
|
64
91
|
|
|
65
92
|
init(_ tasks: [BlueTask]) {
|
|
66
93
|
self.tasks = tasks
|
|
@@ -77,12 +104,14 @@ public class BlueSerialTaskRunner: BlueTaskRunner {
|
|
|
77
104
|
return
|
|
78
105
|
}
|
|
79
106
|
|
|
107
|
+
self.currentTask = task
|
|
108
|
+
|
|
80
109
|
do {
|
|
81
110
|
blueLogDebug("Started: \(task.id)")
|
|
82
111
|
|
|
83
112
|
task.updateStatus(.started)
|
|
84
113
|
|
|
85
|
-
let taskResult = try await task.handler(self)
|
|
114
|
+
let taskResult = try await task.handler(task, self)
|
|
86
115
|
|
|
87
116
|
let taskStatus: BlueTaskStatus
|
|
88
117
|
|
|
@@ -131,6 +160,8 @@ public class BlueSerialTaskRunner: BlueTaskRunner {
|
|
|
131
160
|
|
|
132
161
|
public func cancel() -> Bool {
|
|
133
162
|
if (!sucessful && !failed) {
|
|
163
|
+
self.currentTask?.cancel()
|
|
164
|
+
|
|
134
165
|
cancelled = true
|
|
135
166
|
|
|
136
167
|
return true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class BlueZip
|
|
5
|
+
* A utility class for working with zip files.
|
|
6
|
+
*/
|
|
7
|
+
public class BlueZip {
|
|
8
|
+
/// Extracts contents of a zip file from the provided Data object.
|
|
9
|
+
///
|
|
10
|
+
/// - parameter data: The Data object representing the zip file.
|
|
11
|
+
/// - returns: URL pointing to the location where the contents of the zip file are extracted.
|
|
12
|
+
/// - throws: An error if the extraction process encounters any issues.
|
|
13
|
+
static func extract(data: Data) throws -> URL {
|
|
14
|
+
let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory())
|
|
15
|
+
let sourceURL = tempDirectoryURL.appendingPathComponent("package.zip")
|
|
16
|
+
let destinationURL = tempDirectoryURL.appendingPathComponent("extracted_package")
|
|
17
|
+
|
|
18
|
+
let fileManager = FileManager.default
|
|
19
|
+
|
|
20
|
+
if fileManager.fileExists(atPath: destinationURL.path) {
|
|
21
|
+
try fileManager.removeItem(at: destinationURL)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try data.write(to: sourceURL)
|
|
25
|
+
|
|
26
|
+
try fileManager.unzipItem(at: sourceURL, to: destinationURL)
|
|
27
|
+
|
|
28
|
+
return destinationURL
|
|
29
|
+
}
|
|
30
|
+
}
|