jld3103
2 years ago
4 changed files with 86 additions and 57 deletions
@ -0,0 +1,72 @@
|
||||
part of '../neon.dart'; |
||||
|
||||
class GlobalPopups extends StatefulWidget { |
||||
const GlobalPopups({ |
||||
super.key, |
||||
}); |
||||
|
||||
@override |
||||
State<GlobalPopups> createState() => _GlobalPopupsState(); |
||||
} |
||||
|
||||
class _GlobalPopupsState extends State<GlobalPopups> { |
||||
late FirstLaunchBloc _firstLaunchBloc; |
||||
late NextPushBloc _nextPushBloc; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
_firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false); |
||||
_nextPushBloc = Provider.of<NextPushBloc>(context, listen: false); |
||||
|
||||
_firstLaunchBloc.onFirstLaunch.listen((final _) { |
||||
ScaffoldMessenger.of(context).showSnackBar( |
||||
SnackBar( |
||||
content: Text(AppLocalizations.of(context).firstLaunchGoToSettingsToEnablePushNotifications), |
||||
action: SnackBarAction( |
||||
label: AppLocalizations.of(context).settings, |
||||
onPressed: () async { |
||||
await Navigator.of(context).push( |
||||
MaterialPageRoute( |
||||
builder: (final context) => const SettingsPage(), |
||||
), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
); |
||||
}); |
||||
|
||||
_nextPushBloc.onNextPushSupported.listen((final _) async { |
||||
await showDialog( |
||||
context: context, |
||||
builder: (final context) => AlertDialog( |
||||
title: Text(AppLocalizations.of(context).nextPushSupported), |
||||
content: Text(AppLocalizations.of(context).nextPushSupportedText), |
||||
actions: [ |
||||
OutlinedButton( |
||||
onPressed: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Text(AppLocalizations.of(context).no), |
||||
), |
||||
ElevatedButton( |
||||
onPressed: () { |
||||
Navigator.of(context).pop(); |
||||
launchUrlString( |
||||
'https://f-droid.org/packages/$unifiedPushNextPushID', |
||||
mode: LaunchMode.externalApplication, |
||||
); |
||||
}, |
||||
child: Text(AppLocalizations.of(context).nextPushSupportedInstall), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(final BuildContext context) => Container(); |
||||
} |
Loading…
Reference in new issue