Merge branch 'krille/updateuserdevicekeys' into 'main'
fix: Dont update user device keys if logged out See merge request famedly/famedlysdk!628
This commit is contained in:
commit
a492fc8f96
|
|
@ -1442,6 +1442,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
if (!isLogged()) return;
|
if (!isLogged()) return;
|
||||||
final dbActions = <Future<dynamic> Function()>[];
|
final dbActions = <Future<dynamic> Function()>[];
|
||||||
var trackedUserIds = await _getUserIdsInEncryptedRooms();
|
var trackedUserIds = await _getUserIdsInEncryptedRooms();
|
||||||
|
if (!isLogged()) return;
|
||||||
trackedUserIds.add(userID);
|
trackedUserIds.add(userID);
|
||||||
|
|
||||||
// Remove all userIds we no longer need to track the devices of.
|
// Remove all userIds we no longer need to track the devices of.
|
||||||
|
|
@ -1466,8 +1467,8 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
|
|
||||||
if (outdatedLists.isNotEmpty) {
|
if (outdatedLists.isNotEmpty) {
|
||||||
// Request the missing device key lists from the server.
|
// Request the missing device key lists from the server.
|
||||||
if (!isLogged()) return;
|
|
||||||
final response = await requestDeviceKeys(outdatedLists, timeout: 10000);
|
final response = await requestDeviceKeys(outdatedLists, timeout: 10000);
|
||||||
|
if (!isLogged()) return;
|
||||||
|
|
||||||
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
||||||
final userId = rawDeviceKeyListEntry.key;
|
final userId = rawDeviceKeyListEntry.key;
|
||||||
|
|
@ -1619,6 +1620,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbActions.isNotEmpty) {
|
if (dbActions.isNotEmpty) {
|
||||||
|
if (!isLogged()) return;
|
||||||
await database?.transaction(() async {
|
await database?.transaction(() async {
|
||||||
for (final f in dbActions) {
|
for (final f in dbActions) {
|
||||||
await f();
|
await f();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue