favorites page

This commit is contained in:
nyne
2024-10-12 20:38:24 +08:00
parent a26e5e20de
commit 5a3537657a
22 changed files with 1388 additions and 120 deletions

View File

@@ -47,8 +47,9 @@ class _Appdata {
}
Future<void> init() async {
var dataPath = (await getApplicationSupportDirectory()).path;
var file = File(FilePath.join(
(await getApplicationSupportDirectory()).path,
dataPath,
'appdata.json',
));
if (!await file.exists()) {
@@ -61,6 +62,10 @@ class _Appdata {
}
}
searchHistory = List.from(json['searchHistory']);
var implicitDataFile = File(FilePath.join(dataPath, 'implicitData.json'));
if (await implicitDataFile.exists()) {
implicitData = jsonDecode(await implicitDataFile.readAsString());
}
}
Map<String, dynamic> toJson() {
@@ -69,6 +74,13 @@ class _Appdata {
'searchHistory': searchHistory,
};
}
var implicitData = <String, dynamic>{};
void writeImplicitData() {
var file = File(FilePath.join(App.dataPath, 'implicitData.json'));
file.writeAsString(jsonEncode(implicitData));
}
}
final appdata = _Appdata();

View File

@@ -319,9 +319,6 @@ class LocalFavoritesManager {
/// delete a folder
void deleteFolder(String name) {
_modifiedAfterLastCache = true;
_db.execute("""
delete from folder_sync where folder_name == ?;
""", [name]);
_db.execute("""
drop table "$name";
""");