Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Fix Error Cannot prevent display sleep!, iina#3842
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
low-batt authored and CarterLi committed Aug 30, 2022
1 parent 729e340 commit 8f099eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iina/SleepPreventer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SleepPreventer: NSObject {
IOPMAssertionLevel(kIOPMAssertionLevelOn),
reason,
&assertionID)
if success == kIOReturnSuccess {
guard success != kIOReturnSuccess else {
preventedSleep = true
return
}
Expand Down

0 comments on commit 8f099eb

Please sign in to comment.