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);
static Map<String, Profile> _presences = {};
Future<Profile> _requestProfile(BuildContext context) async {
if (presence.avatarUrl != null) {
return Profile.fromJson({
'avatar_url': presence.avatarUrl.toString(),
'displayname': presence.displayname ?? presence.sender.localpart,
});
}
return Matrix.of(context).client.getProfileFromUserId(presence.sender);
_presences[presence.sender] ??=
await Matrix.of(context).client.getProfileFromUserId(presence.sender);
return _presences[presence.sender];
}
@override

View file

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