Browse Source

fix(neon): Hide useless push notifications popups

pull/509/head
jld3103 1 year ago
parent
commit
efc8f59c10
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 11
      packages/neon/neon/lib/src/utils/global_popups.dart

11
packages/neon/neon/lib/src/utils/global_popups.dart

@ -4,6 +4,7 @@ import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/blocs/first_launch.dart';
import 'package:neon/src/blocs/next_push.dart';
import 'package:neon/src/pages/settings.dart';
import 'package:neon/src/platform/platform.dart';
import 'package:neon/src/router.dart';
import 'package:neon/src/utils/global_options.dart';
import 'package:provider/provider.dart';
@ -31,12 +32,13 @@ class GlobalPopups {
final globalOptions = Provider.of<GlobalOptions>(context, listen: false);
final firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false);
final nextPushBloc = Provider.of<NextPushBloc>(context, listen: false);
final platform = Provider.of<NeonPlatform>(context, listen: false);
firstLaunchBloc.onFirstLaunch.listen((final _) {
if (globalOptions.pushNotificationsEnabled.enabled) {
if (!context.mounted) {
if (!platform.canUsePushNotifications || !globalOptions.pushNotificationsEnabled.enabled) {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context).firstLaunchGoToSettingsToEnablePushNotifications),
@ -48,10 +50,13 @@ class GlobalPopups {
),
),
);
}
});
nextPushBloc.onNextPushSupported.listen((final _) async {
if (!platform.canUsePushNotifications || !globalOptions.pushNotificationsEnabled.enabled) {
return;
}
await showDialog(
context: context,
builder: (final context) => AlertDialog(

Loading…
Cancel
Save