move to new sdk
This commit is contained in:
parent
7e3d330a68
commit
6868f38c7c
26 changed files with 172 additions and 201 deletions
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:famedlysdk/matrix_api.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/components/list_items/presence_list_item.dart';
|
||||
import 'package:fluffychat/components/list_items/public_room_list_item.dart';
|
||||
|
|
@ -93,7 +94,7 @@ class _ChatListState extends State<ChatList> {
|
|||
setState(() => loadingPublicRooms = true);
|
||||
final newPublicRoomsResponse =
|
||||
await SimpleDialogs(context).tryRequestWithErrorToast(
|
||||
Matrix.of(context).client.requestPublicRooms(
|
||||
Matrix.of(context).client.api.searchPublicRooms(
|
||||
limit: 30,
|
||||
includeAllNetworks: true,
|
||||
genericSearchTerm: searchController.text,
|
||||
|
|
@ -107,13 +108,12 @@ class _ChatListState extends State<ChatList> {
|
|||
if (searchController.text.isNotEmpty &&
|
||||
searchController.text.isValidMatrixId &&
|
||||
searchController.text.sigil == '#') {
|
||||
publicRoomsResponse.publicRooms.add(
|
||||
PublicRoomEntry(
|
||||
aliases: [searchController.text],
|
||||
name: searchController.text,
|
||||
roomId: searchController.text,
|
||||
client: Matrix.of(context).client,
|
||||
),
|
||||
publicRoomsResponse.chunk.add(
|
||||
PublicRoom.fromJson({
|
||||
'aliases': [searchController.text],
|
||||
'name': searchController.text,
|
||||
'room_id': searchController.text,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -199,15 +199,9 @@ class _ChatListState extends State<ChatList> {
|
|||
);
|
||||
if (status?.isEmpty ?? true) return;
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
Matrix.of(context).client.jsonRequest(
|
||||
type: HTTPType.PUT,
|
||||
action:
|
||||
'/client/r0/presence/${Matrix.of(context).client.userID}/status',
|
||||
data: {
|
||||
'presence': 'online',
|
||||
'status_msg': status,
|
||||
},
|
||||
),
|
||||
Matrix.of(context).client.api.sendPresence(
|
||||
Matrix.of(context).client.userID, PresenceType.online,
|
||||
statusMsg: status),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -412,8 +406,7 @@ class _ChatListState extends State<ChatList> {
|
|||
);
|
||||
}
|
||||
final publicRoomsCount =
|
||||
(publicRoomsResponse?.publicRooms?.length ??
|
||||
0);
|
||||
(publicRoomsResponse?.chunk?.length ?? 0);
|
||||
final totalCount =
|
||||
rooms.length + publicRoomsCount;
|
||||
return ListView.separated(
|
||||
|
|
@ -469,7 +462,7 @@ class _ChatListState extends State<ChatList> {
|
|||
rooms[i].id,
|
||||
)
|
||||
: PublicRoomListItem(publicRoomsResponse
|
||||
.publicRooms[i - rooms.length]);
|
||||
.chunk[i - rooms.length]);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue