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);
|
const PublicRoomListItem(this.publicRoomEntry, {Key key}) : super(key: key);
|
||||||
|
|
||||||
void joinAction(BuildContext context) async {
|
void joinAction(BuildContext context) async {
|
||||||
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
final success = await SimpleDialogs(context)
|
||||||
Matrix.of(context).client.api.joinRoom(publicRoomEntry.roomId));
|
.tryRequestWithLoadingDialog(_joinRoomAndWait(context));
|
||||||
if (success != false) {
|
if (success != false) {
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
AppRoute.defaultRoute(
|
AppRoute.defaultRoute(
|
||||||
context,
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final hasTopic =
|
final hasTopic =
|
||||||
|
@ -43,8 +58,10 @@ class PublicRoomListItem extends StatelessWidget {
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
hasTopic
|
hasTopic
|
||||||
? publicRoomEntry.topic
|
? publicRoomEntry.topic
|
||||||
|
: publicRoomEntry.numJoinedMembers == null
|
||||||
|
? L10n.of(context).joinRoom
|
||||||
: L10n.of(context).countParticipants(
|
: L10n.of(context).countParticipants(
|
||||||
publicRoomEntry.numJoinedMembers?.toString() ?? '0'),
|
publicRoomEntry.numJoinedMembers.toString()),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
onTap: () => joinAction(context),
|
onTap: () => joinAction(context),
|
||||||
|
|
|
@ -463,6 +463,8 @@ class L10n extends MatrixLocalizations {
|
||||||
args: [username],
|
args: [username],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
String get joinRoom => Intl.message('Join room');
|
||||||
|
|
||||||
String get keysCached => Intl.message("Keys are cached", name: "keysCached");
|
String get keysCached => Intl.message("Keys are cached", name: "keysCached");
|
||||||
|
|
||||||
String get keysMissing =>
|
String get keysMissing =>
|
||||||
|
|
|
@ -390,14 +390,18 @@ class _ChatListState extends State<ChatList> {
|
||||||
a.lastEvent.originServerTs));
|
a.lastEvent.originServerTs));
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
separatorBuilder:
|
separatorBuilder: (BuildContext context,
|
||||||
(BuildContext context, int i) =>
|
int i) =>
|
||||||
i == totalCount - publicRoomsCount
|
i == totalCount - publicRoomsCount
|
||||||
? Material(
|
? ListTile(
|
||||||
elevation: 2,
|
title: Text(
|
||||||
child: ListTile(
|
L10n.of(context).publicRooms +
|
||||||
title: Text(L10n.of(context)
|
':',
|
||||||
.publicRooms),
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
|
|
Loading…
Reference in a new issue