Skip to content

Commit 5533c13

Browse files
Implement Covers - untested
1 parent f736ada commit 5533c13

File tree

6 files changed

+55
-26
lines changed

6 files changed

+55
-26
lines changed

HA Menu.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,15 @@
621621
CODE_SIGN_IDENTITY = "Apple Development";
622622
CODE_SIGN_STYLE = Automatic;
623623
COMBINE_HIDPI_IMAGES = YES;
624-
CURRENT_PROJECT_VERSION = 26;
624+
CURRENT_PROJECT_VERSION = 27;
625625
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
626626
ENABLE_HARDENED_RUNTIME = YES;
627627
INFOPLIST_FILE = "HA Menu/Info.plist";
628628
LD_RUNPATH_SEARCH_PATHS = (
629629
"$(inherited)",
630630
"@executable_path/../Frameworks",
631631
);
632-
MARKETING_VERSION = 2.5.1;
632+
MARKETING_VERSION = 2.6.0;
633633
OTHER_SWIFT_FLAGS = "-D DEBUG";
634634
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu";
635635
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -645,15 +645,15 @@
645645
CODE_SIGN_IDENTITY = "Apple Development";
646646
CODE_SIGN_STYLE = Automatic;
647647
COMBINE_HIDPI_IMAGES = YES;
648-
CURRENT_PROJECT_VERSION = 26;
648+
CURRENT_PROJECT_VERSION = 27;
649649
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
650650
ENABLE_HARDENED_RUNTIME = YES;
651651
INFOPLIST_FILE = "HA Menu/Info.plist";
652652
LD_RUNPATH_SEARCH_PATHS = (
653653
"$(inherited)",
654654
"@executable_path/../Frameworks",
655655
);
656-
MARKETING_VERSION = 2.5.1;
656+
MARKETING_VERSION = 2.6.0;
657657
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu";
658658
PRODUCT_NAME = "$(TARGET_NAME)";
659659
SWIFT_VERSION = 5.0;
@@ -750,15 +750,15 @@
750750
CODE_SIGN_IDENTITY = "Apple Development";
751751
CODE_SIGN_STYLE = Automatic;
752752
COMBINE_HIDPI_IMAGES = YES;
753-
CURRENT_PROJECT_VERSION = 26;
753+
CURRENT_PROJECT_VERSION = 27;
754754
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
755755
ENABLE_HARDENED_RUNTIME = YES;
756756
INFOPLIST_FILE = "HA Menu Launcher/Info.plist";
757757
LD_RUNPATH_SEARCH_PATHS = (
758758
"$(inherited)",
759759
"@executable_path/../Frameworks",
760760
);
761-
MARKETING_VERSION = 2.5.1;
761+
MARKETING_VERSION = 2.6.0;
762762
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu-Launcher";
763763
PRODUCT_NAME = "$(TARGET_NAME)";
764764
SKIP_INSTALL = YES;
@@ -774,15 +774,15 @@
774774
CODE_SIGN_IDENTITY = "Apple Development";
775775
CODE_SIGN_STYLE = Automatic;
776776
COMBINE_HIDPI_IMAGES = YES;
777-
CURRENT_PROJECT_VERSION = 26;
777+
CURRENT_PROJECT_VERSION = 27;
778778
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
779779
ENABLE_HARDENED_RUNTIME = YES;
780780
INFOPLIST_FILE = "HA Menu Launcher/Info.plist";
781781
LD_RUNPATH_SEARCH_PATHS = (
782782
"$(inherited)",
783783
"@executable_path/../Frameworks",
784784
);
785-
MARKETING_VERSION = 2.5.1;
785+
MARKETING_VERSION = 2.6.0;
786786
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu-Launcher";
787787
PRODUCT_NAME = "$(TARGET_NAME)";
788788
SKIP_INSTALL = YES;

HA Menu/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ extension AppDelegate {
5555
"domain_inputselects": true,
5656
"domain_scenes": true,
5757
"domain_scripts": true,
58+
"domain_covers": true,
5859
"betaNotifications": false
5960
])
6061

