Skip to content

Commit

Permalink
refactor: #available OSX -> macOS; use #unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
uiryuu committed Dec 2, 2022
1 parent 767e32f commit da1e06c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iina/JavascriptAPICore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ fileprivate class WindowAPI: JavascriptAPI, CoreSubAPIExportable {
guard let val = value as? Bool, val != window.fsState.isFullscreen else { return }
window.toggleWindowFullScreen()
case "pip":
if #available(OSX 10.12, *) {
if #available(macOS 10.12, *) {
guard let val = value as? Bool else { return }
if val {
window.enterPIP()
Expand Down
7 changes: 3 additions & 4 deletions iina/MainWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import Mustache
import WebKit

fileprivate let isMacOS11: Bool = {
var res = false
if #available(macOS 11.0, *) {
if #available(macOS 12.0, *) {} else {
res = true
if #unavailable(macOS 12.0) {
return true
}
}
return res
return false
}()

fileprivate let TitleBarHeightNormal: CGFloat = {
Expand Down
4 changes: 2 additions & 2 deletions iina/PlayerCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ class PlayerCore: NSObject {
}
}

if #available(OSX 10.13, *), RemoteCommandController.useSystemMediaControl {
if #available(macOS 10.13, *), RemoteCommandController.useSystemMediaControl {
DispatchQueue.main.async {
NowPlayingInfoManager.updateInfo(state: .playing, withTitle: true)
}
Expand Down Expand Up @@ -1450,7 +1450,7 @@ class PlayerCore: NSObject {
reloadSavedIINAfilters()
mainWindow.videoView.videoLayer.draw(forced: true)

if #available(OSX 10.13, *), RemoteCommandController.useSystemMediaControl {
if #available(macOS 10.13, *), RemoteCommandController.useSystemMediaControl {
NowPlayingInfoManager.updateInfo()
}

Expand Down
2 changes: 1 addition & 1 deletion iina/QuickSettingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTab
let currentTag = currentTab.buttonTag
[videoTabBtn, audioTabBtn, subTabBtn].forEach { btn in
let isActive = currentTag == btn!.tag
if #available(OSX 10.14, *) {
if #available(macOS 10.14, *) {
btn!.contentTintColor = isActive ? .sidebarTabTintActive : .sidebarTabTint
} else {
Utility.setBoldTitle(for: btn!, isActive)
Expand Down

0 comments on commit da1e06c

Please # to comment.