@blueid/access-capacitor 0.102.0 → 0.104.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,18 +27,15 @@
26
27
  <key>HeadersPath</key>
27
28
  <string>Headers</string>
28
29
  <key>LibraryIdentifier</key>
29
- <string>ios-arm64_x86_64-simulator</string>
30
+ <string>ios-arm64</string>
30
31
  <key>LibraryPath</key>
31
32
  <string>libCBlueIDAccess.a</string>
32
33
  <key>SupportedArchitectures</key>
33
34
  <array>
34
35
  <string>arm64</string>
35
- <string>x86_64</string>
36
36
  </array>
37
37
  <key>SupportedPlatform</key>
38
38
  <string>ios</string>
39
- <key>SupportedPlatformVariant</key>
40
- <string>simulator</string>
41
39
  </dict>
42
40
  <dict>
43
41
  <key>BinaryPath</key>
@@ -45,7 +43,7 @@
45
43
  <key>HeadersPath</key>
46
44
  <string>Headers</string>
47
45
  <key>LibraryIdentifier</key>
48
- <string>macos-arm64_x86_64</string>
46
+ <string>ios-arm64_x86_64-simulator</string>
49
47
  <key>LibraryPath</key>
50
48
  <string>libCBlueIDAccess.a</string>
51
49
  <key>SupportedArchitectures</key>
@@ -54,7 +52,9 @@
54
52
  <string>x86_64</string>
55
53
  </array>
56
54
  <key>SupportedPlatform</key>
57
- <string>macos</string>
55
+ <string>ios</string>
56
+ <key>SupportedPlatformVariant</key>
57
+ <string>simulator</string>
58
58
  </dict>
59
59
  </array>
60
60
  <key>CFBundlePackageType</key>
@@ -13,14 +13,14 @@ private func getColor(_ status: BlueTaskStatus) -> Color {
13
13
  }
14
14
  }
15
15
 
16
- private func getLineColor(_ status: BlueTaskStatus) -> Color {
16
+ private func getTextColor(_ status: BlueTaskStatus) -> Color {
17
17
  switch (status) {
18
- case .ready, .started:
19
- return .gray
20
- case .failed:
21
- return .red
22
- case .succeeded, .skipped:
23
- return .green
18
+ case .ready, .started, .skipped:
19
+ return .black
20
+ case .succeeded:
21
+ return Color(red: 0.0, green: 0.5, blue: 0.0)
22
+ default:
23
+ return getColor(status)
24
24
  }
25
25
  }
26
26
 
@@ -32,8 +32,10 @@ private func getSymbol(_ status: BlueTaskStatus) -> String {
32
32
  return "circle.circle"
33
33
  case .failed:
34
34
  return "xmark.circle"
35
- case .succeeded, .skipped:
35
+ case .succeeded:
36
36
  return "checkmark.circle"
37
+ case .skipped:
38
+ return "minus.circle"
37
39
  }
38
40
  }
39
41
 