HA Menu/Base.lproj/Main.storyboard

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
66
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
77
</dependencies>
88
<scenes>
@@ -705,28 +705,28 @@
705705
<scene sceneID="Sio-Xm-nKm">
706706
<objects>
707707
<viewController storyboardIdentifier="PreferencesViewController" showSeguePresentationStyle="single" id="b0o-up-s6N" userLabel="Preferences View Controller" customClass="PrefsViewController" customModule="HA_Menu" customModuleProvider="target" sceneMemberID="viewController">
708-
<view key="view" id="R2d-cY-rAO">
709-
<rect key="frame" x="0.0" y="0.0" width="425" height="462"/>
708+
<view key="view" misplaced="YES" id="R2d-cY-rAO">
709+
<rect key="frame" x="0.0" y="0.0" width="425" height="466"/>
710710
<autoresizingMask key="autoresizingMask"/>
711711
<subviews>
712712
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="d6B-OZ-GYv">
713-
<rect key="frame" x="18" y="426" width="44" height="16"/>
713+
<rect key="frame" x="18" y="434" width="44" height="16"/>
714714
<textFieldCell key="cell" lineBreakMode="clipping" title="Server" id="lrv-Ft-Gue">
715715
<font key="font" metaFont="system"/>
716716
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
717717
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
718718
</textFieldCell>
719719
</textField>
720720
<textField verticalHuggingPriority="750" ambiguous="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cJg-XY-9A6" userLabel="Server">
721-
<rect key="frame" x="80" y="425" width="325" height="20"/>
721+
<rect key="frame" x="80" y="429" width="325" height="20"/>
722722
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="border" placeholderString="http://your.server:8123" drawsBackground="YES" id="9z1-au-9a6">
723723
<font key="font" metaFont="system"/>
724724
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
725725
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
726726
</textFieldCell>
727727
</textField>
728728
<textField verticalHuggingPriority="750" ambiguous="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xLm-S0-5hb" userLabel="Token">
729-
<rect key="frame" x="80" y="306" width="325" height="100"/>
729+
<rect key="frame" x="80" y="314" width="325" height="100"/>
730730
<constraints>
731731
<constraint firstAttribute="height" constant="100" id="Eue-mA-oog"/>
732732
</constraints>
@@ -737,21 +737,21 @@
737737
</textFieldCell>
738738
</textField>
739739
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="axF-OX-WUt">
740-
<rect key="frame" x="18" y="10" width="389" height="18"/>
740+
<rect key="frame" x="18" y="11" width="387" height="18"/>
741741
<buttonCell key="cell" type="check" title="Start at login" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="QMM-8Q-kj2">
742742
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
743743
<font key="font" metaFont="system"/>
744744
</buttonCell>
745745
</button>
746746
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="sDh-nR-2un">
747-
<rect key="frame" x="20" y="60" width="385" height="210"/>
747+
<rect key="frame" x="20" y="61" width="385" height="210"/>
748748
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
749749
<clipView key="contentView" id="OZ8-JA-aYe">
750-
<rect key="frame" x="1" y="0.0" width="383" height="209"/>
750+
<rect key="frame" x="1" y="1" width="383" height="208"/>
751751
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
752752
<subviews>
753753
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" headerView="AbX-ym-xml" id="Gml-eL-0ch">
754-
<rect key="frame" x="0.0" y="0.0" width="383" height="184"/>
754+
<rect key="frame" x="0.0" y="0.0" width="383" height="183"/>
755755
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
756756
<size key="intercellSpacing" width="3" height="2"/>
757757
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -780,7 +780,7 @@
780780
</textFieldCell>
781781
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
782782
</tableColumn>
783-
<tableColumn width="60" minWidth="40" maxWidth="1000" id="Tjs-hf-rmo">
783+
<tableColumn width="40" minWidth="40" maxWidth="1000" id="Tjs-hf-rmo">
784784
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Submenu">
785785
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
786786
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -803,13 +803,13 @@
803803
<rect key="frame" x="368" y="0.0" width="16" height="0.0"/>
804804
<autoresizingMask key="autoresizingMask"/>
805805
</scroller>
806-
<tableHeaderView key="headerView" id="AbX-ym-xml">
806+
<tableHeaderView key="headerView" wantsLayer="YES" id="AbX-ym-xml">
807807
<rect key="frame" x="0.0" y="0.0" width="383" height="25"/>
808808
<autoresizingMask key="autoresizingMask"/>
809809
</tableHeaderView>
810810
</scrollView>
811811
<button verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bzu-iR-vUe">
812-
<rect key="frame" x="299" y="268" width="112" height="32"/>
812+
<rect key="frame" x="298" y="272" width="114" height="32"/>
813813
<constraints>
814814
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="wVt-oi-xmo"/>
815815
</constraints>
@@ -822,22 +822,22 @@
822822
</connections>
823823
</button>
824824
<textField identifier="LabelStatus" horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0wc-Hy-MC4">
825-
<rect key="frame" x="18" y="278" width="23" height="16"/>
825+
<rect key="frame" x="18" y="282" width="23" height="16"/>
826826
<textFieldCell key="cell" lineBreakMode="clipping" title="OK" id="2fl-Mt-VYj">
827827
<font key="font" metaFont="system"/>
828828
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
829829
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
830830
</textFieldCell>
831831
</textField>
832832
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Sv8-cb-OH4">
833-
<rect key="frame" x="18" y="36" width="389" height="18"/>
833+
<rect key="frame" x="18" y="39" width="387" height="18"/>
834834
<buttonCell key="cell" type="check" title="Show beta version notifications" bezelStyle="regularSquare" imagePosition="left" inset="2" id="MrG-7X-nxL">
835835
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
836836
<font key="font" metaFont="system"/>
837837
</buttonCell>
838838
</button>
839839
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="s4S-Br-111">
840-
<rect key="frame" x="18" y="387" width="44" height="16"/>
840+
<rect key="frame" x="18" y="395" width="44" height="16"/>
841841
<textFieldCell key="cell" lineBreakMode="clipping" title="Token" id="bQV-gm-Oxx">
842842
<font key="font" metaFont="system"/>
843843
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>

