Allow to disable error modal with showErrorDialog

This commit is contained in:
Sambo Chea 2022-10-28 11:04:02 +07:00
parent 6b813a0285
commit 044645c01a

View File

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