@blueid/access-capacitor 0.106.0 → 0.108.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.
@@ -10,15 +10,16 @@
10
10
  <key>HeadersPath</key>
11
11
  <string>Headers</string>
12
12
  <key>LibraryIdentifier</key>
13
- <string>ios-arm64</string>
13
+ <string>macos-arm64_x86_64</string>
14
14
  <key>LibraryPath</key>
15
15
  <string>libCBlueIDAccess.a</string>
16
16
  <key>SupportedArchitectures</key>
17
17
  <array>
18
18
  <string>arm64</string>
19
+ <string>x86_64</string>
19
20
  </array>
20
21
  <key>SupportedPlatform</key>
21
- <string>ios</string>
22
+ <string>macos</string>
22
23
  </dict>
23
24
  <dict>
24
25
  <key>BinaryPath</key>
@@ -26,7 +27,7 @@
26
27
  <key>HeadersPath</key>
27
28
  <string>Headers</string>
28
29
  <key>LibraryIdentifier</key>
29
- <string>macos-arm64_x86_64</string>
30
+ <string>ios-arm64_x86_64-simulator</string>
30
31
  <key>LibraryPath</key>
31
32
  <string>libCBlueIDAccess.a</string>
32
33
  <key>SupportedArchitectures</key>
@@ -35,7 +36,9 @@
35
36
  <string>x86_64</string>
36
37
  </array>
37
38
  <key>SupportedPlatform</key>
38
- <string>macos</string>
39
+ <string>ios</string>
40
+ <key>SupportedPlatformVariant</key>
41
+ <string>simulator</string>
39
42
  </dict>
40
43
  <dict>
41
44
  <key>BinaryPath</key>
@@ -43,18 +46,15 @@
43
46
  <key>HeadersPath</key>
44
47
  <string>Headers</string>
45
48
  <key>LibraryIdentifier</key>
46
- <string>ios-arm64_x86_64-simulator</string>
49
+ <string>ios-arm64</string>
47
50
  <key>LibraryPath</key>
48
51
  <string>libCBlueIDAccess.a</string>
49
52
  <key>SupportedArchitectures</key>
50
53
  <array>
51
54
  <string>arm64</string>
52
- <string>x86_64</string>
53
55
  </array>
54
56
  <key>SupportedPlatform</key>
55
57
  <string>ios</string>
56
- <key>SupportedPlatformVariant</key>
57
- <string>simulator</string>
58
58
  </dict>
59
59
  </array>
60
60
  <key>CFBundlePackageType</key>
@@ -139,7 +139,6 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
139
139
  case deployBlacklistEntries
140
140
  case getSystemStatus
141
141
  case pushSystemStatus
142
- case checkLatestFirmware
143
142
  }
144
143
 
145
144
  internal override func runAsync(arg0: Any? = nil, arg1: Any? = nil, arg2: Any? = nil) async throws -> Any? {
@@ -267,20 +266,6 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
267
266
 
268
267
  try await self.pushDeviceSystemStatus(status: status, with: tokenAuthentication)
269
268
 
270
- return .result(status)
271
- },
272
-
273
- BlueTask(
274
- id: BlueSynchronizeAccessTaskId.checkLatestFirmware,
275
- label: blueI18n.syncDeviceCheckLatestFwlabel,
276
- failable: true
277
- ) {_, runner in
278
- let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
279
- var status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.pushSystemStatus)
280
- let latestFW = try await self.sdkService.apiService.getLatestFirmware(deviceID: deviceID, with: tokenAuthentication).getData()
281
-
282
- self.updateFirmwareFlags(&status, latestFW)
283
-
284
269
  return .result(status)
285
270
  }
286
271
  ]
@@ -298,11 +283,6 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
298
283
  #endif
299
284
 
300
285
  if runner.isSuccessful() {
301
- let status: BlueSystemStatus? = try runner.getResult(BlueSynchronizeAccessTaskId.checkLatestFirmware)
302
- if let status = status {
303
- return status
304
- }
305
-
306
286
  return try runner.getResult(BlueSynchronizeAccessTaskId.pushSystemStatus)
307
287
  }
308
288
 
@@ -349,11 +329,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
349
329
 
350
330
  private func getSystemStatus(_ deviceID: String) async throws -> BlueSystemStatus {
351
331
  do {
352
- return try await blueTerminalRun(
353
- deviceID: deviceID,
354
- timeoutSeconds: 30.0,
355
- action: "STATUS"
356
- )
332
+ return try await BlueGetSystemStatusCommand(sdkService).runAsync(deviceID: deviceID)
357
333
  } catch {
358
334
  throw BlueError(.sdkGetSystemStatusFailed, cause: error)
359
335
  }
@@ -518,24 +494,6 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
518
494
 
519
495
  } while (sent < limit && offset < entriesCount)
520
496
  }
521
-
522
- internal func updateFirmwareFlags(_ status: inout BlueSystemStatus, _ latestFW: BlueGetLatestFirmwareResult) {
523
- if let testFW = latestFW.test {
524
- if let testVersion = testFW.testVersion {
525
- status.newTestFirmwareVersionAvailable = testVersion != status.applicationVersionTest || testFW.version != status.applicationVersion
526
- }
527
- }
528
-
529
- if let productionFW = latestFW.production {
530
- let isTestVersion = status.hasApplicationVersionTest && status.applicationVersionTest != 0
531
-
532
- if isTestVersion {
533
- status.newFirmwareVersionAvailable = true
534
- } else {
535
- status.newFirmwareVersionAvailable = productionFW.version != status.applicationVersion
536
- }
537
- }
538
- }
539
497
  }
540
498
 