HA Menu/MenuItemController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ final class MenuItemController: NSObject, NSMenuDelegate {
241241
itemType = EntityTypes.scriptType
242242
case "sensor":
243243
itemType = EntityTypes.sensorType
244-
244+
case "cover":
245+
itemType = EntityTypes.coverType
246+
245247
default:
246248
itemType = nil
247249
}
@@ -370,6 +372,10 @@ final class MenuItemController: NSObject, NSMenuDelegate {
370372
menuItem.state = NSControl.StateValue.off
371373
menuItem.offStateImage = NSImage(named: "BulletImage")
372374
}
375+
else if haEntity.domainType == EntityDomains.coverDomain {
376+
menuItem.action = #selector(self.toggleEntityState(_:))
377+
menuItem.state = ((haEntity.state == "open" || haEntity.state == "opening") ? NSControl.StateValue.on : NSControl.StateValue.off)
378+
}
373379
else {
374380
menuItem.action = #selector(self.toggleEntityState(_:))
375381
menuItem.state = ((haEntity.state == "on") ? NSControl.StateValue.on : NSControl.StateValue.off)

HA Menu/Models/HaEntity.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum EntityTypes: Int, CaseIterable {
1818
case sceneType = 8
1919
case scriptType = 9
2020
case sensorType = 10
21+
case coverType = 11
2122
case unknownType = 999
2223
}
2324

@@ -31,6 +32,7 @@ enum EntityDomains: String, CaseIterable {
3132
case scriptDomain = "script"
3233
case groupDomain = "group"
3334
case sensorDomain = "sensor"
35+
case coverDomain = "cover"
3436
case unknownDomain = "unknown"
3537
}
3638

@@ -61,6 +63,8 @@ struct HaEntity {
6163
return EntityDomains.scriptDomain
6264
case EntityDomains.sensorDomain.rawValue:
6365
return EntityDomains.sensorDomain
66+
case EntityDomains.coverDomain.rawValue:
67+
return EntityDomains.coverDomain
6468

6569
case EntityDomains.groupDomain.rawValue:
6670
return EntityDomains.groupDomain
@@ -95,6 +99,8 @@ struct HaEntity {
9599
return EntityTypes.scriptType
96100
case EntityDomains.sensorDomain:
97101
return EntityTypes.sensorType
102+
case EntityDomains.coverDomain:
103+
return EntityTypes.coverType
98104

99105
case EntityDomains.groupDomain:
100106
return EntityTypes.groupType

HA Menu/Models/Preferences.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ struct Preferences {
174174
UserDefaults.standard.synchronize()
175175
}
176176
}
177+
178+
var domainCovers: Bool {
179+
get {
180+
return UserDefaults.standard.bool(forKey: "domain_covers")
181+
}
182+
set {
183+
UserDefaults.standard.set(newValue, forKey: "domain_covers")
184+
UserDefaults.standard.synchronize()
185+
}
186+
}
177187

178188
var menuItems: [PrefMenuItem] {
179189
get {
@@ -196,6 +206,10 @@ struct Preferences {
196206
if !domainExists(domain: "script", prefs: decodedResponse) {
197207
decodedResponse.append(PrefMenuItem(entityId: "script", itemType: itemTypes.Domain, subMenu: true, enabled: domainScenes, friendlyName: "Scripts"))
198208
}
209+
210+
if !domainExists(domain: "cover", prefs: decodedResponse) {
211+
decodedResponse.append(PrefMenuItem(entityId: "cover", itemType: itemTypes.Domain, subMenu: true, enabled: domainCovers, friendlyName: "Covers"))
212+
}
199213

200214
return decodedResponse
201215
}
@@ -220,6 +234,8 @@ struct Preferences {
220234
decodedResponse.append(PrefMenuItem(entityId: "scene", itemType: itemTypes.Domain, subMenu: true, enabled: domainScenes, friendlyName: "Scenes"))
221235

222236
decodedResponse.append(PrefMenuItem(entityId: "script", itemType: itemTypes.Domain, subMenu: true, enabled: domainScripts, friendlyName: "Scripts"))
237+
238+
decodedResponse.append(PrefMenuItem(entityId: "cover", itemType: itemTypes.Domain, subMenu: true, enabled: domainCovers, friendlyName: "Covers"))
223239

224240
// Init Groups from old setting
225241
for group in groups {

0 commit comments

Comments
 (0)