This commit is contained in:
Francesco 2025-04-12 15:17:56 +02:00
parent 0c35749855
commit 0dfaa4614f
6 changed files with 12 additions and 13 deletions

View file

@ -88,7 +88,7 @@ class AniListMutation {
if let data = data {
do {
let responseJSON = try JSONSerialization.jsonObject(with: data, options: [])
_ = try JSONSerialization.jsonObject(with: data, options: [])
Logger.shared.log("Successfully updated anime progress", type: "Debug")
completion(.success(()))
} catch {

View file

@ -1035,7 +1035,6 @@ class CustomMediaPlayerViewController: UIViewController {
let remainingPercentage = (self.duration - self.currentTimeVal) / self.duration
if remainingPercentage < 0.1 &&
self.module.metadata.type == "anime" &&
self.aniListID != 0 &&
!self.aniListUpdatedSuccessfully &&
!self.aniListUpdateImpossible
@ -1077,8 +1076,8 @@ class CustomMediaPlayerViewController: UIViewController {
if isNearEnd {
if !isWatchNextVisible {
watchNextButtonAppearedAt = currentTimeVal
if !self.isWatchNextVisible {
self.watchNextButtonAppearedAt = self.currentTimeVal
}
} else {

View file

@ -134,7 +134,7 @@ class VideoPlayerViewController: UIViewController {
let remainingPercentage = (duration - currentTime) / duration
if remainingPercentage < 0.1 && self.module.metadata.type == "anime" && self.aniListID != 0 {
if remainingPercentage < 0.1 && self.aniListID != 0 {
let aniListMutation = AniListMutation()
aniListMutation.updateAnimeProgress(animeId: self.aniListID, episodeNumber: self.episodeNumber) { result in
switch result {

View file

@ -20,7 +20,7 @@ struct EpisodeCell: View {
let episodeID: Int
let progress: Double
let itemID: Int
let isAnime: Bool
let useAnilist: Bool
let tmdbID: Int?
let onTap: (String) -> Void
@ -32,14 +32,14 @@ struct EpisodeCell: View {
@State private var currentProgress: Double = 0.0
init(episodeIndex: Int, episode: String, episodeID: Int, progress: Double,
itemID: Int, isAnime: Bool = true, tmdbID: Int? = nil,
itemID: Int, useAnilist: Bool = true, tmdbID: Int? = nil,
onTap: @escaping (String) -> Void, onMarkAllPrevious: @escaping () -> Void) {
self.episodeIndex = episodeIndex
self.episode = episode
self.episodeID = episodeID
self.progress = progress
self.itemID = itemID
self.isAnime = isAnime
self.useAnilist = useAnilist
self.tmdbID = tmdbID
self.onTap = onTap
self.onMarkAllPrevious = onMarkAllPrevious
@ -140,7 +140,7 @@ struct EpisodeCell: View {
}
private func fetchEpisodeDetails() {
if isAnime {
if useAnilist {
fetchAnimeEpisodeDetails()
} else {
fetchTMDBEpisodeDetails()

View file

@ -241,7 +241,7 @@ struct MediaInfoView: View {
episodeID: ep.number - 1,
progress: progress,
itemID: itemID ?? 0,
isAnime: module.metadata.type?.lowercased() == "anime",
useAnilist: UserDefaults.standard.string(forKey: "metadataProviders") == "AniList",
tmdbID: tmdbID,
onTap: { imageUrl in
if !isFetchingEpisode {
@ -293,7 +293,7 @@ struct MediaInfoView: View {
episodeID: ep.number - 1,
progress: progress,
itemID: itemID ?? 0,
isAnime: module.metadata.type?.lowercased() == "anime",
useAnilist: UserDefaults.standard.string(forKey: "metadataProviders") == "AniList",
tmdbID: tmdbID,
onTap: { imageUrl in
if !isFetchingEpisode {
@ -376,7 +376,7 @@ struct MediaInfoView: View {
DropManager.shared.showDrop(title: "Fetching Data", subtitle: "Please wait while fetching.", duration: 0.5, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
fetchDetails()
if module.metadata.type == "anime" {
if UserDefaults.standard.string(forKey: "metadataProviders") == "AniList" {
fetchItemID(byTitle: cleanTitle(title)) { result in
switch result {
case .success(let id):

View file

@ -17,7 +17,7 @@ struct SettingsViewGeneral: View {
@AppStorage("mediaColumnsPortrait") private var mediaColumnsPortrait: Int = 2
@AppStorage("mediaColumnsLandscape") private var mediaColumnsLandscape: Int = 4
private let metadataProvidersList = ["AniList"]
private let metadataProvidersList = ["AniList", "TMDB"]
@EnvironmentObject var settings: Settings
var body: some View {