Atoll/DynamicIsland/models/PlaybackState.swift
2026-04-21 23:54:51 +02:00

65 lines
2.1 KiB
Swift

/*
* Atoll (DynamicIsland)
* Copyright (C) 2024-2026 Atoll Contributors
*
* Originally from boring.notch project
* Modified and adapted for Atoll (DynamicIsland)
* See NOTICE for details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Foundation
enum RepeatMode: Int, Codable {
case off = 1
case one = 2
case all = 3
}
struct PlaybackState {
var bundleIdentifier: String
var isPlaying: Bool = false
var title: String = "I'm Handsome"
var artist: String = "Me"
var album: String = "Self Love"
var contentIdentifier: String?
var contentURL: String?
var isExplicit: Bool?
var currentTime: Double = 0
var duration: Double = 0
var playbackRate: Double = 1
var isShuffled: Bool = false
var repeatMode: RepeatMode = .off
var lastUpdated: Date = Date.distantPast
var artwork: Data?
}
extension PlaybackState: Equatable {
static func == (lhs: PlaybackState, rhs: PlaybackState) -> Bool {
return lhs.bundleIdentifier == rhs.bundleIdentifier
&& lhs.isPlaying == rhs.isPlaying
&& lhs.title == rhs.title
&& lhs.artist == rhs.artist
&& lhs.album == rhs.album
&& lhs.contentIdentifier == rhs.contentIdentifier
&& lhs.contentURL == rhs.contentURL
&& lhs.isExplicit == rhs.isExplicit
&& lhs.currentTime == rhs.currentTime
&& lhs.duration == rhs.duration
&& lhs.isShuffled == rhs.isShuffled
&& lhs.repeatMode == rhs.repeatMode
&& lhs.artwork == rhs.artwork
}
}