mirror of
https://github.com/venera-app/venera.git
synced 2025-09-28 00:07:24 +00:00
improve ui
This commit is contained in:
@@ -116,6 +116,7 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
|
||||
route.fullscreenDialog ||
|
||||
route.animation!.status != AnimationStatus.completed ||
|
||||
route.secondaryAnimation!.status != AnimationStatus.dismissed ||
|
||||
!route.popGestureEnabled ||
|
||||
route.navigator!.userGestureInProgress) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -728,28 +728,32 @@ class ComicSourceParser {
|
||||
|
||||
return retryZone(func);
|
||||
};
|
||||
addFolder = (name) async {
|
||||
try {
|
||||
await JsEngine().runCode("""
|
||||
if(_checkExists("favorites.addFolder")) {
|
||||
addFolder = (name) async {
|
||||
try {
|
||||
await JsEngine().runCode("""
|
||||
ComicSource.sources.$_key.favorites.addFolder(${jsonEncode(name)})
|
||||
""");
|
||||
return const Res(true);
|
||||
} catch (e, s) {
|
||||
Log.error("Network", "$e\n$s");
|
||||
return Res.error(e.toString());
|
||||
}
|
||||
};
|
||||
deleteFolder = (key) async {
|
||||
try {
|
||||
await JsEngine().runCode("""
|
||||
return const Res(true);
|
||||
} catch (e, s) {
|
||||
Log.error("Network", "$e\n$s");
|
||||
return Res.error(e.toString());
|
||||
}
|
||||
};
|
||||
}
|
||||
if(_checkExists("favorites.deleteFolder")) {
|
||||
deleteFolder = (key) async {
|
||||
try {
|
||||
await JsEngine().runCode("""
|
||||
ComicSource.sources.$_key.favorites.deleteFolder(${jsonEncode(key)})
|
||||
""");
|
||||
return const Res(true);
|
||||
} catch (e, s) {
|
||||
Log.error("Network", "$e\n$s");
|
||||
return Res.error(e.toString());
|
||||
}
|
||||
};
|
||||
return const Res(true);
|
||||
} catch (e, s) {
|
||||
Log.error("Network", "$e\n$s");
|
||||
return Res.error(e.toString());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return FavoriteData(
|
||||
|
@@ -153,6 +153,8 @@ class HistoryManager with ChangeNotifier {
|
||||
|
||||
Map<String, bool>? _cachedHistory;
|
||||
|
||||
static const _kMaxHistoryLength = 200;
|
||||
|
||||
Future<void> init() async {
|
||||
_db = sqlite3.open("${App.dataPath}/history.db");
|
||||
|
||||
@@ -176,6 +178,12 @@ class HistoryManager with ChangeNotifier {
|
||||
///
|
||||
/// This function would be called when user start reading.
|
||||
Future<void> addHistory(History newItem) async {
|
||||
while(count() >= _kMaxHistoryLength) {
|
||||
_db.execute("""
|
||||
delete from history
|
||||
where time == (select min(time) from history);
|
||||
""");
|
||||
}
|
||||
_db.execute("""
|
||||
insert or replace into history (id, title, subtitle, cover, time, type, ep, page, readEpisode, max_page)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||
@@ -207,6 +215,7 @@ class HistoryManager with ChangeNotifier {
|
||||
where id == ? and type == ?;
|
||||
""", [id, type.value]);
|
||||
updateCache();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<History?> find(String id, ComicType type) async {
|
||||
|
Reference in New Issue
Block a user