Merge branch 'krille/minor-fixes' into 'master'
Minor fixes See merge request ChristianPauly/fluffychat-flutter!96
This commit is contained in:
commit
3c6786e539
|
@ -15,18 +15,33 @@ class PublicRoomListItem extends StatelessWidget {
|
|||
const PublicRoomListItem(this.publicRoomEntry, {Key key}) : super(key: key);
|
||||
|
||||
void joinAction(BuildContext context) async {
|
||||
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
Matrix.of(context).client.api.joinRoom(publicRoomEntry.roomId));
|
||||
final success = await SimpleDialogs(context)
|
||||
.tryRequestWithLoadingDialog(_joinRoomAndWait(context));
|
||||
if (success != false) {
|
||||
await Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
ChatView(publicRoomEntry.roomId),
|
||||
ChatView(success),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> _joinRoomAndWait(BuildContext context) async {
|
||||
final roomId = await Matrix.of(context)
|
||||
.client
|
||||
.api
|
||||
.joinRoomOrAlias(publicRoomEntry.roomId);
|
||||
if (Matrix.of(context).client.getRoomById(roomId) == null) {
|
||||
await Matrix.of(context)
|
||||
.client
|
||||
.onRoomUpdate
|
||||
.stream
|
||||
.firstWhere((r) => r.id == roomId);
|
||||
}
|
||||
return roomId;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasTopic =
|
||||
|
@ -43,8 +58,10 @@ class PublicRoomListItem extends StatelessWidget {
|
|||
subtitle: Text(
|
||||
hasTopic
|
||||
? publicRoomEntry.topic
|
||||
: publicRoomEntry.numJoinedMembers == null
|
||||
? L10n.of(context).joinRoom
|
||||
: L10n.of(context).countParticipants(
|
||||
publicRoomEntry.numJoinedMembers?.toString() ?? '0'),
|
||||
publicRoomEntry.numJoinedMembers.toString()),
|
||||
maxLines: 1,
|
||||
),
|
||||
onTap: () => joinAction(context),
|
||||
|
|
|
@ -463,6 +463,8 @@ class L10n extends MatrixLocalizations {
|
|||
args: [username],
|
||||
);
|
||||
|
||||
String get joinRoom => Intl.message('Join room');
|
||||
|
||||
String get keysCached => Intl.message("Keys are cached", name: "keysCached");
|
||||
|
||||
String get keysMissing =>
|
||||
|
|
|
@ -390,14 +390,18 @@ class _ChatListState extends State<ChatList> {
|
|||
a.lastEvent.originServerTs));
|
||||
return ListView.separated(
|
||||
controller: _scrollController,
|
||||
separatorBuilder:
|
||||
(BuildContext context, int i) =>
|
||||
separatorBuilder: (BuildContext context,
|
||||
int i) =>
|
||||
i == totalCount - publicRoomsCount
|
||||
? Material(
|
||||
elevation: 2,
|
||||
child: ListTile(
|
||||
title: Text(L10n.of(context)
|
||||
.publicRooms),
|
||||
? ListTile(
|
||||
title: Text(
|
||||
L10n.of(context).publicRooms +
|
||||
':',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context)
|
||||
.primaryColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
|
|
Loading…
Reference in a new issue