mirror of
https://github.com/K3vinb5/Unyo.git
synced 2026-06-13 05:49:42 +00:00
Fixed Local Extensions on Windows
This commit is contained in:
@@ -53,9 +53,6 @@ Future<void> main() async {
|
||||
Locale('it'),
|
||||
Locale('pt'),
|
||||
Locale('ru'),
|
||||
// Locale('po'),
|
||||
// Locale('zh-cn'),
|
||||
// Locale('zh-hk')
|
||||
],
|
||||
useOnlyLangCode: true,
|
||||
path: 'assets/languages',
|
||||
|
||||
@@ -12,14 +12,14 @@ class MediaContentModel {
|
||||
if (response.statusCode != 200){
|
||||
if (attempt < 5){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, dynamic> jsonResponse = json.decode(response.body);
|
||||
Map<String, dynamic> episodes = jsonResponse["episodes"];
|
||||
imageUrls = episodes.values.map((e) => e["image"] as String?).toList();
|
||||
titles = episodes.values.map((e) => e["title"]["en"] as String?).toList();
|
||||
fanart = jsonResponse["images"][2]["url"];
|
||||
banner = jsonResponse["images"][0]["url"];
|
||||
fanart = jsonResponse["images"]?[2]["url"];
|
||||
banner = jsonResponse["images"]?[0]["url"];
|
||||
// if (titles != null){
|
||||
// titles!.addAll(List.filled(10, null));
|
||||
// }
|
||||
|
||||
@@ -24,6 +24,7 @@ class PreferencesModel {
|
||||
}
|
||||
String? version = sharedPreferences.getString("version");
|
||||
if(version == null || version != currentVersion){
|
||||
print("New version, updating api");
|
||||
processManager.downloadNewCore();
|
||||
}
|
||||
sharedPreferences.setString("version", currentVersion);
|
||||
|
||||
@@ -200,9 +200,10 @@ class _LocalExtensionsScreenState extends State<LocalExtensionsScreen> {
|
||||
List<String> updatedinstalledExtensions = await animeExtensionsDir
|
||||
.list()
|
||||
.map((fileSystemEntity) => fileSystemEntity.path
|
||||
.substring(fileSystemEntity.path.lastIndexOf("/") + 1)
|
||||
.substring(fileSystemEntity.path.lastIndexOf(Platform.isWindows ? "\\" : "/") + 1)
|
||||
.replaceFirst(".jar", ""))
|
||||
.toList();
|
||||
print(updatedinstalledExtensions);
|
||||
setState(() {
|
||||
installedAnimeExtensions = updatedinstalledExtensions;
|
||||
});
|
||||
@@ -215,7 +216,7 @@ class _LocalExtensionsScreenState extends State<LocalExtensionsScreen> {
|
||||
List<String> updatedinstalledExtensions = await mangaExtensionsDir
|
||||
.list()
|
||||
.map((fileSystemEntity) => fileSystemEntity.path
|
||||
.substring(fileSystemEntity.path.lastIndexOf("/") + 1)
|
||||
.substring(fileSystemEntity.path.lastIndexOf(Platform.isWindows ? "\\" :"/") + 1)
|
||||
.replaceFirst(".jar", ""))
|
||||
.toList();
|
||||
setState(() {
|
||||
|
||||
@@ -17,26 +17,17 @@ class ProcessManager {
|
||||
|
||||
Future<void> _extractJar({bool ignore = false}) async {
|
||||
supportDirectoryPath = await getApplicationSupportDirectory();
|
||||
final jarFile = File(p.join(supportDirectoryPath.path,
|
||||
"extensions.jar")); /*Platform.isWindows
|
||||
? File('${supportDirectoryPath.path}\\extensions.jar')
|
||||
: File('${supportDirectoryPath.path}//extensions.jar');*/
|
||||
final jarFile = File(p.join(supportDirectoryPath.path, "extensions.jar"));
|
||||
|
||||
if (await jarFile.exists() && !ignore) {
|
||||
_jarPath = jarFile.path;
|
||||
return;
|
||||
}
|
||||
|
||||
final byteData = await rootBundle.load(p.join("assets",
|
||||
"extensions.jar") /*Platform.isWindows
|
||||
? 'assets\\extensions.jar'
|
||||
: 'assets//extensions.jar'*/
|
||||
);
|
||||
// NOTE, even for windows, the slash must be forawd on this one
|
||||
final byteData = await rootBundle.load("assets/extensions.jar");
|
||||
final buffer = byteData.buffer;
|
||||
final file = File(p.join(supportDirectoryPath.path,
|
||||
"extensions.jar")); /*Platform.isWindows
|
||||
? File('${supportDirectoryPath.path}\\extensions.jar')
|
||||
: File('${supportDirectoryPath.path}//extensions.jar');*/
|
||||
final file = File(p.join(supportDirectoryPath.path, "extensions.jar"));
|
||||
await file.writeAsBytes(
|
||||
buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
|
||||
_jarPath = file.path;
|
||||
|
||||
0
linux-appimage/Unyo.AppDir/AppRun
Executable file → Normal file
0
linux-appimage/Unyo.AppDir/AppRun
Executable file → Normal file
0
linux-appimage/appimagetool.AppImage
Executable file → Normal file
0
linux-appimage/appimagetool.AppImage
Executable file → Normal file
Reference in New Issue
Block a user