-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix Error Cannot prevent display sleep!, #3842 #3924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The commit in the pull request will: - Change SleepPreventer.preventSleep to only display an alert once per IINA invocation - Change Utility.showAlert to support a suppression button - Add a button to the alert to allow the user to permanently suppress the alert - Change the alert to include the error code returned by macOS Additional text was added to the alert's message requiring localization. This fixes how IINA reports a macOS power management failure. The root cause of the failure is in macOS and must be fixed by Apple.
static private var preventedSleep = false | ||
|
||
/// Ask macOS to not dim or sleep the display. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A brief description is fine but I'd strongly recommend just linking to the issues themselves rather than copying their contents here, because they'll remain up-to-date and are a better place to put extended discussion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That came from my bias for keeping information with the code after encountering broken links on work projects. I've changed that portion of the comment to just refer to the two issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not likely to migrate to JIRA anytime soon :P
iina/SleepPreventer.swift
Outdated
@@ -28,11 +64,21 @@ class SleepPreventer: NSObject { | |||
&assertionID) | |||
if success == kIOReturnSuccess { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth converting this to a guard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
iina/Base.lproj/Localizable.strings
Outdated
@@ -143,7 +143,7 @@ | |||
|
|||
"alert.fatal_error" = "Fatal error: %@ \nThe application will exit now."; | |||
"alert.mpv_error" = "Internal error %@ (%@) when setting option %@."; | |||
"alert.sleep" = "Cannot prevent display sleep!"; | |||
"alert.sleep" = "Cannot prevent display sleep!\nmacOS error 0x%0X8"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer a "Cannot prevent display sleep! (error code)" format, as this better matches how macOS displays errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. I prefer to not pass judgement on where the error is coming from, in general we should just present it as it is.
The commit in the pull request will: - Change SleepPreventer.preventSleep to only display an alert once per IINA invocation - Change Utility.showAlert to support a suppression button - Add a button to the alert to allow the user to permanently suppress the alert - Change the alert to include the error code returned by macOS Additional text was added to the alert's message requiring localization. This fixes how IINA reports a macOS power management failure. The root cause of the failure is in macOS and must be fixed by Apple.
The commit in the pull request will: - Change SleepPreventer.preventSleep to only display an alert once per IINA invocation - Change Utility.showAlert to support a suppression button - Add a button to the alert to allow the user to permanently suppress the alert - Change the alert to include the error code returned by macOS Additional text was added to the alert's message requiring localization. This fixes how IINA reports a macOS power management failure. The root cause of the failure is in macOS and must be fixed by Apple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Change SleepPreventer.preventSleep to only display an alert once per IINA invocation - Change Utility.showAlert to support a suppression button - Add a button to the alert to allow the user to permanently suppress the alert - Change the alert to include the error code returned by macOS - Add a button in Preferences/Utilities to restore suppressed alerts Additional text was added requiring localization. This fixes how IINA reports a macOS power management failure. The root cause of the failure is in macOS and must be fixed by Apple.
LGTM |
The commit in the pull request will:
IINA invocation
the alert
Additional text was added to the alert's message requiring localization.
This fixes how IINA reports a macOS power management failure.
The root cause of the failure is in macOS and must be fixed by Apple.
Description:
This commit includes new text that needs localization.
See the issue for screenshots of the new alert.