Live Activities, nudging, unit tests
This commit is contained in:
@@ -149,6 +149,11 @@ final class MAPlayerManager {
|
||||
/// Finds the best currently-playing player and pushes its state to the Live Activity.
|
||||
/// Spawns a Task to fetch artwork with auth before updating.
|
||||
private func updateLiveActivity() {
|
||||
guard UserDefaults.standard.object(forKey: "liveActivityEnabled") as? Bool ?? true else {
|
||||
liveActivityManager.end()
|
||||
return
|
||||
}
|
||||
|
||||
let playing = players.values
|
||||
.filter { $0.state == .playing }
|
||||
.first { $0.currentItem != nil || playerQueues[$0.playerId]?.currentItem != nil }
|
||||
@@ -248,6 +253,9 @@ final class MAPlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Exposed for unit testing only.
|
||||
static func testResizeAndEncode(_ image: UIImage) -> Data? { resizeAndEncode(image) }
|
||||
|
||||
private static func resizeAndEncode(_ image: UIImage) -> Data? {
|
||||
// ActivityKit ContentState limit is 4 KB total (Data fields are base64 in the payload).
|
||||
// 40×40 JPEG at 0.3 quality ≈ 400–700 bytes, well within limits.
|
||||
|
||||
Reference in New Issue
Block a user