fix: Select room version

This commit is contained in:
Christian Pauly 2021-03-28 20:04:54 +02:00
parent a3af5a9f14
commit 2f5a73f41e

View File

@ -1,5 +1,6 @@
import 'dart:developer'; import 'dart:developer';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:adaptive_page_layout/adaptive_page_layout.dart'; import 'package:adaptive_page_layout/adaptive_page_layout.dart';
import 'package:fluffychat/components/dialogs/permission_slider_dialog.dart'; import 'package:fluffychat/components/dialogs/permission_slider_dialog.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
@ -149,14 +150,25 @@ class ChatPermissionsSettings extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).accentColor), color: Theme.of(context).accentColor),
), ),
onTap: roomVersion == shouldHaveVersion onTap: () async {
? null final newVersion =
: () => showFutureLoadingDialog( await showConfirmationDialog<String>(
context: context, context: context,
future: () => room.client title: 'Choose Room Version',
.upgradeRoom(roomId, shouldHaveVersion), actions: snapshot
).then((_) => .data.mRoomVersions.available.entries
AdaptivePageLayout.of(context).pop()), .where((r) => r.key != roomVersion)
.map((version) => AlertDialogAction(
key: version.key,
label:
'${version.key} (${version.value.toString().split('.').last})')),
);
await showFutureLoadingDialog(
context: context,
future: () =>
room.client.upgradeRoom(roomId, newVersion),
).then((_) => AdaptivePageLayout.of(context).pop());
},
); );
}, },
), ),