Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.
Default DeviceInfoProvider
Kabir Oberaif721741b2308
diff --git a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo+Fetching.swift b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo+Fetching.swiftindex 5c0df5f..ae4288b 100644--- a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo+Fetching.swift+++ b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo+Fetching.swift@@ -83,7 +83,7 @@ extension DeviceInfo {}}-#elseif os(Linux) || os(Windows)+#elseextension DeviceInfo {public static func current() -> DeviceInfo? {return DeviceInfo(@@ -97,5 +97,5 @@ extension DeviceInfo {}#endif-// FIXME: Figure out DeviceInfo.current() on Windows/Linux+// FIXME: Figure out DeviceInfo.current() outside macOS// (see above)diff --git a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swiftindex 64a0fc9..f1d46b2 100644--- a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift+++ b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift@@ -92,14 +92,28 @@ public struct DeviceInfo: Codable, Sendable {}-public struct DeviceInfoProvider: TestDependencyKey, Sendable {+extension DeviceInfo {+ public enum FetchError: Error {+ case couldNotFetch+ }++ fileprivate static func fetch() throws -> Self {+ guard let deviceInfo = DeviceInfo.current() else {+ throw FetchError.couldNotFetch+ }+ return deviceInfo+ }+}++public struct DeviceInfoProvider: DependencyKey, Sendable {public var fetch: @Sendable () throws -> DeviceInfopublic init(fetch: @escaping @Sendable () throws -> DeviceInfo) {self.fetch = fetch}- public static let testValue = DeviceInfoProvider(fetch: unimplemented())+ private static let current = Result { try DeviceInfo.fetch() }+ public static let liveValue = DeviceInfoProvider { try current.get() }}extension DependencyValues {diff --git a/Sources/SupersignCLISupport/AuthCommand.swift b/Sources/SupersignCLISupport/AuthCommand.swiftindex f8ce071..87ad635 100644--- a/Sources/SupersignCLISupport/AuthCommand.swift+++ b/Sources/SupersignCLISupport/AuthCommand.swift@@ -201,17 +201,3 @@ struct AuthCommand: AsyncParsableCommand {defaultSubcommand: AuthLoginCommand.self)}--extension DeviceInfo {- static func fetch() throws -> Self {- guard let deviceInfo = DeviceInfo.current() else {- throw Console.Error("Could not fetch client info.")- }- return deviceInfo- }-}--extension DeviceInfoProvider: DependencyKey {- private static let current = Result { try DeviceInfo.fetch() }- public static let liveValue = DeviceInfoProvider { try current.get() }-}