add novel support
This commit is contained in:
parent
58225ea21d
commit
161750f5dc
6 changed files with 20 additions and 15 deletions
|
|
@ -25,7 +25,7 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_tabBarController = TabController(length: 4, vsync: this);
|
||||
_tabBarController = TabController(length: 6, vsync: this);
|
||||
_tabBarController.animateTo(0);
|
||||
_tabBarController.addListener(() {
|
||||
_chekPermission();
|
||||
|
|
@ -48,7 +48,7 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
|
|||
final l10n = l10nLocalizations(context)!;
|
||||
return DefaultTabController(
|
||||
animationDuration: Duration.zero,
|
||||
length: 4,
|
||||
length: 6,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
import 'package:mangayomi/services/fetch_sources_list.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
|
@ -13,6 +14,6 @@ Future fetchAnimeSourcesList(Ref ref, {int? id, required bool reFresh}) async {
|
|||
refresh: reFresh,
|
||||
id: id,
|
||||
ref: ref,
|
||||
isManga: false);
|
||||
itemType: ItemType.anime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
import 'package:mangayomi/services/fetch_sources_list.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
|
@ -14,6 +15,6 @@ Future fetchMangaSourcesList(Ref ref,
|
|||
refresh: reFresh,
|
||||
id: id,
|
||||
ref: ref,
|
||||
isManga: true);
|
||||
itemType: ItemType.manga);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
import 'package:mangayomi/services/fetch_sources_list.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
|
@ -8,12 +9,13 @@ part 'fetch_novel_sources.g.dart';
|
|||
Future fetchNovelSourcesList(Ref ref,
|
||||
{int? id, required reFresh}) async {
|
||||
if (ref.watch(checkForExtensionsUpdateStateProvider) || reFresh) {
|
||||
return;
|
||||
await fetchSourcesList(
|
||||
sourcesIndexUrl:
|
||||
"https://kodjodevf.github.io/mangayomi-extensions/index.json",
|
||||
"https://kodjodevf.github.io/mangayomi-extensions/novel_index.json",
|
||||
refresh: reFresh,
|
||||
id: id,
|
||||
ref: ref,
|
||||
isManga: true);
|
||||
itemType: ItemType.novel);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ part of 'fetch_novel_sources.dart';
|
|||
// **************************************************************************
|
||||
|
||||
String _$fetchNovelSourcesListHash() =>
|
||||
r'110b23568136e32ebfba7e5414bdf524881a8579';
|
||||
r'464573fff74edd4bf1f0bf36eb9ad44ef38accfc';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:isar/isar.dart';
|
|||
import 'package:mangayomi/eval/dart/service.dart';
|
||||
import 'package:mangayomi/eval/javascript/service.dart';
|
||||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
import 'package:mangayomi/services/http/m_client.dart';
|
||||
|
|
@ -14,7 +15,7 @@ Future<void> fetchSourcesList(
|
|||
required bool refresh,
|
||||
required String sourcesIndexUrl,
|
||||
required Ref ref,
|
||||
required bool isManga}) async {
|
||||
required ItemType itemType}) async {
|
||||
final http = MClient.init(reqcopyWith: {'useDartHttpClient': true});
|
||||
final req = await http.get(Uri.parse(sourcesIndexUrl));
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ Future<void> fetchSourcesList(
|
|||
for (var source in sourceList) {
|
||||
if (source.appMinVerReq != null) {
|
||||
if (compareVersions(info.version, source.appMinVerReq!) > -1) {
|
||||
if ((source.isManga ?? true) == isManga) {
|
||||
if (source.itemType == itemType || (!source.isManga! && itemType == ItemType.anime)) {
|
||||
if (id != null) {
|
||||
if (id == source.id) {
|
||||
final sourc = isar.sources.getSync(id)!;
|
||||
|
|
@ -51,7 +52,7 @@ Future<void> fetchSourcesList(
|
|||
..name = source.name
|
||||
..version = source.version
|
||||
..versionLast = source.version
|
||||
..isManga = source.isManga
|
||||
..itemType = itemType
|
||||
..isFullData = source.isFullData ?? false
|
||||
..appMinVerReq = source.appMinVerReq
|
||||
..sourceCodeLanguage = source.sourceCodeLanguage
|
||||
|
|
@ -90,7 +91,7 @@ Future<void> fetchSourcesList(
|
|||
..name = source.name
|
||||
..version = source.version
|
||||
..versionLast = source.version
|
||||
..isManga = source.isManga
|
||||
..itemType = itemType
|
||||
..isFullData = source.isFullData ?? false
|
||||
..appMinVerReq = source.appMinVerReq
|
||||
..sourceCodeLanguage = source.sourceCodeLanguage
|
||||
|
|
@ -120,7 +121,7 @@ Future<void> fetchSourcesList(
|
|||
..name = source.name
|
||||
..version = source.version
|
||||
..versionLast = source.version
|
||||
..isManga = source.isManga
|
||||
..itemType = itemType
|
||||
..sourceCodeLanguage = source.sourceCodeLanguage
|
||||
..isFullData = source.isFullData ?? false
|
||||
..appMinVerReq = source.appMinVerReq
|
||||
|
|
@ -132,14 +133,14 @@ Future<void> fetchSourcesList(
|
|||
}
|
||||
}
|
||||
});
|
||||
checkIfSourceIsObsolete(sourceList, isManga);
|
||||
checkIfSourceIsObsolete(sourceList, itemType);
|
||||
}
|
||||
|
||||
void checkIfSourceIsObsolete(List<Source> sourceList, bool isManga) {
|
||||
void checkIfSourceIsObsolete(List<Source> sourceList, ItemType itemType) {
|
||||
for (var source in isar.sources
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.isMangaEqualTo(isManga)
|
||||
.itemTypeEqualTo(itemType)
|
||||
.findAllSync()) {
|
||||
if (sourceList.isNotEmpty && !(source.isLocal ?? false)) {
|
||||
final ids =
|
||||
|
|
|
|||
Loading…
Reference in a new issue