Skip to content

Commit

Permalink
fix: only display discord events on connect and only if enabled (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Oct 21, 2024
1 parent 8fe60cd commit 5913d03
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/app/view/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '../../extensions/build_context_x.dart';
import '../../l10n/l10n.dart';
import '../../patch_notes/patch_notes_dialog.dart';
import '../../player/view/player_view.dart';
import '../../settings/settings_model.dart';
import '../app_model.dart';
import '../connectivity_model.dart';
import 'master_detail_page.dart';
Expand Down Expand Up @@ -45,17 +46,20 @@ class _MusicPodScaffoldState extends State<MusicPodScaffold> {
Widget build(BuildContext context) {
final playerToTheRight = context.mediaQuerySize.width > kSideBarThreshHold;
final isFullScreen = watchPropertyValue((AppModel m) => m.fullWindowMode);
final enableDiscordRPC =
watchPropertyValue((SettingsModel m) => m.enableDiscordRPC);

if (allowDiscordRPC) {
if (allowDiscordRPC && enableDiscordRPC) {
registerStreamHandler(
select: (AppModel m) => m.isDiscordConnectedStream,
handler: (context, snapshot, cancel) {
if (!snapshot.hasData || snapshot.hasError) return;
showSnackBar(
context: context,
duration: const Duration(seconds: 3),
content: _DiscordConnectContent(connected: snapshot.data == true),
);
if (snapshot.data == true) {
showSnackBar(
context: context,
duration: const Duration(seconds: 3),
content: _DiscordConnectContent(connected: snapshot.data == true),
);
}
},
);
}
Expand Down

0 comments on commit 5913d03

Please sign in to comment.