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(),
|
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(
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user