App update

This commit is contained in:
Hillel Coren 2020-03-01 21:01:54 +02:00
parent 0fdd44d0bd
commit 86f9d28589
4 changed files with 23 additions and 11 deletions

View File

@ -524,7 +524,7 @@ class SidebarFooterCollapsed extends StatelessWidget {
}
},
itemBuilder: (BuildContext context) => [
if (true || isSelfHosted(context))
if (true || isSelfHosted(context) && kIsWeb)
PopupMenuItem<String>(
child: ListTile(
leading: Icon(

View File

@ -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<UpdateDialog> {
setState(() => _isLoading = true);
final state = StoreProvider.of<AppState>(context).state;
passwordCallback(
context: context,
callback: (password) {
final credentials = state.credentials;
final webClient = WebClient();
const url = '/self-update';
webClient.post(url, credentials.token).then((dynamic response) {
print('DONE: $response');
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);
});
});
}
}

View File

@ -25,3 +25,5 @@ void webDownload(String filename, String data) {
..setAttribute('download', filename)
..click();
}
void webReload() => window.location.reload();

View File

@ -1,3 +1,5 @@
Future<String> webFilePicker() => null;
void webDownload(String filename, String data) {}
void webReload() {}