Skip to content

Commit

Permalink
Organize things into a new Resources folder and begin some minor loca…
Browse files Browse the repository at this point in the history
…lization, mostly to clean up swiftlint disables
  • Loading branch information
robbiet480 committed Jan 9, 2017
1 parent d5a2076 commit b8fbdf0
Show file tree
Hide file tree
Showing 28 changed files with 344 additions and 55 deletions.
53 changes: 43 additions & 10 deletions HomeAssistant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
B6767A511D0234E700F2A08B /* SwitchableEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6767A501D0234E700F2A08B /* SwitchableEntity.swift */; };
B6880B2B1D7B9E6400CCB899 /* ClimateComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6880B2A1D7B9E6400CCB899 /* ClimateComponent.swift */; };
B689EBCB1D8B7C800000AECE /* MjpegStreamingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B689EBCA1D8B7C800000AECE /* MjpegStreamingController.swift */; };
B69933951E232AEA0054453D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B69933931E232AEA0054453D /* Localizable.strings */; };
B699339A1E232E060054453D /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = B69933991E232E060054453D /* Strings.swift */; };
B6AAD7A41D827DD40090B220 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6AAD7A31D827DD40090B220 /* NotificationService.swift */; };
B6AAD7A81D827DD40090B220 /* APNSAttachmentService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = B6AAD7A11D827DD40090B220 /* APNSAttachmentService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
B6DBF7661D89F7D800402A57 /* AutomationComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6DBF7651D89F7D800402A57 /* AutomationComponent.swift */; };
Expand Down Expand Up @@ -443,6 +445,8 @@
B689EBCA1D8B7C800000AECE /* MjpegStreamingController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MjpegStreamingController.swift; sourceTree = "<group>"; };
B689EBCC1D8B91C80000AECE /* APNSAttachmentService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = APNSAttachmentService.entitlements; sourceTree = "<group>"; };
B689EBCD1D8B91CE0000AECE /* NotificationContentExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationContentExtension.entitlements; sourceTree = "<group>"; };
B69933941E232AEA0054453D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
B69933991E232E060054453D /* Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
B6AAD79C1D825C8D0090B220 /* HomeAssistant.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HomeAssistant.entitlements; sourceTree = "<group>"; };
B6AAD7A11D827DD40090B220 /* APNSAttachmentService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = APNSAttachmentService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
B6AAD7A31D827DD40090B220 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -778,17 +782,13 @@
isa = PBXGroup;
children = (
B6F02BE71CB4698A0029ABE7 /* Classes */,
B69933961E232AF50054453D /* Resources */,
B60614B31D1F116D00249C11 /* Sounds */,
B679B1FA1E1F3D020071D366 /* Utilities */,
B679B1F91E1F3CFB0071D366 /* Views */,
B657A8E91CA646EB00121384 /* AppDelegate.swift */,
B657A8F21CA646EB00121384 /* Assets.xcassets */,
B657A9191CA647C500121384 /* HAAPI.swift */,
B6E8579B1CB0F37200F96925 /* HomeAssistant-Bridging-Header.h */,
B6AAD79C1D825C8D0090B220 /* HomeAssistant.entitlements */,
B657A8F71CA646EB00121384 /* Info.plist */,
B657A8F41CA646EB00121384 /* LaunchScreen.storyboard */,
B657A8EF1CA646EB00121384 /* Main.storyboard */,
);
path = HomeAssistant;
sourceTree = "<group>";
Expand Down Expand Up @@ -839,6 +839,28 @@
path = Utilities;
sourceTree = "<group>";
};
B69933961E232AF50054453D /* Resources */ = {
isa = PBXGroup;
children = (
B69933971E232B5F0054453D /* SwiftGen */,
B657A8F21CA646EB00121384 /* Assets.xcassets */,
B6AAD79C1D825C8D0090B220 /* HomeAssistant.entitlements */,
B657A8F71CA646EB00121384 /* Info.plist */,
B657A8F41CA646EB00121384 /* LaunchScreen.storyboard */,
B69933931E232AEA0054453D /* Localizable.strings */,
B657A8EF1CA646EB00121384 /* Main.storyboard */,
);
path = Resources;
sourceTree = "<group>";
};
B69933971E232B5F0054453D /* SwiftGen */ = {
isa = PBXGroup;
children = (
B69933991E232E060054453D /* Strings.swift */,
);
path = SwiftGen;
sourceTree = "<group>";
};
B6AAD7A21D827DD40090B220 /* APNSAttachmentService */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1200,6 +1222,7 @@
B606162D1D1F117700249C11 /* US-EN-Morgan-Freeman-Patio-Door-Opened.wav in Resources */,
B60616991D1F117800249C11 /* US-EN-Alexa-Water-Detected-In-Garage.wav in Resources */,
B60616411D1F117700249C11 /* US-EN-Morgan-Freeman-Turning-Off-The-Family-Room-Lights.wav in Resources */,
B69933951E232AEA0054453D /* Localizable.strings in Resources */,
B60616851D1F117700249C11 /* US-EN-Alexa-Good-Morning.wav in Resources */,
B606162B1D1F117700249C11 /* US-EN-Morgan-Freeman-Patio-Door-Closed.wav in Resources */,
B60616371D1F117700249C11 /* US-EN-Morgan-Freeman-Smoke-Detected-In-Kitchen.wav in Resources */,
Expand Down Expand Up @@ -1349,7 +1372,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
shellScript = "${PODS_ROOT}/SwiftLint/swiftlint";
};
B6E47E861CB9FD350027F6CA /* [CP] Copy Acknowledgements */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -1510,6 +1533,7 @@
B6F02C151CB489770029ABE7 /* LockComponent.swift in Sources */,
B629E8D61DAD8CFA00040A90 /* PushRegistrationRequest.swift in Sources */,
B6767A511D0234E700F2A08B /* SwitchableEntity.swift in Sources */,
B699339A1E232E060054453D /* Strings.swift in Sources */,
B6617EED1CFE79AD004DEE6D /* NSURL+QueryDictionary.swift in Sources */,
B6F02C131CB489770029ABE7 /* InputSelectComponent.swift in Sources */,
B6F02BF61CB4728D0029ABE7 /* History.swift in Sources */,
Expand Down Expand Up @@ -1633,6 +1657,15 @@
path = .;
sourceTree = "<group>";
};
B69933931E232AEA0054453D /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
B69933941E232AEA0054453D /* en */,
);
name = Localizable.strings;
path = .;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -1785,12 +1818,12 @@
baseConfigurationReference = 6410E5092616A0DD9241A91D /* Pods-HomeAssistant.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = HomeAssistant/HomeAssistant.entitlements;
CODE_SIGN_ENTITLEMENTS = HomeAssistant/Resources/HomeAssistant.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer: Robert Trencheny (43BAGK8JW5)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Robert Trencheny (43BAGK8JW5)";
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = UTQFCBPQRF;
INFOPLIST_FILE = HomeAssistant/Info.plist;
INFOPLIST_FILE = HomeAssistant/Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IS_SANDBOXED = true;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -1844,12 +1877,12 @@
baseConfigurationReference = 366FD7D1C50AFCED407FEBB6 /* Pods-HomeAssistant.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = HomeAssistant/HomeAssistant.entitlements;
CODE_SIGN_ENTITLEMENTS = HomeAssistant/Resources/HomeAssistant.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = UTQFCBPQRF;
INFOPLIST_FILE = HomeAssistant/Info.plist;
INFOPLIST_FILE = HomeAssistant/Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IS_SANDBOXED = false;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
1 change: 1 addition & 0 deletions HomeAssistant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let settingsView = SettingsViewController()
settingsView.title = "Settings"
settingsView.showErrorConnectingMessage = true
settingsView.showErrorConnectingMessageError = err
let navController = UINavigationController(rootViewController: settingsView)
self.window?.makeKeyAndVisible()
self.window?.rootViewController!.present(navController, animated: true, completion: nil)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
200 changes: 200 additions & 0 deletions HomeAssistant/Resources/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen

import Foundation

// swiftlint:disable file_length
// swiftlint:disable line_length

// swiftlint:disable type_body_length
// swiftlint:disable nesting
// swiftlint:disable variable_name
// swiftlint:disable valid_docs

enum L10n {

enum LocationChangeNotification {
/// Location change
static let title = L10n.tr("location_change_notification.title")
}

enum ManualLocationUpdateFailedNotification {
/// Failed to send current location to server. The error was %@
static func message(_ p1: String) -> String {
return L10n.tr("manual_location_update_failed_notification.message", p1)
}
/// Location failed to update
static let title = L10n.tr("manual_location_update_failed_notification.title")
}

enum ManualLocationUpdateNotification {
/// Successfully sent a one shot location to the server
static let message = L10n.tr("manual_location_update_notification.message")
/// Location updated
static let title = L10n.tr("manual_location_update_notification.title")
}

enum Permissions {

enum Location {
/// We use this to inform\r\nHome Assistant of your device location and state.
static let message = L10n.tr("permissions.location.message")
}

enum Notification {
/// We use this to let you\r\nsend notifications to your device.
static let message = L10n.tr("permissions.notification.message")
}
}

enum Settings {

enum ConnectionErrorNotification {
/// There was an error connecting to Home Assistant. Please confirm the settings are correct and save to attempt to reconnect. The error was %@.
static func message(_ p1: String) -> String {
return L10n.tr("settings.connection_error_notification.message", p1)
}
/// Connection Error
static let title = L10n.tr("settings.connection_error_notification.title")
}

enum ConnectionSection {
/// Connection
static let header = L10n.tr("settings.connection_section.header")

enum ApiPasswordRow {
/// password
static let placeholder = L10n.tr("settings.connection_section.api_password_row.placeholder")
/// Password
static let title = L10n.tr("settings.connection_section.api_password_row.title")
}

enum ConnectRow {
/// Connect
static let title = L10n.tr("settings.connection_section.connect_row.title")
}

enum InvalidUrlSchemeNotification {
/// The URL must begin with either http:// or https://.
static let message = L10n.tr("settings.connection_section.invalid_url_scheme_notification.message")
/// Invalid URL
static let title = L10n.tr("settings.connection_section.invalid_url_scheme_notification.title")
}
}

enum DetailsSection {

enum EnableLocationRow {
/// Enable location tracking
static let title = L10n.tr("settings.details_section.enable_location_row.title")
}

enum EnableNotificationRow {
/// Enable notifications
static let title = L10n.tr("settings.details_section.enable_notification_row.title")
}

enum LocationSettingsRow {
/// Location Settings
static let title = L10n.tr("settings.details_section.location_settings_row.title")
}

enum NotificationSettingsRow {
/// Notification Settings
static let title = L10n.tr("settings.details_section.notification_settings_row.title")
}
}

enum DeviceIdSection {
/// Device ID is the identifier used when sending location updates to Home Assistant, as well as the target to send push notifications to.
static let footer = L10n.tr("settings.device_id_section.footer")

enum DeviceIdRow {
/// Device ID
static let title = L10n.tr("settings.device_id_section.device_id_row.title")
}
}

enum DiscoverySection {
/// Discovered Home Assistants
static let header = L10n.tr("settings.discovery_section.header")
}

enum ResetSection {

enum ResetAlert {
/// Your settings will be reset and this device will be unregistered from push notifications as well as removed from your Home Assistant configuration.
static let message = L10n.tr("settings.reset_section.reset_alert.message")
/// Reset
static let title = L10n.tr("settings.reset_section.reset_alert.title")
}

enum ResetRow {
/// Reset
static let title = L10n.tr("settings.reset_section.reset_row.title")
}
}

enum StatusSection {
/// Status
static let header = L10n.tr("settings.status_section.header")

enum ConnectedToSseRow {
/// Connected
static let title = L10n.tr("settings.status_section.connected_to_sse_row.title")
}

enum DeviceTrackerComponentLoadedRow {
/// Device Tracker Component Loaded
static let title = L10n.tr("settings.status_section.device_tracker_component_loaded_row.title")
}

enum IosComponentLoadedRow {
/// iOS Component Loaded
static let title = L10n.tr("settings.status_section.ios_component_loaded_row.title")
}

enum LocationNameRow {
/// My Home Assistant
static let placeholder = L10n.tr("settings.status_section.location_name_row.placeholder")
/// Name
static let title = L10n.tr("settings.status_section.location_name_row.title")
}

enum NotifyPlatformLoadedRow {
/// iOS Notify Platform Loaded
static let title = L10n.tr("settings.status_section.notify_platform_loaded_row.title")
}

enum VersionRow {
/// 0.35.0
static let placeholder = L10n.tr("settings.status_section.version_row.placeholder")
/// Version
static let title = L10n.tr("settings.status_section.version_row.title")
}
}
}

enum SignificantLocationChangeNotification {
/// Significant location change detected, notifying Home Assistant
static let message = L10n.tr("significant_location_change_notification.message")
}

enum ZoneEnteredNotification {
/// %@ entered
static func message(_ p1: String) -> String {
return L10n.tr("zone_entered_notification.message", p1)
}
}
}

extension L10n {
fileprivate static func tr(_ key: String, _ args: CVarArg...) -> String {
let format = NSLocalizedString(key, comment: "")
return String(format: format, locale: Locale.current, arguments: args)
}
}

// swiftlint:enable type_body_length
// swiftlint:enable nesting
// swiftlint:enable variable_name
// swiftlint:enable valid_docs
50 changes: 50 additions & 0 deletions HomeAssistant/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
Localizable.strings
HomeAssistant

Created by Robert Trencheny on 1/8/17.
Copyright © 2017 Robbie Trencheny. All rights reserved.
*/
"location_change_notification.title" = "Location change";
"zone_entered_notification.message" = "%@ entered";
"significant_location_change_notification.message" = "Significant location change detected, notifying Home Assistant";
"manual_location_update_notification.title" = "Location updated";
"manual_location_update_notification.message" = "Successfully sent a one shot location to the server";
"manual_location_update_failed_notification.title" = "Location failed to update";
"manual_location_update_failed_notification.message" = "Failed to send current location to server. The error was %@";

