fix: companion remote acts as remote instead of host on Android TV
This commit is contained in:
@@ -894,7 +894,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
const Spacer(),
|
||||
Consumer2<WatchTogetherProvider, CompanionRemoteProvider>(
|
||||
builder: (context, watchTogether, companionRemote, _) {
|
||||
final isDesktop = PlatformDetector.isDesktop(context);
|
||||
final isDesktop = PlatformDetector.shouldActAsRemoteHost(context);
|
||||
final userProvider = context.watch<UserProfileProvider>();
|
||||
|
||||
return FocusableActionBar(
|
||||
|
||||
@@ -419,8 +419,8 @@ class _MainScreenState extends State<MainScreen> with RouteAware, WindowListener
|
||||
_multiServerProvider!.addListener(_handleLiveTvChanged);
|
||||
}
|
||||
|
||||
// Wire up Companion Remote command routing (desktop only, once)
|
||||
if (!_companionRemoteSetup && PlatformDetector.isDesktop(context)) {
|
||||
// Wire up Companion Remote command routing (host devices only, once)
|
||||
if (!_companionRemoteSetup && PlatformDetector.shouldActAsRemoteHost(context)) {
|
||||
_companionRemoteSetup = true;
|
||||
_setupCompanionRemote();
|
||||
}
|
||||
|
||||
@@ -1160,7 +1160,7 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
if (PlatformDetector.isDesktop(context))
|
||||
if (PlatformDetector.shouldActAsRemoteHost(context))
|
||||
ListTile(
|
||||
leading: const AppIcon(Symbols.phone_android_rounded, fill: 1),
|
||||
title: Text(t.companionRemote.hostRemoteSession),
|
||||
|
||||
@@ -51,6 +51,12 @@ class PlatformDetector {
|
||||
return isDesktop(context) || isTV();
|
||||
}
|
||||
|
||||
/// Whether this device should act as a companion remote host (receiver).
|
||||
/// Desktop platforms and Android TV are hosts; phones/tablets are controllers.
|
||||
static bool shouldActAsRemoteHost(BuildContext context) {
|
||||
return isDesktop(context) || isTV();
|
||||
}
|
||||
|
||||
/// Detects if running on a mobile platform (iOS or Android)
|
||||
/// Uses Theme for consistent platform detection across the app
|
||||
static bool isMobile(BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user