mirror of
https://github.com/venera-app/venera.git
synced 2025-09-28 08:17:25 +00:00
comic source page
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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';
|
||||
|
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user