Merge branch 'krille/update-matrix-sdk' into 'main'
refactor: Update Matrix SDK See merge request famedly/fluffychat!869
This commit is contained in:
commit
05f55b7aad
10 changed files with 48 additions and 53 deletions
|
|
@ -54,7 +54,7 @@ class _ContactsState extends State<ContactsList> {
|
|||
final contactList = Matrix.of(context)
|
||||
.client
|
||||
.contactList
|
||||
.where((p) => p.senderId
|
||||
.where((p) => p.userid
|
||||
.toLowerCase()
|
||||
.contains(widget.searchController.text.toLowerCase()))
|
||||
.toList();
|
||||
|
|
@ -66,17 +66,16 @@ class _ContactsState extends State<ContactsList> {
|
|||
}
|
||||
|
||||
class _ContactListTile extends StatelessWidget {
|
||||
final Presence contact;
|
||||
final CachedPresence contact;
|
||||
|
||||
const _ContactListTile({Key? key, required this.contact}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<Profile>(
|
||||
future:
|
||||
Matrix.of(context).client.getProfileFromUserId(contact.senderId),
|
||||
future: Matrix.of(context).client.getProfileFromUserId(contact.userid),
|
||||
builder: (context, snapshot) {
|
||||
final displayname = snapshot.data?.displayName ??
|
||||
contact.senderId.localpart ??
|
||||
contact.userid.localpart ??
|
||||
'No valid MXID';
|
||||
final avatarUrl = snapshot.data?.avatarUrl;
|
||||
return ListTile(
|
||||
|
|
@ -104,7 +103,7 @@ class _ContactListTile extends StatelessWidget {
|
|||
),
|
||||
title: Text(displayname),
|
||||
subtitle: Text(contact.getLocalizedStatusMessage(context),
|
||||
style: contact.presence.statusMsg?.isNotEmpty ?? false
|
||||
style: contact.statusMsg?.isNotEmpty ?? false
|
||||
? TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -112,9 +111,7 @@ class _ContactListTile extends StatelessWidget {
|
|||
: null),
|
||||
onTap: () => VRouter.of(context).toSegments([
|
||||
'rooms',
|
||||
Matrix.of(context)
|
||||
.client
|
||||
.getDirectChatFromUserId(contact.senderId)!
|
||||
Matrix.of(context).client.getDirectChatFromUserId(contact.userid)!
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
final onUiaRequest = <String, StreamSubscription<UiaRequest>>{};
|
||||
StreamSubscription<html.Event>? onFocusSub;
|
||||
StreamSubscription<html.Event>? onBlurSub;
|
||||
final onOwnPresence = <String, StreamSubscription<Presence>>{};
|
||||
final onOwnPresence = <String, StreamSubscription<CachedPresence>>{};
|
||||
|
||||
String? _cachedPassword;
|
||||
Timer? _cachedPasswordClearTimer;
|
||||
|
|
@ -342,13 +342,12 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
}
|
||||
});
|
||||
// Cache and resend status message
|
||||
onOwnPresence[name] ??= c.onPresence.stream.listen((presence) {
|
||||
onOwnPresence[name] ??= c.onPresenceChanged.stream.listen((presence) {
|
||||
if (c.isLogged() &&
|
||||
c.userID == presence.senderId &&
|
||||
presence.presence.statusMsg != null) {
|
||||
Logs().v('Update status message: "${presence.presence.statusMsg}"');
|
||||
store.setItem(
|
||||
SettingKeys.ownStatusMessage, presence.presence.statusMsg);
|
||||
c.userID == presence.userid &&
|
||||
presence.statusMsg != null) {
|
||||
Logs().v('Update status message: "${presence.statusMsg}"');
|
||||
store.setItem(SettingKeys.ownStatusMessage, presence.statusMsg);
|
||||
}
|
||||
});
|
||||
onUiaRequest[name] ??= c.onUiaRequest.stream.listen(uiaRequestHandler);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue