comic source page

This commit is contained in:
nyne
2024-09-30 17:06:58 +08:00
parent a8782b5ce0
commit fdb3901fd1
20 changed files with 695 additions and 27 deletions

View File

@@ -67,6 +67,16 @@ class _App {
_ => Colors.blue,
};
}
Function? _forceRebuildHandler;
void registerForceRebuild(Function handler) {
_forceRebuildHandler = handler;
}
void forceRebuild() {
_forceRebuildHandler?.call();
}
}
// ignore: non_constant_identifier_names

View File

@@ -1,5 +1,16 @@
import 'dart:convert';
import 'package:venera/foundation/app.dart';
import 'package:venera/utils/io.dart';
class _Appdata {
final _Settings settings = _Settings();
void saveSettings() async {
var data = jsonEncode(settings._data);
var file = File(FilePath.join(App.dataPath, 'settings.json'));
await file.writeAsString(data);
}
}
final appdata = _Appdata();
@@ -15,9 +26,16 @@ class _Settings {
'newFavoriteAddTo': 'end', // start, end
'moveFavoriteAfterRead': 'none', // none, end, start
'proxy': 'direct', // direct, system, proxy string
'explore_pages': [],
'categories': [],
'favorites': [],
};
operator[](String key) {
return _data[key];
}
operator[]=(String key, dynamic value) {
_data[key] = value;
}
}

View File

@@ -11,6 +11,7 @@ import 'package:venera/foundation/app.dart';
import 'package:venera/foundation/history.dart';
import 'package:venera/foundation/res.dart';
import 'package:venera/utils/ext.dart';
import 'package:venera/utils/io.dart';
import '../js_engine.dart';
import '../log.dart';

View File

@@ -59,11 +59,11 @@ class ComicSourceParser {
if(!fileName.endsWith("js")){
fileName = "$fileName.js";
}
var file = File("${App.dataPath}/comic_source/$fileName");
var file = File(FilePath.join(App.dataPath, "comic_source", fileName));
if(file.existsSync()){
int i = 0;
while(file.existsSync()){
file = File("${App.dataPath}/comic_source/$fileName($i).js");
file = File(FilePath.join(App.dataPath, "comic_source", "${fileName.split('.').first}($i).js"));
i++;
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:venera/components/components.dart';
import 'app_page_route.dart';
@@ -31,6 +32,6 @@ extension Navigation on BuildContext {
Brightness get brightness => Theme.of(this).brightness;
void showMessage({required String message}) {
// TODO: show message
showToast(message: message, context: this);
}
}