-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge branch 'ladislas/feature/lekaapp-reflect-connection-status-in…
…-sidebar'
- Loading branch information
Showing
8 changed files
with
108 additions
and
121 deletions.
There are no files selected for viewing
67 changes: 0 additions & 67 deletions
67
...ources/Views/Sidebar/Components/Header/RobotButton/Components/RobotBatteryIndicator.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Modules/RobotKit/Sources/UI/ViewModels/BatteryViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright 2023 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import BLEKit | ||
import SwiftUI | ||
|
||
public struct BatteryViewModel: Equatable { | ||
|
||
public let level: Int | ||
public let name: String | ||
public let color: Color | ||
|
||
public init(level: Int) { | ||
self.level = level | ||
switch level { | ||
case 0..<10: | ||
self.name = "battery.0" | ||
self.color = .red | ||
case 10..<25: | ||
self.name = "battery.25" | ||
self.color = .red | ||
case 25..<45: | ||
self.name = "battery.25" | ||
self.color = .orange | ||
case 45..<70: | ||
self.name = "battery.50" | ||
self.color = .yellow | ||
case 70..<95: | ||
self.name = "battery.75" | ||
self.color = .green | ||
case 95...100: | ||
self.name = "battery.100" | ||
self.color = .green | ||
default: | ||
self.name = "battery.0" | ||
self.color = .gray | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters