Upgrade hive database version to 14

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-04-04 19:35:16 +07:00
committed by Dat H. Pham
parent 7523ddf07b
commit 51c95bbc69
14 changed files with 152 additions and 63 deletions
+15 -16
View File
@@ -90,28 +90,27 @@ class FileUtils {
return emailContent;
}
Future<bool> isFileExisted({
required String nameFile,
String? folderPath,
String? extensionFile
}) async {
final internalStorageDirPath = await _getInternalStorageDirPath(
nameFile: nameFile,
folderPath: folderPath,
extensionFile: extensionFile
);
return File(internalStorageDirPath).exists();
Future<Directory?> getFolder(String folderName) async {
try {
String folderPath = (await getApplicationDocumentsDirectory()).absolute.path;
folderPath = '$folderPath/$folderName';
log('FileUtils::getFolder(): $folderPath');
return Directory(folderPath);
} catch (e) {
logError('FileUtils::getFolder():EXCEPTION: $e');
return null;
}
}
Future<void> removeFolder(String folderName) async {
try {
String folderPath = (await getApplicationDocumentsDirectory()).absolute.path;
folderPath = '$folderPath/$folderName';
log('FileUtils::removeFolder():folderPath: $folderPath');
final dir = Directory(folderPath);
final dir = await getFolder(folderName);
if (dir == null) return;
if (await dir.exists()) {
await dir.delete(recursive: true);
await dir.create(); // Re-create folder
log('FileUtils::removeFolder: Remove ${dir.path} success');
}
} catch (e) {
logError('FileUtils::removeFolder():EXCEPTION: $e');