mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 00:22:12 +00:00
added releases page
This commit is contained in:
parent
8d77da1718
commit
6812afffb6
5 changed files with 92 additions and 3 deletions
|
|
@ -39,6 +39,8 @@
|
||||||
132417D72D13242400B4F2D2 /* CircularProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 132417D62D13242400B4F2D2 /* CircularProgressBar.swift */; };
|
132417D72D13242400B4F2D2 /* CircularProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 132417D62D13242400B4F2D2 /* CircularProgressBar.swift */; };
|
||||||
132417D92D1328B900B4F2D2 /* VideoPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 132417D82D1328B900B4F2D2 /* VideoPlayerView.swift */; };
|
132417D92D1328B900B4F2D2 /* VideoPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 132417D82D1328B900B4F2D2 /* VideoPlayerView.swift */; };
|
||||||
1352BA712D1ABC30000A9AF9 /* URLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1352BA702D1ABC30000A9AF9 /* URLSession.swift */; };
|
1352BA712D1ABC30000A9AF9 /* URLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1352BA702D1ABC30000A9AF9 /* URLSession.swift */; };
|
||||||
|
13AEE7BA2D2451F200CA634A /* GitHubAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13AEE7B92D2451F200CA634A /* GitHubAPI.swift */; };
|
||||||
|
13AEE7BC2D24521200CA634A /* SettingsReleasesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13AEE7BB2D24521200CA634A /* SettingsReleasesView.swift */; };
|
||||||
13B3A4B22D1477F100BCC0D5 /* SettingsStorageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */; };
|
13B3A4B22D1477F100BCC0D5 /* SettingsStorageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */; };
|
||||||
13C9821F2D2152B1007A0132 /* GitHubRelease.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13C9821E2D2152B1007A0132 /* GitHubRelease.swift */; };
|
13C9821F2D2152B1007A0132 /* GitHubRelease.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13C9821E2D2152B1007A0132 /* GitHubRelease.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
@ -77,6 +79,8 @@
|
||||||
132417D82D1328B900B4F2D2 /* VideoPlayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerView.swift; sourceTree = "<group>"; };
|
132417D82D1328B900B4F2D2 /* VideoPlayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerView.swift; sourceTree = "<group>"; };
|
||||||
1352BA6F2D1AB113000A9AF9 /* Sora.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Sora.entitlements; sourceTree = "<group>"; };
|
1352BA6F2D1AB113000A9AF9 /* Sora.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Sora.entitlements; sourceTree = "<group>"; };
|
||||||
1352BA702D1ABC30000A9AF9 /* URLSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSession.swift; sourceTree = "<group>"; };
|
1352BA702D1ABC30000A9AF9 /* URLSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSession.swift; sourceTree = "<group>"; };
|
||||||
|
13AEE7B92D2451F200CA634A /* GitHubAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubAPI.swift; sourceTree = "<group>"; };
|
||||||
|
13AEE7BB2D24521200CA634A /* SettingsReleasesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsReleasesView.swift; sourceTree = "<group>"; };
|
||||||
13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsStorageView.swift; sourceTree = "<group>"; };
|
13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsStorageView.swift; sourceTree = "<group>"; };
|
||||||
13C9821E2D2152B1007A0132 /* GitHubRelease.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubRelease.swift; sourceTree = "<group>"; };
|
13C9821E2D2152B1007A0132 /* GitHubRelease.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubRelease.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
@ -247,6 +251,7 @@
|
||||||
132417AE2D131A0600B4F2D2 /* SettingsModuleView.swift */,
|
132417AE2D131A0600B4F2D2 /* SettingsModuleView.swift */,
|
||||||
132417AF2D131A0600B4F2D2 /* SettingsPlayerView.swift */,
|
132417AF2D131A0600B4F2D2 /* SettingsPlayerView.swift */,
|
||||||
13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */,
|
13B3A4B12D1477F100BCC0D5 /* SettingsStorageView.swift */,
|
||||||
|
13AEE7BB2D24521200CA634A /* SettingsReleasesView.swift */,
|
||||||
);
|
);
|
||||||
path = SubPages;
|
path = SubPages;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -283,6 +288,7 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
13C9821E2D2152B1007A0132 /* GitHubRelease.swift */,
|
13C9821E2D2152B1007A0132 /* GitHubRelease.swift */,
|
||||||
|
13AEE7B92D2451F200CA634A /* GitHubAPI.swift */,
|
||||||
);
|
);
|
||||||
path = GitHub;
|
path = GitHub;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -377,6 +383,7 @@
|
||||||
1308CFC12D198466004CD38C /* CustomPlayer.swift in Sources */,
|
1308CFC12D198466004CD38C /* CustomPlayer.swift in Sources */,
|
||||||
132417A22D1319E800B4F2D2 /* ModulesManager.swift in Sources */,
|
132417A22D1319E800B4F2D2 /* ModulesManager.swift in Sources */,
|
||||||
132417862D13198000B4F2D2 /* ContentView.swift in Sources */,
|
132417862D13198000B4F2D2 /* ContentView.swift in Sources */,
|
||||||
|
13AEE7BA2D2451F200CA634A /* GitHubAPI.swift in Sources */,
|
||||||
132417C22D131A0600B4F2D2 /* LibraryView.swift in Sources */,
|
132417C22D131A0600B4F2D2 /* LibraryView.swift in Sources */,
|
||||||
132417A32D1319E800B4F2D2 /* NormalPlayer.swift in Sources */,
|
132417A32D1319E800B4F2D2 /* NormalPlayer.swift in Sources */,
|
||||||
132417D72D13242400B4F2D2 /* CircularProgressBar.swift in Sources */,
|
132417D72D13242400B4F2D2 /* CircularProgressBar.swift in Sources */,
|
||||||
|
|
@ -385,6 +392,7 @@
|
||||||
132417C32D131A0600B4F2D2 /* MediaView.swift in Sources */,
|
132417C32D131A0600B4F2D2 /* MediaView.swift in Sources */,
|
||||||
132417A12D1319E800B4F2D2 /* ModuleStruct.swift in Sources */,
|
132417A12D1319E800B4F2D2 /* ModuleStruct.swift in Sources */,
|
||||||
132417B92D131A0600B4F2D2 /* SearchResultsView.swift in Sources */,
|
132417B92D131A0600B4F2D2 /* SearchResultsView.swift in Sources */,
|
||||||
|
13AEE7BC2D24521200CA634A /* SettingsReleasesView.swift in Sources */,
|
||||||
132417842D13198000B4F2D2 /* SoraApp.swift in Sources */,
|
132417842D13198000B4F2D2 /* SoraApp.swift in Sources */,
|
||||||
132417BE2D131A0600B4F2D2 /* SettingsPlayerView.swift in Sources */,
|
132417BE2D131A0600B4F2D2 /* SettingsPlayerView.swift in Sources */,
|
||||||
132417C12D131A0600B4F2D2 /* LibraryManager.swift in Sources */,
|
132417C12D131A0600B4F2D2 /* LibraryManager.swift in Sources */,
|
||||||
|
|
|
||||||
Binary file not shown.
38
Sora/Utils/GitHub/GitHubAPI.swift
Normal file
38
Sora/Utils/GitHub/GitHubAPI.swift
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// GitHubAPI.swift
|
||||||
|
// Sora
|
||||||
|
//
|
||||||
|
// Created by Francesco on 31/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct GitHubReleases: Codable {
|
||||||
|
let tagName: String
|
||||||
|
let body: String
|
||||||
|
let htmlUrl: String
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case tagName = "tag_name"
|
||||||
|
case body
|
||||||
|
case htmlUrl = "html_url"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GitHubAPI {
|
||||||
|
static let shared = GitHubAPI()
|
||||||
|
|
||||||
|
func fetchReleases(completion: @escaping ([GitHubReleases]?) -> Void) {
|
||||||
|
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/releases")!
|
||||||
|
|
||||||
|
URLSession.custom.dataTask(with: url) { data, response, error in
|
||||||
|
guard let data = data, error == nil else {
|
||||||
|
completion(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let releases = try? JSONDecoder().decode([GitHubReleases].self, from: data)
|
||||||
|
completion(releases)
|
||||||
|
}.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -79,9 +79,10 @@ struct SettingsView: View {
|
||||||
|
|
||||||
Section(header: Text("Info")) {
|
Section(header: Text("Info")) {
|
||||||
NavigationLink(destination: AboutView()) {
|
NavigationLink(destination: AboutView()) {
|
||||||
HStack {
|
Text("About")
|
||||||
Text("About")
|
}
|
||||||
}
|
NavigationLink(destination: SettingsReleasesView()) {
|
||||||
|
Text("Releases")
|
||||||
}
|
}
|
||||||
Button(action: {
|
Button(action: {
|
||||||
if let url = URL(string: "https://github.com/cranci1/Sora") {
|
if let url = URL(string: "https://github.com/cranci1/Sora") {
|
||||||
|
|
|
||||||
42
Sora/Views/SettingsViews/SubPages/SettingsReleasesView.swift
Normal file
42
Sora/Views/SettingsViews/SubPages/SettingsReleasesView.swift
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
//
|
||||||
|
// SettingsReleasesView.swift
|
||||||
|
// Sora
|
||||||
|
//
|
||||||
|
// Created by Francesco on 31/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct SettingsReleasesView: View {
|
||||||
|
@State private var releases: [GitHubReleases] = []
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
List(releases, id: \.tagName) { release in
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(release.tagName)
|
||||||
|
.font(.system(size: 17))
|
||||||
|
.bold()
|
||||||
|
Text(release.body)
|
||||||
|
.font(.system(size: 14))
|
||||||
|
}
|
||||||
|
.contextMenu {
|
||||||
|
Button(action: {
|
||||||
|
if let url = URL(string: release.htmlUrl) {
|
||||||
|
UIApplication.shared.open(url)
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Text("View on GitHub")
|
||||||
|
Image(systemName: "safari")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.navigationTitle("Releases")
|
||||||
|
.onAppear {
|
||||||
|
GitHubAPI.shared.fetchReleases { fetchedReleases in
|
||||||
|
if let fetchedReleases = fetchedReleases {
|
||||||
|
self.releases = fetchedReleases
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue