mirror of
https://github.com/cranci1/Sora.git
synced 2026-03-11 17:45:37 +00:00
Build please (#114)
* fixed plist * made Anilist push updaes correctly * test episode order * fixed display order
This commit is contained in:
parent
3635fe377f
commit
ec3b251d83
5 changed files with 33 additions and 9 deletions
|
|
@ -2,8 +2,6 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Sora may requires access to your device's camera.</string>
|
||||
<key>BGTaskSchedulerPermittedIdentifiers</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
|
|
|
|||
|
|
@ -45,17 +45,19 @@ class AniListMutation {
|
|||
}
|
||||
|
||||
let query = """
|
||||
mutation ($mediaId: Int, $progress: Int) {
|
||||
SaveMediaListEntry (mediaId: $mediaId, progress: $progress) {
|
||||
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus) {
|
||||
SaveMediaListEntry (mediaId: $mediaId, progress: $progress, status: $status) {
|
||||
id
|
||||
progress
|
||||
status
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
let variables: [String: Any] = [
|
||||
"mediaId": animeId,
|
||||
"progress": episodeNumber
|
||||
"progress": episodeNumber,
|
||||
"status": "WATCHING"
|
||||
]
|
||||
|
||||
let requestBody: [String: Any] = [
|
||||
|
|
@ -124,7 +126,6 @@ class AniListMutation {
|
|||
var request = URLRequest(url: apiURL)
|
||||
request.httpMethod = "POST"
|
||||
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||
// no auth required for read
|
||||
request.httpBody = jsonData
|
||||
|
||||
URLSession.shared.dataTask(with: request) { data, resp, error in
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ struct MediaInfoView: View {
|
|||
|
||||
@AppStorage("externalPlayer") private var externalPlayer: String = "Default"
|
||||
@AppStorage("episodeChunkSize") private var episodeChunkSize: Int = 100
|
||||
@AppStorage("episodeSortOrder") private var episodeSortOrder: String = "Ascending"
|
||||
|
||||
@StateObject private var jsController = JSController()
|
||||
@EnvironmentObject var moduleManager: ModuleManager
|
||||
|
|
@ -595,6 +596,13 @@ struct MediaInfoView: View {
|
|||
return groups
|
||||
}
|
||||
|
||||
private func sortEpisodes(_ episodes: [EpisodeLink]) -> [EpisodeLink] {
|
||||
if episodeSortOrder == "Descending" {
|
||||
return episodes.sorted(by: { $0.number > $1.number })
|
||||
} else {
|
||||
return episodes.sorted(by: { $0.number < $1.number })
|
||||
}
|
||||
}
|
||||
|
||||
func fetchDetails() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
|
|
@ -609,7 +617,7 @@ struct MediaInfoView: View {
|
|||
self.aliases = item.aliases
|
||||
self.airdate = item.airdate
|
||||
}
|
||||
self.episodeLinks = episodes
|
||||
self.episodeLinks = self.sortEpisodes(episodes)
|
||||
self.isLoading = false
|
||||
self.isRefetching = false
|
||||
}
|
||||
|
|
@ -620,7 +628,7 @@ struct MediaInfoView: View {
|
|||
self.aliases = item.aliases
|
||||
self.airdate = item.airdate
|
||||
}
|
||||
self.episodeLinks = episodes
|
||||
self.episodeLinks = self.sortEpisodes(episodes)
|
||||
self.isLoading = false
|
||||
self.isRefetching = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@ struct SettingsViewGeneral: View {
|
|||
@AppStorage("metadataProviders") private var metadataProviders: String = "AniList"
|
||||
@AppStorage("mediaColumnsPortrait") private var mediaColumnsPortrait: Int = 2
|
||||
@AppStorage("mediaColumnsLandscape") private var mediaColumnsLandscape: Int = 4
|
||||
@AppStorage("episodeSortOrder") private var episodeSortOrder: String = "Ascending"
|
||||
|
||||
private let metadataProvidersList = ["AniList"]
|
||||
private let sortOrderOptions = ["Ascending", "Descending"]
|
||||
@EnvironmentObject var settings: Settings
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -36,6 +38,7 @@ struct SettingsViewGeneral: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Media View"), footer: Text("The episode range controls how many episodes appear on each page. Episodes are grouped into sets (like 1-25, 26-50, and so on), allowing you to navigate through them more easily.\n\nFor episode metadata it is refering to the episode thumbnail and title, since sometimes it can contain spoilers.")) {
|
||||
|
||||
HStack {
|
||||
Text("Episodes Range")
|
||||
Spacer()
|
||||
|
|
@ -48,8 +51,23 @@ struct SettingsViewGeneral: View {
|
|||
Text("\(episodeChunkSize)")
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Episode Sort Order")
|
||||
Spacer()
|
||||
Menu(episodeSortOrder) {
|
||||
Button(action: { episodeSortOrder = "Ascending" }) {
|
||||
Text("Ascending (1-100)")
|
||||
}
|
||||
Button(action: { episodeSortOrder = "Descending" }) {
|
||||
Text("Descending (100-1)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Toggle("Fetch Episode metadata", isOn: $fetchEpisodeMetadata)
|
||||
.tint(.accentColor)
|
||||
|
||||
HStack {
|
||||
Text("Metadata Provider")
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -205,5 +205,4 @@ struct SettingsViewModule: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue