diff --git a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart index 996016bb6..95e7eaa00 100644 --- a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart +++ b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart @@ -32,6 +32,20 @@ Future flutterMatrixSdkDatabaseBuilder(String clientName) async { ); // Pangea# Logs().wtf('Unable to construct database!', e, s); + + try { + // #Pangea + // // Send error notification: + // final l10n = await lookupL10n(PlatformDispatcher.instance.locale); + // ClientManager.sendInitNotification( + // l10n.initAppError, + // e.toString(), + // ); + // Pangea# + } catch (e, s) { + Logs().e('Unable to send error notification', e, s); + } + // Try to delete database so that it can created again on next init: database?.delete().catchError( // #Pangea @@ -52,27 +66,11 @@ Future flutterMatrixSdkDatabaseBuilder(String clientName) async { ); // Delete database file: - if (database == null && !kIsWeb) { + if (!kIsWeb) { final dbFile = File(await _getDatabasePath(clientName)); if (await dbFile.exists()) await dbFile.delete(); } - try { - // Send error notification: - // #Pangea - // final l10n = await lookupL10n(PlatformDispatcher.instance.locale); - // ClientManager.sendInitNotification( - // l10n.initAppError, - // l10n.databaseBuildErrorBody( - // AppConfig.newIssueUrl.toString(), - // e.toString(), - // ), - // ); - // Pangea# - } catch (e, s) { - Logs().e('Unable to send error notification', e, s); - } - rethrow; } } @@ -104,16 +102,17 @@ Future _constructDatabase(String clientName) async { // import the SQLite / SQLCipher shared objects / dynamic libraries final factory = createDatabaseFactoryFfi(ffiInit: SQfLiteEncryptionHelper.ffiInit); + // #Pangea Sentry.addBreadcrumb(Breadcrumb(message: 'Database path: $path')); // Pangea# - // migrate from potential previous SQLite database path to current one - await _migrateLegacyLocation(path, clientName); - // required for [getDatabasesPath] databaseFactory = factory; + // migrate from potential previous SQLite database path to current one + await _migrateLegacyLocation(path, clientName); + // in case we got a cipher, we use the encryption helper // to manage SQLite encryption final helper = cipher == null