mirror of
https://github.com/cranci1/Sora.git
synced 2026-01-11 20:10:24 +00:00
nvm 😭
This commit is contained in:
parent
0eef3dd918
commit
5d3939e61f
4 changed files with 26 additions and 157 deletions
|
|
@ -6,7 +6,6 @@
|
|||
//
|
||||
|
||||
import SwiftUI
|
||||
import SlideOverCard
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
|
|
@ -19,12 +18,10 @@ struct ContentView_Previews: PreviewProvider {
|
|||
|
||||
struct ContentView: View {
|
||||
@AppStorage("useNativeTabBar") private var useNativeTabBar: Bool = false
|
||||
@AppStorage("lastVersionPrompt") private var lastVersionPrompt: String = ""
|
||||
@StateObject private var tabBarController = TabBarController()
|
||||
@State var selectedTab: Int = 0
|
||||
@State var lastTab: Int = 0
|
||||
@State private var searchQuery: String = ""
|
||||
@State private var showWhatsNew: Bool = false
|
||||
|
||||
let tabs: [TabItem] = [
|
||||
TabItem(icon: "square.stack", title: NSLocalizedString("LibraryTab", comment: "")),
|
||||
|
|
@ -33,8 +30,6 @@ struct ContentView: View {
|
|||
TabItem(icon: "magnifyingglass", title: NSLocalizedString("SearchTab", comment: ""))
|
||||
]
|
||||
|
||||
private let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0.0"
|
||||
|
||||
private func tabView(for index: Int) -> some View {
|
||||
switch index {
|
||||
case 1: return AnyView(DownloadView())
|
||||
|
|
@ -45,45 +40,35 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if #available(iOS 26, *), useNativeTabBar == true {
|
||||
TabView {
|
||||
ForEach(Array(tabs.enumerated()), id: \.offset) { index, item in
|
||||
tabView(for: index)
|
||||
.tabItem {
|
||||
Label(item.title, systemImage: item.icon)
|
||||
}
|
||||
}
|
||||
if #available(iOS 26, *), useNativeTabBar == true {
|
||||
TabView {
|
||||
ForEach(Array(tabs.enumerated()), id: \.offset) { index, item in
|
||||
tabView(for: index)
|
||||
.tabItem {
|
||||
Label(item.title, systemImage: item.icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
.searchable(text: $searchQuery)
|
||||
.environmentObject(tabBarController)
|
||||
} else {
|
||||
ZStack(alignment: .bottom) {
|
||||
Group {
|
||||
tabView(for: selectedTab)
|
||||
}
|
||||
.searchable(text: $searchQuery)
|
||||
.environmentObject(tabBarController)
|
||||
} else {
|
||||
ZStack(alignment: .bottom) {
|
||||
Group {
|
||||
tabView(for: selectedTab)
|
||||
}
|
||||
.environmentObject(tabBarController)
|
||||
|
||||
TabBar(
|
||||
tabs: tabs,
|
||||
selectedTab: $selectedTab,
|
||||
lastTab: $lastTab,
|
||||
searchQuery: $searchQuery,
|
||||
controller: tabBarController
|
||||
)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
|
||||
.ignoresSafeArea(.keyboard, edges: .bottom)
|
||||
.padding(.bottom, -20)
|
||||
|
||||
TabBar(
|
||||
tabs: tabs,
|
||||
selectedTab: $selectedTab,
|
||||
lastTab: $lastTab,
|
||||
searchQuery: $searchQuery,
|
||||
controller: tabBarController
|
||||
)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if lastVersionPrompt != currentVersion {
|
||||
showWhatsNew = true
|
||||
}
|
||||
}
|
||||
.slideOverCard(isPresented: $showWhatsNew, options: SOCOptions()) {
|
||||
WhatsNewView(isPresented: $showWhatsNew)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
|
||||
.ignoresSafeArea(.keyboard, edges: .bottom)
|
||||
.padding(.bottom, -20)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
//
|
||||
// WhatsNewView.swift
|
||||
// Sora
|
||||
//
|
||||
// Created by Francesco on 25/06/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import SlideOverCard
|
||||
|
||||
struct WhatsNewView: View {
|
||||
@AppStorage("lastVersionPrompt") private var lastVersionPrompt: String = ""
|
||||
@Binding var isPresented: Bool
|
||||
|
||||
private let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0.0"
|
||||
private let whatsNewItems = [
|
||||
WhatsNewItem(title: "Brand new UI", description: "Enjoy this brand new look of Sora", icon: "sparkles"),
|
||||
WhatsNewItem(title: "TMDB Metadata", description: "Various UI improvements and animations across the app", icon: "bolt.fill"),
|
||||
WhatsNewItem(title: "Download Support", description: "For both mp4 and HLS with Multi server support", icon: "tray.and.arrow.down.fill")
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center, spacing: 25) {
|
||||
HStack {
|
||||
Text("What's New in Sora")
|
||||
.font(.system(size: 28, weight: .bold))
|
||||
Text("Version \(currentVersion)")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
VStack(spacing: 20) {
|
||||
ForEach(whatsNewItems) { item in
|
||||
WhatsNewItemView(item: item)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
Button("Continue", action: {
|
||||
lastVersionPrompt = currentVersion
|
||||
isPresented = false
|
||||
}).buttonStyle(SOCActionButton())
|
||||
|
||||
Button("Release Notes", action: {
|
||||
if let url = URL(string: "https://github.com/cranci1/Sora/releases/tag/1.0.0") {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}).buttonStyle(SOCEmptyButton())
|
||||
}
|
||||
}
|
||||
.frame(height: 480)
|
||||
}
|
||||
}
|
||||
|
||||
struct WhatsNewItem: Identifiable {
|
||||
let id = UUID()
|
||||
let title: String
|
||||
let description: String
|
||||
let icon: String
|
||||
}
|
||||
|
||||
struct WhatsNewItemView: View {
|
||||
let item: WhatsNewItem
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 16) {
|
||||
Image(systemName: item.icon)
|
||||
.font(.system(size: 24))
|
||||
.foregroundColor(.blue)
|
||||
.frame(width: 32)
|
||||
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(item.title)
|
||||
.font(.headline)
|
||||
Text(item.description)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.gray)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
|
|
@ -78,8 +78,6 @@
|
|||
138AA1B82D2D66FD0021F9DF /* EpisodeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138AA1B62D2D66FD0021F9DF /* EpisodeCell.swift */; };
|
||||
138AA1B92D2D66FD0021F9DF /* CircularProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138AA1B72D2D66FD0021F9DF /* CircularProgressBar.swift */; };
|
||||
138B66A02E0BEA52009BE8D9 /* WebAuthenticationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138B669F2E0BEA52009BE8D9 /* WebAuthenticationManager.swift */; };
|
||||
138B66A82E0BF22E009BE8D9 /* SlideOverCard in Frameworks */ = {isa = PBXBuildFile; productRef = 138B66A72E0BF22E009BE8D9 /* SlideOverCard */; };
|
||||
138B66AC2E0BF560009BE8D9 /* WhatsNewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138B66AB2E0BF560009BE8D9 /* WhatsNewView.swift */; };
|
||||
138FE1D02DECA00D00936D81 /* TMDB-FetchID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138FE1CF2DECA00D00936D81 /* TMDB-FetchID.swift */; };
|
||||
1398FB3F2DE4E161004D3F5F /* SettingsViewAbout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1398FB3E2DE4E161004D3F5F /* SettingsViewAbout.swift */; };
|
||||
139935662D468C450065CEFF /* ModuleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 139935652D468C450065CEFF /* ModuleManager.swift */; };
|
||||
|
|
@ -192,7 +190,6 @@
|
|||
138AA1B62D2D66FD0021F9DF /* EpisodeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EpisodeCell.swift; sourceTree = "<group>"; };
|
||||
138AA1B72D2D66FD0021F9DF /* CircularProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircularProgressBar.swift; sourceTree = "<group>"; };
|
||||
138B669F2E0BEA52009BE8D9 /* WebAuthenticationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebAuthenticationManager.swift; sourceTree = "<group>"; };
|
||||
138B66AB2E0BF560009BE8D9 /* WhatsNewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WhatsNewView.swift; path = Sora/Views/WhatsNewView.swift; sourceTree = SOURCE_ROOT; };
|
||||
138FE1CF2DECA00D00936D81 /* TMDB-FetchID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TMDB-FetchID.swift"; sourceTree = "<group>"; };
|
||||
1398FB3E2DE4E161004D3F5F /* SettingsViewAbout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewAbout.swift; sourceTree = "<group>"; };
|
||||
139935652D468C450065CEFF /* ModuleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleManager.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -245,7 +242,6 @@
|
|||
13637B902DE0ECD200BDA2FC /* Drops in Frameworks */,
|
||||
13530BDF2E0002790048B7DE /* SoraCore in Frameworks */,
|
||||
13637B932DE0ECDB00BDA2FC /* MarqueeLabel in Frameworks */,
|
||||
138B66A82E0BF22E009BE8D9 /* SlideOverCard in Frameworks */,
|
||||
13367ECE2DF70698009CB33F /* NukeUI in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -542,7 +538,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
04EAC3992DF9E0DB00BBD483 /* SplashScreenView.swift */,
|
||||
138B66AB2E0BF560009BE8D9 /* WhatsNewView.swift */,
|
||||
72443C7C2DC8036500A61321 /* DownloadView.swift */,
|
||||
04536F732E04BA5600A11248 /* ReaderView */,
|
||||
0402DA122DE7B5EC003BB42C /* SearchView */,
|
||||
|
|
@ -864,7 +859,6 @@
|
|||
13367ECB2DF70698009CB33F /* Nuke */,
|
||||
13367ECD2DF70698009CB33F /* NukeUI */,
|
||||
13530BDE2E0002790048B7DE /* SoraCore */,
|
||||
138B66A72E0BF22E009BE8D9 /* SlideOverCard */,
|
||||
);
|
||||
productName = Sora;
|
||||
productReference = 133D7C6A2D2BE2500075467E /* Sulfur.app */;
|
||||
|
|
@ -913,7 +907,6 @@
|
|||
13637B912DE0ECDB00BDA2FC /* XCRemoteSwiftPackageReference "MarqueeLabel" */,
|
||||
13367ECA2DF70698009CB33F /* XCRemoteSwiftPackageReference "Nuke" */,
|
||||
13530BDD2E0002790048B7DE /* XCRemoteSwiftPackageReference "SoraCore" */,
|
||||
138B66A62E0BF22E009BE8D9 /* XCRemoteSwiftPackageReference "SlideOverCard" */,
|
||||
);
|
||||
productRefGroup = 133D7C6B2D2BE2500075467E /* Products */;
|
||||
projectDirPath = "";
|
||||
|
|
@ -998,7 +991,6 @@
|
|||
04EAC39A2DF9E0DB00BBD483 /* SplashScreenView.swift in Sources */,
|
||||
132AF1212D99951700A0140B /* JSController-Streams.swift in Sources */,
|
||||
131845F92D47C62D00CA7A54 /* SettingsViewGeneral.swift in Sources */,
|
||||
138B66AC2E0BF560009BE8D9 /* WhatsNewView.swift in Sources */,
|
||||
04CD76DB2DE20F2200733536 /* AllWatching.swift in Sources */,
|
||||
13103E8E2D58E04A000F0673 /* SkeletonCell.swift in Sources */,
|
||||
13D842552D45267500EBBFA6 /* DropManager.swift in Sources */,
|
||||
|
|
@ -1443,14 +1435,6 @@
|
|||
kind = branch;
|
||||
};
|
||||
};
|
||||
138B66A62E0BF22E009BE8D9 /* XCRemoteSwiftPackageReference "SlideOverCard" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/akwasiio/SlideOverCard";
|
||||
requirement = {
|
||||
branch = main;
|
||||
kind = branch;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
|
|
@ -1479,11 +1463,6 @@
|
|||
package = 13637B912DE0ECDB00BDA2FC /* XCRemoteSwiftPackageReference "MarqueeLabel" */;
|
||||
productName = MarqueeLabel;
|
||||
};
|
||||
138B66A72E0BF22E009BE8D9 /* SlideOverCard */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 138B66A62E0BF22E009BE8D9 /* XCRemoteSwiftPackageReference "SlideOverCard" */;
|
||||
productName = SlideOverCard;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 133D7C622D2BE2500075467E /* Project object */;
|
||||
|
|
|
|||
|
|
@ -27,15 +27,6 @@
|
|||
"revision" : "c7ba4833b1b38f09e9708858aeaf91babc69f65c"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "slideovercard",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/akwasiio/SlideOverCard",
|
||||
"state" : {
|
||||
"branch" : "main",
|
||||
"revision" : "5773fcbbe583ce09a2e0314d6e72494e945c4ab6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "soracore",
|
||||
"kind" : "remoteSourceControl",
|
||||
|
|
|
|||
Loading…
Reference in a new issue