diff --git a/lib/ui/app/menu_drawer.dart b/lib/ui/app/menu_drawer.dart index db68f230c..1b82c5be6 100644 --- a/lib/ui/app/menu_drawer.dart +++ b/lib/ui/app/menu_drawer.dart @@ -524,7 +524,7 @@ class SidebarFooterCollapsed extends StatelessWidget { } }, itemBuilder: (BuildContext context) => [ - if (true || isSelfHosted(context)) + if (true || isSelfHosted(context) && kIsWeb) PopupMenuItem( child: ListTile( leading: Icon( diff --git a/lib/ui/system/update_dialog.dart b/lib/ui/system/update_dialog.dart index fb0119c44..5cc51f590 100644 --- a/lib/ui/system/update_dialog.dart +++ b/lib/ui/system/update_dialog.dart @@ -7,6 +7,8 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart'; import 'package:invoiceninja_flutter/utils/dialogs.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; +import 'package:invoiceninja_flutter/utils/web_stub.dart' + if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart'; class UpdateDialog extends StatefulWidget { @override @@ -57,15 +59,21 @@ class _UpdateDialogState extends State { setState(() => _isLoading = true); final state = StoreProvider.of(context).state; - final credentials = state.credentials; - final webClient = WebClient(); - const url = '/self-update'; - webClient.post(url, credentials.token).then((dynamic response) { - print('DONE: $response'); - setState(() => _isLoading = false); - }).catchError((dynamic error) { - showErrorDialog(context: context, message: '$error'); - setState(() => _isLoading = false); - }); + passwordCallback( + context: context, + callback: (password) { + final credentials = state.credentials; + final webClient = WebClient(); + const url = '/self-update'; + webClient + .post(url, credentials.token, password: password) + .then((dynamic response) { + setState(() => _isLoading = false); + webReload(); + }).catchError((dynamic error) { + showErrorDialog(context: context, message: '$error'); + setState(() => _isLoading = false); + }); + }); } } diff --git a/lib/utils/web.dart b/lib/utils/web.dart index 25098e3e0..a73b7b628 100644 --- a/lib/utils/web.dart +++ b/lib/utils/web.dart @@ -25,3 +25,5 @@ void webDownload(String filename, String data) { ..setAttribute('download', filename) ..click(); } + +void webReload() => window.location.reload(); \ No newline at end of file diff --git a/lib/utils/web_stub.dart b/lib/utils/web_stub.dart index 2cb741001..7aeb137e4 100644 --- a/lib/utils/web_stub.dart +++ b/lib/utils/web_stub.dart @@ -1,3 +1,5 @@ Future webFilePicker() => null; void webDownload(String filename, String data) {} + +void webReload() {} \ No newline at end of file