@@ -35,6 +35,7 @@ public struct ResolvedRestoreImage: ResolvedCatalogModel, DownloadableCatalogCon
3535 public var channel : CatalogChannel
3636 public var features : [ ResolvedVirtualizationFeature ]
3737 public var requirements : ResolvedRequirementSet
38+ public var deviceSupportVersion : CatalogDeviceSupportVersion ?
3839 public var status : ResolvedFeatureStatus
3940 public var localFileURL : URL ?
4041
@@ -46,13 +47,14 @@ public struct ResolvedRestoreImage: ResolvedCatalogModel, DownloadableCatalogCon
4647 public var downloadSize : Int64 { Int64 ( image. downloadSize ?? 0 ) }
4748 public var isDownloaded : Bool { localFileURL != nil }
4849
49- public init ( image: RestoreImage , channel: CatalogChannel , features: [ ResolvedVirtualizationFeature ] , requirements: ResolvedRequirementSet , status: ResolvedFeatureStatus , localFileURL: URL ? ) {
50+ public init ( image: RestoreImage , channel: CatalogChannel , features: [ ResolvedVirtualizationFeature ] , requirements: ResolvedRequirementSet , status: ResolvedFeatureStatus , localFileURL: URL ? , deviceSupportVersion : CatalogDeviceSupportVersion ? ) {
5051 self . image = image
5152 self . channel = channel
5253 self . features = features
5354 self . requirements = requirements
5455 self . status = status
5556 self . localFileURL = localFileURL
57+ self . deviceSupportVersion = deviceSupportVersion
5658 }
5759}
5860
@@ -61,14 +63,21 @@ public enum ResolvedFeatureStatus: Hashable, Sendable {
6163 /// The feature is fully supported.
6264 case supported
6365 /// The feature is partially supported.
64- case warning( message: String )
66+ case warning( title : String ? , message: String )
6567 /// The feature is not supported.
66- case unsupported( message: String )
68+ case unsupported( title: String ? , message: String )
69+
70+ var title : String ? {
71+ switch self {
72+ case . supported: return nil
73+ case . warning( let title, _) , . unsupported( let title, _) : return title
74+ }
75+ }
6776
6877 var message : String ? {
6978 switch self {
7079 case . supported: return nil
71- case . warning( let message) , . unsupported( let message) : return message
80+ case . warning( _ , let message) , . unsupported( _ , let message) : return message
7281 }
7382 }
7483}
@@ -207,7 +216,8 @@ public extension ResolvedRestoreImage {
207216 features: catalog. features. map { ResolvedVirtualizationFeature ( feature: $0, status: . supported, platform: environment. guestPlatform) } ,
208217 requirements: ResolvedRequirementSet ( requirements: catalog. requirementSet ( with: image. requirements) , status: . supported) ,
209218 status: . supported,
210- localFileURL: environment. downloadsProvider? . localFileURL ( for: image)
219+ localFileURL: environment. downloadsProvider? . localFileURL ( for: image) ,
220+ deviceSupportVersion: catalog. deviceSupportVersion ( for: image)
211221 )
212222
213223 update ( with: environment)
@@ -219,7 +229,11 @@ public extension ResolvedRestoreImage {
219229
220230 /// Mobile device requirement is isolated from min host/app requirements.
221231 if versionedEnvironment. mobileDeviceVersion < image. mobileDeviceMinVersion {
222- self . status = . mobileDeviceOutdated
232+ if let deviceSupportVersion {
233+ self . status = . unsupported( title: deviceSupportVersion. title, message: deviceSupportVersion. instructions)
234+ } else {
235+ self . status = . mobileDeviceOutdated
236+ }
223237 }
224238
225239 features = features. map { $0. updated ( with: versionedEnvironment) }
@@ -233,6 +247,16 @@ public extension ResolvedRestoreImage {
233247 }
234248}
235249
250+ extension SoftwareCatalog {
251+ func deviceSupportVersion( for image: RestoreImage ) -> CatalogDeviceSupportVersion ? {
252+ deviceSupportVersions. first ( where: {
253+ $0. mobileDeviceMinVersion == image. mobileDeviceMinVersion
254+ || ( $0. osVersion. major == image. version. major && $0. osVersion. minor == image. version. minor)
255+ || $0. osVersion. major == image. version. major
256+ } )
257+ }
258+ }
259+
236260public extension ResolvedVirtualizationFeature {
237261 mutating func update( with environment: CatalogResolutionEnvironment ) {
238262 guard !feature. unsupportedPlatform else {
@@ -286,7 +310,7 @@ public extension ResolvedRequirementSet {
286310
287311extension ResolvedFeatureStatus {
288312 static func unsupported( _ message: String ? ... ) -> Self {
289- . unsupported( message: message. compactMap ( { $0 } ) . joined ( separator: " \n " ) )
313+ . unsupported( title : nil , message: message. compactMap ( { $0 } ) . joined ( separator: " \n " ) )
290314 }
291315
292316 static func unsupportedHostAndGuestAligned( _ feature: VirtualizationFeature ) -> Self {
@@ -313,16 +337,19 @@ extension ResolvedFeatureStatus {
313337 . unsupported( " Not supported for \( platform. name) guests. " , feature. detail)
314338 }
315339
316-
317340 static var mobileDeviceOutdated : Self {
318- . warning( message: """
319- This version of macOS requires device support files which are not currently installed on your system.
320-
321- It's likely that this is a beta for a major macOS version and your Mac is not running the corresponding macOS beta.
322-
323- Device support files can be obtained by installing the Xcode beta, they are sometimes made available separately in the Apple Developer portal.
324- """ )
341+ . unsupported( title: Self . defaultDeviceSupportUpdateNeededTitle, message: Self . defaultDeviceSupportUpdateNeededInstructions)
325342 }
343+
344+ static let defaultDeviceSupportUpdateNeededTitle = " Device Support Update Required "
345+
346+ static let defaultDeviceSupportUpdateNeededInstructions = """
347+ This version of macOS requires device support files which are not currently installed on your system.
348+
349+ It's likely that this is a beta for a major macOS version and your Mac is not running the corresponding macOS beta.
350+
351+ Device support files can be obtained by installing the Xcode beta, they are sometimes made available separately in the Apple Developer portal.
352+ """
326353}
327354
328355struct CatalogError : LocalizedError , CustomStringConvertible {
@@ -420,7 +447,7 @@ public extension ResolvedVirtualizationFeature {
420447 case . linux: " Supported. Requires host on macOS \( minVersionHost. shortDescription) or later. "
421448 default : " Supported. "
422449 }
423- case . warning( let message) , . unsupported( let message) :
450+ case . warning( _ , let message) , . unsupported( _ , let message) :
424451 message
425452 }
426453 }
0 commit comments