more restrictive timeout on notification init
This commit is contained in:
parent
ccca02a0bc
commit
a5da44fdea
1 changed files with 14 additions and 14 deletions
|
|
@ -71,6 +71,22 @@ void main(List<String> args) async {
|
|||
WidgetsFlutterBinding.ensureInitialized();
|
||||
MediaKit.ensureInitialized();
|
||||
|
||||
isInBackground =
|
||||
Platform.environment["FLUTTER_HEADLESS"] != null ||
|
||||
args.contains("--unifiedpush-bg");
|
||||
|
||||
LicenseRegistry.addLicense(() => .fromIterable(fontLicenses));
|
||||
|
||||
FlutterError.onError = (FlutterErrorDetails details) =>
|
||||
showError(details.exception.toString(), details.stack);
|
||||
|
||||
if (isInBackground) {
|
||||
await ProviderContainer()
|
||||
.read(UnifiedPushController.provider.future)
|
||||
.timeout(Duration(seconds: 20), onTimeout: () => false);
|
||||
|
||||
exit(0);
|
||||
} else {
|
||||
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
|
||||
await windowManager.ensureInitialized();
|
||||
await windowManager.waitUntilReadyToShow(
|
||||
|
|
@ -82,22 +98,6 @@ void main(List<String> args) async {
|
|||
await windowManager.setMinimumSize(Size.square(500));
|
||||
}
|
||||
|
||||
isInBackground =
|
||||
Platform.environment["FLUTTER_HEADLESS"] != null ||
|
||||
args.contains("--unifiedpush-bg");
|
||||
|
||||
LicenseRegistry.addLicense(() => .fromIterable(fontLicenses));
|
||||
|
||||
FlutterError.onError = (FlutterErrorDetails details) =>
|
||||
showError(details.exception.toString(), details.stack);
|
||||
|
||||
if (isInBackground) {
|
||||
await ProviderContainer().read(UnifiedPushController.provider.future);
|
||||
|
||||
// In case it didn't exit for some reason
|
||||
await Future.delayed(Duration(seconds: 20));
|
||||
exit(0);
|
||||
} else {
|
||||
runApp(
|
||||
ProviderScope(
|
||||
retry: (_, _) => null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue