mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 01:31:04 +00:00
Quick look support for media preview
This commit is contained in:
parent
1b4bef1459
commit
1a85fa19f8
23 changed files with 117 additions and 82 deletions
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F24EEB729360C330042359D /* Preview Assets.xcassets */; };
|
9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F24EEB729360C330042359D /* Preview Assets.xcassets */; };
|
||||||
9F24EEBB293619210042359D /* Routeur in Frameworks */ = {isa = PBXBuildFile; productRef = 9F24EEBA293619210042359D /* Routeur */; };
|
|
||||||
9F295540292B6C3400E0E81B /* Timeline in Frameworks */ = {isa = PBXBuildFile; productRef = 9F29553F292B6C3400E0E81B /* Timeline */; };
|
9F295540292B6C3400E0E81B /* Timeline in Frameworks */ = {isa = PBXBuildFile; productRef = 9F29553F292B6C3400E0E81B /* Timeline */; };
|
||||||
9F35DB44294F9A7D00B3281A /* Status in Frameworks */ = {isa = PBXBuildFile; productRef = 9F35DB43294F9A7D00B3281A /* Status */; };
|
9F35DB44294F9A7D00B3281A /* Status in Frameworks */ = {isa = PBXBuildFile; productRef = 9F35DB43294F9A7D00B3281A /* Status */; };
|
||||||
9F35DB4729506F6600B3281A /* NotificationTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F35DB4629506F6600B3281A /* NotificationTab.swift */; };
|
9F35DB4729506F6600B3281A /* NotificationTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F35DB4629506F6600B3281A /* NotificationTab.swift */; };
|
||||||
|
@ -18,6 +17,7 @@
|
||||||
9F398AA92935FFDB00A889F2 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 9F398AA82935FFDB00A889F2 /* Account */; };
|
9F398AA92935FFDB00A889F2 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 9F398AA82935FFDB00A889F2 /* Account */; };
|
||||||
9F398AAB2935FFDB00A889F2 /* Models in Frameworks */ = {isa = PBXBuildFile; productRef = 9F398AAA2935FFDB00A889F2 /* Models */; };
|
9F398AAB2935FFDB00A889F2 /* Models in Frameworks */ = {isa = PBXBuildFile; productRef = 9F398AAA2935FFDB00A889F2 /* Models */; };
|
||||||
9F398AB329360A4C00A889F2 /* TimelineTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F398AB229360A4C00A889F2 /* TimelineTab.swift */; };
|
9F398AB329360A4C00A889F2 /* TimelineTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F398AB229360A4C00A889F2 /* TimelineTab.swift */; };
|
||||||
|
9F5E581929545BE700A53960 /* Env in Frameworks */ = {isa = PBXBuildFile; productRef = 9F5E581829545BE700A53960 /* Env */; };
|
||||||
9FAE4ACB293783B000772766 /* SettingsTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FAE4ACA293783B000772766 /* SettingsTab.swift */; };
|
9FAE4ACB293783B000772766 /* SettingsTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FAE4ACA293783B000772766 /* SettingsTab.swift */; };
|
||||||
9FAE4ACE29379A5A00772766 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 9FAE4ACD29379A5A00772766 /* KeychainSwift */; };
|
9FAE4ACE29379A5A00772766 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 9FAE4ACD29379A5A00772766 /* KeychainSwift */; };
|
||||||
9FAE4AD129379AD600772766 /* AppAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FAE4AD029379AD600772766 /* AppAccount.swift */; };
|
9FAE4AD129379AD600772766 /* AppAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FAE4AD029379AD600772766 /* AppAccount.swift */; };
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
9F24EEB729360C330042359D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
9F24EEB729360C330042359D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||||
9F24EEB92936185B0042359D /* Routeur */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Routeur; path = Packages/Routeur; sourceTree = "<group>"; };
|
|
||||||
9F29553D292B67B600E0E81B /* Network */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Network; path = Packages/Network; sourceTree = "<group>"; };
|
9F29553D292B67B600E0E81B /* Network */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Network; path = Packages/Network; sourceTree = "<group>"; };
|
||||||
9F29553E292B6AF600E0E81B /* Timeline */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Timeline; path = Packages/Timeline; sourceTree = "<group>"; };
|
9F29553E292B6AF600E0E81B /* Timeline */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Timeline; path = Packages/Timeline; sourceTree = "<group>"; };
|
||||||
9F35DB42294F9A2900B3281A /* Status */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Status; path = Packages/Status; sourceTree = "<group>"; };
|
9F35DB42294F9A2900B3281A /* Status */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Status; path = Packages/Status; sourceTree = "<group>"; };
|
||||||
|
@ -42,6 +41,7 @@
|
||||||
9F398AA52935FE8A00A889F2 /* AppRouteur.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRouteur.swift; sourceTree = "<group>"; };
|
9F398AA52935FE8A00A889F2 /* AppRouteur.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRouteur.swift; sourceTree = "<group>"; };
|
||||||
9F398AAC2936005300A889F2 /* Account */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Account; path = Packages/Account; sourceTree = "<group>"; };
|
9F398AAC2936005300A889F2 /* Account */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Account; path = Packages/Account; sourceTree = "<group>"; };
|
||||||
9F398AB229360A4C00A889F2 /* TimelineTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTab.swift; sourceTree = "<group>"; };
|
9F398AB229360A4C00A889F2 /* TimelineTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTab.swift; sourceTree = "<group>"; };
|
||||||
|
9F5E581729545B5500A53960 /* Env */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Env; path = Packages/Env; sourceTree = "<group>"; };
|
||||||
9FAE4AC8293774FF00772766 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
9FAE4AC8293774FF00772766 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||||
9FAE4ACA293783B000772766 /* SettingsTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTab.swift; sourceTree = "<group>"; };
|
9FAE4ACA293783B000772766 /* SettingsTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTab.swift; sourceTree = "<group>"; };
|
||||||
9FAE4AD029379AD600772766 /* AppAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAccount.swift; sourceTree = "<group>"; };
|
9FAE4AD029379AD600772766 /* AppAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAccount.swift; sourceTree = "<group>"; };
|
||||||
|
@ -62,8 +62,8 @@
|
||||||
9F398AA92935FFDB00A889F2 /* Account in Frameworks */,
|
9F398AA92935FFDB00A889F2 /* Account in Frameworks */,
|
||||||
9FBFE64E292A72BD00C250E9 /* Network in Frameworks */,
|
9FBFE64E292A72BD00C250E9 /* Network in Frameworks */,
|
||||||
9F398AAB2935FFDB00A889F2 /* Models in Frameworks */,
|
9F398AAB2935FFDB00A889F2 /* Models in Frameworks */,
|
||||||
|
9F5E581929545BE700A53960 /* Env in Frameworks */,
|
||||||
9F35DB44294F9A7D00B3281A /* Status in Frameworks */,
|
9F35DB44294F9A7D00B3281A /* Status in Frameworks */,
|
||||||
9F24EEBB293619210042359D /* Routeur in Frameworks */,
|
|
||||||
9F295540292B6C3400E0E81B /* Timeline in Frameworks */,
|
9F295540292B6C3400E0E81B /* Timeline in Frameworks */,
|
||||||
9F35DB4A29506FA100B3281A /* Notifications in Frameworks */,
|
9F35DB4A29506FA100B3281A /* Notifications in Frameworks */,
|
||||||
);
|
);
|
||||||
|
@ -119,11 +119,11 @@
|
||||||
9FBFE64C292A72BD00C250E9 /* Frameworks */,
|
9FBFE64C292A72BD00C250E9 /* Frameworks */,
|
||||||
9F398AAC2936005300A889F2 /* Account */,
|
9F398AAC2936005300A889F2 /* Account */,
|
||||||
9F35DB45294FA04C00B3281A /* DesignSystem */,
|
9F35DB45294FA04C00B3281A /* DesignSystem */,
|
||||||
|
9F5E581729545B5500A53960 /* Env */,
|
||||||
9F398AA32935F90100A889F2 /* Models */,
|
9F398AA32935F90100A889F2 /* Models */,
|
||||||
9F29553D292B67B600E0E81B /* Network */,
|
9F29553D292B67B600E0E81B /* Network */,
|
||||||
9F35DB4829506F7F00B3281A /* Notifications */,
|
9F35DB4829506F7F00B3281A /* Notifications */,
|
||||||
9F29553E292B6AF600E0E81B /* Timeline */,
|
9F29553E292B6AF600E0E81B /* Timeline */,
|
||||||
9F24EEB92936185B0042359D /* Routeur */,
|
|
||||||
9F35DB42294F9A2900B3281A /* Status */,
|
9F35DB42294F9A2900B3281A /* Status */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -185,10 +185,10 @@
|
||||||
9F29553F292B6C3400E0E81B /* Timeline */,
|
9F29553F292B6C3400E0E81B /* Timeline */,
|
||||||
9F398AA82935FFDB00A889F2 /* Account */,
|
9F398AA82935FFDB00A889F2 /* Account */,
|
||||||
9F398AAA2935FFDB00A889F2 /* Models */,
|
9F398AAA2935FFDB00A889F2 /* Models */,
|
||||||
9F24EEBA293619210042359D /* Routeur */,
|
|
||||||
9FAE4ACD29379A5A00772766 /* KeychainSwift */,
|
9FAE4ACD29379A5A00772766 /* KeychainSwift */,
|
||||||
9F35DB43294F9A7D00B3281A /* Status */,
|
9F35DB43294F9A7D00B3281A /* Status */,
|
||||||
9F35DB4929506FA100B3281A /* Notifications */,
|
9F35DB4929506FA100B3281A /* Notifications */,
|
||||||
|
9F5E581829545BE700A53960 /* Env */,
|
||||||
);
|
);
|
||||||
productName = IceCubesApp;
|
productName = IceCubesApp;
|
||||||
productReference = 9FBFE639292A715500C250E9 /* IceCubesApp.app */;
|
productReference = 9FBFE639292A715500C250E9 /* IceCubesApp.app */;
|
||||||
|
@ -496,10 +496,6 @@
|
||||||
/* End XCRemoteSwiftPackageReference section */
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
9F24EEBA293619210042359D /* Routeur */ = {
|
|
||||||
isa = XCSwiftPackageProductDependency;
|
|
||||||
productName = Routeur;
|
|
||||||
};
|
|
||||||
9F29553F292B6C3400E0E81B /* Timeline */ = {
|
9F29553F292B6C3400E0E81B /* Timeline */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = Timeline;
|
productName = Timeline;
|
||||||
|
@ -520,6 +516,10 @@
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = Models;
|
productName = Models;
|
||||||
};
|
};
|
||||||
|
9F5E581829545BE700A53960 /* Env */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
productName = Env;
|
||||||
|
};
|
||||||
9FAE4ACD29379A5A00772766 /* KeychainSwift */ = {
|
9FAE4ACD29379A5A00772766 /* KeychainSwift */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */;
|
package = 9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
import Account
|
import Account
|
||||||
import Routeur
|
import Env
|
||||||
import Status
|
import Status
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,14 @@ import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
import Network
|
import Network
|
||||||
import KeychainSwift
|
import KeychainSwift
|
||||||
|
import Env
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct IceCubesApp: App {
|
struct IceCubesApp: App {
|
||||||
public static let defaultServer = "mastodon.social"
|
public static let defaultServer = "mastodon.social"
|
||||||
|
|
||||||
@StateObject private var appAccountsManager = AppAccountsManager()
|
@StateObject private var appAccountsManager = AppAccountsManager()
|
||||||
|
@StateObject private var quickLook = QuickLook()
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
|
@ -32,8 +34,10 @@ struct IceCubesApp: App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tint(.brand)
|
.tint(.brand)
|
||||||
|
.quickLookPreview($quickLook.url, in: quickLook.urls)
|
||||||
.environmentObject(appAccountsManager)
|
.environmentObject(appAccountsManager)
|
||||||
.environmentObject(appAccountsManager.currentClient)
|
.environmentObject(appAccountsManager.currentClient)
|
||||||
|
.environmentObject(quickLook)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
import Account
|
import Account
|
||||||
import Models
|
import Models
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
import Notifications
|
import Notifications
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
import Account
|
import Account
|
||||||
import Models
|
import Models
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
|
|
||||||
struct TimelineTab: View {
|
struct TimelineTab: View {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Routeur
|
import Env
|
||||||
|
|
||||||
struct AccountDetailHeaderView: View {
|
struct AccountDetailHeaderView: View {
|
||||||
@EnvironmentObject private var routeurPath: RouterPath
|
@EnvironmentObject private var routeurPath: RouterPath
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Network
|
||||||
import Status
|
import Status
|
||||||
import Shimmer
|
import Shimmer
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Routeur
|
import Env
|
||||||
|
|
||||||
public struct AccountDetailView: View {
|
public struct AccountDetailView: View {
|
||||||
@Environment(\.redactionReasons) private var reasons
|
@Environment(\.redactionReasons) private var reasons
|
||||||
|
|
|
@ -4,26 +4,23 @@
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Routeur",
|
name: "Env",
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v16),
|
.iOS(.v16),
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
.library(
|
.library(
|
||||||
name: "Routeur",
|
name: "Env",
|
||||||
targets: ["Routeur"]),
|
targets: ["Env"]),
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(name: "Models", path: "../Models")
|
.package(name: "Models", path: "../Models")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
name: "Routeur",
|
name: "Env",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
]),
|
]),
|
||||||
.testTarget(
|
|
||||||
name: "RouteurTests",
|
|
||||||
dependencies: ["Routeur"]),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
|
@ -1,3 +1,3 @@
|
||||||
# Routeur
|
# Env
|
||||||
|
|
||||||
A description of this package.
|
A description of this package.
|
54
Packages/Env/Sources/Env/QuickLook.swift
Normal file
54
Packages/Env/Sources/Env/QuickLook.swift
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import QuickLook
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
public class QuickLook: ObservableObject {
|
||||||
|
@Published public var url: URL?
|
||||||
|
@Published public private(set) var urls: [URL] = []
|
||||||
|
@Published public private(set) var isPreparing: Bool = false
|
||||||
|
@Published public private(set) var latestError: Error?
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public func prepareFor(urls: [URL], selectedURL: URL) async {
|
||||||
|
withAnimation {
|
||||||
|
isPreparing = true
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
let paths: [URL] = try await withThrowingTaskGroup(of: URL.self, body: { group in
|
||||||
|
var paths: [URL] = []
|
||||||
|
for url in urls {
|
||||||
|
group.addTask {
|
||||||
|
try await self.localPathFor(url: url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for try await path in group {
|
||||||
|
paths.append(path)
|
||||||
|
}
|
||||||
|
return paths
|
||||||
|
})
|
||||||
|
self.urls = paths
|
||||||
|
url = paths.first(where: { $0.lastPathComponent == selectedURL.lastPathComponent })
|
||||||
|
withAnimation {
|
||||||
|
isPreparing = false
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
withAnimation {
|
||||||
|
isPreparing = false
|
||||||
|
}
|
||||||
|
self.urls = []
|
||||||
|
url = nil
|
||||||
|
latestError = error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func localPathFor(url: URL) async throws -> URL {
|
||||||
|
let tempDir = URL(fileURLWithPath: NSTemporaryDirectory())
|
||||||
|
let path = tempDir.appendingPathComponent(url.lastPathComponent)
|
||||||
|
let data = try await URLSession.shared.data(from: url).0
|
||||||
|
try data.write(to: path)
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(name: "Network", path: "../Network"),
|
.package(name: "Network", path: "../Network"),
|
||||||
.package(name: "Models", path: "../Models"),
|
.package(name: "Models", path: "../Models"),
|
||||||
.package(name: "Routeur", path: "../Routeur"),
|
.package(name: "Env", path: "../Env"),
|
||||||
.package(name: "Status", path: "../Status"),
|
.package(name: "Status", path: "../Status"),
|
||||||
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
||||||
],
|
],
|
||||||
|
@ -26,7 +26,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(name: "Network", package: "Network"),
|
.product(name: "Network", package: "Network"),
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
.product(name: "Routeur", package: "Routeur"),
|
.product(name: "Env", package: "Env"),
|
||||||
.product(name: "Status", package: "Status"),
|
.product(name: "Status", package: "Status"),
|
||||||
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -2,7 +2,7 @@ import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Status
|
import Status
|
||||||
import Routeur
|
import Env
|
||||||
|
|
||||||
struct NotificationRowView: View {
|
struct NotificationRowView: View {
|
||||||
@EnvironmentObject private var routeurPath: RouterPath
|
@EnvironmentObject private var routeurPath: RouterPath
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import XCTest
|
|
||||||
@testable import Routeur
|
|
||||||
|
|
||||||
final class RouteurTests: XCTestCase {
|
|
||||||
func testExample() throws {
|
|
||||||
// This is an example of a functional test case.
|
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
|
||||||
// results.
|
|
||||||
XCTAssertEqual(Routeur().text, "Hello, World!")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(name: "Models", path: "../Models"),
|
.package(name: "Models", path: "../Models"),
|
||||||
.package(name: "Network", path: "../Network"),
|
.package(name: "Network", path: "../Network"),
|
||||||
.package(name: "Routeur", path: "../Routeur"),
|
.package(name: "Env", path: "../Env"),
|
||||||
.package(name: "DesignSystem", path: "../DesignSystem"),
|
.package(name: "DesignSystem", path: "../DesignSystem"),
|
||||||
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
||||||
],
|
],
|
||||||
|
@ -26,7 +26,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
.product(name: "Network", package: "Network"),
|
.product(name: "Network", package: "Network"),
|
||||||
.product(name: "Routeur", package: "Routeur"),
|
.product(name: "Env", package: "Env"),
|
||||||
.product(name: "DesignSystem", package: "DesignSystem"),
|
.product(name: "DesignSystem", package: "DesignSystem"),
|
||||||
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import Shimmer
|
import Shimmer
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import Routeur
|
import Env
|
||||||
import Network
|
import Network
|
||||||
|
|
||||||
struct StatusActionsView: View {
|
struct StatusActionsView: View {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import AVKit
|
import AVKit
|
||||||
|
import Env
|
||||||
|
|
||||||
private class VideoPlayerViewModel: ObservableObject {
|
private class VideoPlayerViewModel: ObservableObject {
|
||||||
@Published var player: AVPlayer?
|
@Published var player: AVPlayer?
|
||||||
|
@ -33,9 +34,13 @@ private class SelectedMediaSheetManager: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct StatusMediaPreviewView: View {
|
public struct StatusMediaPreviewView: View {
|
||||||
|
@EnvironmentObject private var quickLook: QuickLook
|
||||||
|
|
||||||
public let attachements: [MediaAttachement]
|
public let attachements: [MediaAttachement]
|
||||||
|
|
||||||
@StateObject private var selectedMediaSheetManager = SelectedMediaSheetManager()
|
@StateObject private var selectedMediaSheetManager = SelectedMediaSheetManager()
|
||||||
|
|
||||||
|
@State private var isQuickLookLoading: Bool = false
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
|
@ -56,9 +61,13 @@ public struct StatusMediaPreviewView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sheet(item: $selectedMediaSheetManager.selectedAttachement) { selectedAttachement in
|
.overlay {
|
||||||
makeSelectedAttachementsSheet(selectedAttachement: selectedAttachement)
|
if quickLook.isPreparing {
|
||||||
|
quickLookLoadingView
|
||||||
|
.transition(.opacity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
@ -93,43 +102,25 @@ public struct StatusMediaPreviewView: View {
|
||||||
.cornerRadius(4)
|
.cornerRadius(4)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
selectedMediaSheetManager.selectedAttachement = attachement
|
Task {
|
||||||
}
|
await quickLook.prepareFor(urls: attachements.map{ $0.url }, selectedURL: attachement.url)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private func makeSelectedAttachementsSheet(selectedAttachement: MediaAttachement) -> some View {
|
|
||||||
var attachements = attachements
|
|
||||||
attachements.removeAll(where: { $0.id == selectedAttachement.id })
|
|
||||||
attachements.insert(selectedAttachement, at: 0)
|
|
||||||
return TabView {
|
|
||||||
ForEach(attachements) { attachement in
|
|
||||||
if let type = attachement.supportedType {
|
|
||||||
VStack {
|
|
||||||
Spacer()
|
|
||||||
switch type {
|
|
||||||
case .image:
|
|
||||||
AsyncImage(
|
|
||||||
url: attachement.url,
|
|
||||||
content: { image in
|
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
|
||||||
},
|
|
||||||
placeholder: {
|
|
||||||
ProgressView()
|
|
||||||
.frame(maxWidth: 80, maxHeight: 80)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
case .gifv:
|
|
||||||
VideoPlayerView(viewModel: .init(url: attachement.url))
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tabViewStyle(.page(indexDisplayMode: .always))
|
}
|
||||||
|
|
||||||
|
private var quickLookLoadingView: some View {
|
||||||
|
ZStack(alignment: .center) {
|
||||||
|
VStack {
|
||||||
|
Spacer()
|
||||||
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
ProgressView()
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.background(.ultraThinMaterial)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Models
|
import Models
|
||||||
import Routeur
|
import Env
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Network
|
import Network
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(name: "Network", path: "../Network"),
|
.package(name: "Network", path: "../Network"),
|
||||||
.package(name: "Models", path: "../Models"),
|
.package(name: "Models", path: "../Models"),
|
||||||
.package(name: "Routeur", path: "../Routeur"),
|
.package(name: "Env", path: "../Env"),
|
||||||
.package(name: "Status", path: "../Status"),
|
.package(name: "Status", path: "../Status"),
|
||||||
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0")
|
||||||
],
|
],
|
||||||
|
@ -26,7 +26,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(name: "Network", package: "Network"),
|
.product(name: "Network", package: "Network"),
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
.product(name: "Routeur", package: "Routeur"),
|
.product(name: "Env", package: "Env"),
|
||||||
.product(name: "Status", package: "Status"),
|
.product(name: "Status", package: "Status"),
|
||||||
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
.product(name: "Shimmer", package: "SwiftUI-Shimmer")
|
||||||
]),
|
]),
|
||||||
|
|
Loading…
Reference in a new issue