1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Constants.swift

85 lines
1.7 KiB
Swift
Raw Normal View History

2022-12-19 16:38:27 +05:30
import Defaults
2022-08-25 22:39:55 +05:30
import Foundation
import SwiftUI
struct Constants {
2022-12-04 17:51:50 +05:30
static let yatteeProtocol = "yattee://"
2022-08-25 22:39:55 +05:30
static let overlayAnimation = Animation.linear(duration: 0.2)
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
}
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
}
static var channelDetailsStackSpacing: Double {
#if os(tvOS)
12
#else
6
#endif
}
2022-12-18 17:41:06 +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
2022-12-19 16:38:27 +05:30
static func seekIcon(_ type: String, _ interval: TimeInterval) -> String {
let interval = Int(interval)
let allVersions = [10, 15, 30, 45, 60, 75, 90]
let iOS15 = [5]
let iconName = "go\(type).\(interval)"
if #available(iOS 15, macOS 12, *) {
if iOS15.contains(interval) {
return iconName
}
}
if allVersions.contains(interval) {
return iconName
}
let sign = type == "forward" ? "plus" : "minus"
return "go\(type).\(sign)"
}
2022-08-25 22:39:55 +05:30
}