Skip to content

Commit

Permalink
chore: cleaned up some cods
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Dec 2, 2024
1 parent 1e1d839 commit 6ef1209
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 52 deletions.
12 changes: 0 additions & 12 deletions lib/utils/sources/manga/extensions/mangafire.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:developer';
import 'package:anymex/utils/sources/manga/base/source_base.dart';
import 'package:anymex/utils/sources/manga/helper/jaro_helper.dart';
import 'package:http/http.dart' as http;
import 'package:html/parser.dart';
import 'dart:async';
Expand Down Expand Up @@ -252,17 +251,6 @@ class MangaFire implements SourceBase {
@override
String get baseUrl => url;

@override
Future<dynamic> mapToAnilist(String id, {int page = 1}) async {
final mangaList = await fetchMangaSearchResults(id);
String bestMatchId = findBestMatch(id, mangaList);
if (bestMatchId.isNotEmpty) {
return await fetchMangaChapters(bestMatchId);
} else {
throw Exception('No suitable match found for the query');
}
}

@override
String get sourceName => 'MangaFire';

Expand Down
11 changes: 0 additions & 11 deletions lib/utils/sources/manga/extensions/mangakakalot.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:developer';
import 'package:anymex/utils/sources/manga/helper/jaro_helper.dart';
import 'package:anymex/utils/sources/manga/base/source_base.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -122,16 +121,6 @@ class MangaKakalot implements SourceBase {
}
}

@override
Future<dynamic> mapToAnilist(String query) async {
final mangaList = await fetchMangaSearchResults(query);
String bestMatchId = findBestMatch(query, mangaList);
if (bestMatchId.isNotEmpty) {
return await fetchMangaChapters(bestMatchId);
} else {
throw Exception('No suitable match found for the query');
}
}

@override
Future<dynamic> fetchChapterImages({
Expand Down
12 changes: 0 additions & 12 deletions lib/utils/sources/manga/extensions/mangakakalot_unofficial.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// ignore_for_file: empty_c
import 'dart:developer';

import 'package:anymex/utils/sources/manga/helper/jaro_helper.dart';
import 'package:anymex/utils/sources/manga/base/source_base.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -203,15 +202,4 @@ class MangaKakalotUnofficial implements SourceBase {
throw Exception('Error: $e');
}
}

@override
Future<dynamic> mapToAnilist(String id, {int page = 1}) async {
final mangaList = await fetchMangaSearchResults(id);
String bestMatchId = findBestMatch(id, mangaList);
if (bestMatchId.isNotEmpty) {
return await fetchMangaChapters(bestMatchId);
} else {
throw Exception('No suitable match found for the query');
}
}
}
11 changes: 0 additions & 11 deletions lib/utils/sources/manga/extensions/manganato.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:developer';
import 'package:anymex/utils/sources/manga/helper/jaro_helper.dart';
import 'package:anymex/utils/sources/manga/base/source_base.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -205,14 +204,4 @@ class MangaNato implements SourceBase {
}
}

@override
Future<dynamic> mapToAnilist(String id, {int page = 1}) async {
final mangaList = await fetchMangaSearchResults(id);
String bestMatchId = findBestMatch(id, mangaList);
if (bestMatchId.isNotEmpty) {
return await fetchMangaChapters(bestMatchId);
} else {
throw Exception('No suitable match found for the query');
}
}
}
10 changes: 6 additions & 4 deletions lib/utils/sources/manga/handlers/manga_sources_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:anymex/utils/sources/manga/extensions/mangafire.dart';
import 'package:anymex/utils/sources/manga/extensions/mangakakalot.dart';
import 'package:anymex/utils/sources/manga/extensions/mangakakalot_unofficial.dart';
import 'package:anymex/utils/sources/manga/extensions/manganato.dart';
import 'package:anymex/utils/sources/manga/helper/jaro_helper.dart';
import 'package:hive/hive.dart';
import '../base/source_base.dart';

Expand Down Expand Up @@ -84,11 +85,12 @@ class MangaSourceHandler {
}

Future<dynamic> mapToAnilist(String query) async {
final source = _getSource(selectedSourceName);
if (source != null) {
return await source.mapToAnilist(query);
final mangaList = await fetchMangaSearchResults(query);
String bestMatchId = findBestMatch(query, mangaList);
if (bestMatchId.isNotEmpty) {
return await fetchMangaChapters(bestMatchId);
} else {
log("No source available or selected to fetch chapter images");
throw Exception('No suitable match found for the query');
}
}
}
1 change: 0 additions & 1 deletion lib/utils/update_notifier.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:package_info_plus/package_info_plus.dart';
Expand Down
2 changes: 1 addition & 1 deletion macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import flutter_local_notifications
import flutter_web_auth_2
import package_info_plus
import path_provider_foundation
import sqflite_darwin
import sqflite
import url_launcher_macos
import wakelock_plus
import window_to_front
Expand Down

0 comments on commit 6ef1209

Please sign in to comment.