fixed client-reported crashes in the pdf viewer, image picker and prosemirror images, mapped webdav errors to user messages and hardened keychain, cache and push stores against io failures

This commit is contained in:
MineTec committed 2026-10-12 17:00:14 +02:00
1 parent c5592f117b
commit 23e4510bf8
19 files changed
+545 -55

No files matched your search

+10 -2
View File
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:localstore/localstore.dart';
/// Maximum messages kept per chat thread — enough for a messenger-style
@@ -190,8 +191,15 @@ class ChatThreadStore {
DocumentRef _doc(String chatToken) =>
_db.collection(_collection).doc(docIdForToken(chatToken));
Future<void> _write(String chatToken, List<ThreadMessage> messages) =>
_doc(chatToken).set({
/// Best effort: a full disk must not keep the notification from being
/// shown; the thread just restarts from the next push.
Future<void> _write(String chatToken, List<ThreadMessage> messages) async {
try {
await _doc(chatToken).set({
'messages': [for (final m in messages) m.toJson()],
});
} on Object catch (e) {
debugPrint('ChatThreadStore.write($chatToken) failed: $e');
}
}
}
+10 -2
View File
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:localstore/localstore.dart';
/// A rendered notification's bookkeeping, keyed by the Nextcloud notification
@@ -40,8 +41,15 @@ class NidStore {
NidStore({Localstore? db}) : _db = db ?? Localstore.instance;
Future<void> put(NidEntry entry) =>
_db.collection(_collection).doc('${entry.nid}').set(entry.toJson());
/// Best effort: a full disk must not keep the notification itself from
/// being shown — only a later delete-push would then miss the mapping.
Future<void> put(NidEntry entry) async {
try {
await _db.collection(_collection).doc('${entry.nid}').set(entry.toJson());
} on Object catch (e) {
debugPrint('NidStore.put(${entry.nid}) failed: $e');
}
}
Future<NidEntry?> get(int nid) async {
final data = await _db.collection(_collection).doc('$nid').get();
+4 -1
View File
@@ -1,4 +1,5 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../storage/keychain_write.dart';
/// Keychain access group shared between the Runner and the (Phase 3) iOS
/// Notification Service Extension so the NSE can read the RSA private key,
@@ -48,7 +49,9 @@ class PushSecureStorage implements FlutterSecureStorageLike {
@override
Future<void> write({required String key, required String? value}) =>
pushSecureStorage.write(key: key, value: value);
value == null
? pushSecureStorage.delete(key: key)
: pushSecureStorage.writeRetrying(key: key, value: value);
@override
Future<void> delete({required String key}) =>