From 044645c01ad6d6c4606cc2da1d24f6052065b864 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Fri, 28 Oct 2022 11:04:02 +0700 Subject: [PATCH] Allow to disable error modal with showErrorDialog --- lib/src/native_updater.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/native_updater.dart b/lib/src/native_updater.dart index b7be4bd..e3db7e5 100644 --- a/lib/src/native_updater.dart +++ b/lib/src/native_updater.dart @@ -12,6 +12,7 @@ import 'update_cupertino_alert.dart'; class NativeUpdater { late BuildContext _context; late bool _forceUpdate; + late bool _showErrorDialog; late String _appName; String? _appStoreUrl; String? _iOSDescription; @@ -34,6 +35,7 @@ class NativeUpdater { static displayUpdateAlert( BuildContext context, { required bool forceUpdate, + bool? showErrorDialog, String? appStoreUrl, String? iOSDescription, String? iOSUpdateButtonLabel, @@ -52,6 +54,7 @@ class NativeUpdater { /// Set singleton properties _nativeUpdaterInstance._context = context; _nativeUpdaterInstance._forceUpdate = forceUpdate; + _nativeUpdaterInstance._showErrorDialog = showErrorDialog; _nativeUpdaterInstance._appName = info.appName; _nativeUpdaterInstance._appStoreUrl = appStoreUrl; _nativeUpdaterInstance._iOSDescription = iOSDescription; @@ -119,6 +122,10 @@ class NativeUpdater { } } } on PlatformException catch (e) { + if (_showErrorDialog == true) { + return; + } + developer.log(e.code.toString()); showDialog(