...
 
Commits (4)
......@@ -9,6 +9,7 @@
library matrix_sdk_sqflite;
import 'dart:convert';
import 'dart:io';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:meta/meta.dart';
......@@ -255,6 +256,7 @@ class SqfliteStore implements Store {
try {
_db = await openDatabase(
path,
singleInstance: false,
version: 17,
onUpgrade: (Database db, int oldVersion, int newVersion) async {
final localUser = await getLocalUser(db: db);
......@@ -294,13 +296,28 @@ class SqfliteStore implements Store {
@override
Future<void> close() async {
_isOpen = false;
await _db.close();
await _db?.close();
}
@override
Future<void> delete() async {
await _db?.close();
await deleteDatabase(await getDatabasesPath() + path);
await close();
final path = !this.path.startsWith('/') ? '/${this.path}' : this.path;
final fullPath = await getDatabasesPath() + path;
final files = [
File(fullPath),
File('$fullPath-journal'),
File('$fullPath-wal'),
File('$fullPath-shm'),
];
for (final file in files) {
if (await file.exists()) {
await file.delete();
}
}
}
@override
......
......@@ -11,7 +11,7 @@ environment:
dependencies:
matrix_sdk: ^0.29.0
sqflite: ^1.1.6
sqflite: ^1.2.0
flutter:
sdk: flutter
......@@ -19,7 +19,7 @@ dependency_overrides:
matrix_sdk:
git:
url: https://git.pattle.im/pattle/library/matrix-dart-sdk.git
ref: de715fb919c597931f40336d79e26ae5b9fc544f
ref: 7043b9061be8c516b786ea0992af8daa5f997552
dev_dependencies:
flutter_test:
......