Skip to content

Commit

Permalink
Move ProgressView out of the Label, add Spacer
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Nov 17, 2024
1 parent b338e02 commit 341dd10
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Sources/SpeziDevicesUI/Scanning/NearbyDeviceRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public struct NearbyDeviceRow<Label: View>: View {
}
.tint(.primary)

Spacer()

if peripheral.state == .connecting || peripheral.state == .disconnecting {
ProgressView()
.accessibilityRemoveTraits(.updatesFrequently)
.foregroundStyle(.secondary)
}

if secondaryActionClosure != nil && peripheral.state == .connected {
ListInfoButton(Text("Device Details", bundle: .module), action: deviceDetailsAction)
}
Expand Down Expand Up @@ -113,6 +121,22 @@ public struct NearbyDeviceRow<Label: View>: View {
print("Clicked")
} secondaryAction: {
}

let peripheral = MockBluetoothPeripheral(label: "MyDevice 2", state: .connected)

Check failure on line 125 in Sources/SpeziDevicesUI/Scanning/NearbyDeviceRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used (operator_usage_whitespace)
NearbyDeviceRow(peripheral: MockBluetoothPeripheral(label: "MyDevice 2", state: .connected)) {
print("Clicked")
} secondaryAction: {
print("Secondary Clicked!")
} label: {
ListRow {
PeripheralLabel(peripheral)
Text("RSSI: -64")
} content: {
PeripheralSecondaryLabel(peripheral)
}

Check failure on line 137 in Sources/SpeziDevicesUI/Scanning/NearbyDeviceRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Vertical Whitespace before Closing Braces Violation: Don't include vertical whitespace (empty line) before closing braces (vertical_whitespace_closing_braces)
}

Check failure on line 139 in Sources/SpeziDevicesUI/Scanning/NearbyDeviceRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Vertical Whitespace before Closing Braces Violation: Don't include vertical whitespace (empty line) before closing braces (vertical_whitespace_closing_braces)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public struct PeripheralSecondaryLabel: View {
} else {
switch peripheral.state {
case .connecting, .disconnecting:
ProgressView()
.accessibilityRemoveTraits(.updatesFrequently)
EmptyView()
case .connected:
Text("Connected", bundle: .module)
case .disconnected:
Expand Down

0 comments on commit 341dd10

Please sign in to comment.