diff --git a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift index abc06d4d4..88b323fbd 100644 --- a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift +++ b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift @@ -9,7 +9,6 @@ // // SPDX-License-Identifier: EPL-2.0 -import Alamofire import Foundation import Fuzi import MapKit diff --git a/OpenHABCore/Sources/OpenHABCore/Util/ClientCertificateManager.swift b/OpenHABCore/Sources/OpenHABCore/Util/ClientCertificateManager.swift index 78dd94dd1..55c522b87 100644 --- a/OpenHABCore/Sources/OpenHABCore/Util/ClientCertificateManager.swift +++ b/OpenHABCore/Sources/OpenHABCore/Util/ClientCertificateManager.swift @@ -13,7 +13,7 @@ import Foundation import os.log import Security -public protocol ClientCertificateManagerDelegate: NSObjectProtocol { +public protocol ClientCertificateManagerDelegate: AnyObject { // delegate should ask user for a decision on whether to import the client certificate into the keychain func askForClientCertificateImport(_ clientCertificateManager: ClientCertificateManager?) // delegate should ask user for the export password used to decode the PKCS#12 diff --git a/OpenHABCore/Sources/OpenHABCore/Util/ServerCertificateManager.swift b/OpenHABCore/Sources/OpenHABCore/Util/ServerCertificateManager.swift index a9aac69ed..2798633f3 100644 --- a/OpenHABCore/Sources/OpenHABCore/Util/ServerCertificateManager.swift +++ b/OpenHABCore/Sources/OpenHABCore/Util/ServerCertificateManager.swift @@ -13,7 +13,7 @@ import Alamofire import Foundation import os.log -public protocol ServerCertificateManagerDelegate: NSObjectProtocol { +public protocol ServerCertificateManagerDelegate: AnyObject { // delegate should ask user for a decision on what to do with invalid certificate func evaluateServerTrust(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?) // certificate received from openHAB doesn't match our record, ask user for a decision diff --git a/openHAB.xcodeproj/project.pbxproj b/openHAB.xcodeproj/project.pbxproj index 02eae31fc..03c49bae9 100644 --- a/openHAB.xcodeproj/project.pbxproj +++ b/openHAB.xcodeproj/project.pbxproj @@ -72,11 +72,9 @@ B7D5ECE121499E55001B0EC6 /* MapViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D5ECE021499E55001B0EC6 /* MapViewTableViewCell.swift */; }; DA0749DE23E0B5950057FA83 /* ColorPickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0749DD23E0B5950057FA83 /* ColorPickerRow.swift */; }; DA0749E023E0BF510057FA83 /* ColorSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0749DF23E0BF510057FA83 /* ColorSelection.swift */; }; - DA0775192346705D0086C685 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA0775172346705D0086C685 /* Interface.storyboard */; }; DA07751B2346705F0086C685 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DA07751A2346705F0086C685 /* Assets.xcassets */; }; DA0775272346705F0086C685 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0775262346705F0086C685 /* ContentView.swift */; }; - DA0775292346705F0086C685 /* HostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0775282346705F0086C685 /* HostingController.swift */; }; - DA07752B2346705F0086C685 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA07752A2346705F0086C685 /* ExtensionDelegate.swift */; }; + DA07752B2346705F0086C685 /* OpenHABWatchAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA07752A2346705F0086C685 /* OpenHABWatchAppDelegate.swift */; }; DA07752D2346705F0086C685 /* NotificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA07752C2346705F0086C685 /* NotificationController.swift */; }; DA07752F2346705F0086C685 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA07752E2346705F0086C685 /* NotificationView.swift */; }; DA0775312346705F0086C685 /* ComplicationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0775302346705F0086C685 /* ComplicationController.swift */; }; @@ -93,7 +91,6 @@ DA2E0B1023DCC439009B0A99 /* MapViewRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2E0B0F23DCC439009B0A99 /* MapViewRow.swift */; }; DA4D4DB5233F9ACB00B37E37 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = DA4D4DB4233F9ACB00B37E37 /* README.md */; }; DA65871F236F83CE007E2E7F /* UserDefaultsExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA65871E236F83CD007E2E7F /* UserDefaultsExtension.swift */; }; - DA6587222370C9D8007E2E7F /* PreferencesHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA6587212370C9D8007E2E7F /* PreferencesHostingController.swift */; }; DA7224D223828D3400712D20 /* PreviewConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA7224D123828D3300712D20 /* PreviewConstants.swift */; }; DA72E1B8236DEA0900B8EF3A /* AppMessageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA72E1B5236DEA0900B8EF3A /* AppMessageService.swift */; }; DA7649DE23FC81A20085CE46 /* Unwrap.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA7649DD23FC81A20085CE46 /* Unwrap.swift */; }; @@ -113,6 +110,10 @@ DAC9AF4924F966FA006DAE93 /* LazyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC9AF4824F966FA006DAE93 /* LazyView.swift */; }; DACB636227D3FC6500041931 /* error.png in Resources */ = {isa = PBXBuildFile; fileRef = DACB636127D3FC6500041931 /* error.png */; }; DACB636327D3FC6500041931 /* error.png in Resources */ = {isa = PBXBuildFile; fileRef = DACB636127D3FC6500041931 /* error.png */; }; + DAD085712AE4782D001D36BE /* openHABWatchSwiftUI_Watch_AppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD085702AE4782D001D36BE /* openHABWatchSwiftUI_Watch_AppTests.swift */; }; + DAD0857B2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD0857A2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITests.swift */; }; + DAD0857D2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD0857C2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift */; }; + DAD0858B2AE56F0E001D36BE /* OpenHABWatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD0855F2AE47824001D36BE /* OpenHABWatch.swift */; }; DAEAA89B21E2611000267EA3 /* OpenHABNotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEAA89A21E2611000267EA3 /* OpenHABNotificationsViewController.swift */; }; DAEAA89D21E6B06400267EA3 /* ReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEAA89C21E6B06300267EA3 /* ReusableView.swift */; }; DAEAA89F21E6B16600267EA3 /* UITableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEAA89E21E6B16600267EA3 /* UITableView.swift */; }; @@ -129,7 +130,6 @@ DAF457A223DB6C640018B495 /* RollershutterRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF457A123DB6C640018B495 /* RollershutterRow.swift */; }; DAF457A623DB9CE00018B495 /* SetpointRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF457A523DB9CE00018B495 /* SetpointRow.swift */; }; DAF457A923DBA4990018B495 /* FrameRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF457A823DBA4990018B495 /* FrameRow.swift */; }; - DAF4581423DC1F5D0018B495 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA72E1B0236DE9F200B8EF3A /* AppState.swift */; }; DAF4581623DC48400018B495 /* GenericRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF4581523DC483F0018B495 /* GenericRow.swift */; }; DAF4581823DC4A050018B495 /* ImageRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF4581723DC4A050018B495 /* ImageRow.swift */; }; DAF4581E23DC60020018B495 /* ImageRawRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF4581D23DC60020018B495 /* ImageRawRow.swift */; }; @@ -301,19 +301,17 @@ 938BF9CF24EFCCC000E6B52F /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/InfoPlist.strings; sourceTree = ""; }; 938BF9D224EFD0B700E6B52F /* UIViewController+Localization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Localization.swift"; sourceTree = ""; }; 938EDCE022C4FEB800661CA1 /* ScaleAspectFitImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScaleAspectFitImageView.swift; sourceTree = ""; }; - A07ED02D2402EE6E006588FE /* OpenHABWatchTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenHABWatchTracker.swift; path = "openHABWatch Extension/OpenHABWatchTracker.swift"; sourceTree = SOURCE_ROOT; }; + A07ED02D2402EE6E006588FE /* OpenHABWatchTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenHABWatchTracker.swift; sourceTree = ""; }; A07EF79F2230C0A20040919F /* OpenHABClientCertificatesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenHABClientCertificatesViewController.swift; sourceTree = ""; }; A3F4C3A41A49A5940019A09F /* MainLaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MainLaunchScreen.xib; path = ../MainLaunchScreen.xib; sourceTree = ""; }; B7D5ECE021499E55001B0EC6 /* MapViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewTableViewCell.swift; sourceTree = ""; }; DA0749DD23E0B5950057FA83 /* ColorPickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerRow.swift; sourceTree = ""; }; DA0749DF23E0BF510057FA83 /* ColorSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorSelection.swift; sourceTree = ""; }; DA0775152346705D0086C685 /* openHABWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = openHABWatch.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DA0775182346705D0086C685 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; DA07751A2346705F0086C685 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; DA07751C2346705F0086C685 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DA0775262346705F0086C685 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - DA0775282346705F0086C685 /* HostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostingController.swift; sourceTree = ""; }; - DA07752A2346705F0086C685 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = ""; }; + DA07752A2346705F0086C685 /* OpenHABWatchAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenHABWatchAppDelegate.swift; sourceTree = ""; }; DA07752C2346705F0086C685 /* NotificationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationController.swift; sourceTree = ""; }; DA07752E2346705F0086C685 /* NotificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationView.swift; sourceTree = ""; }; DA0775302346705F0086C685 /* ComplicationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComplicationController.swift; sourceTree = ""; }; @@ -368,14 +366,10 @@ DA4D4DB4233F9ACB00B37E37 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; DA4D4E0E2340A00200B37E37 /* Changes.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Changes.md; sourceTree = ""; }; DA65871E236F83CD007E2E7F /* UserDefaultsExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsExtension.swift; sourceTree = ""; }; - DA6587212370C9D8007E2E7F /* PreferencesHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesHostingController.swift; sourceTree = ""; }; DA7224D123828D3300712D20 /* PreviewConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewConstants.swift; sourceTree = ""; }; - DA72E1B0236DE9F200B8EF3A /* AppState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppState.swift; path = "openHABWatch Extension/app/AppState.swift"; sourceTree = ""; }; - DA72E1B5236DEA0900B8EF3A /* AppMessageService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppMessageService.swift; path = "openHABWatch Extension/external/AppMessageService.swift"; sourceTree = ""; }; + DA72E1B5236DEA0900B8EF3A /* AppMessageService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppMessageService.swift; sourceTree = ""; }; DA7649DD23FC81A20085CE46 /* Unwrap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Unwrap.swift; sourceTree = ""; }; DA7E1E47222EB00B002AEFD8 /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; - DA7EB1C3259BC8C00072A7D9 /* openHABWatch.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = openHABWatch.entitlements; sourceTree = ""; }; - DA7EB1C4259BC9230072A7D9 /* openHABWatch Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "openHABWatch Extension.entitlements"; sourceTree = ""; }; DA817E79234BF39B00C91824 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; DA88F8C522EC377100B408E5 /* ReleaseNotes.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = ReleaseNotes.md; sourceTree = ""; }; DA9721C224E29A8F0092CCFD /* UserDefaultsBacked.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsBacked.swift; sourceTree = ""; }; @@ -391,7 +385,13 @@ DAC9AF4624F9669F006DAE93 /* ObservableOpenHABWidgetExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableOpenHABWidgetExtension.swift; sourceTree = ""; }; DAC9AF4824F966FA006DAE93 /* LazyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyView.swift; sourceTree = ""; }; DACB636127D3FC6500041931 /* error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = error.png; sourceTree = ""; }; - DAD488B2287DDDFE00414693 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Interface.strings; sourceTree = ""; }; + DAD0855F2AE47824001D36BE /* OpenHABWatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenHABWatch.swift; sourceTree = ""; }; + DAD085662AE4782A001D36BE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + DAD0856C2AE4782B001D36BE /* openHABWatchSwiftUI Watch AppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "openHABWatchSwiftUI Watch AppTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + DAD085702AE4782D001D36BE /* openHABWatchSwiftUI_Watch_AppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = openHABWatchSwiftUI_Watch_AppTests.swift; sourceTree = ""; }; + DAD085762AE4782E001D36BE /* openHABWatchSwiftUI Watch AppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "openHABWatchSwiftUI Watch AppUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + DAD0857A2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = openHABWatchSwiftUI_Watch_AppUITests.swift; sourceTree = ""; }; + DAD0857C2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift; sourceTree = ""; }; DAD488B3287DDDFE00414693 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = Resources/nb.lproj/Intents.strings; sourceTree = ""; }; DAD488B4287DDDFF00414693 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Localizable.strings; sourceTree = ""; }; DAD488B5287DDDFF00414693 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -489,6 +489,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DAD085692AE4782A001D36BE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DAD085732AE4782D001D36BE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; DFB2622418830A3600D3244D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -524,23 +538,13 @@ name = Watch; sourceTree = ""; }; - 1224F7C0228A8E9A00750965 /* App */ = { - isa = PBXGroup; - children = ( - DA72E1B0236DE9F200B8EF3A /* AppState.swift */, - ); - name = App; - path = "../openHABWatch Extension"; - sourceTree = ""; - }; 1224F7C8228A8EC600750965 /* Domain */ = { isa = PBXGroup; children = ( A07ED02D2402EE6E006588FE /* OpenHABWatchTracker.swift */, DA0776EF234788010086C685 /* UserData.swift */, ); - name = Domain; - path = "openHABWatch Extension"; + path = Domain; sourceTree = ""; }; 1224F7C9228A8ED100750965 /* External */ = { @@ -549,8 +553,8 @@ DA72E1B5236DEA0900B8EF3A /* AppMessageService.swift */, ); name = External; - path = "../openHABWatch Extension"; - sourceTree = ""; + path = openHABWatch/External; + sourceTree = SOURCE_ROOT; }; 4D6470D42561F935007B03FC /* openHABIntents */ = { isa = PBXGroup; @@ -606,33 +610,29 @@ DAC9AF4624F9669F006DAE93 /* ObservableOpenHABWidgetExtension.swift */, DAC9AF4824F966FA006DAE93 /* LazyView.swift */, ); - name = Model; - path = "openHABWatch Extension/Model"; + path = Model; sourceTree = ""; }; DA0775162346705D0086C685 /* openHABWatch */ = { isa = PBXGroup; children = ( - DA7EB1C3259BC8C00072A7D9 /* openHABWatch.entitlements */, - DA0775172346705D0086C685 /* Interface.storyboard */, + DAD0855F2AE47824001D36BE /* OpenHABWatch.swift */, + DA0775252346705F0086C685 /* Extension */, + 1224F7C9228A8ED100750965 /* External */, + 1224F7C8228A8EC600750965 /* Domain */, + 93F38D4623803731001B1451 /* Model */, + DA658720236F841F007E2E7F /* Views */, + DAD0858A2AE52126001D36BE /* Preview Content */, DA07751A2346705F0086C685 /* Assets.xcassets */, DA07751C2346705F0086C685 /* Info.plist */, ); path = openHABWatch; sourceTree = ""; }; - DA0775252346705F0086C685 /* openHABWatch Extension */ = { + DA0775252346705F0086C685 /* Extension */ = { isa = PBXGroup; children = ( - DA7EB1C4259BC9230072A7D9 /* openHABWatch Extension.entitlements */, - 1224F7C0228A8E9A00750965 /* App */, - 1224F7C8228A8EC600750965 /* Domain */, - 1224F7C9228A8ED100750965 /* External */, - 93F38D4623803731001B1451 /* Model */, - DA658720236F841F007E2E7F /* Views */, - DA0775282346705F0086C685 /* HostingController.swift */, - DA6587212370C9D8007E2E7F /* PreferencesHostingController.swift */, - DA07752A2346705F0086C685 /* ExtensionDelegate.swift */, + DA07752A2346705F0086C685 /* OpenHABWatchAppDelegate.swift */, DA07752C2346705F0086C685 /* NotificationController.swift */, DA07752E2346705F0086C685 /* NotificationView.swift */, DA0775302346705F0086C685 /* ComplicationController.swift */, @@ -641,7 +641,7 @@ DA65871E236F83CD007E2E7F /* UserDefaultsExtension.swift */, DA0775382346705F0086C685 /* PushNotificationPayload.apns */, ); - path = "openHABWatch Extension"; + path = Extension; sourceTree = ""; }; DA1C2E4A230DC28F00FACFB0 /* fastlane */ = { @@ -734,6 +734,31 @@ path = Views; sourceTree = ""; }; + DAD0856F2AE4782D001D36BE /* openHABWatchSwiftUI Watch AppTests */ = { + isa = PBXGroup; + children = ( + DAD085702AE4782D001D36BE /* openHABWatchSwiftUI_Watch_AppTests.swift */, + ); + path = "openHABWatchSwiftUI Watch AppTests"; + sourceTree = ""; + }; + DAD085792AE4782F001D36BE /* openHABWatchSwiftUI Watch AppUITests */ = { + isa = PBXGroup; + children = ( + DAD0857A2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITests.swift */, + DAD0857C2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift */, + ); + path = "openHABWatchSwiftUI Watch AppUITests"; + sourceTree = ""; + }; + DAD0858A2AE52126001D36BE /* Preview Content */ = { + isa = PBXGroup; + children = ( + DAD085662AE4782A001D36BE /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; DAE238252806E5C800196467 /* Recovered References */ = { isa = PBXGroup; children = ( @@ -872,8 +897,9 @@ DA2DC23021F2736C00830730 /* openHABTestsSwift */, 933D7F0522E7015000621A03 /* openHABUITests */, DA0775162346705D0086C685 /* openHABWatch */, - DA0775252346705F0086C685 /* openHABWatch Extension */, 4D6470D42561F935007B03FC /* openHABIntents */, + DAD0856F2AE4782D001D36BE /* openHABWatchSwiftUI Watch AppTests */, + DAD085792AE4782F001D36BE /* openHABWatchSwiftUI Watch AppUITests */, DFB2622818830A3600D3244D /* Products */, DFB2622918830A3600D3244D /* Frameworks */, DA1C2E4A230DC28F00FACFB0 /* fastlane */, @@ -889,6 +915,8 @@ 933D7F0422E7015000621A03 /* openHABUITests.xctest */, DA0775152346705D0086C685 /* openHABWatch.app */, 4D6470D32561F935007B03FC /* openHABIntents.appex */, + DAD0856C2AE4782B001D36BE /* openHABWatchSwiftUI Watch AppTests.xctest */, + DAD085762AE4782E001D36BE /* openHABWatchSwiftUI Watch AppUITests.xctest */, ); name = Products; sourceTree = ""; @@ -1054,6 +1082,40 @@ productReference = DA2DC22F21F2736C00830730 /* openHABTestsSwift.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + DAD0856B2AE4782A001D36BE /* openHABWatchSwiftUI Watch AppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = DAD085842AE47831001D36BE /* Build configuration list for PBXNativeTarget "openHABWatchSwiftUI Watch AppTests" */; + buildPhases = ( + DAD085682AE4782A001D36BE /* Sources */, + DAD085692AE4782A001D36BE /* Frameworks */, + DAD0856A2AE4782A001D36BE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "openHABWatchSwiftUI Watch AppTests"; + productName = "openHABWatchSwiftUI Watch AppTests"; + productReference = DAD0856C2AE4782B001D36BE /* openHABWatchSwiftUI Watch AppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + DAD085752AE4782D001D36BE /* openHABWatchSwiftUI Watch AppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = DAD085872AE47831001D36BE /* Build configuration list for PBXNativeTarget "openHABWatchSwiftUI Watch AppUITests" */; + buildPhases = ( + DAD085722AE4782D001D36BE /* Sources */, + DAD085732AE4782D001D36BE /* Frameworks */, + DAD085742AE4782D001D36BE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "openHABWatchSwiftUI Watch AppUITests"; + productName = "openHABWatchSwiftUI Watch AppUITests"; + productReference = DAD085762AE4782E001D36BE /* openHABWatchSwiftUI Watch AppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; DFB2622618830A3600D3244D /* openHAB */ = { isa = PBXNativeTarget; buildConfigurationList = DFB2625C18830A3600D3244D /* Build configuration list for PBXNativeTarget "openHAB" */; @@ -1100,7 +1162,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; CLASSPREFIX = OpenHAB; - LastSwiftUpdateCheck = 1210; + LastSwiftUpdateCheck = 1500; LastUpgradeCheck = 1500; ORGANIZATIONNAME = "openHAB e.V."; TargetAttributes = { @@ -1120,6 +1182,14 @@ ProvisioningStyle = Automatic; TestTargetID = DFB2622618830A3600D3244D; }; + DAD0856B2AE4782A001D36BE = { + CreatedOnToolsVersion = 15.0; + TestTargetID = DAD0855C2AE47822001D36BE; + }; + DAD085752AE4782D001D36BE = { + CreatedOnToolsVersion = 15.0; + TestTargetID = DAD0855C2AE47822001D36BE; + }; DFB2622618830A3600D3244D = { LastSwiftMigration = ""; SystemCapabilities = { @@ -1181,6 +1251,8 @@ 933D7F0322E7015000621A03 /* openHABUITests */, DA0775142346705D0086C685 /* openHABWatch */, 4D6470D22561F935007B03FC /* openHABIntents */, + DAD0856B2AE4782A001D36BE /* openHABWatchSwiftUI Watch AppTests */, + DAD085752AE4782D001D36BE /* openHABWatchSwiftUI Watch AppUITests */, ); }; /* End PBXProject section */ @@ -1208,7 +1280,6 @@ DA07751B2346705F0086C685 /* Assets.xcassets in Resources */, 938BF9D524EFD5B100E6B52F /* Localizable.strings in Resources */, DACB636327D3FC6500041931 /* error.png in Resources */, - DA0775192346705D0086C685 /* Interface.storyboard in Resources */, 932602EE2382892B00EAD685 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1224,6 +1295,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DAD0856A2AE4782A001D36BE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DAD085742AE4782D001D36BE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; DFB2622518830A3600D3244D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1320,11 +1405,9 @@ files = ( DA7649DE23FC81A20085CE46 /* Unwrap.swift in Sources */, DAC9AF4724F9669F006DAE93 /* ObservableOpenHABWidgetExtension.swift in Sources */, - DAF4581423DC1F5D0018B495 /* AppState.swift in Sources */, DA2E0B0E23DCC153009B0A99 /* MapView.swift in Sources */, DA2E0B1023DCC439009B0A99 /* MapViewRow.swift in Sources */, DA0F37D023D4ACC7007EAB48 /* SliderRow.swift in Sources */, - DA0775292346705F0086C685 /* HostingController.swift in Sources */, DA07764A234683BC0086C685 /* SwitchRow.swift in Sources */, DA2E0AA423DC96E9009B0A99 /* EncircledIconWithAction.swift in Sources */, DAF4578723D798A50018B495 /* TextLabelView.swift in Sources */, @@ -1332,6 +1415,7 @@ DA0775272346705F0086C685 /* ContentView.swift in Sources */, DA7224D223828D3400712D20 /* PreviewConstants.swift in Sources */, DAF4581E23DC60020018B495 /* ImageRawRow.swift in Sources */, + DAD0858B2AE56F0E001D36BE /* OpenHABWatch.swift in Sources */, A07ED02E2402EE6E006588FE /* OpenHABWatchTracker.swift in Sources */, DAF4578223D630C70018B495 /* IconView.swift in Sources */, DA07752D2346705F0086C685 /* NotificationController.swift in Sources */, @@ -1339,7 +1423,7 @@ DA65871F236F83CE007E2E7F /* UserDefaultsExtension.swift in Sources */, DA9721C324E29A8F0092CCFD /* UserDefaultsBacked.swift in Sources */, DA72E1B8236DEA0900B8EF3A /* AppMessageService.swift in Sources */, - DA07752B2346705F0086C685 /* ExtensionDelegate.swift in Sources */, + DA07752B2346705F0086C685 /* OpenHABWatchAppDelegate.swift in Sources */, DAF4581623DC48400018B495 /* GenericRow.swift in Sources */, DAC6608F236F80BA00F4501E /* PreferencesRowUIView.swift in Sources */, 9350F17A23814FAC00054BA8 /* ObservableOpenHABSitemapPage.swift in Sources */, @@ -1348,7 +1432,6 @@ DA15BFBD23C6726400BD8ADA /* ObservableOpenHABDataObject.swift in Sources */, DAC9AF4924F966FA006DAE93 /* LazyView.swift in Sources */, DA0776F0234788010086C685 /* UserData.swift in Sources */, - DA6587222370C9D8007E2E7F /* PreferencesHostingController.swift in Sources */, DAC6608D236F771600F4501E /* PreferencesSwiftUIView.swift in Sources */, DAF457A623DB9CE00018B495 /* SetpointRow.swift in Sources */, DAF4581823DC4A050018B495 /* ImageRow.swift in Sources */, @@ -1373,6 +1456,23 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DAD085682AE4782A001D36BE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DAD085712AE4782D001D36BE /* openHABWatchSwiftUI_Watch_AppTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DAD085722AE4782D001D36BE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DAD0857D2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift in Sources */, + DAD0857B2AE4782F001D36BE /* openHABWatchSwiftUI_Watch_AppUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DFB2622318830A3600D3244D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1501,15 +1601,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - DA0775172346705D0086C685 /* Interface.storyboard */ = { - isa = PBXVariantGroup; - children = ( - DA0775182346705D0086C685 /* Base */, - DAD488B2287DDDFE00414693 /* nb */, - ); - name = Interface.storyboard; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -1617,6 +1708,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; INFOPLIST_FILE = openHABUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1659,6 +1751,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; INFOPLIST_FILE = openHABUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1691,21 +1784,32 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = "openHABWatch Extension/openHABWatch Extension.entitlements"; + CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; "CODE_SIGN_STYLE[sdk=*]" = Automatic; CURRENT_PROJECT_VERSION = 1580410538; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_ASSET_PATHS = "\"openHABWatch/Preview Content\""; DEVELOPMENT_TEAM = PBAPXHRAM9; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = openHABWatch/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = openHAB; + INFOPLIST_KEY_CLKComplicationPrincipalClass = "$(PRODUCT_MODULE_NAME).ComplicationController"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = es.spaphone.openhab; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 2.4.60; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -1715,11 +1819,12 @@ SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; VERSIONING_SYSTEM = "apple-generic"; - WATCHOS_DEPLOYMENT_TARGET = 7.0; + WATCHOS_DEPLOYMENT_TARGET = 9.6; }; name = Debug; }; @@ -1736,34 +1841,45 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = "openHABWatch Extension/openHABWatch Extension.entitlements"; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_ENTITLEMENTS = ""; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1580410538; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_ASSET_PATHS = "\"openHABWatch/Preview Content\""; DEVELOPMENT_TEAM = PBAPXHRAM9; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = openHABWatch/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = openHAB; + INFOPLIST_KEY_CLKComplicationPrincipalClass = "$(PRODUCT_MODULE_NAME).ComplicationController"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = es.spaphone.openhab; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 2.4.60; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = es.spaphone.openhab.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AppStore es.spaphone.openhab.*"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = watchos; SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; VERSIONING_SYSTEM = "apple-generic"; - WATCHOS_DEPLOYMENT_TARGET = 7.0; + WATCHOS_DEPLOYMENT_TARGET = 9.6; }; name = Release; }; @@ -1788,6 +1904,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; INFOPLIST_FILE = openHABTestsSwift/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1831,6 +1948,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; INFOPLIST_FILE = openHABTestsSwift/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1852,6 +1970,150 @@ }; name = Release; }; + DAD085852AE47831001D36BE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = D6A95UZXVC; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABWatchSwiftUI-Watch-AppTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/openHABWatchSwiftUI Watch App.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/openHABWatchSwiftUI Watch App"; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Debug; + }; + DAD085862AE47831001D36BE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = D6A95UZXVC; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABWatchSwiftUI-Watch-AppTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/openHABWatchSwiftUI Watch App.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/openHABWatchSwiftUI Watch App"; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Release; + }; + DAD085882AE47831001D36BE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = D6A95UZXVC; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABWatchSwiftUI-Watch-AppUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + TEST_TARGET_NAME = "openHABWatchSwiftUI Watch App"; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Debug; + }; + DAD085892AE47831001D36BE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = D6A95UZXVC; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABWatchSwiftUI-Watch-AppUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + TEST_TARGET_NAME = "openHABWatchSwiftUI Watch App"; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Release; + }; DFB2625A18830A3600D3244D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1886,6 +2148,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEVELOPMENT_TEAM = PBAPXHRAM9; + ENABLE_PREVIEWS = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; @@ -1949,6 +2212,7 @@ COPY_PHASE_STRIP = NO; DEVELOPMENT_TEAM = PBAPXHRAM9; ENABLE_NS_ASSERTIONS = NO; + ENABLE_PREVIEWS = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; EXCLUDED_ARCHS = i386; @@ -1988,6 +2252,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "openHAB/openHAB-Prefix.pch"; INFOPLIST_FILE = "openHAB/openHAB-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2024,14 +2289,14 @@ CLANG_CXX_LANGUAGE_STANDARD = "$(inherited)"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = openHAB/openHAB.entitlements; - CODE_SIGN_IDENTITY = "Apple Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1580410538; DEVELOPMENT_TEAM = PBAPXHRAM9; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "openHAB/openHAB-Prefix.pch"; INFOPLIST_FILE = "openHAB/openHAB-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2046,7 +2311,7 @@ PRODUCT_BUNDLE_IDENTIFIER = es.spaphone.openhab; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - PROVISIONING_PROFILE_SPECIFIER = "match AppStore es.spaphone.openhab"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTS_MACCATALYST = NO; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_INSTALL_OBJC_HEADER = NO; @@ -2098,6 +2363,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + DAD085842AE47831001D36BE /* Build configuration list for PBXNativeTarget "openHABWatchSwiftUI Watch AppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAD085852AE47831001D36BE /* Debug */, + DAD085862AE47831001D36BE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DAD085872AE47831001D36BE /* Build configuration list for PBXNativeTarget "openHABWatchSwiftUI Watch AppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAD085882AE47831001D36BE /* Debug */, + DAD085892AE47831001D36BE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; DFB2622218830A3600D3244D /* Build configuration list for PBXProject "openHAB" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -2148,7 +2431,7 @@ repositoryURL = "https://github.com/Alamofire/Alamofire.git"; requirement = { kind = exactVersion; - version = 5.4.4; + version = 5.8.0; }; }; 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */ = { @@ -2156,7 +2439,7 @@ repositoryURL = "https://github.com/Alamofire/AlamofireNetworkActivityIndicator.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 3.0.0; + minimumVersion = 3.1.0; }; }; 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { @@ -2196,7 +2479,7 @@ repositoryURL = "https://github.com/jonkykong/SideMenu.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 6.0.0; + minimumVersion = 6.5.0; }; }; 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit" */ = { diff --git a/openHAB.xcodeproj/xcshareddata/xcschemes/openHABWatch (Notification).xcscheme b/openHAB.xcodeproj/xcshareddata/xcschemes/openHABWatch (Notification).xcscheme index 0ae68e971..45cfdeb6b 100644 --- a/openHAB.xcodeproj/xcshareddata/xcschemes/openHABWatch (Notification).xcscheme +++ b/openHAB.xcodeproj/xcshareddata/xcschemes/openHABWatch (Notification).xcscheme @@ -55,7 +55,7 @@ debugServiceExtension = "internal" allowLocationSimulation = "YES" launchAutomaticallySubstyle = "8" - notificationPayloadFile = "openHABWatch Extension/PushNotificationPayload.apns"> + notificationPayloadFile = "openHABWatch/Extension/PushNotificationPayload.apns"> + notificationPayloadFile = "openHABWatch/Extension/PushNotificationPayload.apns"> + allowLocationSimulation = "YES"> + debugDocumentVersioning = "YES"> { - @ObservedObject var settings = ObservableOpenHABDataObject.shared - let userData = UserData(sitemapName: ObservableOpenHABDataObject.shared.sitemapName) - - override var body: ContentView { - ContentView(viewModel: userData, settings: settings) - } - - override init() { - super.init() - ExtensionDelegate.extensionDelegate.viewModel = userData - } -} diff --git a/openHABWatch Extension/PreferencesHostingController.swift b/openHABWatch Extension/PreferencesHostingController.swift deleted file mode 100644 index 75df87ae2..000000000 --- a/openHABWatch Extension/PreferencesHostingController.swift +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2010-2023 Contributors to the openHAB project -// -// See the NOTICE file(s) distributed with this work for additional -// information. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0 -// -// SPDX-License-Identifier: EPL-2.0 - -import OpenHABCore -import SwiftUI -import WatchKit - -class PreferencesHostingController: WKHostingController { - override var body: PreferencesSwiftUIView { - PreferencesSwiftUIView() - } -} diff --git a/openHABWatch Extension/openHABWatch Extension.entitlements b/openHABWatch Extension/openHABWatch Extension.entitlements deleted file mode 100644 index 0c67376eb..000000000 --- a/openHABWatch Extension/openHABWatch Extension.entitlements +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/openHABWatch Extension/openHABWatch Extension/app/AppState.swift b/openHABWatch Extension/openHABWatch Extension/app/AppState.swift deleted file mode 100644 index 192c0e3ab..000000000 --- a/openHABWatch Extension/openHABWatch Extension/app/AppState.swift +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2010-2023 Contributors to the openHAB project -// -// See the NOTICE file(s) distributed with this work for additional -// information. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0 -// -// SPDX-License-Identifier: EPL-2.0 - -import Foundation - -class AppState { - static let singleton = AppState() - - var active = false -} diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Contents.json b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Contents.json index 83075e829..5471514b4 100644 --- a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,92 +1,20 @@ { "images" : [ { - "size" : "24x24", - "idiom" : "watch", - "filename" : "Icon-24@2x.png", - "scale" : "2x", - "role" : "notificationCenter", - "subtype" : "38mm" + "filename" : "ItunesArtwork@2x 1.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" }, { - "size" : "27.5x27.5", - "idiom" : "watch", - "filename" : "Icon-27.5@2x.png", - "scale" : "2x", - "role" : "notificationCenter", - "subtype" : "42mm" - }, - { - "size" : "29x29", - "idiom" : "watch", - "filename" : "Icon-29@2x.png", - "role" : "companionSettings", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "watch", - "filename" : "Icon-29@3x.png", - "role" : "companionSettings", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "watch", - "filename" : "Icon-40@2x.png", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "38mm" - }, - { - "size" : "44x44", - "idiom" : "watch", - "filename" : "icon-88.png", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "40mm" - }, - { - "size" : "50x50", - "idiom" : "watch", - "filename" : "icon-100.png", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "44mm" - }, - { - "size" : "86x86", - "idiom" : "watch", - "filename" : "Icon-86@2x.png", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "38mm" - }, - { - "size" : "98x98", - "idiom" : "watch", - "filename" : "Icon-98@2x.png", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "42mm" - }, - { - "size" : "108x108", - "idiom" : "watch", - "filename" : "icon-216@2x.png", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "44mm" - }, - { - "size" : "1024x1024", - "idiom" : "watch-marketing", "filename" : "ItunesArtwork@2x.png", - "scale" : "1x" + "idiom" : "universal", + "platform" : "watchos", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-24@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-24@2x.png deleted file mode 100644 index ddaeb8a83..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-24@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-27.5@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-27.5@2x.png deleted file mode 100644 index 1eac96b36..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-27.5@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png deleted file mode 100644 index fb09d700b..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png deleted file mode 100644 index 2ad0f8e39..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png deleted file mode 100644 index b3e172f3b..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-86@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-86@2x.png deleted file mode 100644 index 17f389b20..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-86@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-98@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-98@2x.png deleted file mode 100644 index d0247b851..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/Icon-98@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x 1.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x 1.png new file mode 100644 index 000000000..cef6707ed Binary files /dev/null and b/openHABWatch/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x 1.png differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-100.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-100.png deleted file mode 100644 index ecef5b4bf..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-100.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-216@2x.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-216@2x.png deleted file mode 100644 index acdc92b1e..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-216@2x.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-88.png b/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-88.png deleted file mode 100644 index 7b493dff3..000000000 Binary files a/openHABWatch/Assets.xcassets/AppIcon.appiconset/icon-88.png and /dev/null differ diff --git a/openHABWatch/Assets.xcassets/Contents.json b/openHABWatch/Assets.xcassets/Contents.json index da4a164c9..73c00596a 100644 --- a/openHABWatch/Assets.xcassets/Contents.json +++ b/openHABWatch/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/openHABWatch Extension/OpenHABWatchTracker.swift b/openHABWatch/Domain/OpenHABWatchTracker.swift similarity index 98% rename from openHABWatch Extension/OpenHABWatchTracker.swift rename to openHABWatch/Domain/OpenHABWatchTracker.swift index 3af05c75c..dde4eccc1 100644 --- a/openHABWatch Extension/OpenHABWatchTracker.swift +++ b/openHABWatch/Domain/OpenHABWatchTracker.swift @@ -77,6 +77,9 @@ class OpenHABWatchTracker: NSObject { connectivityTask.cancel() } let request = URLRequest(url: URL(string: ObservableOpenHABDataObject.shared.localUrl)!, cachePolicy: .reloadIgnoringCacheData, timeoutInterval: 2.0) + if NetworkConnection.shared == nil { + NetworkConnection.initialize(ignoreSSL: Preferences.ignoreSSL, interceptor: nil) + } connectivityTask = NetworkConnection.shared.manager.request(request) .validate() .responseData { response in diff --git a/openHABWatch Extension/openHABWatch Extension/UserData.swift b/openHABWatch/Domain/UserData.swift similarity index 99% rename from openHABWatch Extension/openHABWatch Extension/UserData.swift rename to openHABWatch/Domain/UserData.swift index d81c5ea2f..81fba06c8 100644 --- a/openHABWatch Extension/openHABWatch Extension/UserData.swift +++ b/openHABWatch/Domain/UserData.swift @@ -26,6 +26,7 @@ extension OpenHABCore.Future where Value == ObservableOpenHABSitemapPage.CodingD } final class UserData: ObservableObject { + static let shared = UserData() @Published var widgets: [ObservableOpenHABWidget] = [] @Published var showAlert = false @Published var errorDescription = "" diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Contents.json similarity index 84% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Contents.json index 1571c7e53..e8b3252e3 100644 --- a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json +++ b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Contents.json @@ -1,48 +1,53 @@ { "assets" : [ { - "idiom" : "watch", "filename" : "Circular.imageset", + "idiom" : "watch", "role" : "circular" }, { - "idiom" : "watch", "filename" : "Extra Large.imageset", + "idiom" : "watch", "role" : "extra-large" }, { - "idiom" : "watch", "filename" : "Graphic Bezel.imageset", + "idiom" : "watch", "role" : "graphic-bezel" }, { - "idiom" : "watch", "filename" : "Graphic Circular.imageset", + "idiom" : "watch", "role" : "graphic-circular" }, { - "idiom" : "watch", "filename" : "Graphic Corner.imageset", + "idiom" : "watch", "role" : "graphic-corner" }, { + "filename" : "Graphic Extra Large.imageset", "idiom" : "watch", + "role" : "graphic-extra-large" + }, + { "filename" : "Graphic Large Rectangular.imageset", + "idiom" : "watch", "role" : "graphic-large-rectangular" }, { - "idiom" : "watch", "filename" : "Modular.imageset", + "idiom" : "watch", "role" : "modular" }, { - "idiom" : "watch", "filename" : "Utilitarian.imageset", + "idiom" : "watch", "role" : "utilitarian" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json diff --git a/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Extra Large.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Extra Large.imageset/Contents.json new file mode 100644 index 000000000..26454cac8 --- /dev/null +++ b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Extra Large.imageset/Contents.json @@ -0,0 +1,25 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">183" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "auto-scaling" : "auto" + } +} diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/Contents.json b/openHABWatch/Extension/Assets.xcassets/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Contents.json rename to openHABWatch/Extension/Assets.xcassets/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/OHIcon.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/OHIcon.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/OHIcon.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/OHIcon.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/OHIcon.imageset/Icon.png b/openHABWatch/Extension/Assets.xcassets/OHIcon.imageset/Icon.png similarity index 100% rename from openHABWatch Extension/Assets.xcassets/OHIcon.imageset/Icon.png rename to openHABWatch/Extension/Assets.xcassets/OHIcon.imageset/Icon.png diff --git a/openHABWatch Extension/Assets.xcassets/OHTemplateIcon.imageset/Contents.json b/openHABWatch/Extension/Assets.xcassets/OHTemplateIcon.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/OHTemplateIcon.imageset/Contents.json rename to openHABWatch/Extension/Assets.xcassets/OHTemplateIcon.imageset/Contents.json diff --git a/openHABWatch Extension/Assets.xcassets/OHTemplateIcon.imageset/oh_logo_template.pdf b/openHABWatch/Extension/Assets.xcassets/OHTemplateIcon.imageset/oh_logo_template.pdf similarity index 100% rename from openHABWatch Extension/Assets.xcassets/OHTemplateIcon.imageset/oh_logo_template.pdf rename to openHABWatch/Extension/Assets.xcassets/OHTemplateIcon.imageset/oh_logo_template.pdf diff --git a/openHABWatch Extension/ComplicationController.swift b/openHABWatch/Extension/ComplicationController.swift similarity index 100% rename from openHABWatch Extension/ComplicationController.swift rename to openHABWatch/Extension/ComplicationController.swift diff --git a/openHABWatch Extension/Info.plist b/openHABWatch/Extension/Info.plist similarity index 100% rename from openHABWatch Extension/Info.plist rename to openHABWatch/Extension/Info.plist diff --git a/openHABWatch Extension/NotificationController.swift b/openHABWatch/Extension/NotificationController.swift similarity index 100% rename from openHABWatch Extension/NotificationController.swift rename to openHABWatch/Extension/NotificationController.swift diff --git a/openHABWatch Extension/NotificationView.swift b/openHABWatch/Extension/NotificationView.swift similarity index 100% rename from openHABWatch Extension/NotificationView.swift rename to openHABWatch/Extension/NotificationView.swift diff --git a/openHABWatch Extension/ExtensionDelegate.swift b/openHABWatch/Extension/OpenHABWatchAppDelegate.swift similarity index 56% rename from openHABWatch Extension/ExtensionDelegate.swift rename to openHABWatch/Extension/OpenHABWatchAppDelegate.swift index ede5e53c6..397475dc7 100644 --- a/openHABWatch Extension/ExtensionDelegate.swift +++ b/openHABWatch/Extension/OpenHABWatchAppDelegate.swift @@ -15,58 +15,25 @@ import os.log import WatchConnectivity import WatchKit -@main -class ExtensionDelegate: NSObject, WKApplicationDelegate { - static var extensionDelegate: ExtensionDelegate! - - var appData: ObservableOpenHABDataObject - - var session: WCSession? { - didSet { - if let session { - session.delegate = AppMessageService.singleton - session.activate() - } - } - } - - var viewModel: UserData? +class OpenHABWatchAppDelegate: NSObject { + var session: WCSession + let delegate: WCSessionDelegate +// var viewModel: UserData? override init() { - appData = ObservableOpenHABDataObject.shared + delegate = AppMessageService.singleton + session = .default + session.delegate = delegate + session.activate() super.init() - ExtensionDelegate.extensionDelegate = self - - ImageDownloader.default.authenticationChallengeResponder = self - } - func applicationDidFinishLaunching() { - // Perform any final initialization of your application. - activateWatchConnectivity() - - NetworkConnection.initialize(ignoreSSL: Preferences.ignoreSSL, interceptor: OpenHABAccessTokenAdapter(appData: ExtensionDelegate.extensionDelegate.appData)) - - NetworkConnection.shared.assignDelegates(serverDelegate: self, clientDelegate: self) - - KingfisherManager.shared.defaultOptions = [.requestModifier(OpenHABAccessTokenAdapter(appData: ExtensionDelegate.extensionDelegate.appData))] - } - - func activateWatchConnectivity() { - // WCSession.isSupported is always supported on a Watch - session = WCSession.default - } - - func applicationDidBecomeActive() { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - AppState.singleton.active = true - } +// let appData = ObservableOpenHABDataObject.shared - func applicationWillResignActive() { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, etc. - AppState.singleton.active = false +// NetworkConnection.initialize(ignoreSSL: Preferences.ignoreSSL, interceptor: OpenHABAccessTokenAdapter(appData: appData)) } +} +extension OpenHABWatchAppDelegate: WKApplicationDelegate { func handle(_ backgroundTasks: Set) { // Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one. for task in backgroundTasks { @@ -96,11 +63,21 @@ class ExtensionDelegate: NSObject, WKApplicationDelegate { } } } + + func applicationDidFinishLaunching() { + // TODO: + ImageDownloader.default.authenticationChallengeResponder = self + +// NetworkConnection.shared.assignDelegates(serverDelegate: self, clientDelegate: self) + + let appData = ObservableOpenHABDataObject.shared + KingfisherManager.shared.defaultOptions = [.requestModifier(OpenHABAccessTokenAdapter(appData: appData))] + } } // MARK: Kingfisher authentication with NSURLCredential -extension ExtensionDelegate: AuthenticationChallengeResponsible { +extension OpenHABWatchAppDelegate: AuthenticationChallengeResponsible { // sessionDelegate.onReceiveSessionTaskChallenge func downloader(_ downloader: ImageDownloader, task: URLSessionTask, @@ -121,37 +98,37 @@ extension ExtensionDelegate: AuthenticationChallengeResponsible { // MARK: - ServerCertificateManagerDelegate -extension ExtensionDelegate: ServerCertificateManagerDelegate { - // delegate should ask user for a decision on what to do with invalid certificate - func evaluateServerTrust(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?) { - guard viewModel != nil else { - policy!.evaluateResult = .deny - return - } - DispatchQueue.main.async { - self.viewModel?.showCertificateAlert = true - self.viewModel?.certificateErrorDescription = String(format: NSLocalizedString("ssl_certificate_invalid", comment: ""), certificateSummary ?? "", domain ?? "") - } - } - - // certificate received from openHAB doesn't match our record, ask user for a decision - func evaluateCertificateMismatch(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?) { - guard viewModel != nil else { - policy!.evaluateResult = .deny - return - } - DispatchQueue.main.async { - self.viewModel?.showCertificateAlert = true - self.viewModel?.certificateErrorDescription = String(format: NSLocalizedString("ssl_certificate_no_match", comment: ""), certificateSummary ?? "", domain ?? "") - } - } - - func acceptedServerCertificatesChanged(_ policy: ServerCertificateManager?) {} -} +// extension OpenHABWatchAppDelegate: ServerCertificateManagerDelegate { +// // delegate should ask user for a decision on what to do with invalid certificate +// func evaluateServerTrust(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?) { +// guard viewModel != nil else { +// policy!.evaluateResult = .deny +// return +// } +// DispatchQueue.main.async { +// self.viewModel?.showCertificateAlert = true +// self.viewModel?.certificateErrorDescription = String(format: NSLocalizedString("ssl_certificate_invalid", comment: ""), certificateSummary ?? "", domain ?? "") +// } +// } +// +// // certificate received from openHAB doesn't match our record, ask user for a decision +// func evaluateCertificateMismatch(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?) { +// guard viewModel != nil else { +// policy!.evaluateResult = .deny +// return +// } +// DispatchQueue.main.async { +// self.viewModel?.showCertificateAlert = true +// self.viewModel?.certificateErrorDescription = String(format: NSLocalizedString("ssl_certificate_no_match", comment: ""), certificateSummary ?? "", domain ?? "") +// } +// } +// +// func acceptedServerCertificatesChanged(_ policy: ServerCertificateManager?) {} +// } // MARK: - ClientCertificateManagerDelegate -extension ExtensionDelegate: ClientCertificateManagerDelegate { +extension OpenHABWatchAppDelegate: ClientCertificateManagerDelegate { // delegate should ask user for a decision on whether to import the client certificate into the keychain func askForClientCertificateImport(_ clientCertificateManager: ClientCertificateManager?) {} diff --git a/openHABWatch Extension/PushNotificationPayload.apns b/openHABWatch/Extension/PushNotificationPayload.apns similarity index 100% rename from openHABWatch Extension/PushNotificationPayload.apns rename to openHABWatch/Extension/PushNotificationPayload.apns diff --git a/openHABWatch Extension/UserDefaultsExtension.swift b/openHABWatch/Extension/UserDefaultsExtension.swift similarity index 100% rename from openHABWatch Extension/UserDefaultsExtension.swift rename to openHABWatch/Extension/UserDefaultsExtension.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-32@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-32@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-32@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-32@2x.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-36@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-36@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-36@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Icon-36@2x.png diff --git a/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json similarity index 100% rename from openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab84.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab84.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab84.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab84.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab94.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab94.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab94.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/openhab94.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-52@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-52@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-52@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-52@2x.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-58@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-58@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-58@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Icon-58@2x.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-40@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-40@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-40@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-40@2x.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-44@2x.png b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-44@2x.png similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-44@2x.png rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Icon-44@2x.png diff --git a/openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Contents.json b/openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Contents.json similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Assets.xcassets/Contents.json rename to openHABWatch/Extension/openHABWatch Extension/Assets.xcassets/Contents.json diff --git a/openHABWatch Extension/openHABWatch Extension/ButtonTableRowController.swift b/openHABWatch/Extension/openHABWatch Extension/ButtonTableRowController.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/ButtonTableRowController.swift rename to openHABWatch/Extension/openHABWatch Extension/ButtonTableRowController.swift diff --git a/openHABWatch Extension/openHABWatch Extension/ComplicationController.swift b/openHABWatch/Extension/openHABWatch Extension/ComplicationController.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/ComplicationController.swift rename to openHABWatch/Extension/openHABWatch Extension/ComplicationController.swift diff --git a/openHABWatch Extension/openHABWatch Extension/ExtensionDelegate.swift b/openHABWatch/Extension/openHABWatch Extension/ExtensionDelegate.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/ExtensionDelegate.swift rename to openHABWatch/Extension/openHABWatch Extension/ExtensionDelegate.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Info.plist b/openHABWatch/Extension/openHABWatch Extension/Info.plist similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Info.plist rename to openHABWatch/Extension/openHABWatch Extension/Info.plist diff --git a/openHABWatch Extension/openHABWatch Extension/InterfaceController.swift b/openHABWatch/Extension/openHABWatch Extension/InterfaceController.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/InterfaceController.swift rename to openHABWatch/Extension/openHABWatch Extension/InterfaceController.swift diff --git a/openHABWatch Extension/openHABWatch Extension/NotificationController.swift b/openHABWatch/Extension/openHABWatch Extension/NotificationController.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/NotificationController.swift rename to openHABWatch/Extension/openHABWatch Extension/NotificationController.swift diff --git a/openHABWatch Extension/openHABWatch Extension/PrefsInterfaceController.swift b/openHABWatch/Extension/openHABWatch Extension/PrefsInterfaceController.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/PrefsInterfaceController.swift rename to openHABWatch/Extension/openHABWatch Extension/PrefsInterfaceController.swift diff --git a/openHABWatch Extension/openHABWatch Extension/PushNotificationPayload.apns b/openHABWatch/Extension/openHABWatch Extension/PushNotificationPayload.apns similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/PushNotificationPayload.apns rename to openHABWatch/Extension/openHABWatch Extension/PushNotificationPayload.apns diff --git a/openHABWatch Extension/openHABWatch Extension/UserDefaultsExtension.swift b/openHABWatch/Extension/openHABWatch Extension/UserDefaultsExtension.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/UserDefaultsExtension.swift rename to openHABWatch/Extension/openHABWatch Extension/UserDefaultsExtension.swift diff --git a/openHABWatch Extension/openHABWatch Extension/external/OpenHabService.swift b/openHABWatch/Extension/openHABWatch Extension/external/OpenHabService.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/external/OpenHabService.swift rename to openHABWatch/Extension/openHABWatch Extension/external/OpenHabService.swift diff --git a/openHABWatch Extension/openHABWatch Extension/external/AppMessageService.swift b/openHABWatch/External/AppMessageService.swift similarity index 89% rename from openHABWatch Extension/openHABWatch Extension/external/AppMessageService.swift rename to openHABWatch/External/AppMessageService.swift index a28e0a182..ef2a8ac78 100644 --- a/openHABWatch Extension/openHABWatch Extension/external/AppMessageService.swift +++ b/openHABWatch/External/AppMessageService.swift @@ -45,10 +45,10 @@ class AppMessageService: NSObject, WCSessionDelegate { ObservableOpenHABDataObject.shared.ignoreSSL = ignoreSSL } - if let trustedCertificates = applicationContext["trustedCertificates"] as? [String: Any] { - NetworkConnection.shared.serverCertificateManager.trustedCertificates = trustedCertificates - NetworkConnection.shared.serverCertificateManager.saveTrustedCertificates() - } +// if let trustedCertificates = applicationContext["trustedCertificates"] as? [String: Any] { +// NetworkConnection.shared.serverCertificateManager.trustedCertificates = trustedCertificates +// NetworkConnection.shared.serverCertificateManager.saveTrustedCertificates() +// } if let alwaysSendCreds = applicationContext["alwaysSendCreds"] as? Bool { ObservableOpenHABDataObject.shared.openHABAlwaysSendCreds = alwaysSendCreds @@ -68,7 +68,7 @@ class AppMessageService: NSObject, WCSessionDelegate { os_log("Received %{PUBLIC}@", log: .watch, type: .info, "\(filteredMessages)") DispatchQueue.main.async { () in - AppMessageService.singleton.updateValuesFromApplicationContext(response as [String: AnyObject]) + self.updateValuesFromApplicationContext(response as [String: AnyObject]) } }, errorHandler: { (error) in @@ -77,7 +77,6 @@ class AppMessageService: NSObject, WCSessionDelegate { ) } - @available(watchOSApplicationExtension 2.2, *) func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { os_log("activationDidCompleteWith activationState %{PUBLIC}@ error: %{PUBLIC}@", log: .watch, type: .info, "\(activationState)", "\(String(describing: error))") DispatchQueue.main.async { () in @@ -86,7 +85,6 @@ class AppMessageService: NSObject, WCSessionDelegate { } /** Called on the delegate of the receiver. Will be called on startup if an applicationContext is available. */ - @available(watchOS 2.0, *) func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String: Any]) { os_log("didReceiveApplicationContext %{PUBLIC}@", log: .watch, type: .info, "\(applicationContext)") DispatchQueue.main.async { () in @@ -95,7 +93,6 @@ class AppMessageService: NSObject, WCSessionDelegate { } /** Called on the delegate of the receiver. Will be called on startup if the user info finished transferring when the receiver was not running. */ - @available(watchOS 2.0, *) func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any]) { os_log("didReceiveUserInfo %{PUBLIC}@", log: .watch, type: .info, "\(userInfo)") DispatchQueue.main.async { () in @@ -103,7 +100,6 @@ class AppMessageService: NSObject, WCSessionDelegate { } } - @available(watchOS 2.0, *) func session(_ session: WCSession, didReceiveMessage message: [String: Any]) { let filteredMessages = message.filter { ["remoteUrl", "localUrl", "username"].contains($0.key) } os_log("didReceiveMessage some filtered messages: %{PUBLIC}@", log: .watch, type: .info, "\(filteredMessages)") @@ -112,7 +108,6 @@ class AppMessageService: NSObject, WCSessionDelegate { } } - @available(watchOS 2.0, *) func session(_ session: WCSession, didReceiveMessage message: [String: Any], replyHandler: @escaping ([String: Any]) -> Swift.Void) { let filteredMessages = message.filter { ["remoteUrl", "localUrl", "username", "defaultSitemap"].contains($0.key) } os_log("didReceiveMessage some filtered messages: %{PUBLIC}@ with reply handler", log: .watch, type: .info, "\(filteredMessages)") diff --git a/openHABWatch/Info.plist b/openHABWatch/Info.plist index 05f45a077..2bc276815 100644 --- a/openHABWatch/Info.plist +++ b/openHABWatch/Info.plist @@ -2,39 +2,12 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - openHAB - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - CLKComplicationPrincipalClass - $(PRODUCT_MODULE_NAME).ComplicationController NSAppTransportSecurity NSAllowsArbitraryLoads - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - WKApplication - - WKCompanionAppBundleIdentifier - es.spaphone.openhab + diff --git a/openHABWatch Extension/openHABWatch Extension/Model/LazyView.swift b/openHABWatch/Model/LazyView.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Model/LazyView.swift rename to openHABWatch/Model/LazyView.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABDataObject.swift b/openHABWatch/Model/ObservableOpenHABDataObject.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABDataObject.swift rename to openHABWatch/Model/ObservableOpenHABDataObject.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABSitemapPage.swift b/openHABWatch/Model/ObservableOpenHABSitemapPage.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABSitemapPage.swift rename to openHABWatch/Model/ObservableOpenHABSitemapPage.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABWidget.swift b/openHABWatch/Model/ObservableOpenHABWidget.swift similarity index 100% rename from openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABWidget.swift rename to openHABWatch/Model/ObservableOpenHABWidget.swift diff --git a/openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABWidgetExtension.swift b/openHABWatch/Model/ObservableOpenHABWidgetExtension.swift similarity index 83% rename from openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABWidgetExtension.swift rename to openHABWatch/Model/ObservableOpenHABWidgetExtension.swift index 23fcfc6b1..118b0d151 100644 --- a/openHABWatch Extension/openHABWatch Extension/Model/ObservableOpenHABWidgetExtension.swift +++ b/openHABWatch/Model/ObservableOpenHABWidgetExtension.swift @@ -21,7 +21,10 @@ extension ObservableOpenHABWidget { // os_log("Selected %{PUBLIC}@", log: .viewCycle, type: .info, pageUrl) NavigationLink(destination: LazyView( - ContentView(viewModel: UserData(url: URL(string: pageUrl)), settings: settings, title: title)) + // TODO: + EmptyView() + // ContentView(viewModel: UserData(url: URL(string: pageUrl)), settings: settings, title: title) + ) ) { Image(systemName: "chevron.right") } diff --git a/openHABWatch Extension/openHABWatch Extension/Model/UserDefaultsBacked.swift b/openHABWatch/Model/UserDefaultsBacked.swift similarity index 94% rename from openHABWatch Extension/openHABWatch Extension/Model/UserDefaultsBacked.swift rename to openHABWatch/Model/UserDefaultsBacked.swift index 6c0de7bbc..9e470de1e 100644 --- a/openHABWatch Extension/openHABWatch Extension/Model/UserDefaultsBacked.swift +++ b/openHABWatch/Model/UserDefaultsBacked.swift @@ -28,7 +28,7 @@ struct UserDefaultsBacked { } } -/// Convenience initializer when UserDefaults is optional. +// Convenience initializer when UserDefaults is optional. extension UserDefaultsBacked where T: ExpressibleByNilLiteral { init(key: String, storage: UserDefaults = .standard) { self.init(key: key, defaultValue: nil, storage: storage) diff --git a/openHABWatch/OpenHABWatch.swift b/openHABWatch/OpenHABWatch.swift new file mode 100644 index 000000000..02ee1d47a --- /dev/null +++ b/openHABWatch/OpenHABWatch.swift @@ -0,0 +1,42 @@ +// Copyright (c) 2010-2023 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +import SwiftUI + +@main +struct OpenHABWatch: App { + @ObservedObject var settings = ObservableOpenHABDataObject.shared + + // https://developer.apple.com/documentation/watchkit/wkapplicationdelegate + @WKApplicationDelegateAdaptor(OpenHABWatchAppDelegate.self) var appDelegate + @ObservedObject var userData = UserData(sitemapName: ObservableOpenHABDataObject.shared.sitemapName) + // @ObservedObject var userData = UserData(sitemapName: ObservableOpenHABDataObject.shared.sitemapName) + + var body: some Scene { + WindowGroup { + TabView { + ContentView(viewModel: userData, settings: settings) + .tabItem { + Label("Received", systemImage: "tray.and.arrow.down.fill") + } + PreferencesSwiftUIView() + .tabItem { + Label("Preferences", systemImage: "person.crop.circle.fill") + } + } + // .environmentObject(userData) + } + + #if os(watchOS) + WKNotificationScene(controller: NotificationController.self, category: "openHABNotification") + #endif + } +} diff --git a/openHABWatch/Preview Content/Preview Assets.xcassets/Contents.json b/openHABWatch/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/openHABWatch/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHABWatch Extension/Views/ContentView.swift b/openHABWatch/Views/ContentView.swift similarity index 86% rename from openHABWatch Extension/Views/ContentView.swift rename to openHABWatch/Views/ContentView.swift index b852d70b6..dae6281d7 100644 --- a/openHABWatch Extension/Views/ContentView.swift +++ b/openHABWatch/Views/ContentView.swift @@ -101,13 +101,23 @@ struct ContentView: View { } } -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - Group { - ContentView(viewModel: UserData()) - .previewDevice("Apple Watch Series 4 - 44mm") - ContentView(viewModel: UserData()) - .previewDevice("Apple Watch Series 2 - 38mm") - } - } -} +// TODO: +// struct ContentView_Previews: PreviewProvider { +// static let envObject = UserData() +// static var previews: some View { +// Group { +// ContentView() +//// .previewDevice("Apple Watch Series 4 - 44mm") +// .environmentObject({ () -> UserData in +// let envObj = UserData() +// return envObj +// }() ) +// +// +// +// +// ContentView(viewModel: UserData()) +// .previewDevice("Apple Watch Series 2 - 38mm") +// } +// } +// } diff --git a/openHABWatch Extension/Views/PreferencesSwiftUIView.swift b/openHABWatch/Views/PreferencesSwiftUIView.swift similarity index 100% rename from openHABWatch Extension/Views/PreferencesSwiftUIView.swift rename to openHABWatch/Views/PreferencesSwiftUIView.swift diff --git a/openHABWatch Extension/Views/Rows/ColorPickerRow.swift b/openHABWatch/Views/Rows/ColorPickerRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/ColorPickerRow.swift rename to openHABWatch/Views/Rows/ColorPickerRow.swift diff --git a/openHABWatch Extension/Views/Rows/FrameRow.swift b/openHABWatch/Views/Rows/FrameRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/FrameRow.swift rename to openHABWatch/Views/Rows/FrameRow.swift diff --git a/openHABWatch Extension/Views/Rows/GenericRow.swift b/openHABWatch/Views/Rows/GenericRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/GenericRow.swift rename to openHABWatch/Views/Rows/GenericRow.swift diff --git a/openHABWatch Extension/Views/Rows/ImageRawRow.swift b/openHABWatch/Views/Rows/ImageRawRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/ImageRawRow.swift rename to openHABWatch/Views/Rows/ImageRawRow.swift diff --git a/openHABWatch Extension/Views/Rows/ImageRow.swift b/openHABWatch/Views/Rows/ImageRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/ImageRow.swift rename to openHABWatch/Views/Rows/ImageRow.swift diff --git a/openHABWatch Extension/Views/Rows/MapViewRow.swift b/openHABWatch/Views/Rows/MapViewRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/MapViewRow.swift rename to openHABWatch/Views/Rows/MapViewRow.swift diff --git a/openHABWatch Extension/Views/Rows/PreferencesRowUIView.swift b/openHABWatch/Views/Rows/PreferencesRowUIView.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/PreferencesRowUIView.swift rename to openHABWatch/Views/Rows/PreferencesRowUIView.swift diff --git a/openHABWatch Extension/Views/Rows/RollershutterRow.swift b/openHABWatch/Views/Rows/RollershutterRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/RollershutterRow.swift rename to openHABWatch/Views/Rows/RollershutterRow.swift diff --git a/openHABWatch Extension/Views/Rows/SegmentRow.swift b/openHABWatch/Views/Rows/SegmentRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/SegmentRow.swift rename to openHABWatch/Views/Rows/SegmentRow.swift diff --git a/openHABWatch Extension/Views/Rows/SetpointRow.swift b/openHABWatch/Views/Rows/SetpointRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/SetpointRow.swift rename to openHABWatch/Views/Rows/SetpointRow.swift diff --git a/openHABWatch Extension/Views/Rows/SliderRow.swift b/openHABWatch/Views/Rows/SliderRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/SliderRow.swift rename to openHABWatch/Views/Rows/SliderRow.swift diff --git a/openHABWatch Extension/Views/Rows/SwitchRow.swift b/openHABWatch/Views/Rows/SwitchRow.swift similarity index 100% rename from openHABWatch Extension/Views/Rows/SwitchRow.swift rename to openHABWatch/Views/Rows/SwitchRow.swift diff --git a/openHABWatch Extension/Views/Utils/Color+Extension.swift b/openHABWatch/Views/Utils/Color+Extension.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/Color+Extension.swift rename to openHABWatch/Views/Utils/Color+Extension.swift diff --git a/openHABWatch Extension/Views/Utils/ColorSelection.swift b/openHABWatch/Views/Utils/ColorSelection.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/ColorSelection.swift rename to openHABWatch/Views/Utils/ColorSelection.swift diff --git a/openHABWatch Extension/Views/Utils/DetailTextLabelView.swift b/openHABWatch/Views/Utils/DetailTextLabelView.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/DetailTextLabelView.swift rename to openHABWatch/Views/Utils/DetailTextLabelView.swift diff --git a/openHABWatch Extension/Views/Utils/EncircledIconWithAction.swift b/openHABWatch/Views/Utils/EncircledIconWithAction.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/EncircledIconWithAction.swift rename to openHABWatch/Views/Utils/EncircledIconWithAction.swift diff --git a/openHABWatch Extension/Views/Utils/IconView.swift b/openHABWatch/Views/Utils/IconView.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/IconView.swift rename to openHABWatch/Views/Utils/IconView.swift diff --git a/openHABWatch Extension/Views/Utils/MapView.swift b/openHABWatch/Views/Utils/MapView.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/MapView.swift rename to openHABWatch/Views/Utils/MapView.swift diff --git a/openHABWatch Extension/Views/Utils/PreviewConstants.swift b/openHABWatch/Views/Utils/PreviewConstants.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/PreviewConstants.swift rename to openHABWatch/Views/Utils/PreviewConstants.swift diff --git a/openHABWatch Extension/Views/Utils/TextLabelView.swift b/openHABWatch/Views/Utils/TextLabelView.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/TextLabelView.swift rename to openHABWatch/Views/Utils/TextLabelView.swift diff --git a/openHABWatch Extension/Views/Utils/Unwrap.swift b/openHABWatch/Views/Utils/Unwrap.swift similarity index 100% rename from openHABWatch Extension/Views/Utils/Unwrap.swift rename to openHABWatch/Views/Utils/Unwrap.swift diff --git a/openHABWatch/openHABWatch.entitlements b/openHABWatch/openHABWatch.entitlements deleted file mode 100644 index 0c67376eb..000000000 --- a/openHABWatch/openHABWatch.entitlements +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/openHABWatchSwiftUI Watch AppTests/openHABWatchSwiftUI_Watch_AppTests.swift b/openHABWatchSwiftUI Watch AppTests/openHABWatchSwiftUI_Watch_AppTests.swift new file mode 100644 index 000000000..65a35aad4 --- /dev/null +++ b/openHABWatchSwiftUI Watch AppTests/openHABWatchSwiftUI_Watch_AppTests.swift @@ -0,0 +1,38 @@ +// Copyright (c) 2010-2023 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +@testable import openHABWatchSwiftUI_Watch_App +import XCTest + +final class OpenHABWatchAppTests: XCTestCase { + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Tests marked async will run the test method on an arbitrary thread managed by the Swift runtime. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + measure { + // Put the code you want to measure the time of here. + } + } +} diff --git a/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITests.swift b/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITests.swift new file mode 100644 index 000000000..34ecda046 --- /dev/null +++ b/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITests.swift @@ -0,0 +1,44 @@ +// Copyright (c) 2010-2023 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +import XCTest + +final class OpenHABWatchUITests: XCTestCase { + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift b/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift new file mode 100644 index 000000000..60118a193 --- /dev/null +++ b/openHABWatchSwiftUI Watch AppUITests/openHABWatchSwiftUI_Watch_AppUITestsLaunchTests.swift @@ -0,0 +1,35 @@ +// Copyright (c) 2010-2023 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +import XCTest + +final class OpenHABWatchLaunchTests: XCTestCase { + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +}