fix: companion remote acts as remote instead of host on Android TV

This commit is contained in:
edde746
2026-04-01 16:23:31 +02:00
parent 87da5b400e
commit b16a6a6bd5
4 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -894,7 +894,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
const Spacer(), const Spacer(),
Consumer2<WatchTogetherProvider, CompanionRemoteProvider>( Consumer2<WatchTogetherProvider, CompanionRemoteProvider>(
builder: (context, watchTogether, companionRemote, _) { builder: (context, watchTogether, companionRemote, _) {
final isDesktop = PlatformDetector.isDesktop(context); final isDesktop = PlatformDetector.shouldActAsRemoteHost(context);
final userProvider = context.watch<UserProfileProvider>(); final userProvider = context.watch<UserProfileProvider>();
return FocusableActionBar( return FocusableActionBar(
+2 -2
View File
@@ -419,8 +419,8 @@ class _MainScreenState extends State<MainScreen> with RouteAware, WindowListener
_multiServerProvider!.addListener(_handleLiveTvChanged); _multiServerProvider!.addListener(_handleLiveTvChanged);
} }
// Wire up Companion Remote command routing (desktop only, once) // Wire up Companion Remote command routing (host devices only, once)
if (!_companionRemoteSetup && PlatformDetector.isDesktop(context)) { if (!_companionRemoteSetup && PlatformDetector.shouldActAsRemoteHost(context)) {
_companionRemoteSetup = true; _companionRemoteSetup = true;
_setupCompanionRemote(); _setupCompanionRemote();
} }
+1 -1
View File
@@ -1160,7 +1160,7 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold), style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
), ),
), ),
if (PlatformDetector.isDesktop(context)) if (PlatformDetector.shouldActAsRemoteHost(context))
ListTile( ListTile(
leading: const AppIcon(Symbols.phone_android_rounded, fill: 1), leading: const AppIcon(Symbols.phone_android_rounded, fill: 1),
title: Text(t.companionRemote.hostRemoteSession), title: Text(t.companionRemote.hostRemoteSession),
+6
View File
@@ -51,6 +51,12 @@ class PlatformDetector {
return isDesktop(context) || isTV(); 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) /// Detects if running on a mobile platform (iOS or Android)
/// Uses Theme for consistent platform detection across the app /// Uses Theme for consistent platform detection across the app
static bool isMobile(BuildContext context) { static bool isMobile(BuildContext context) {