mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-06 18:19:35 +00:00
Testflight (#73)
This commit is contained in:
commit
41dbd6892c
6 changed files with 42 additions and 41 deletions
|
|
@ -920,6 +920,24 @@ class CustomMediaPlayerViewController: UIViewController {
|
|||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if let currentItem = self.player.currentItem, currentItem.duration.seconds > 0 {
|
||||
let progress = min(max(self.currentTimeVal / self.duration, 0), 1.0)
|
||||
|
||||
let item = ContinueWatchingItem(
|
||||
id: UUID(),
|
||||
imageUrl: self.episodeImageUrl,
|
||||
episodeNumber: self.episodeNumber,
|
||||
mediaTitle: self.titleText,
|
||||
progress: progress,
|
||||
streamUrl: self.streamURL,
|
||||
fullUrl: self.fullUrl,
|
||||
subtitles: self.subtitlesURL,
|
||||
aniListID: self.aniListID,
|
||||
module: self.module
|
||||
)
|
||||
ContinueWatchingManager.shared.save(item: item)
|
||||
}
|
||||
|
||||
let remainingPercentage = (self.duration - self.currentTimeVal) / self.duration
|
||||
|
||||
if remainingPercentage < 0.1 && self.module.metadata.type == "anime" && self.aniListID != 0 {
|
||||
|
|
@ -1008,23 +1026,6 @@ class CustomMediaPlayerViewController: UIViewController {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
if let currentItem = player.currentItem, currentItem.duration.seconds > 0 {
|
||||
let progress = currentTimeVal / currentItem.duration.seconds
|
||||
let item = ContinueWatchingItem(
|
||||
id: UUID(),
|
||||
imageUrl: episodeImageUrl,
|
||||
episodeNumber: episodeNumber,
|
||||
mediaTitle: titleText,
|
||||
progress: progress,
|
||||
streamUrl: streamURL,
|
||||
fullUrl: fullUrl,
|
||||
subtitles: subtitlesURL,
|
||||
aniListID: aniListID,
|
||||
module: module
|
||||
)
|
||||
ContinueWatchingManager.shared.save(item: item)
|
||||
}
|
||||
}
|
||||
|
||||
func repositionWatchNextButton() {
|
||||
|
|
@ -1581,7 +1582,7 @@ class CustomMediaPlayerViewController: UIViewController {
|
|||
try audioSession.setActive(true)
|
||||
try audioSession.overrideOutputAudioPort(.speaker)
|
||||
} catch {
|
||||
Logger.shared.log("Failed to set up AVAudioSession: \(error)")
|
||||
Logger.shared.log("Didn't set up AVAudioSession: \(error)", type: "Debug")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class NormalPlayer: AVPlayerViewController {
|
|||
|
||||
try audioSession.overrideOutputAudioPort(.speaker)
|
||||
} catch {
|
||||
Logger.shared.log("Failed to set up AVAudioSession: \(error)")
|
||||
Logger.shared.log("Didn't set up AVAudioSession: \(error)", type: "Debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,22 +114,9 @@ class VideoPlayerViewController: UIViewController {
|
|||
UserDefaults.standard.set(currentTime, forKey: "lastPlayedTime_\(fullURL)")
|
||||
UserDefaults.standard.set(duration, forKey: "totalTime_\(fullURL)")
|
||||
|
||||
let remainingPercentage = (duration - currentTime) / duration
|
||||
|
||||
if remainingPercentage < 0.1 && self.module.metadata.type == "anime" && self.aniListID != 0 {
|
||||
let aniListMutation = AniListMutation()
|
||||
aniListMutation.updateAnimeProgress(animeId: self.aniListID, episodeNumber: self.episodeNumber) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
Logger.shared.log("Successfully updated AniList progress for episode \(self.episodeNumber)", type: "General")
|
||||
case .failure(let error):
|
||||
Logger.shared.log("Failed to update AniList progress: \(error.localizedDescription)", type: "Error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let streamUrl = self.streamUrl {
|
||||
let progress = currentTime / duration
|
||||
let progress = min(max(currentTime / duration, 0), 1.0)
|
||||
|
||||
let item = ContinueWatchingItem(
|
||||
id: UUID(),
|
||||
imageUrl: self.episodeImageUrl,
|
||||
|
|
@ -144,6 +131,20 @@ class VideoPlayerViewController: UIViewController {
|
|||
)
|
||||
ContinueWatchingManager.shared.save(item: item)
|
||||
}
|
||||
|
||||
let remainingPercentage = (duration - currentTime) / duration
|
||||
|
||||
if remainingPercentage < 0.1 && self.module.metadata.type == "anime" && self.aniListID != 0 {
|
||||
let aniListMutation = AniListMutation()
|
||||
aniListMutation.updateAnimeProgress(animeId: self.aniListID, episodeNumber: self.episodeNumber) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
Logger.shared.log("Successfully updated AniList progress for episode \(self.episodeNumber)", type: "General")
|
||||
case .failure(let error):
|
||||
Logger.shared.log("Failed to update AniList progress: \(error.localizedDescription)", type: "Error")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,11 +124,6 @@ struct EpisodeCell: View {
|
|||
}
|
||||
|
||||
private func fetchEpisodeDetails() {
|
||||
guard episodeID != 0 else {
|
||||
isLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
guard let url = URL(string: "https://api.ani.zip/mappings?anilist_id=\(itemID)") else {
|
||||
isLoading = false
|
||||
return
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ struct MediaInfoView: View {
|
|||
@State var isFetchingEpisode: Bool = false
|
||||
|
||||
@State private var refreshTrigger: Bool = false
|
||||
@State private var buttonRefreshTrigger: Bool = false
|
||||
|
||||
@State private var selectedEpisodeNumber: Int = 0
|
||||
@State private var selectedEpisodeImage: String = ""
|
||||
|
|
@ -169,6 +170,7 @@ struct MediaInfoView: View {
|
|||
.cornerRadius(10)
|
||||
}
|
||||
.disabled(isFetchingEpisode)
|
||||
.id(buttonRefreshTrigger)
|
||||
|
||||
Button(action: {
|
||||
libraryManager.toggleBookmark(
|
||||
|
|
@ -363,6 +365,8 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
.onAppear {
|
||||
buttonRefreshTrigger.toggle()
|
||||
|
||||
if !hasFetched {
|
||||
DropManager.shared.showDrop(title: "Fetching Data", subtitle: "Please wait while fetching.", duration: 1.0, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
|
||||
fetchDetails()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct SettingsViewTrackers: View {
|
|||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(header: Text("AniList"), footer: Text("Sora and cranci1 are not affiliated with AniList in any way.\n\nNote that push updates may not be 100% acurate.")) {
|
||||
Section(header: Text("AniList"), footer: Text("Sora and cranci1 are not affiliated with AniList in any way.\n\nNote that progresses update may not be 100% acurate.")) {
|
||||
HStack() {
|
||||
KFImage(URL(string: "https://raw.githubusercontent.com/cranci1/Ryu/2f10226aa087154974a70c1ec78aa83a47daced9/Ryu/Assets.xcassets/Listing/Anilist.imageset/anilist.png"))
|
||||
.placeholder {
|
||||
|
|
@ -53,7 +53,7 @@ struct SettingsViewTrackers: View {
|
|||
}
|
||||
}
|
||||
if isLoggedIn {
|
||||
Toggle("Send push updates", isOn: $isSendPushUpdates)
|
||||
Toggle("Sync progreses", isOn: $isSendPushUpdates)
|
||||
.tint(.accentColor)
|
||||
}
|
||||
Button(isLoggedIn ? "Log Out from AniList.co" : "Log In with AniList.co") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue