mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-19 19:46:45 -05:00
This is somewhat in prep of being able to make the project file generated, but also just organizes things into more concrete directory structures.
This pulls out _all_ of the build settings from the root level, and most from the target level, into xcconfigs.
The new directory structure looks like:
- Sources
- App
- (everything from HomeAssistant/)
- WatchApp
- Shared
- MacBridge
- Extensions
- Intents
- NotificationContent
- NotificationService
- Share
- Today
- Watch
- Widgets
- Tests
- App
- UI
- Shared
Somewhat intentionally, the file structure under these is not yet standardized/organized.
The project targets are now:
- App
- WatchApp
- Shared-iOS
- Shared-watchOS
- MacBridge
- Tests-App
- Tests-UI
- Tests-Shared
- Extension-Intents
- Extension-NotificationContent
- Extension-NotificationService
- Extension-Share
- Extension-Today
- Extension-Widget
- WatchExtension-Watch
This does not yet clean up resources vs. sources, nor does it handle some of the "it's in Sources/App but it's part of Shared" crossover directory issues.
69 lines
1.7 KiB
Swift
69 lines
1.7 KiB
Swift
//
|
|
// CMMotion+StringExtensions.swift
|
|
// HomeAssistant
|
|
//
|
|
// Created by Robert Trencheny on 8/6/18.
|
|
// Copyright © 2018 Robbie Trencheny. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import CoreMotion
|
|
|
|
// Don't translate these strings as they are sent to HA and we don't want to cause people to have to write
|
|
// automations expecting localized strings.
|
|
|
|
extension CMMotionActivity {
|
|
var activityTypes: [String] {
|
|
var types: [String] = []
|
|
|
|
if self.walking {
|
|
types.append("Walking")
|
|
} else if self.running {
|
|
types.append("Running")
|
|
} else if self.automotive {
|
|
types.append("Automotive")
|
|
} else if self.cycling {
|
|
types.append("Cycling")
|
|
} else if self.stationary {
|
|
types.append("Stationary")
|
|
} else {
|
|
types.append("Unknown")
|
|
}
|
|
|
|
return types
|
|
}
|
|
|
|
var icons: [String] {
|
|
var icons: [String] = []
|
|
|
|
if self.walking {
|
|
icons.append("mdi:walk")
|
|
} else if self.running {
|
|
icons.append("mdi:run")
|
|
} else if self.automotive {
|
|
icons.append("mdi:car")
|
|
} else if self.cycling {
|
|
icons.append("mdi:bike")
|
|
} else if self.stationary {
|
|
icons.append("mdi:human-male")
|
|
} else {
|
|
icons.append("mdi:help-circle")
|
|
}
|
|
|
|
return icons
|
|
}
|
|
}
|
|
|
|
extension CMMotionActivityConfidence {
|
|
var description: String {
|
|
if self == CMMotionActivityConfidence.low {
|
|
return "Low"
|
|
} else if self == CMMotionActivityConfidence.medium {
|
|
return "Medium"
|
|
} else if self == CMMotionActivityConfidence.high {
|
|
return "High"
|
|
}
|
|
return "Unknown"
|
|
}
|
|
}
|