Skip to content

Commit

Permalink
feat: handle event not found
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Apr 18, 2024
1 parent b52acff commit 9dd12f1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ whisper.cpp/whisper.cpp-*/

integration_test/docker/config/jetstream/
integration_test/docker/config/logs/
integration_test/docker/config/media_store/
4 changes: 0 additions & 4 deletions lib/pages/settings/advanced_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ class AdvancedSettingsPage extends StatelessWidget {
title: localizations.settingsSyncCfgTitle,
path: '/settings/advanced/sync_settings',
),
SettingsNavCard(
title: localizations.settingsMatrixTitle,
path: '/settings/advanced/matrix_settings',
),
const MatrixSettingsCard(),
SettingsNavCard(
trailing: OutboxBadgeIcon(
Expand Down
6 changes: 6 additions & 0 deletions lib/sync/matrix/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Future<String?> joinMatrixRoom({
..syncRoom = syncRoom
..syncRoomId = roomId;

loggingDb.captureEvent(
'joined $roomId $joinRes',
domain: 'MATRIX_SERVICE',
subDomain: 'joinRoom',
);

return joinRes;
} catch (e, stackTrace) {
debugPrint('$e');
Expand Down
9 changes: 7 additions & 2 deletions lib/sync/matrix/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ Future<void> processNewTimelineEvents({

try {
final lastReadEventContextId = service.lastReadEventContextId;
await service.client.sync();
final hasMessage = await service.syncRoom
?.getEventById(lastReadEventContextId.toString()) !=
null;

final timeline = await service.syncRoom?.getTimeline(
eventContextId: lastReadEventContextId,
eventContextId: hasMessage ? lastReadEventContextId : null,
);

if (timeline == null) {
Expand Down Expand Up @@ -102,10 +107,10 @@ Future<void> processNewTimelineEvents({
try {
if (eventId.startsWith(r'$')) {
service.lastReadEventContextId = eventId;
await setLastReadMatrixEventId(eventId);
}

await timeline.setReadMarker(eventId: eventId);
await setLastReadMatrixEventId(eventId);
} catch (e) {
debugPrint('$e');
}
Expand Down
12 changes: 10 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1675,10 +1675,18 @@ packages:
dependency: "direct main"
description:
name: matrix
sha256: "36c7e13d5d7420898f2597d6f5f0611a9da8114a0fde11f41b9e54cd1140b05f"
sha256: f829dd542f354e5073e3b43aaed3adc2829e762a9ec50a3f186ffd7dddc36d5e
url: "https://pub.dev"
source: hosted
version: "0.27.0"
version: "0.26.1"
matrix_api_lite:
dependency: transitive
description:
name: matrix_api_lite
sha256: e78b333f49733f3ec4c014532ddcb5e9c68639b9b6ff0d89c094a6c284b80b74
url: "https://pub.dev"
source: hosted
version: "1.7.4"
media_kit:
dependency: "direct main"
description:
Expand Down
10 changes: 2 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.448+2458
version: 0.9.448+2459

msix_config:
display_name: LottiApp
Expand Down Expand Up @@ -110,13 +110,7 @@ dependencies:
location: ^6.0.1
lottie: ^3.0.0
material_design_icons_flutter: ^7.0.7096

matrix: ^0.27.0
# matrix:
# git:
# url: https://github.com/matthiasn/matrix-dart-sdk
# ref: 1816235c

matrix: ^0.26.1
media_kit: ^1.0.2
media_kit_libs_android_audio: ^1.0.3
media_kit_libs_ios_audio: ^1.0.4
Expand Down

0 comments on commit 9dd12f1

Please sign in to comment.