mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
fix: Room upgrade
This commit is contained in:
parent
ef7ccef62b
commit
dac26dd754
@ -81,6 +81,16 @@
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"roomVersion": "Room version",
|
||||
"@roomVersion": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"goToTheNewRoom": "Go to the new room",
|
||||
"@goToTheNewRoom": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"alreadyHaveAnAccount": "Already have an account?",
|
||||
"@alreadyHaveAnAccount": {
|
||||
"type": "text",
|
||||
|
@ -701,15 +701,38 @@ class _ChatState extends State<Chat> {
|
||||
ConnectionStatusHeader(),
|
||||
if (room.getState(EventTypes.RoomTombstone) != null)
|
||||
Container(
|
||||
height: 56,
|
||||
height: 72,
|
||||
child: Material(
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.upgrade_outlined),
|
||||
title: Text(room
|
||||
leading: CircleAvatar(
|
||||
foregroundColor: Theme.of(context).accentColor,
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
child: Icon(Icons.upgrade_outlined),
|
||||
),
|
||||
title: Text(
|
||||
room
|
||||
.getState(EventTypes.RoomTombstone)
|
||||
.parsedTombstoneContent
|
||||
.body),
|
||||
.body,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(L10n.of(context).goToTheNewRoom),
|
||||
onTap: () async {
|
||||
if (OkCancelResult.ok !=
|
||||
await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).goToTheNewRoom,
|
||||
message: room
|
||||
.getState(EventTypes.RoomTombstone)
|
||||
.parsedTombstoneContent
|
||||
.body,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
final result = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.client.joinRoom(room
|
||||
@ -729,6 +752,7 @@ class _ChatState extends State<Chat> {
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FutureBuilder<bool>(
|
||||
future: getTimeline(context),
|
||||
|
@ -141,32 +141,35 @@ class ChatPermissionsSettings extends StatelessWidget {
|
||||
.getState(EventTypes.RoomCreate)
|
||||
.content['room_version'] ??
|
||||
'1';
|
||||
final shouldHaveVersion =
|
||||
snapshot.data.mRoomVersions.defaultVersion;
|
||||
|
||||
return ListTile(
|
||||
title: Text('Current room version: $roomVersion'),
|
||||
subtitle: roomVersion == shouldHaveVersion
|
||||
? null
|
||||
: Text(
|
||||
'Upgrade to $shouldHaveVersion available!',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).accentColor),
|
||||
),
|
||||
title: Text(
|
||||
'${L10n.of(context).roomVersion}: $roomVersion'),
|
||||
onTap: () async {
|
||||
final newVersion =
|
||||
await showConfirmationDialog<String>(
|
||||
context: context,
|
||||
title: 'Choose Room Version',
|
||||
title: L10n.of(context)
|
||||
.replaceRoomWithNewerVersion,
|
||||
actions: snapshot
|
||||
.data.mRoomVersions.available.entries
|
||||
.where((r) => r.key != roomVersion)
|
||||
.map((version) => AlertDialogAction(
|
||||
key: version.key,
|
||||
label:
|
||||
'${version.key} (${version.value.toString().split('.').last})')),
|
||||
'${version.key} (${version.value.toString().split('.').last})'))
|
||||
.toList(),
|
||||
);
|
||||
if (newVersion == null ||
|
||||
OkCancelResult.cancel ==
|
||||
await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
title: L10n.of(context).areYouSure,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () =>
|
||||
|
Loading…
Reference in New Issue
Block a user