mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 21:07:24 +00:00
fix download path settings
This commit is contained in:
@@ -129,9 +129,15 @@ class DownloadingTask {
|
||||
String subPathPatten = appdata.settings["downloadSubPath"];
|
||||
final tagsWeight = (appdata.settings["tagsWeight"] as String).split(' ');
|
||||
final originalTags = List<Tag>.from(illust.tags);
|
||||
print(originalTags);
|
||||
originalTags.sort((a, b){
|
||||
return tagsWeight.indexOf(a.name) - tagsWeight.indexOf(b.name);
|
||||
var aWeight = tagsWeight.indexOf(a.name);
|
||||
if(aWeight == -1) aWeight = tagsWeight.length;
|
||||
var bWeight = tagsWeight.indexOf(b.name);
|
||||
if(bWeight == -1) bWeight = tagsWeight.length;
|
||||
return aWeight - bWeight;
|
||||
});
|
||||
print(originalTags);
|
||||
final tags = appdata.settings["useTranslatedNameForDownload"] == false
|
||||
? originalTags.map((e) => e.name).toList()
|
||||
: originalTags.map((e) => e.translatedName ?? e.name).toList();
|
||||
|
@@ -137,6 +137,11 @@ class Tag {
|
||||
final String? translatedName;
|
||||
|
||||
const Tag(this.name, this.translatedName);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "$name${translatedName == null ? "" : "($translatedName)"}";
|
||||
}
|
||||
}
|
||||
|
||||
class IllustImage {
|
||||
|
@@ -279,10 +279,11 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
|
||||
var text = controller.text;
|
||||
if (check(text)) {
|
||||
appdata.settings["downloadSubPath"] = text;
|
||||
appdata.settings["tagsWeight"] = controller2.text;
|
||||
appdata.writeData();
|
||||
context.pop();
|
||||
} else {
|
||||
showToast(context, message: "No Permission".tl);
|
||||
showToast(context, message: "Invalid".tl);
|
||||
}
|
||||
},
|
||||
).toAlign(Alignment.centerRight).paddingRight(16),
|
||||
@@ -296,11 +297,11 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
|
||||
}
|
||||
|
||||
bool check(String text) {
|
||||
if (!text.startsWith('/') || !text.startsWith('\\')) {
|
||||
return false;
|
||||
}
|
||||
if (text.startsWith('/') || text.startsWith('\\')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
String get _instruction => """
|
||||
${"Edit the rule for where to save an image.".tl}
|
||||
|
Reference in New Issue
Block a user