mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 21:35:32 +00:00
refactor
This commit is contained in:
parent
cd574e636c
commit
9ca43e4f8e
13 changed files with 52 additions and 133 deletions
|
|
@ -52,7 +52,15 @@ class _AboutScreenState extends State<AboutScreen> {
|
|||
),
|
||||
body: Column(
|
||||
children: [
|
||||
const SizedBox(height: 150, child: Center(child: Text("LOGO"))),
|
||||
SizedBox(
|
||||
height: 150,
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
"assets/icon.png",
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
))),
|
||||
Flexible(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ part of 'flex_scheme_color_state_provider.dart';
|
|||
// **************************************************************************
|
||||
|
||||
String _$flexSchemeColorStateHash() =>
|
||||
r'a8b6bdbfce0d97a3fd9f95fceea81205e275a4b4';
|
||||
r'5c535382cc52e144426fa36dc20ea614d6288f53';
|
||||
|
||||
/// See also [FlexSchemeColorState].
|
||||
@ProviderFor(FlexSchemeColorState)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ part of 'theme_mode_state_provider.dart';
|
|||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$themeModeStateHash() => r'6b366dcb03de67cfd2d792d3a9e6678da9e6869c';
|
||||
String _$themeModeStateHash() => r'49a0f05f3d5eb1fcd49ec3c8c0d0b57a732b54fc';
|
||||
|
||||
/// See also [ThemeModeState].
|
||||
@ProviderFor(ThemeModeState)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class CloudflareBypassDomProvider extends AutoDisposeFutureProvider<Document?> {
|
|||
}
|
||||
|
||||
String _$cloudflareBypassHtmlHash() =>
|
||||
r'8c1d6820ba10fe5ddfe6ce532e1e4677b563ceee';
|
||||
r'fdc35dcbef7c4cb9fcca41d70208c4e82f9eb146';
|
||||
typedef CloudflareBypassHtmlRef = AutoDisposeFutureProviderRef<String>;
|
||||
|
||||
/// See also [cloudflareBypassHtml].
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/models/chapter.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/services/http_service/http_res_to_dom_html.dart';
|
||||
import 'package:mangayomi/sources/multisrc/heancms/model/search.dart';
|
||||
import 'package:mangayomi/sources/multisrc/heancms/utils/utils.dart';
|
||||
|
|
@ -121,14 +120,7 @@ class HeanCms extends MangaYomiServices {
|
|||
}
|
||||
|
||||
for (var a in data) {
|
||||
final status = (switch (a.status) {
|
||||
"Ongoing" => Status.ongoing,
|
||||
"Hiatus" => Status.onHiatus,
|
||||
"Dropped" => Status.canceled,
|
||||
"Completed" => Status.completed,
|
||||
"Finished" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
final status = parseHeanCmsStatus(a.status!);
|
||||
statusList.add(status);
|
||||
image.add(a.thumbnail!.startsWith("https://")
|
||||
? a.thumbnail
|
||||
|
|
@ -165,14 +157,7 @@ class HeanCms extends MangaYomiServices {
|
|||
}
|
||||
|
||||
for (var a in data) {
|
||||
final status = (switch (a.status) {
|
||||
"Ongoing" => Status.ongoing,
|
||||
"Hiatus" => Status.onHiatus,
|
||||
"Dropped" => Status.canceled,
|
||||
"Completed" => Status.completed,
|
||||
"Finished" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
final status = parseHeanCmsStatus(a.status!);
|
||||
statusList.add(status);
|
||||
image.add(a.thumbnail!.startsWith("https://")
|
||||
? a.thumbnail
|
||||
|
|
@ -212,14 +197,7 @@ class HeanCms extends MangaYomiServices {
|
|||
}
|
||||
|
||||
for (var a in data) {
|
||||
final status = (switch (a.status) {
|
||||
"Ongoing" => Status.ongoing,
|
||||
"Hiatus" => Status.onHiatus,
|
||||
"Dropped" => Status.canceled,
|
||||
"Completed" => Status.completed,
|
||||
"Finished" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
final status = parseHeanCmsStatus(a.status!);
|
||||
statusList.add(status);
|
||||
image.add(a.thumbnail!.startsWith("https://")
|
||||
? a.thumbnail
|
||||
|
|
|
|||
|
|
@ -1,2 +1,14 @@
|
|||
import 'package:mangayomi/models/manga.dart';
|
||||
|
||||
RegExp timeStampRegex = RegExp("-\\d+");
|
||||
RegExp timeStampRegex = RegExp("-\\d+");
|
||||
|
||||
parseHeanCmsStatus(String status) {
|
||||
return switch (status) {
|
||||
"Ongoing" => Status.ongoing,
|
||||
"Hiatus" => Status.onHiatus,
|
||||
"Dropped" => Status.canceled,
|
||||
"Completed" => Status.completed,
|
||||
"Finished" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -53,7 +52,6 @@ class Madara extends MangaYomiServices {
|
|||
} else {
|
||||
pageUrls = imgs;
|
||||
}
|
||||
log(pageUrls.toString());
|
||||
|
||||
return pageUrls;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,16 +141,6 @@ class Comick extends MangaYomiServices {
|
|||
return pageUrls;
|
||||
}
|
||||
|
||||
Future<String> paginatedChapterListRequest(AutoDisposeFutureProviderRef ref,
|
||||
String mangaUrl, int page, String source, String lang) async {
|
||||
final response = await ref.watch(httpGetProvider(
|
||||
url:
|
||||
"${getMangaAPIUrl(source)}$mangaUrl/chapters?${lang != "all" ? 'lang=$lang' : ''}&tachiyomi=true&page=$page",
|
||||
source: source,
|
||||
resDom: false)
|
||||
.future) as String?;
|
||||
return response!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<GetManga?>> getLatestUpdatesManga(
|
||||
|
|
|
|||
|
|
@ -1,96 +1,29 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/services/http_service/http_service.dart';
|
||||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
|
||||
parseStatut(int i) {
|
||||
return (switch (i) {
|
||||
return switch (i) {
|
||||
1 => Status.ongoing,
|
||||
2 => Status.completed,
|
||||
3 => Status.canceled,
|
||||
4 => Status.onHiatus,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
}
|
||||
|
||||
Future findCurrentSlug(String oldSlug, AutoDisposeFutureProviderRef ref) async {
|
||||
var request = http.Request('GET',
|
||||
Uri.parse('https://api.comick.fun/tachiyomi/mapping?slugs=$oldSlug'));
|
||||
|
||||
request.headers.addAll(ref.watch(headersProvider(source: "comick")));
|
||||
|
||||
http.StreamedResponse response = await request.send();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return await response.stream.bytesToString();
|
||||
} else {
|
||||
return response.reasonPhrase;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
beautifyChapterName(String? vol, String? chap, String? title, String? lang) {
|
||||
return "${vol!.isNotEmpty ? chap!.isEmpty ? "Volume $vol " : "Vol. $vol " : ""}${chap!.isNotEmpty ? vol.isEmpty ? lang == "fr" ? "Chapitre $chap" : "Chapter $chap" : "Ch. $chap " : ""}${title!.isNotEmpty ? chap.isEmpty ? title : " : $title" : ""}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// class ChapterList {
|
||||
// List<Chapter> chapters;
|
||||
// int total;
|
||||
|
||||
// ChapterList({
|
||||
// required this.chapters,
|
||||
// required this.total,
|
||||
// });
|
||||
|
||||
// factory ChapterList.fromJson(Map<String, dynamic> json) {
|
||||
// return ChapterList(
|
||||
// chapters: (json['chapters'] as List).map((item) => Chapter.fromJson(item)).toList(),
|
||||
// total: json['total'],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class Chapter {
|
||||
// String hid;
|
||||
// String chap;
|
||||
// String? vol;
|
||||
// String? title;
|
||||
// String? created_at;
|
||||
// List<String> group_name;
|
||||
|
||||
// Chapter({
|
||||
// required this.hid,
|
||||
// required this.chap,
|
||||
// this.vol,
|
||||
// this.title,
|
||||
// this.created_at,
|
||||
// required this.group_name,
|
||||
// });
|
||||
|
||||
// factory Chapter.fromJson(Map<String, dynamic> json) {
|
||||
// return Chapter(
|
||||
// hid: json['hid'],
|
||||
// chap: json['chap'],
|
||||
// vol: json['vol'],
|
||||
// title: json['title'],
|
||||
// created_at: json['created_at'],
|
||||
// group_name: (json['group_name'] as List).map((item) => item.toString()).toList(),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// class SChapter {
|
||||
// String? url;
|
||||
// String? name;
|
||||
// int? date_upload;
|
||||
// String? scanlator;
|
||||
|
||||
// SChapter.create();
|
||||
|
||||
// // Add any additional properties and methods as needed
|
||||
// }
|
||||
Future<String> paginatedChapterListRequest(AutoDisposeFutureProviderRef ref,
|
||||
String mangaUrl, int page, String source, String lang) async {
|
||||
final response = await ref.watch(httpGetProvider(
|
||||
url:
|
||||
"${getMangaAPIUrl(source)}$mangaUrl/chapters?${lang != "all" ? 'lang=$lang' : ''}&tachiyomi=true&page=$page",
|
||||
source: source,
|
||||
resDom: false)
|
||||
.future) as String?;
|
||||
return response!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ class Mangahere extends MangaYomiServices {
|
|||
.map((e) => e.text.trim())
|
||||
.toList();
|
||||
|
||||
status = (switch (tt[0]) {
|
||||
status = switch (tt[0]) {
|
||||
"ongoing" => Status.ongoing,
|
||||
"completed" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
};
|
||||
} else {
|
||||
status = Status.unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ class Japscan extends MangaYomiServices {
|
|||
|
||||
if (stat.isNotEmpty) {
|
||||
String sta = stat[0].replaceAll('Statut:', '').trim();
|
||||
status = (switch (sta) {
|
||||
status = switch (sta) {
|
||||
"En Cours" => Status.ongoing,
|
||||
"Terminé" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
};
|
||||
} else {
|
||||
status = Status.unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ class MangaKawaii extends MangaYomiServices {
|
|||
}
|
||||
}
|
||||
detail = detail.toSet().toList();
|
||||
status = (switch (detail[0]) {
|
||||
status = switch (detail[0]) {
|
||||
"En Cours" => Status.ongoing,
|
||||
"Terminé" => Status.completed,
|
||||
_ => Status.unknown,
|
||||
});
|
||||
};
|
||||
author = detail[1];
|
||||
if (dom.querySelectorAll("tr[class*='volume-']").isNotEmpty) {
|
||||
final url = dom.querySelectorAll("tr[class*='volume-']").map((e) {
|
||||
|
|
|
|||
|
|
@ -5,21 +5,21 @@ const defaultUserAgent =
|
|||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0";
|
||||
|
||||
String getMangaStatusName(Status status) {
|
||||
return (switch (status) {
|
||||
return switch (status) {
|
||||
Status.ongoing => "Ongoing",
|
||||
Status.onHiatus => "On hiatus",
|
||||
Status.canceled => "Canceled",
|
||||
Status.completed => "Completed",
|
||||
_ => "Unknown",
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
IconData getMangaStatusIcon(Status status) {
|
||||
return (switch (status) {
|
||||
return switch (status) {
|
||||
Status.ongoing => Icons.schedule_rounded,
|
||||
Status.onHiatus => Icons.pause_circle_rounded,
|
||||
Status.canceled => Icons.cancel_rounded,
|
||||
Status.completed => Icons.done_all_rounded,
|
||||
_ => Icons.block_outlined,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue