@@ -276,6 +276,7 @@ class KeyManager {
276276 }
277277 return sess; // nothing to do
278278 }
279+ await client.ensureNotSoftLoggedOut ();
279280 final session =
280281 await client.database? .getInboundGroupSession (roomId, sessionId);
281282 if (session == null ) return null ;
@@ -460,6 +461,7 @@ class KeyManager {
460461 room.id,
461462 sess.outboundGroupSession! .session_id (),
462463 );
464+ await client.ensureNotSoftLoggedOut ();
463465 // send out the key
464466 await client.sendToDeviceEncryptedChunked (
465467 devicesToReceive,
@@ -591,6 +593,7 @@ class KeyManager {
591593 key: userID,
592594 );
593595 try {
596+ await client.ensureNotSoftLoggedOut ();
594597 await client.sendToDeviceEncryptedChunked (
595598 deviceKeys,
596599 EventTypes .RoomKey ,
@@ -659,6 +662,7 @@ class KeyManager {
659662 .isBefore (_roomKeysVersionCacheDate! )) {
660663 return _roomKeysVersionCache! ;
661664 }
665+ await client.ensureNotSoftLoggedOut ();
662666 _roomKeysVersionCache = await client.getRoomKeysVersionCurrent ();
663667 _roomKeysVersionCacheDate = DateTime .now ();
664668 return _roomKeysVersionCache! ;
@@ -725,6 +729,7 @@ class KeyManager {
725729 /// while for older and big accounts.
726730 Future <void > loadAllKeys () async {
727731 final info = await getRoomKeysBackupInfo ();
732+ await client.ensureNotSoftLoggedOut ();
728733 final ret = await client.getRoomKeys (info.version);
729734 await loadFromResponse (ret);
730735 }
@@ -733,6 +738,7 @@ class KeyManager {
733738 /// while for older and big rooms.
734739 Future <void > loadAllKeysFromRoom (String roomId) async {
735740 final info = await getRoomKeysBackupInfo ();
741+ await client.ensureNotSoftLoggedOut ();
736742 final ret = await client.getRoomKeysByRoomId (roomId, info.version);
737743 final keys = RoomKeys .fromJson ({
738744 'rooms' : {
@@ -748,6 +754,7 @@ class KeyManager {
748754 /// and stores it.
749755 Future <void > loadSingleKey (String roomId, String sessionId) async {
750756 final info = await getRoomKeysBackupInfo ();
757+ await client.ensureNotSoftLoggedOut ();
751758 final ret =
752759 await client.getRoomKeyBySessionId (roomId, sessionId, info.version);
753760 final keys = RoomKeys .fromJson ({
@@ -809,6 +816,7 @@ class KeyManager {
809816 sessionId: sessionId,
810817 );
811818 final userList = await room.requestParticipants ();
819+ await client.ensureNotSoftLoggedOut ();
812820 await client.sendToDevicesOfUserIds (
813821 userList.map <String >((u) => u.id).toSet (),
814822 EventTypes .RoomKeyRequest ,
@@ -916,6 +924,7 @@ class KeyManager {
916924 await client.nativeImplementations.generateUploadKeys (args);
917925 Logs ().i ('[Key Manager] Uploading ${dbSessions .length } room keys...' );
918926 // upload the payload...
927+ await client.ensureNotSoftLoggedOut ();
919928 await client.putRoomKeys (info.version, roomKeys);
920929 // and now finally mark all the keys as uploaded
921930 // no need to optimze this, as we only run it so seldomly and almost never with many keys at once
@@ -1119,6 +1128,7 @@ class KeyManager {
11191128 final userData = data[device.userId] ?? = {};
11201129 userData[device.deviceId! ] = sendToDeviceMessage;
11211130 }
1131+ await client.ensureNotSoftLoggedOut ();
11221132 await client.sendToDevice (
11231133 EventTypes .RoomKeyRequest ,
11241134 client.generateUniqueTransactionId (),
0 commit comments