|
|
|
@ -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( |
|
|
|
|