Fix remote player SDK types and signing prefix; test remote commands
This commit is contained in:
@@ -73,6 +73,6 @@
|
||||
</dict>
|
||||
</dict>
|
||||
<key>MusicBridgeSharedKeychainGroup</key>
|
||||
<string>$(AppIdentifierPrefix)ru.yukinoki.musicbridge.remote-control</string>
|
||||
<string>ru.yukinoki.musicbridge.remote-control</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -44,21 +44,29 @@ final class SystemPlayerManager: ObservableObject {
|
||||
func restore(connection: Connection?) async {
|
||||
guard #available(iOS 27.0, *), id == nil, !busy,
|
||||
let savedID = UserDefaults.standard.string(forKey: savedIDKey) else { return }
|
||||
busy = true
|
||||
id = savedID
|
||||
let operation = generation
|
||||
defer { if generation == operation { busy = false } }
|
||||
do {
|
||||
let saved = try SystemPlayerCredentials.load(savedID)
|
||||
guard let connection, saved.fingerprint == connection.fingerprint, saved.token == connection.token else {
|
||||
try SystemPlayerCredentials.delete(savedID)
|
||||
UserDefaults.standard.removeObject(forKey: savedIDKey)
|
||||
for session in try await RemoteMediaSession<SystemPlayerAttributes>.sessions() where session.id == savedID { try await session.end() }
|
||||
if generation == operation { id = nil }
|
||||
return
|
||||
}
|
||||
if let session = try await RemoteMediaSession<SystemPlayerAttributes>.sessions().first(where: { $0.id == savedID }) {
|
||||
guard generation == operation else { return }
|
||||
storage = session; id = savedID; running = true
|
||||
} else {
|
||||
guard generation == operation else { return }
|
||||
try SystemPlayerCredentials.delete(savedID)
|
||||
UserDefaults.standard.removeObject(forKey: savedIDKey)
|
||||
id = nil
|
||||
}
|
||||
} catch { self.error = BridgeError.describe(error) }
|
||||
} catch { if generation == operation { self.error = BridgeError.describe(error); id = nil } }
|
||||
}
|
||||
|
||||
func receive(_ state: MediaState, connection: Connection) {
|
||||
|
||||
Reference in New Issue
Block a user