@@ -41,7 +43,7 @@ class BlueTaskModel: ObservableObject, Identifiable {
41
43
  @Published var label: String
42
44
  @Published var status: BlueTaskStatus
43
45
  @Published var statusColor: Color
44
- @Published var lineColor: Color
46
+ @Published var textColor: Color
45
47
  @Published var symbol: String
46
48
  @Published var errorDescription: String
47
49
  @Published var isLast: Bool
@@ -51,8 +53,8 @@ class BlueTaskModel: ObservableObject, Identifiable {
51
53
  init(_ task: BlueTask, _ isLast: Bool) {
52
54
  self.label = task.label
53
55
  self.status = task.status.value
56
+ self.textColor = getTextColor(task.status.value)
54
57
  self.statusColor = getColor(task.status.value)
55
- self.lineColor = getLineColor(task.status.value)
56
58
  self.symbol = getSymbol(task.status.value)
57
59
  self.errorDescription = task.errorDescription ?? ""
58
60
  self.isLast = isLast
@@ -61,8 +63,8 @@ class BlueTaskModel: ObservableObject, Identifiable {
61
63
  guard let self = self else { return }
62
64
 
63
65
  self.status = status
66
+ self.textColor = getTextColor(status)
64
67
  self.statusColor = getColor(status)
65
- self.lineColor = getLineColor(status)
66
68
  self.symbol = getSymbol(status)
67
69
  self.errorDescription = task.errorDescription ?? ""
68
70
 
@@ -90,23 +92,27 @@ struct TaskView: View {
90
92
 
91
93
  Text(task.label)
92
94
  .font(.system(size: 14))
95
+ .foregroundColor(task.textColor)
93
96
  .frame(maxWidth: .infinity, alignment: .leading)
94
97
  }
95
98
 
96
- HStack(alignment: .center) {
97
- if !task.isLast {
99
+ HStack(alignment: .center, spacing: 0) {
100
+ ZStack(alignment: .leading) {
98
101
  Rectangle()
99
- .fill(task.lineColor)
102
+ .fill(task.statusColor)
100
103
  .frame(width: 2)
101
104
  .padding(.horizontal, 10.5)
102
- }
103
-
104
- if !task.errorDescription.isEmpty {
105
- Text(task.errorDescription)
106
- .foregroundColor(.red)
107
- .font(.system(size: 11))
108
- .padding(.vertical, 2)
109
- .multilineTextAlignment(.leading)
105
+ .hidden(task.isLast)
106
+
107
+ if !task.errorDescription.isEmpty {
108
+ Text(task.errorDescription)
109
+ .foregroundColor(.red)
110
+ .font(.system(size: 11))
111
+ .padding(.leading, 32)
112
+ .padding(.bottom, 5)
113
+ .fixedSize(horizontal: false, vertical: true)
114
+ .alignmentGuide(.leading) { d in d[.leading] }
115
+ }
110
116
  }
111
117
  }
112
118
  }
@@ -119,9 +125,10 @@ class BlueSynchronizeAccessDeviceModalViewModel: ObservableObject {
119
125
  @Published var dismissEnabled: Bool = true
120
126
  @Published var tasks: [BlueTask]
121
127
 
122
- init(title: String = "", dismiss: String = "", tasks: [BlueTask] = []) {
128
+ init(title: String = "", dismiss: String = "", dismissEnabled: Bool = true, tasks: [BlueTask] = []) {
123
129
  self.title = title
124
130
  self.dismiss = dismiss
131
+ self.dismissEnabled = dismissEnabled
125
132
  self.tasks = tasks
126
133
  }
127
134
  }
@@ -129,7 +136,7 @@ class BlueSynchronizeAccessDeviceModalViewModel: ObservableObject {
129
136
  struct BlueSynchronizeAccessDeviceModalView: View {
130
137
  @ObservedObject private var vm: BlueSynchronizeAccessDeviceModalViewModel
131
138
 
132
- internal var height: CGFloat = 500
139
+ internal var height: CGFloat = 550
133
140
  internal var backgroundColor: UIColor = .white
134
141
  internal var foregroundColor: UIColor = .black
135
142
 
@@ -155,24 +162,30 @@ struct BlueSynchronizeAccessDeviceModalView: View {
155
162
  .foregroundColor(Color(backgroundColor))
156
163
  .shadow(color: .gray, radius: 1)
157
164
 
158
- VStack(alignment: .center) {
165
+ VStack(alignment: .center, spacing: 0) {
159
166
  Text(vm.title)
160
167
  .font(.system(size: 20))
161
168
  .foregroundColor(.gray)
169
+ .multilineTextAlignment(.center)
162
170
 
163
171
  Spacer()
164
172
 
165
- ScrollView {
166
- VStack(alignment: .leading, spacing: 0) {
167
- ForEach(vm.tasks.indices, id: \.self){ index in
168
- TaskView(task: BlueTaskModel(vm.tasks[index], index == vm.tasks.indices.last))
173
+ GeometryReader { geometry in
174
+ ScrollView(.vertical) {
175
+ VStack(alignment: .leading, spacing: 0) {
176
+ ForEach(vm.tasks.indices, id: \.self){ index in
177
+ TaskView(task: BlueTaskModel(vm.tasks[index], index == vm.tasks.indices.last))
178
+ }
169
179
  }
170
- }.padding(.vertical, 10)
180
+ .padding(.vertical, 10)
181
+ .frame(width: geometry.size.width)
182
+ .frame(minHeight: geometry.size.height)
183
+ }
171
184
  }
172
185
 
186
+ Spacer()
187
+
173
188
  if !vm.dismiss.isEmpty {
174
- Spacer()
175
-
176
189
  Button {
177
190
  onDismiss()
178
191
  } label: {
@@ -180,7 +193,8 @@ struct BlueSynchronizeAccessDeviceModalView: View {
180
193
  .font(.system(size: 18))
181
194
  .frame(maxWidth: .infinity)
182
195
  .padding(EdgeInsets(top: 15, leading: 10, bottom: 15, trailing: 10))
183
- .background(Color.gray.opacity(0.5))
196
+ .background(Color.gray.opacity(vm.dismissEnabled ? 0.5 : 0.3))
197
+ .foregroundColor(vm.dismissEnabled ? .black : .gray)
184
198
  .cornerRadius(10)
185
199
  }
186
200
  .disabled(!vm.dismissEnabled)
@@ -198,38 +212,40 @@ struct BlueSynchronizeAccessDeviceModalView: View {
198
212
  }
199
213
  }
200
214
 
215
+ let noop: (BlueSerialTaskRunner) async throws -> BlueTaskResult = { _ in .result(nil) }
216
+
201
217
  struct BlueSynchronizeAccessDeviceModalView_Preview: PreviewProvider {
202
218
  static var previews: some View {
203
219
  BlueSynchronizeAccessDeviceModalView(
204
220
  BlueSynchronizeAccessDeviceModalViewModel(
205
- title: "Synchronization in Progress",
206
- dismiss: "Cancel",
207
- tasks: [
221
+ title: "Synchronization has failed (Worst case)",
222
+ dismiss: "Done",
223
+ tasks: Array(1..<12).map { element in
208
224
  BlueTask(
209
- id: "A",
210
- label: "Retrieve device configuration",
225
+ id: element.description,
226
+ label: "Task label - \(element.description)",
211
227
  status: .failed,
212
- error: BlueError(.sdkCredentialNotFound, cause: BlueError(.invalidCrc), detail: "Something is wrong")
213
- ) { _ in .result(nil) },
214
-
215
- BlueTask(
216
- id: "B",
217
- label: "Update device configuration",
218
- status: .succeeded
219
- ) { _ in .result(nil) },
220
-
221
- BlueTask(
222
- id: "C",
223
- label: "Wait for device to restart",
224
- status: .started
225
- ) { _ in .result(nil) },
226
-
228
+ error: BlueError(.sdkDecodeJsonFailed, cause: BlueError(.sdkNetworkError), detail: "Something went wrong ¯\\_(ツ)_/¯"),
229
+ handler: noop
230
+ )
231
+ }
232
+ )
233
+ ) {}
234
+
235
+ BlueSynchronizeAccessDeviceModalView(
236
+ BlueSynchronizeAccessDeviceModalViewModel(
237
+ title: "Cancelling...",
238
+ dismiss: "Cancel",
239
+ dismissEnabled: false,
240
+ tasks: Array(1..<12).enumerated().map { (index, element) in
227
241
  BlueTask(
228
- id: "D",
229
- label: "Push system status",
230
- status: .ready
231
- ) { _ in .result(nil) }
232
- ]
242
+ id: element.description,
243
+ label: "Task label - \(element.description)",
244
+ status: index == 1 ? .failed : .succeeded,
245
+ error: index == 1 ? BlueError(.sdkDecodeJsonFailed, cause: BlueError(.sdkNetworkError), detail: "Something went wrong ¯\\_(ツ)_/¯"): nil,
246
+ handler: noop
247
+ )
248
+ }
233
249
  )
234
250
  ) {}
235
251
  }
@@ -35,7 +35,7 @@ public class BlueTask {
35
35
 
36
36
  let handler: (BlueSerialTaskRunner) async throws -> BlueTaskResult
37
37
 
38
- init(id: AnyHashable, label: String, failable: Bool = false, status: BlueTaskStatus = .ready, error: Error? = nil, _ handler: @escaping (BlueSerialTaskRunner) async throws -> BlueTaskResult) {
38
+ init(id: AnyHashable, label: String, failable: Bool = false, status: BlueTaskStatus = .ready, error: Error? = nil, handler: @escaping (BlueSerialTaskRunner) async throws -> BlueTaskResult) {
39
39
  self.id = id
40
40
  self.label = label
41
41
  self.failable = failable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueid/access-capacitor",
3
- "version": "0.102.0",
3
+ "version": "0.104.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",