Skip to content

Commit

Permalink
Dark mode override, additional options on battery
Browse files Browse the repository at this point in the history
  • Loading branch information
glouel committed Oct 31, 2018
1 parent 0638faa commit ec5ca4a
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 156 deletions.
18 changes: 9 additions & 9 deletions Aerial.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
03E8730E216501ED002B469B /* AsynchronousOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsynchronousOperation.swift; sourceTree = "<group>"; };
03E8731221675FE0002B469B /* TimeManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeManagement.swift; sourceTree = "<group>"; };
AA7E2E5D1FC62E8B00E5F320 /* AerialPlayerItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AerialPlayerItem.swift; sourceTree = "<group>"; };
FA143CD61BDA3E880041A82B /* AerialApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AerialApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
FA143CD61BDA3E880041A82B /* AerialConfig.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AerialConfig.app; sourceTree = BUILT_PRODUCTS_DIR; };
FA143CE51BDA3EEF0041A82B /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; };
FA36BD3E1BE57F8E00D5E03B /* VideoDownload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = VideoDownload.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FA6F81DB1D939455007975FE /* Preferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -331,7 +331,7 @@
isa = PBXGroup;
children = (
FACAF1A51BD9FC6000E539DC /* Aerial.saver */,
FA143CD61BDA3E880041A82B /* AerialApp.app */,
FA143CD61BDA3E880041A82B /* AerialConfig.app */,
FA71996E1D94EC5A00FBC99B /* Aerial Tests.xctest */,
);
name = Products;
Expand All @@ -351,9 +351,9 @@
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
FA143CD51BDA3E880041A82B /* AerialApp */ = {
FA143CD51BDA3E880041A82B /* AerialConfig */ = {
isa = PBXNativeTarget;
buildConfigurationList = FA143CE01BDA3E880041A82B /* Build configuration list for PBXNativeTarget "AerialApp" */;
buildConfigurationList = FA143CE01BDA3E880041A82B /* Build configuration list for PBXNativeTarget "AerialConfig" */;
buildPhases = (
FA74B8481D94DCE0004FE056 /* Run Script - Swiftlint */,
FA143CD21BDA3E880041A82B /* Sources */,
Expand All @@ -364,9 +364,9 @@
);
dependencies = (
);
name = AerialApp;
name = AerialConfig;
productName = "Aerial Test";
productReference = FA143CD61BDA3E880041A82B /* AerialApp.app */;
productReference = FA143CD61BDA3E880041A82B /* AerialConfig.app */;
productType = "com.apple.product-type.application";
};
FA71996D1D94EC5A00FBC99B /* Aerial Tests */ = {
Expand Down Expand Up @@ -446,7 +446,7 @@
projectRoot = "";
targets = (
FACAF1A41BD9FC6000E539DC /* Aerial */,
FA143CD51BDA3E880041A82B /* AerialApp */,
FA143CD51BDA3E880041A82B /* AerialConfig */,
FA71996D1D94EC5A00FBC99B /* Aerial Tests */,
);
};
Expand Down Expand Up @@ -599,7 +599,7 @@
/* Begin PBXTargetDependency section */
FA7199741D94EC5A00FBC99B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = FA143CD51BDA3E880041A82B /* AerialApp */;
target = FA143CD51BDA3E880041A82B /* AerialConfig */;
targetProxy = FA7199731D94EC5A00FBC99B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
Expand Down Expand Up @@ -831,7 +831,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
FA143CE01BDA3E880041A82B /* Build configuration list for PBXNativeTarget "AerialApp" */ = {
FA143CE01BDA3E880041A82B /* Build configuration list for PBXNativeTarget "AerialConfig" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FA143CE11BDA3E880041A82B /* Debug */,
Expand Down
16 changes: 8 additions & 8 deletions Aerial.xcodeproj/xcshareddata/xcschemes/AerialApp.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA143CD51BDA3E880041A82B"
BuildableName = "AerialApp.app"
BlueprintName = "AerialApp"
BuildableName = "AerialConfig.app"
BlueprintName = "AerialConfig"
ReferencedContainer = "container:Aerial.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -44,8 +44,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA143CD51BDA3E880041A82B"
BuildableName = "AerialApp.app"
BlueprintName = "AerialApp"
BuildableName = "AerialConfig.app"
BlueprintName = "AerialConfig"
ReferencedContainer = "container:Aerial.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -67,8 +67,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA143CD51BDA3E880041A82B"
BuildableName = "AerialApp.app"
BlueprintName = "AerialApp"
BuildableName = "AerialConfig.app"
BlueprintName = "AerialConfig"
ReferencedContainer = "container:Aerial.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand All @@ -93,8 +93,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA143CD51BDA3E880041A82B"
BuildableName = "AerialApp.app"
BlueprintName = "AerialApp"
BuildableName = "AerialConfig.app"
BlueprintName = "AerialConfig"
ReferencedContainer = "container:Aerial.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand Down
13 changes: 7 additions & 6 deletions Aerial/App/Resources/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="AerialApp" id="1Xt-HY-uBw">
<menuItem title="AerialConfig" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="AerialApp" systemMenu="apple" id="uQy-DD-JDr">
<menu key="submenu" title="AerialConfig" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About AerialApp" id="5kV-Vb-QxS">
<menuItem title="About AerialConfig" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
Expand All @@ -39,7 +39,7 @@
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide AerialApp" keyEquivalent="h" id="Olw-nP-bQN">
<menuItem title="Hide AerialConfig" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
Expand All @@ -57,7 +57,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit AerialApp" keyEquivalent="q" id="4sb-4s-VLi">
<menuItem title="Quit AerialConfig" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
Expand Down Expand Up @@ -94,7 +94,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="AerialApp Help" keyEquivalent="?" id="FKE-Sm-Kum">
<menuItem title="AerialConfig Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
</connections>
Expand All @@ -103,6 +103,7 @@
</menu>
</menuItem>
</items>
<point key="canvasLocation" x="-460" y="78"/>
</menu>
<window title="Aerial Preview" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
Expand Down
49 changes: 49 additions & 0 deletions Aerial/Source/Controllers/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class Preferences {
case overrideMargins = "overrideMargins"
case marginX = "marginX"
case marginY = "marginY"

case alternateVideoFormat = "alternateVideoFormat"
case overrideOnBattery = "overrideOnBattery"
case powerSavingOnLowBattery = "powerSavingOnLowBattery"

case darkModeNightOverride = "darkModeNightOverride"
}

enum SolarMode: Int {
Expand Down Expand Up @@ -95,6 +101,10 @@ class Preferences {
case v1080pH264, v1080pHEVC, v4KHEVC
}

enum AlternateVideoFormat: Int {
case powerSaving, v1080pH264, v1080pHEVC, v4KHEVC
}

enum DescriptionMode: Int {
case fade10seconds, always
}
Expand Down Expand Up @@ -161,6 +171,10 @@ class Preferences {
defaultValues[.overrideMargins] = false
defaultValues[.marginX] = 50
defaultValues[.marginY] = 50
defaultValues[.overrideOnBattery] = false
defaultValues[.powerSavingOnLowBattery] = false
defaultValues[.alternateVideoFormat] = AlternateVideoFormat.powerSaving
defaultValues[.darkModeNightOverride] = false

let defaults = defaultValues.reduce([String: Any]()) { (result, pair:(key: Identifiers, value: Any)) -> [String: Any] in
var mutable = result
Expand All @@ -172,6 +186,41 @@ class Preferences {
}

// MARK: - Variables
var alternateVideoFormat: Int? {
get {
return optionalValue(forIdentifier: .alternateVideoFormat)
}
set {
setValue(forIdentifier: .alternateVideoFormat, value: newValue)
}
}

var darkModeNightOverride: Bool {
get {
return value(forIdentifier: .darkModeNightOverride)
}
set {
setValue(forIdentifier: .darkModeNightOverride, value: newValue)
}
}

var overrideOnBattery: Bool {
get {
return value(forIdentifier: .overrideOnBattery)
}
set {
setValue(forIdentifier: .overrideOnBattery, value: newValue)
}
}

var powerSavingOnLowBattery: Bool {
get {
return value(forIdentifier: .powerSavingOnLowBattery)
}
set {
setValue(forIdentifier: .powerSavingOnLowBattery, value: newValue)
}
}

var useCommunityDescriptions: Bool {
get {
Expand Down
Loading

0 comments on commit ec5ca4a

Please sign in to comment.