Skip to content

Commit

Permalink
Update matrix sdk (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz authored Aug 10, 2024
1 parent 73f506e commit 904d7bd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
34 changes: 27 additions & 7 deletions commet/lib/client/matrix/matrix_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ class MatrixClient extends Client {
startSyncLoop: !isBackgroundService,
onMigration: () => Log.w("Matrix Database is migrating"));
});
self =
MatrixProfile(_matrixClient, await _matrixClient.fetchOwnProfile());

await _updateOwnProfile();

if (!isBackgroundService) {
firstSync = _matrixClient.oneShotSync();
Expand Down Expand Up @@ -299,18 +299,38 @@ class MatrixClient extends Client {
}

void _postLoginSuccess() async {
if (_matrixClient.userID != null) {
self =
MatrixProfile(_matrixClient, await _matrixClient.fetchOwnProfile());
}

await _updateOwnProfile();
for (var component in getAllComponents()!) {
if (component is NeedsPostLoginInit) {
(component as NeedsPostLoginInit).postLoginInit();
}
}
}

Future<void> _updateOwnProfile() async {
final id = _matrixClient.userID;
if (id != null) {
var data = await _matrixClient.database!.getUserProfile(id);
if (data != null) {
self = MatrixProfile(
_matrixClient,
matrix.Profile(
userId: id,
displayName: data.displayname,
avatarUrl: data.avatarUrl,
));

// Update own profile, but lets not wait for it before continuing
_matrixClient.getProfileFromUserId(id).then((profile) {
self = MatrixProfile(_matrixClient, profile);
});
} else {
self = MatrixProfile(_matrixClient,
await _matrixClient.getProfileFromUserId(_matrixClient.userID!));
}
}
}

void _updateRoomslist() {
var joinedRooms = _matrixClient.rooms
.where((element) => !element.isSpace && element.membership.isJoin);
Expand Down
8 changes: 4 additions & 4 deletions commet/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -911,16 +911,16 @@ packages:
description:
path: "."
ref: main
resolved-ref: a4e6e73f79138d2044e618697ae43ab81ec2b9c7
resolved-ref: "9c7c17582080811d4ba88b65977da1a0b7f46350"
url: "https://github.com/commetchat/matrix-dart-sdk.git"
source: git
version: "0.30.0"
version: "0.32.0"
matrix_dart_sdk_drift_db:
dependency: "direct main"
description:
path: "."
ref: update-matrix-sdk
resolved-ref: "0d17db077ca2ce4fb39946779031d97d8a1c7a80"
ref: HEAD
resolved-ref: c2234b7c22847b31cc3bc196bac9759365198f67
url: "https://github.com/commetchat/matrix-dart-sdk-drift-db.git"
source: git
version: "0.0.1"
Expand Down
15 changes: 10 additions & 5 deletions commet/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ dependencies:
intl_translation: ^0.20.0
intl_utils: any
just_the_tooltip: ^0.0.12
matrix:
git:
url: https://github.com/commetchat/matrix-dart-sdk.git
ref: main
media_kit: ^1.1.7
media_kit_libs_video: ^1.0.1
media_kit_video: ^1.1.8
Expand Down Expand Up @@ -73,10 +69,13 @@ dependencies:
ref: fix
tiamat:
path: ../tiamat/
matrix:
git:
url: https://github.com/commetchat/matrix-dart-sdk.git
ref: main
matrix_dart_sdk_drift_db:
git:
url: https://github.com/commetchat/matrix-dart-sdk-drift-db.git
ref: update-matrix-sdk
encrypted_url_preview:
git: https://github.com/commetchat/encrypted_url_preview.git
signal_sticker_api:
Expand All @@ -102,6 +101,12 @@ dependencies:

dependency_overrides:
# Force dependency overrides for all (direct or transitive) dependencies

matrix:
git:
url: https://github.com/commetchat/matrix-dart-sdk.git
ref: main

media_kit:
git:
url: https://github.com/Airyzz/media-kit.git
Expand Down

0 comments on commit 904d7bd

Please sign in to comment.