2022-12-19 16:38:27 +05:30
|
|
|
import Defaults
|
2022-08-25 22:39:55 +05:30
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
2024-02-02 04:21:41 +05:30
|
|
|
enum Constants {
|
2022-08-25 22:39:55 +05:30
|
|
|
static let overlayAnimation = Animation.linear(duration: 0.2)
|
2024-05-13 11:24:24 +05:30
|
|
|
|
|
|
|
static var isAppleTV: Bool {
|
|
|
|
#if os(iOS)
|
|
|
|
UIDevice.current.userInterfaceIdiom == .tv
|
|
|
|
#else
|
|
|
|
false
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static var isMac: Bool {
|
|
|
|
#if os(iOS)
|
|
|
|
UIDevice.current.userInterfaceIdiom == .mac
|
|
|
|
#else
|
|
|
|
false
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-02-25 21:12:45 +05:30
|
|
|
static var isIPhone: Bool {
|
|
|
|
#if os(iOS)
|
|
|
|
UIDevice.current.userInterfaceIdiom == .phone
|
|
|
|
#else
|
|
|
|
false
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-04-22 22:52:13 +05:30
|
|
|
static var isIPad: Bool {
|
|
|
|
#if os(iOS)
|
|
|
|
UIDevice.current.userInterfaceIdiom == .pad
|
|
|
|
#else
|
|
|
|
false
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-12-10 07:31:59 +05:30
|
|
|
static var progressViewScale: Double {
|
|
|
|
#if os(macOS)
|
|
|
|
0.4
|
|
|
|
#else
|
|
|
|
0.6
|
|
|
|
#endif
|
|
|
|
}
|
2022-12-14 17:26:47 +05:30
|
|
|
|
|
|
|
static var channelThumbnailSize: Double {
|
|
|
|
#if os(tvOS)
|
|
|
|
50
|
|
|
|
#else
|
|
|
|
30
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-12-16 03:11:42 +05:30
|
|
|
static var sidebarChannelThumbnailSize: Double {
|
2022-12-15 16:39:16 +05:30
|
|
|
#if os(macOS)
|
|
|
|
20
|
|
|
|
#else
|
|
|
|
30
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-12-14 17:26:47 +05:30
|
|
|
static var channelDetailsStackSpacing: Double {
|
|
|
|
#if os(tvOS)
|
|
|
|
12
|
|
|
|
#else
|
|
|
|
6
|
|
|
|
#endif
|
|
|
|
}
|
2022-12-18 17:41:06 +05:30
|
|
|
|
2022-12-23 00:05:36 +05:30
|
|
|
static var detailsVisibility: Bool {
|
2022-12-18 17:41:06 +05:30
|
|
|
#if os(iOS)
|
|
|
|
false
|
|
|
|
#else
|
|
|
|
true
|
|
|
|
#endif
|
|
|
|
}
|
2022-12-19 00:09:03 +05:30
|
|
|
|
2024-02-02 04:24:16 +05:30
|
|
|
static var deviceName: String {
|
|
|
|
#if os(macOS)
|
|
|
|
Host().localizedName ?? "Mac"
|
|
|
|
#else
|
|
|
|
UIDevice.current.name
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static var platform: String {
|
|
|
|
#if os(macOS)
|
|
|
|
"macOS"
|
|
|
|
#elseif os(iOS)
|
|
|
|
"iOS"
|
|
|
|
#elseif os(tvOS)
|
|
|
|
"tvOS"
|
|
|
|
#else
|
|
|
|
"unknown"
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2024-05-16 22:23:47 +05:30
|
|
|
static var defaultNavigationStyle: NavigationStyle {
|
|
|
|
#if os(macOS)
|
|
|
|
return .sidebar
|
|
|
|
#elseif os(iOS)
|
|
|
|
if isIPad {
|
|
|
|
return .sidebar
|
|
|
|
} else {
|
|
|
|
return .tab
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
return .tab
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-12-19 16:38:27 +05:30
|
|
|
static func seekIcon(_ type: String, _ interval: TimeInterval) -> String {
|
|
|
|
let interval = Int(interval)
|
2023-10-15 17:05:23 +05:30
|
|
|
let allVersions = [10, 15, 30, 45, 60, 75, 90]
|
|
|
|
let iOS15 = [5]
|
2022-12-19 16:38:27 +05:30
|
|
|
let iconName = "go\(type).\(interval)"
|
|
|
|
|
2023-10-15 17:05:23 +05:30
|
|
|
if #available(iOS 15, macOS 12, *) {
|
|
|
|
if iOS15.contains(interval) {
|
|
|
|
return iconName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-19 16:38:27 +05:30
|
|
|
if allVersions.contains(interval) {
|
|
|
|
return iconName
|
|
|
|
}
|
|
|
|
|
|
|
|
let sign = type == "forward" ? "plus" : "minus"
|
|
|
|
|
|
|
|
return "go\(type).\(sign)"
|
|
|
|
}
|
2022-08-25 22:39:55 +05:30
|
|
|
}
|