Files
iOS/Sources/Shared/API/WebSocket/AuthenticatedUser.swift
Zac West 4d9a530637 Reorganize files in repo, pull out build settings from pbxproj (#1140)
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.
2020-10-03 00:15:04 -07:00

38 lines
1.0 KiB
Swift

//
// AuthenticatedUser.swift
// HomeAssistant
//
// Created by Robert Trencheny on 4/9/19.
// Copyright © 2019 Robbie Trencheny. All rights reserved.
//
import Foundation
public class AuthenticatedUser: Codable, CustomStringConvertible {
public let ID: String
public let Name: String
public let IsOwner: Bool
public let IsAdmin: Bool
enum CodingKeys: String, CodingKey {
case ID = "id"
case Name = "name"
case IsOwner = "is_owner"
case IsAdmin = "is_admin"
}
public init?(_ dictionary: [String: Any]) {
guard let id = dictionary["id"] as? String, let name = dictionary["name"] as? String else {
return nil
}
self.ID = id
self.Name = name
self.IsOwner = dictionary["is_owner"] as? Bool ?? false
self.IsAdmin = dictionary["is_admin"] as? Bool ?? false
}
public var description: String {
return "AuthenticatedUser(id: \(self.ID), name: \(self.Name), owner: \(self.IsOwner), admin: \(self.IsAdmin)"
}
}