mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-01 07:58:08 +00:00
fix(tv): remove deprecated presentUserPicker API
This commit is contained in:
@@ -8,7 +8,6 @@ interface TvUserProfileModuleEvents {
|
||||
interface TvUserProfileModuleType {
|
||||
getCurrentProfileId(): string | null;
|
||||
isProfileSwitchingSupported(): boolean;
|
||||
presentUserPicker(): Promise<boolean>;
|
||||
addListener<K extends keyof TvUserProfileModuleEvents>(
|
||||
eventName: K,
|
||||
listener: TvUserProfileModuleEvents[K],
|
||||
@@ -78,26 +77,8 @@ export function addProfileChangeListener(
|
||||
return () => subscription.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Present the system user picker panel.
|
||||
* Returns true if successful, false otherwise.
|
||||
*/
|
||||
export async function presentUserPicker(): Promise<boolean> {
|
||||
if (!TvUserProfileModule) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return await TvUserProfileModule.presentUserPicker();
|
||||
} catch (error) {
|
||||
console.error("[TvUserProfile] Error presenting user picker:", error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
getCurrentProfileId,
|
||||
isProfileSwitchingSupported,
|
||||
addProfileChangeListener,
|
||||
presentUserPicker,
|
||||
};
|
||||
|
||||
@@ -35,27 +35,6 @@ public class TvUserProfileModule: Module {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Present the system user picker
|
||||
AsyncFunction("presentUserPicker") { () -> Bool in
|
||||
#if os(tvOS)
|
||||
return await withCheckedContinuation { continuation in
|
||||
DispatchQueue.main.async {
|
||||
self.userManager.presentProfilePreferencePanel { error in
|
||||
if let error = error {
|
||||
print("[TvUserProfile] Error presenting user picker: \(error)")
|
||||
continuation.resume(returning: false)
|
||||
} else {
|
||||
print("[TvUserProfile] User picker presented, new ID: \(self.userManager.currentUserIdentifier ?? "nil")")
|
||||
continuation.resume(returning: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
OnCreate {
|
||||
#if os(tvOS)
|
||||
self.setupProfileObserver()
|
||||
|
||||
Reference in New Issue
Block a user