Skip to content

Commit

Permalink
feat: almost 95% tv support is impl
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Feb 5, 2025
1 parent c8ad256 commit 9041b4c
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 142 deletions.
2 changes: 0 additions & 2 deletions lib/controllers/services/anilist/anilist_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ import 'package:anymex/models/Service/online_service.dart';
import 'package:anymex/screens/home_page.dart';
import 'package:anymex/screens/library/online/anime_list.dart';
import 'package:anymex/screens/library/online/manga_list.dart';
import 'package:anymex/screens/search/search_anilist.dart';
import 'package:anymex/utils/fallback/fallback_manga.dart' as fbm;
import 'package:anymex/utils/fallback/fallback_anime.dart' as fb;
import 'package:anymex/utils/function.dart';
import 'package:anymex/widgets/common/reusable_carousel.dart';
import 'package:anymex/widgets/common/search_bar.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:http/http.dart';
Expand Down
10 changes: 4 additions & 6 deletions lib/controllers/services/mal/mal_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import 'package:anymex/models/Service/online_service.dart';
import 'package:anymex/screens/home_page.dart';
import 'package:anymex/screens/library/online/anime_list.dart';
import 'package:anymex/screens/library/online/manga_list.dart';
import 'package:anymex/screens/search/search_anilist.dart';
import 'package:anymex/utils/fallback/fallback_manga.dart';
import 'package:anymex/utils/fallback/fallback_anime.dart' as fb;
import 'package:anymex/utils/function.dart';
import 'package:anymex/widgets/common/search_bar.dart';
import 'package:anymex/widgets/non_widgets/snackbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Expand Down Expand Up @@ -218,9 +216,9 @@ class MalService extends GetxController implements BaseService, OnlineService {
)
: const SizedBox.shrink(),
if (isLoggedIn.value) const SizedBox(height: 30),
buildSection("Continue Watching", continueWatching.value,
buildSection("Continue Watching", continueWatching,
variant: DataVariant.anilist),
buildSection("Continue Reading", continueReading.value,
buildSection("Continue Reading", continueReading,
isManga: true, variant: DataVariant.anilist),
buildSectionIfNotEmpty("Trending Animes", trendingAnimes),
buildSectionIfNotEmpty("Popular Animes", popularAnimes),
Expand Down Expand Up @@ -542,10 +540,10 @@ class MalService extends GetxController implements BaseService, OnlineService {
@override
void setCurrentMedia(String id, {bool isManga = false}) {
if (isManga) {
currentMedia.value = mangaList.value
currentMedia.value = mangaList
.firstWhere((el) => el.id == id, orElse: () => TrackedMedia());
} else {
currentMedia.value = animeList.value
currentMedia.value = animeList
.firstWhere((el) => el.id == id, orElse: () => TrackedMedia());
}
}
Expand Down
3 changes: 0 additions & 3 deletions lib/controllers/services/simkl/simkl_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import 'package:anymex/models/Service/base_service.dart';
import 'package:anymex/models/Service/online_service.dart';
import 'package:anymex/screens/home_page.dart';
import 'package:anymex/screens/library/online/anime_list.dart';
import 'package:anymex/screens/manga/widgets/search_selector.dart';
import 'package:anymex/screens/search/search_anilist.dart';
import 'package:anymex/utils/function.dart';
import 'package:anymex/widgets/common/big_carousel.dart';
import 'package:anymex/widgets/common/reusable_carousel.dart';
import 'package:anymex/widgets/common/search_bar.dart';
import 'package:anymex/widgets/non_widgets/snackbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Expand Down
14 changes: 6 additions & 8 deletions lib/core/Extensions/fetch_anime_sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ part 'fetch_anime_sources.g.dart';
@riverpod
Future fetchAnimeSourcesList(FetchAnimeSourcesListRef ref,
{int? id, required bool reFresh}) async {
if ((true) || reFresh) {
await fetchSourcesList(
sourcesIndexUrl: Get.find<SourceController>().activeAnimeRepo,
refresh: reFresh,
id: id,
ref: ref,
isManga: false);
}
await fetchSourcesList(
sourcesIndexUrl: Get.find<SourceController>().activeAnimeRepo,
refresh: reFresh,
id: id,
ref: ref,
isManga: false);
}
14 changes: 6 additions & 8 deletions lib/core/Extensions/fetch_manga_sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ part 'fetch_manga_sources.g.dart';
@riverpod
Future fetchMangaSourcesList(FetchMangaSourcesListRef ref,
{int? id, required reFresh}) async {
if ((true ?? true) || reFresh) {
await fetchSourcesList(
sourcesIndexUrl: Get.find<SourceController>().activeMangaRepo,
refresh: reFresh,
id: id,
ref: ref,
isManga: true);
}
await fetchSourcesList(
sourcesIndexUrl: Get.find<SourceController>().activeMangaRepo,
refresh: reFresh,
id: id,
ref: ref,
isManga: true);
}
1 change: 0 additions & 1 deletion lib/models/Media/media.dart
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ class Recommendation {

factory Recommendation.fromSmallSimkl(
Map<String?, dynamic> json, bool isMovie) {
MediaType type = MediaType.anime;
return Recommendation(
id:
'${json['ids']?['simkl']?.toString()}*${isMovie ? "MOVIE" : "SERIES"}',
Expand Down
16 changes: 7 additions & 9 deletions lib/screens/anime/widgets/episode_list_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,12 @@ class _EpisodeListBuilderState extends State<EpisodeListBuilder> {
? 0.8
: 1,
child: TVWrapper(
child: InkWell(
onTap: () => isSelected
? fetchServers(episode.link!)
: _handleEpisodeSelection(episode),
child: isAnify.value
? _anifyEpisode(isSelected, context, episode)
: _normalEpisode(isSelected, context, episode),
),
onTap: () => isSelected
? fetchServers(episode.link!)
: _handleEpisodeSelection(episode),
child: isAnify.value
? _anifyEpisode(isSelected, context, episode)
: _normalEpisode(isSelected, context, episode),
),
);
});
Expand Down Expand Up @@ -242,7 +240,7 @@ class _EpisodeListBuilderState extends State<EpisodeListBuilder> {
Get.back();
Get.to(() => WatchPage(
episodeSrc: e,
episodeList: widget.episodeList ?? [],
episodeList: widget.episodeList,
anilistData: widget.anilistData!,
currentEpisode: selectedEpisode.value,
episodeTracks: streamList,
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/anime/widgets/episode_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _TitleSection extends StatelessWidget {
onTap: () {
showWrongTitleModal(
context,
anilistData.title,
anilistData.romajiTitle,
(manga) async {
episodeList?.clear();
await getDetailsFromSource(
Expand Down Expand Up @@ -322,7 +322,7 @@ class _EpisodeList extends StatelessWidget {
);
}

if (episodeList!.value.isEmpty || episodeList == null) {
if (episodeList!.isEmpty || episodeList == null) {
return const SizedBox(
height: 500,
child: Center(child: CircularProgressIndicator()),
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/anime/widgets/episode_watch_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class _EpisodeWatchScreenState extends State<EpisodeWatchScreen> {
}

return Obx(() {
final chunkedEpisodes = chunkEpisodes(widget.episodeList ?? [],
calculateChunkSize(widget.episodeList ?? []));
final chunkedEpisodes = chunkEpisodes(
widget.episodeList, calculateChunkSize(widget.episodeList));
final selectedEpisodes = chunkedEpisodes.isNotEmpty
? chunkedEpisodes[selectedChunkIndex.value]
: [];
Expand Down
27 changes: 17 additions & 10 deletions lib/screens/library/anime_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -397,24 +397,31 @@ class AnimeHistoryCard extends StatelessWidget {
child: TVWrapper(
onTap: () {
if (data.currentEpisode == null ||
data.currentEpisode!.currentTrack == null ||
data.currentEpisode?.currentTrack == null ||
data.episodes == null ||
data.currentEpisode!.videoTracks == null) {
data.currentEpisode?.videoTracks == null) {
snackBar(
"Error: Missing required data. It seems you closed the app directly after watching the episode!",
duration: 2000,
maxLines: 3,
maxWidth: Get.width * 0.6);
} else {
Get.find<SourceController>()
if (data.currentEpisode?.source == null) {
snackBar("Cant Play since user closed the app abruptly");
}
final source = Get.find<SourceController>()
.getExtensionByName(data.currentEpisode!.source!);
Get.to(() => WatchPage(
episodeSrc: data.currentEpisode!.currentTrack!,
episodeList: data.episodes!,
anilistData: convertOfflineToMedia(data),
currentEpisode: data.currentEpisode!,
episodeTracks: data.currentEpisode!.videoTracks!,
));
if (source == null) {
snackBar("You Dont have the exact needed extension to run this");
} else {
Get.to(() => WatchPage(
episodeSrc: data.currentEpisode!.currentTrack!,
episodeList: data.episodes!,
anilistData: convertOfflineToMedia(data),
currentEpisode: data.currentEpisode!,
episodeTracks: data.currentEpisode!.videoTracks!,
));
}
}
},
child: ClipRRect(
Expand Down
32 changes: 25 additions & 7 deletions lib/screens/manga/reading_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,7 @@ class _ReadingPageState extends State<ReadingPage> {
_buildWebtoonMode()
else if (activeMode.value != ReadingMode.webtoon)
InteractiveViewer(
minScale: 0.5,
maxScale: 4,
child: _buildPageViewMode())
minScale: 0.5, maxScale: 4, child: _buildPageViewMode())
else
InteractiveViewer(
minScale: 0.5,
Expand Down Expand Up @@ -571,10 +569,15 @@ class _ReadingPageState extends State<ReadingPage> {
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
bottom: isMenuToggled.value ? 0 : -150,
left: 0,
right: 0,
left: getResponsiveSize(context,
mobileSize: 0, dektopSize: Get.width * 0.3),
right: getResponsiveSize(context,
mobileSize: 0, dektopSize: Get.width * 0.3),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
padding: getResponsiveValue(context,
mobileValue:
const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
desktopValue: const EdgeInsets.all(0)),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
Expand All @@ -587,7 +590,20 @@ class _ReadingPageState extends State<ReadingPage> {
),
),
child: Container(
margin: const EdgeInsets.only(bottom: 30),
decoration: BoxDecoration(
color: getResponsiveValue(context,
mobileValue: Colors.transparent,
desktopValue: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.6)),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
padding: EdgeInsets.all(
getResponsiveSize(context, mobileSize: 0, dektopSize: 10)),
margin: EdgeInsets.only(
bottom:
getResponsiveSize(context, mobileSize: 30, dektopSize: 0)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down Expand Up @@ -666,6 +682,8 @@ class _ReadingPageState extends State<ReadingPage> {
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return Container(
height: getResponsiveSize(context,
mobileSize: 300, dektopSize: Get.height * 0.5),
padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
Expand Down
Loading

0 comments on commit 9041b4c

Please sign in to comment.