"settings.connection_error_notification.title" = "Connection Error";
"settings.connection_error_notification.message" = "There was an error connecting to Home Assistant. Please confirm the settings are correct and save to attempt to reconnect. The error was %@.";
"settings.discovery_section.header" = "Discovered Home Assistants";
"settings.connection_section.header" = "Connection";
"settings.connection_section.invalid_url_scheme_notification.title" = "Invalid URL";
"settings.connection_section.invalid_url_scheme_notification.message" = "The URL must begin with either http:// or https://.";
"settings.connection_section.api_password_row.title" = "Password";
"settings.connection_section.api_password_row.placeholder" = "password";
"settings.connection_section.connect_row.title" = "Connect";

"settings.status_section.header" = "Status";
"settings.status_section.location_name_row.title" = "Name";
"settings.status_section.location_name_row.placeholder" = "My Home Assistant";
"settings.status_section.version_row.title" = "Version";
"settings.status_section.version_row.placeholder" = "0.35.0";
"settings.status_section.connected_to_sse_row.title" = "Connected";
"settings.status_section.ios_component_loaded_row.title" = "iOS Component Loaded";
"settings.status_section.device_tracker_component_loaded_row.title" = "Device Tracker Component Loaded";
"settings.status_section.notify_platform_loaded_row.title" = "iOS Notify Platform Loaded";

"settings.device_id_section.footer" = "Device ID is the identifier used when sending location updates to Home Assistant, as well as the target to send push notifications to.";
"settings.device_id_section.device_id_row.title" = "Device ID";

"settings.details_section.enable_location_row.title" = "Enable location tracking";
"settings.details_section.location_settings_row.title" = "Location Settings";

"settings.details_section.enable_notification_row.title" = "Enable notifications";
"settings.details_section.notification_settings_row.title" = "Notification Settings";

"settings.reset_section.reset_row.title" = "Reset";
"settings.reset_section.reset_alert.title" = "Reset";
"settings.reset_section.reset_alert.message" = "Your settings will be reset and this device will be unregistered from push notifications as well as removed from your Home Assistant configuration.";

"permissions.location.message" = "We use this to inform\r\nHome Assistant of your device location and state.";
"permissions.notification.message" = "We use this to let you\r\nsend notifications to your device.";
Loading

0 comments on commit b8fbdf0

Please sign in to comment.