541
499
  public class BlueGetAccessObjectsCommand: BlueSdkAsyncCommand {
@@ -170,6 +170,11 @@ internal func blueDisconnectBluetoothPeripheral(_ peripheral: CBPeripheral) thro
170
170
  return
171
171
  }
172
172
 
173
+ if peripheral.state == .connecting {
174
+ blueRemoveSignal(group: "bleCentral", name: "didConnect")
175
+ return
176
+ }
177
+
173
178
  guard peripheral.state == .connected else {
174
179
  throw BlueError(.unavailable)
175
180
  }
@@ -89,7 +89,7 @@ public struct BlueCommands {
89
89
  public let clearBlacklist = BlueClearBlacklistCommand()
90
90
  public let clearEventLog = BlueClearEventLogCommand()
91
91
  public let clearSystemLog = BlueClearSystemLogCommand()
92
- public let getSystemStatus = BlueGetSystemStatusCommand()
92
+ public let getSystemStatus = BlueGetSystemStatusCommand(defaultSdkService)
93
93
 
94
94
  public let openAppSettings = BlueOpenAppSettingsCommand()
95
95
 
@@ -7,38 +7,14 @@ public class BlueAsyncTerminalCommand: BlueAsyncCommand {
7
7
  init(action: String) { self.action = action }
8
8
 
9
9
  internal func runAsync(arg0: Any? = nil, arg1: Any? = nil, arg2: Any? = nil) async throws -> Any? {
10
- if #available(macOS 10.15, *) {
11
- return try await runAsync(deviceID: try blueCastArg(String.self, arg0))
12
- } else {
13
- throw BlueError(.unavailable)
14
- }
10
+ return try await runAsync(deviceID: try blueCastArg(String.self, arg0))
15
11
  }
16
12
 
17
- @available(macOS 10.15, *)
18
13
  public func runAsync(deviceID: String) async throws {
19
14
  return try await blueTerminalRun(deviceID: deviceID, timeoutSeconds: 30.0, action: action)
20
15
  }
21
16
  }
22
17
 
23
- public class BlueAsyncTerminalCommandWithResult<T>: BlueAsyncCommand where T: Message {
24
- let action: String
25
-
26
- init(action: String) { self.action = action }
27
-
28
- internal func runAsync(arg0: Any? = nil, arg1: Any? = nil, arg2: Any? = nil) async throws -> Any? {
29
- if #available(macOS 10.15, *) {
30
- return try await runAsync(deviceID: try blueCastArg(String.self, arg0))
31
- } else {
32
- throw BlueError(.unavailable)
33
- }
34
- }
35
-
36
- @available(macOS 10.15, *)
37
- public func runAsync(deviceID: String) async throws -> T {
38
- return try await blueTerminalRun(deviceID: deviceID, timeoutSeconds: 30.0, action: action)
39
- }
40
- }
41
-
42
18
  public class BlueClearBlacklistCommand: BlueAsyncTerminalCommand {
43
19
  init() { super.init(action: "BL_CLEAR") }
44
20
  }
@@ -51,6 +27,49 @@ public class BlueClearSystemLogCommand: BlueAsyncTerminalCommand {
51
27
  init() { super.init(action: "SL_CLEAR") }
52
28
  }
53
29
 
54
- public class BlueGetSystemStatusCommand: BlueAsyncTerminalCommandWithResult<BlueSystemStatus> {
55
- init() { super.init(action: "STATUS") }
30
+ public class BlueGetSystemStatusCommand: BlueSdkAsyncCommand {
31
+ internal override func runAsync(arg0: Any? = nil, arg1: Any? = nil, arg2: Any? = nil) async throws -> Any? {
32
+ return try await runAsync(
33
+ deviceID: try blueCastArg(String.self, arg0)
34
+ )
35
+ }
36
+
37
+ public func runAsync(deviceID: String) async throws -> BlueSystemStatus {
38
+ var status: BlueSystemStatus = try await blueTerminalRun(deviceID: deviceID, timeoutSeconds: 30.0, action: "STATUS")
39
+
40
+ do {
41
+ let credentials = try BlueGetAccessCredentialsCommand().run(credentialType: .maintenance, for: deviceID, includePrivateKey: true)
42
+
43
+ if let credential = credentials.credentials.first {
44
+ let tokenAuthentication = try await sdkService.authenticationTokenService
45
+ .getTokenAuthentication(credential: credential)
46
+
47
+ let latestFW = try await self.sdkService.apiService.getLatestFirmware(deviceID: deviceID, with: tokenAuthentication).getData()
48
+
49
+ self.updateFirmwareFlags(&status, latestFW)
50
+ }
51
+ } catch {
52
+ blueLogError(error.localizedDescription)
53
+ }
54
+
55
+ return status
56
+ }
57
+
58
+ internal func updateFirmwareFlags(_ status: inout BlueSystemStatus, _ latestFW: BlueGetLatestFirmwareResult) {
59
+ if let testFW = latestFW.test {
60
+ if let testVersion = testFW.testVersion {
61
+ status.newTestFirmwareVersionAvailable = testVersion != status.applicationVersionTest || testFW.version != status.applicationVersion
62
+ }
63
+ }
64
+
65
+ if let productionFW = latestFW.production {
66
+ let isTestVersion = status.hasApplicationVersionTest && status.applicationVersionTest != 0
67
+
68
+ if isTestVersion {
69
+ status.newFirmwareVersionAvailable = true
70
+ } else {
71
+ status.newFirmwareVersionAvailable = productionFW.version != status.applicationVersion
72
+ }
73
+ }
74
+ }
56
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueid/access-capacitor",
3
- "version": "0.106.0",
3
+ "version": "0.108.0",
4
4
  "description": "Capacitor JS plugin for the BlueID Access SDK",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",