Skip to content

Commit

Permalink
test: remove logout
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Apr 21, 2024
1 parent 0645a52 commit 31f62af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
6 changes: 0 additions & 6 deletions integration_test/matrix_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,6 @@ void main() {
final bobEntriesCount = await bobDb.getJournalCount();
expect(bobEntriesCount, n);
debugPrint('Bob persisted $bobEntriesCount entries');

debugPrint('\n--- Logging out Alice and Bob');

await alice.logout();
await waitSeconds(defaultDelay * delayFactor);
await bob.logout();
},
timeout: const Timeout(Duration(minutes: 15)),
);
Expand Down
1 change: 1 addition & 0 deletions lib/sync/matrix/matrix_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class MatrixService {

Future<void> logout() async {
if (_client.isLogged()) {
timeline?.cancelSubscriptions();
await _client.logout();
}
}
Expand Down
18 changes: 12 additions & 6 deletions lib/sync/matrix/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Future<void> processNewTimelineEvents({

try {
final lastReadEventContextId = service.lastReadEventContextId;

await service.client.sync();
final hasMessage = await service.syncRoom
?.getEventById(lastReadEventContextId.toString()) !=
Expand Down Expand Up @@ -116,21 +117,26 @@ Future<void> processNewTimelineEvents({
service.lastReadEventContextId = eventId;
await setLastReadMatrixEventId(eventId);
}

await timeline.setReadMarker(eventId: eventId);
} catch (e) {
debugPrint('$e');
final loginState = service.client.onLoginStateChanged.value;
if (loginState == LoginState.loggedIn) {
await timeline.setReadMarker(eventId: eventId);
}
} catch (e, stackTrace) {
loggingDb.captureException(
e,
domain: 'MATRIX_SERVICE',
subDomain: 'setReadMarker ${service.client.deviceName}',
stackTrace: stackTrace,
);
}
}
} catch (e, stackTrace) {
debugPrint('$e');
loggingDb.captureException(
e,
domain: 'MATRIX_SERVICE',
subDomain: 'listenToTimelineEvents ${service.client.deviceName}',
stackTrace: stackTrace,
);
rethrow;
}
}

Expand Down

0 comments on commit 31f62af

Please sign in to comment.