refactor: Migrate to new matrix sdk API
This commit is contained in:
parent
a85f35088a
commit
47e68d813d
32 changed files with 103 additions and 93 deletions
|
|
@ -100,7 +100,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||
),
|
||||
if (room.canSendEvent(EventTypes.RoomTombstone)) ...{
|
||||
Divider(thickness: 1),
|
||||
FutureBuilder<ServerCapabilities>(
|
||||
FutureBuilder<Capabilities>(
|
||||
future: room.client.getCapabilities(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ class InvitationSelectionView extends StatelessWidget {
|
|||
itemBuilder: (BuildContext context, int i) => ListTile(
|
||||
leading: Avatar(
|
||||
controller.foundProfiles[i].avatarUrl,
|
||||
controller.foundProfiles[i].displayname ??
|
||||
controller.foundProfiles[i].displayName ??
|
||||
controller.foundProfiles[i].userId,
|
||||
),
|
||||
title: Text(
|
||||
controller.foundProfiles[i].displayname ??
|
||||
controller.foundProfiles[i].displayName ??
|
||||
controller.foundProfiles[i].userId.localpart,
|
||||
),
|
||||
subtitle: Text(controller.foundProfiles[i].userId),
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class NewPrivateChatView extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(8.0),
|
||||
child: Avatar(
|
||||
controller.foundProfile.avatarUrl,
|
||||
controller.foundProfile.displayname ??
|
||||
controller.foundProfile.displayName ??
|
||||
controller.foundProfile.userId,
|
||||
size: 12,
|
||||
),
|
||||
|
|
@ -101,11 +101,11 @@ class NewPrivateChatView extends StatelessWidget {
|
|||
onTap: () => controller.pickUser(foundProfile),
|
||||
leading: Avatar(
|
||||
foundProfile.avatarUrl,
|
||||
foundProfile.displayname ?? foundProfile.userId,
|
||||
foundProfile.displayName ?? foundProfile.userId,
|
||||
//size: 24,
|
||||
),
|
||||
title: Text(
|
||||
foundProfile.displayname ??
|
||||
foundProfile.displayName ??
|
||||
foundProfile.userId.localpart,
|
||||
style: TextStyle(),
|
||||
maxLines: 1,
|
||||
|
|
|
|||
|
|
@ -29,22 +29,24 @@ class SearchView extends StatelessWidget {
|
|||
.client
|
||||
.queryPublicRooms(
|
||||
server: server,
|
||||
genericSearchTerm: controller.genericSearchTerm,
|
||||
filter: PublicRoomQueryFilter(
|
||||
genericSearchTerm: controller.genericSearchTerm,
|
||||
),
|
||||
)
|
||||
.catchError((error) {
|
||||
if (!(controller.genericSearchTerm?.isValidMatrixId ?? false)) {
|
||||
throw error;
|
||||
}
|
||||
return PublicRoomsResponse.fromJson({
|
||||
return QueryPublicRoomsResponse.fromJson({
|
||||
'chunk': [],
|
||||
});
|
||||
}).then((PublicRoomsResponse res) {
|
||||
}).then((QueryPublicRoomsResponse res) {
|
||||
if (controller.genericSearchTerm != null &&
|
||||
!res.chunk.any((room) =>
|
||||
(room.aliases?.contains(controller.genericSearchTerm) ?? false) ||
|
||||
room.canonicalAlias == controller.genericSearchTerm)) {
|
||||
// we have to tack on the original alias
|
||||
res.chunk.add(PublicRoom.fromJson(<String, dynamic>{
|
||||
res.chunk.add(PublicRoomsChunk.fromJson(<String, dynamic>{
|
||||
'aliases': [controller.genericSearchTerm],
|
||||
'name': controller.genericSearchTerm,
|
||||
}));
|
||||
|
|
@ -105,10 +107,10 @@ class SearchView extends StatelessWidget {
|
|||
title: Text(L10n.of(context).changeTheServer),
|
||||
onTap: controller.setServer,
|
||||
),
|
||||
FutureBuilder<PublicRoomsResponse>(
|
||||
FutureBuilder<QueryPublicRoomsResponse>(
|
||||
future: controller.publicRoomsResponse,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<PublicRoomsResponse> snapshot) {
|
||||
AsyncSnapshot<QueryPublicRoomsResponse> snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -183,10 +185,7 @@ class SearchView extends StatelessWidget {
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Avatar(
|
||||
Uri.parse(publicRoomsResponse
|
||||
.chunk[i].avatarUrl ??
|
||||
''),
|
||||
Avatar(publicRoomsResponse.chunk[i].avatarUrl,
|
||||
publicRoomsResponse.chunk[i].name),
|
||||
Text(
|
||||
publicRoomsResponse.chunk[i].name,
|
||||
|
|
@ -244,11 +243,11 @@ class SearchView extends StatelessWidget {
|
|||
},
|
||||
leading: Avatar(
|
||||
foundProfile.avatarUrl,
|
||||
foundProfile.displayname ?? foundProfile.userId,
|
||||
foundProfile.displayName ?? foundProfile.userId,
|
||||
//size: 24,
|
||||
),
|
||||
title: Text(
|
||||
foundProfile.displayname ??
|
||||
foundProfile.displayName ??
|
||||
foundProfile.userId.localpart,
|
||||
style: TextStyle(),
|
||||
maxLines: 1,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class SettingsAccountView extends StatelessWidget {
|
|||
ListTile(
|
||||
trailing: Icon(Icons.edit_outlined),
|
||||
title: Text(L10n.of(context).editDisplayname),
|
||||
subtitle: Text(controller.profile?.displayname ??
|
||||
subtitle: Text(controller.profile?.displayName ??
|
||||
Matrix.of(context).client.userID.localpart),
|
||||
onTap: controller.setDisplaynameAction,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||
builder: (c, s) => ListTile(
|
||||
leading: Avatar(
|
||||
s.data?.avatarUrl ?? Uri.parse(''),
|
||||
s.data?.displayname ?? client.ignoredUsers[i],
|
||||
s.data?.displayName ?? client.ignoredUsers[i],
|
||||
),
|
||||
title: Text(
|
||||
s.data?.displayname ?? client.ignoredUsers[i]),
|
||||
s.data?.displayName ?? client.ignoredUsers[i]),
|
||||
trailing: IconButton(
|
||||
tooltip: L10n.of(context).delete,
|
||||
icon: Icon(Icons.delete_forever_outlined),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue