Stupid Profile cache

This commit is contained in:
Christian Pauly 2020-05-06 19:03:57 +02:00
parent 2f79d4b5c7
commit 6891ce30d0
2 changed files with 27 additions and 22 deletions

View file

@ -13,14 +13,12 @@ class PresenceListItem extends StatelessWidget {
const PresenceListItem(this.presence); const PresenceListItem(this.presence);
static Map<String, Profile> _presences = {};
Future<Profile> _requestProfile(BuildContext context) async { Future<Profile> _requestProfile(BuildContext context) async {
if (presence.avatarUrl != null) { _presences[presence.sender] ??=
return Profile.fromJson({ await Matrix.of(context).client.getProfileFromUserId(presence.sender);
'avatar_url': presence.avatarUrl.toString(), return _presences[presence.sender];
'displayname': presence.displayname ?? presence.sender.localpart,
});
}
return Matrix.of(context).client.getProfileFromUserId(presence.sender);
} }
@override @override

View file

@ -21,28 +21,28 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.11" version: "2.0.13"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.2" version: "1.6.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.4.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "2.0.0"
bubble: bubble:
dependency: "direct main" dependency: "direct main"
description: description:
@ -63,14 +63,14 @@ packages:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "1.1.3"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.11" version: "1.14.12"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -91,7 +91,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
csslib: csslib:
dependency: transitive dependency: transitive
description: description:
@ -274,7 +274,7 @@ packages:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "2.1.12"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@ -288,7 +288,7 @@ packages:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.0" version: "0.16.1"
intl_translation: intl_translation:
dependency: "direct main" dependency: "direct main"
description: description:
@ -516,7 +516,7 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.1.3"
receive_sharing_intent: receive_sharing_intent:
dependency: "direct main" dependency: "direct main"
description: description:
@ -584,7 +584,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.5" version: "1.7.0"
sqflite: sqflite:
dependency: "direct main" dependency: "direct main"
description: description:
@ -633,21 +633,21 @@ packages:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.4" version: "1.13.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.11" version: "0.2.15"
test_core: test_core:
dependency: transitive dependency: transitive
description: description:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.15" version: "0.3.1"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -732,6 +732,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.2"
webview_flutter: webview_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -745,7 +752,7 @@ packages:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.5.0" version: "3.6.1"
yaml: yaml:
dependency: transitive dependency: transitive
description: description: