mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
更改安卓端的文件访问方式,优化导入逻辑 (#64)
* Refactor import function & Allow import local comics without copying them to local path. * android: use file_picker instead, support directory access for android 10 * Improve import logic * Fix sql query. * Add ability to remove invalid favorite items. * Perform sort before choosing cover * Revert changes of "use file_picker instead". * Try catch on "check update" * Added module 'flutter_saf' * gitignore * remove unsupported arch in build.gradle * Use flutter_saf to handle android's directory and files, improve import logic. * revert changes of 'requestLegacyExternalStorage' * fix cbz import * openDirectoryPlatform * Remove double check on source folder * use openFilePlatform * remove unused import * improve local comic's path handling * bump version * fix pubspec format * return null when comic folder is empty
This commit is contained in:
@@ -86,29 +86,33 @@ Future<bool> checkUpdate() async {
|
||||
}
|
||||
|
||||
Future<void> checkUpdateUi([bool showMessageIfNoUpdate = true]) async {
|
||||
var value = await checkUpdate();
|
||||
if (value) {
|
||||
showDialog(
|
||||
context: App.rootContext,
|
||||
builder: (context) {
|
||||
return ContentDialog(
|
||||
title: "New version available".tl,
|
||||
content: Text(
|
||||
"A new version is available. Do you want to update now?".tl),
|
||||
actions: [
|
||||
Button.text(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
launchUrlString(
|
||||
"https://github.com/venera-app/venera/releases");
|
||||
},
|
||||
child: Text("Update".tl),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
} else if (showMessageIfNoUpdate) {
|
||||
App.rootContext.showMessage(message: "No new version available".tl);
|
||||
try {
|
||||
var value = await checkUpdate();
|
||||
if (value) {
|
||||
showDialog(
|
||||
context: App.rootContext,
|
||||
builder: (context) {
|
||||
return ContentDialog(
|
||||
title: "New version available".tl,
|
||||
content: Text(
|
||||
"A new version is available. Do you want to update now?".tl),
|
||||
actions: [
|
||||
Button.text(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
launchUrlString(
|
||||
"https://github.com/venera-app/venera/releases");
|
||||
},
|
||||
child: Text("Update".tl),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
} else if (showMessageIfNoUpdate) {
|
||||
App.rootContext.showMessage(message: "No new version available".tl);
|
||||
}
|
||||
} catch (e, s) {
|
||||
Log.error("Check Update", e.toString(), s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,16 @@ class _LocalFavoritesSettingsState extends State<LocalFavoritesSettings> {
|
||||
for (var e in LocalFavoritesManager().folderNames) e: e
|
||||
},
|
||||
).toSliver(),
|
||||
_CallbackSetting(
|
||||
title: "Delete all unavailable local favorite items".tl,
|
||||
callback: () async {
|
||||
var controller = showLoadingDialog(context);
|
||||
var count = await LocalFavoritesManager().removeInvalid();
|
||||
controller.close();
|
||||
context.showMessage(message: "Deleted @a favorite items".tlParams({'a': count}));
|
||||
},
|
||||
actionTitle: 'Delete'.tl,
|
||||
).toSliver(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user