Browse Source

neon: Hide hint to enable push notifications on first launch when push notifications are unavailable

pull/209/head
jld3103 2 years ago
parent
commit
d774870a2d
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 9
      packages/neon/lib/src/utils/global_popups.dart

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

@ -10,6 +10,7 @@ class GlobalPopups extends StatefulWidget {
} }
class _GlobalPopupsState extends State<GlobalPopups> { class _GlobalPopupsState extends State<GlobalPopups> {
late GlobalOptions _globalOptions;
late FirstLaunchBloc _firstLaunchBloc; late FirstLaunchBloc _firstLaunchBloc;
late NextPushBloc _nextPushBloc; late NextPushBloc _nextPushBloc;
@ -17,10 +18,15 @@ class _GlobalPopupsState extends State<GlobalPopups> {
void initState() { void initState() {
super.initState(); super.initState();
_globalOptions = Provider.of<GlobalOptions>(context, listen: false);
_firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false); _firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false);
_nextPushBloc = Provider.of<NextPushBloc>(context, listen: false); _nextPushBloc = Provider.of<NextPushBloc>(context, listen: false);
_firstLaunchBloc.onFirstLaunch.listen((final _) { _firstLaunchBloc.onFirstLaunch.listen((final _) async {
if (await _globalOptions.pushNotificationsEnabled.enabled.first) {
if (!mounted) {
return;
}
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(AppLocalizations.of(context).firstLaunchGoToSettingsToEnablePushNotifications), content: Text(AppLocalizations.of(context).firstLaunchGoToSettingsToEnablePushNotifications),
@ -36,6 +42,7 @@ class _GlobalPopupsState extends State<GlobalPopups> {
), ),
), ),
); );
}
}); });
_nextPushBloc.onNextPushSupported.listen((final _) async { _nextPushBloc.onNextPushSupported.listen((final _) async {

Loading…
Cancel
Save