From 02d5be94fc17db254fef875b066dfa9a5e294f1f Mon Sep 17 00:00:00 2001 From: Marcel Dierkes Date: Fri, 30 Dec 2016 12:01:29 +0100 Subject: [PATCH] Removed info.marcel-dierkes.KeepingYouAwake.AllowDisplaySleep preference --- CHANGELOG.md | 3 +++ KeepingYouAwake/Base.lproj/Localizable.strings | 3 --- KeepingYouAwake/Extensions/NSUserDefaults+Keys.h | 6 ------ KeepingYouAwake/Extensions/NSUserDefaults+Keys.m | 15 +-------------- KeepingYouAwake/KYASleepWakeTimer.m | 10 +--------- .../KYAAdvancedPreferencesViewController.m | 4 ---- KeepingYouAwake/fr.lproj/Localizable.strings | 3 --- Localizations/KeepingYouAwake/de.xliff | 4 ---- Localizations/KeepingYouAwake/ko.xliff | 4 ---- 9 files changed, 5 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09c7c8f9..c30bf48d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ - *Thank you [rei-vilo](https://github.com/rei-vilo)!* - Korean ([Issue #64](https://github.com/newmarcel/KeepingYouAwake/pull/64)) - *Thank you [Pusnow](https://github.com/Pusnow)!* +- removed advanced preference to allow the display to sleep *(didn't work properly and lead to confusion)* + - the `info.marcel-dierkes.KeepingYouAwake.AllowDisplaySleep` preference was removed + - a similar, more powerful replacement feature will be introduced soon ### v1.4 ### diff --git a/KeepingYouAwake/Base.lproj/Localizable.strings b/KeepingYouAwake/Base.lproj/Localizable.strings index 684a880b..6e925194 100644 --- a/KeepingYouAwake/Base.lproj/Localizable.strings +++ b/KeepingYouAwake/Base.lproj/Localizable.strings @@ -1,9 +1,6 @@ /* Enable experimental Notification Center integration */ "Enable experimental Notification Center integration" = "Enable experimental Notification Center integration"; -/* Allow the display to sleep (when connected to AC power) */ -"Allow the display to sleep (when connected to AC power)" = "Allow the display to sleep (when connected to AC power)"; - /* Disable menu bar icon highlight color */ "Disable menu bar icon highlight color" = "Disable menu bar icon highlight color"; diff --git a/KeepingYouAwake/Extensions/NSUserDefaults+Keys.h b/KeepingYouAwake/Extensions/NSUserDefaults+Keys.h index ebbc5bef..bdb77a9f 100644 --- a/KeepingYouAwake/Extensions/NSUserDefaults+Keys.h +++ b/KeepingYouAwake/Extensions/NSUserDefaults+Keys.h @@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN extern NSString * const KYAUserDefaultsKeyActivateOnLaunch; extern NSString * const KYAUserDefaultsKeyNotificationsEnabled; extern NSString * const KYAUserDefaultsKeyDefaultTimeInterval; -extern NSString * const KYAUserDefaultsKeyAllowDisplaySleep; extern NSString * const KYAUserDefaultsKeyMenuBarIconHighlightDisabled; extern NSString * const KYAUserDefaultsKeyBatteryCapacityThresholdEnabled; extern NSString * const KYAUserDefaultsKeyBatteryCapacityThreshold; @@ -37,11 +36,6 @@ extern NSString * const KYAUserDefaultsKeyPreReleaseUpdatesEnabled; */ @property (nonatomic) NSTimeInterval kya_defaultTimeInterval; -/** - * Returns YES if the app should allow the display to sleep while still keeping the system awake (AC-only). This exposes the `caffeinate -s` command. - */ -@property (nonatomic, getter = kya_shouldAllowDisplaySleep) BOOL kya_allowDisplaySleep; - /** * Returns YES if the menu bar icon should not be highlighted on left and right click. */ diff --git a/KeepingYouAwake/Extensions/NSUserDefaults+Keys.m b/KeepingYouAwake/Extensions/NSUserDefaults+Keys.m index 530cf4d1..5e575d5b 100644 --- a/KeepingYouAwake/Extensions/NSUserDefaults+Keys.m +++ b/KeepingYouAwake/Extensions/NSUserDefaults+Keys.m @@ -12,7 +12,6 @@ NSString * const KYAUserDefaultsKeyActivateOnLaunch = @"info.marcel-dierkes.KeepingYouAwake.ActivateOnLaunch"; NSString * const KYAUserDefaultsKeyNotificationsEnabled = @"info.marcel-dierkes.KeepingYouAwake.NotificationsEnabled"; NSString * const KYAUserDefaultsKeyDefaultTimeInterval = @"info.marcel-dierkes.KeepingYouAwake.TimeInterval"; -NSString * const KYAUserDefaultsKeyAllowDisplaySleep = @"info.marcel-dierkes.KeepingYouAwake.AllowDisplaySleep"; NSString * const KYAUserDefaultsKeyMenuBarIconHighlightDisabled = @"info.marcel-dierkes.KeepingYouAwake.MenuBarIconHighlightDisabled"; NSString * const KYAUserDefaultsKeyBatteryCapacityThresholdEnabled = @"info.marcel-dierkes.KeepingYouAwake.BatteryCapacityThresholdEnabled"; @@ -21,7 +20,7 @@ @implementation NSUserDefaults (Keys) @dynamic kya_activateOnLaunch, kya_defaultTimeInterval, kya_notificationsEnabled; -@dynamic kya_allowDisplaySleep, kya_menuBarIconHighlightDisabled; +@dynamic kya_menuBarIconHighlightDisabled; @dynamic kya_batteryCapacityThresholdEnabled, kya_batteryCapacityThreshold; @dynamic kya_preReleaseUpdatesEnabled; @@ -61,18 +60,6 @@ - (void)setKya_defaultTimeInterval:(NSTimeInterval)defaultTimeInterval [self setInteger:(NSInteger)defaultTimeInterval forKey:KYAUserDefaultsKeyDefaultTimeInterval]; // decimal places will be cut-off } -#pragma mark - Allow Display Sleep - -- (BOOL)kya_shouldAllowDisplaySleep -{ - return [self boolForKey:KYAUserDefaultsKeyAllowDisplaySleep]; -} - -- (void)setKya_allowDisplaySleep:(BOOL)allowDisplaySleep -{ - [self setBool:allowDisplaySleep forKey:KYAUserDefaultsKeyAllowDisplaySleep]; -} - #pragma mark - Menu Bar Icon Highlight Disabled - (BOOL)kya_isMenuBarIconHighlightDisabled diff --git a/KeepingYouAwake/KYASleepWakeTimer.m b/KeepingYouAwake/KYASleepWakeTimer.m index 43fdd9c6..a5871f7e 100644 --- a/KeepingYouAwake/KYASleepWakeTimer.m +++ b/KeepingYouAwake/KYASleepWakeTimer.m @@ -82,15 +82,7 @@ - (BOOL)isScheduled - (void)spawnCaffeinateTaskForTimeInterval:(NSTimeInterval)timeInterval { NSMutableArray *arguments = [NSMutableArray new]; - - if([[NSUserDefaults standardUserDefaults] kya_shouldAllowDisplaySleep]) - { - [arguments addObject:@"-s"]; - } - else - { - [arguments addObject:@"-di"]; - } + [arguments addObject:@"-di"]; if(timeInterval != KYASleepWakeTimeIntervalIndefinite) { diff --git a/KeepingYouAwake/Preferences/Advanced/KYAAdvancedPreferencesViewController.m b/KeepingYouAwake/Preferences/Advanced/KYAAdvancedPreferencesViewController.m index 44ad426f..07abf10a 100644 --- a/KeepingYouAwake/Preferences/Advanced/KYAAdvancedPreferencesViewController.m +++ b/KeepingYouAwake/Preferences/Advanced/KYAAdvancedPreferencesViewController.m @@ -47,10 +47,6 @@ - (void)configureAdvancedPreferences defaultsKey:KYAUserDefaultsKeyNotificationsEnabled ]]; - [preferences addObject:[[KYAPreference alloc] initWithTitle:NSLocalizedString(@"Allow the display to sleep (when connected to AC power)", @"Allow the display to sleep (when connected to AC power)") - defaultsKey:KYAUserDefaultsKeyAllowDisplaySleep - ]]; - [preferences addObject:[[KYAPreference alloc] initWithTitle:NSLocalizedString(@"Disable menu bar icon highlight color", @"Disable menu bar icon highlight color") defaultsKey:KYAUserDefaultsKeyMenuBarIconHighlightDisabled ]]; diff --git a/KeepingYouAwake/fr.lproj/Localizable.strings b/KeepingYouAwake/fr.lproj/Localizable.strings index 80d96c25..a3557f12 100644 --- a/KeepingYouAwake/fr.lproj/Localizable.strings +++ b/KeepingYouAwake/fr.lproj/Localizable.strings @@ -1,6 +1,3 @@ -/* Allow the display to sleep (when connected to AC power) */ -"Allow the display to sleep (when connected to AC power)" = "Autoriser la mise en veille de l'écran (avec alimentation sur secteur)"; - /* Allowing your Mac to go to sleep… */ "Allowing your Mac to go to sleep…" = "Autoriser la mise en veille du Mac…"; diff --git a/Localizations/KeepingYouAwake/de.xliff b/Localizations/KeepingYouAwake/de.xliff index 184fe300..6945cf81 100644 --- a/Localizations/KeepingYouAwake/de.xliff +++ b/Localizations/KeepingYouAwake/de.xliff @@ -274,10 +274,6 @@ - - Allow the display to sleep (when connected to AC power) - Allow the display to sleep (when connected to AC power) - Allowing your Mac to go to sleep… Ruhezustand erlauben… diff --git a/Localizations/KeepingYouAwake/ko.xliff b/Localizations/KeepingYouAwake/ko.xliff index 41d38fcf..9626ae61 100644 --- a/Localizations/KeepingYouAwake/ko.xliff +++ b/Localizations/KeepingYouAwake/ko.xliff @@ -274,10 +274,6 @@ - - Allow the display to sleep (when connected to AC power) - Allow the display to sleep (when connected to AC power) - Allowing your Mac to go to sleep… 잠자기를 허용합니다…