mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
[Comic Source] Improve data conversion
This commit is contained in:
@@ -169,7 +169,9 @@ class ComicDetails with HistoryMixin {
|
||||
static Map<String, List<String>> _generateMap(Map<dynamic, dynamic> map) {
|
||||
var res = <String, List<String>>{};
|
||||
map.forEach((key, value) {
|
||||
res[key] = List<String>.from(value);
|
||||
if (value is List) {
|
||||
res[key] = List<String>.from(value);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
@@ -1035,9 +1035,12 @@ class ComicSourceParser {
|
||||
var res = JsEngine().runCode("""
|
||||
ComicSource.sources.$_key.comic.onClickTag(${jsonEncode(namespace)}, ${jsonEncode(tag)})
|
||||
""");
|
||||
var r = Map<String, String?>.from(res);
|
||||
if (res is! Map) {
|
||||
return null;
|
||||
}
|
||||
var r = Map<String, dynamic>.from(res);
|
||||
r.removeWhere((key, value) => value == null);
|
||||
return Map.from(r);
|
||||
return PageJumpTarget.parse(_key!, r);
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ typedef LikeCommentFunc = Future<Res<int?>> Function(
|
||||
typedef VoteCommentFunc = Future<Res<int?>> Function(
|
||||
String comicId, String? subId, String commentId, bool isUp, bool isCancel);
|
||||
|
||||
typedef HandleClickTagEvent = Map<String, String> Function(
|
||||
typedef HandleClickTagEvent = PageJumpTarget? Function(
|
||||
String namespace, String tag);
|
||||
|
||||
/// [rating] is the rating value, 0-10. 1 represents 0.5 star.
|
||||
|
Reference in New Issue
Block a user