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