mirror of
https://github.com/devicekit/DeviceKit.git
synced 2026-05-17 10:20:34 +00:00
Restrict advanced volume capacity properties to iOS only, keep basic properties for both iOS and tvOS
Co-authored-by: Zandor300 <6069593+Zandor300@users.noreply.github.com>
This commit is contained in:
@@ -2118,21 +2118,25 @@ extension Device {
|
||||
public static var volumeAvailableCapacity: Int? {
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityKey]))?.volumeAvailableCapacity
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
extension Device {
|
||||
/// The volume’s available capacity in bytes for storing important resources.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumeAvailableCapacityForImportantUsage: Int64? {
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey]))?.volumeAvailableCapacityForImportantUsage
|
||||
}
|
||||
|
||||
/// The volume’s available capacity in bytes for storing nonessential resources.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage
|
||||
}
|
||||
|
||||
/// All volumes capacity information in bytes.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumes: [URLResourceKey: Int64]? {
|
||||
do {
|
||||
let values = try rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey,
|
||||
|
||||
@@ -1259,21 +1259,25 @@ extension Device {
|
||||
public static var volumeAvailableCapacity: Int? {
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityKey]))?.volumeAvailableCapacity
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
extension Device {
|
||||
/// The volume’s available capacity in bytes for storing important resources.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumeAvailableCapacityForImportantUsage: Int64? {
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey]))?.volumeAvailableCapacityForImportantUsage
|
||||
}
|
||||
|
||||
/// The volume’s available capacity in bytes for storing nonessential resources.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name
|
||||
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage
|
||||
}
|
||||
|
||||
/// All volumes capacity information in bytes.
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
public static var volumes: [URLResourceKey: Int64]? {
|
||||
do {
|
||||
let values = try rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey,
|
||||
|
||||
+5
-3
@@ -595,18 +595,20 @@ class DeviceKitTests: XCTestCase {
|
||||
func testVolumeAvailableCapacity() {
|
||||
XCTAssertNotNil(Device.volumeAvailableCapacity)
|
||||
}
|
||||
#endif
|
||||
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
#if os(iOS)
|
||||
@available(iOS 11.0, *)
|
||||
func testVolumeAvailableCapacityForImportantUsage() {
|
||||
XCTAssertNotNil(Device.volumeAvailableCapacityForImportantUsage)
|
||||
}
|
||||
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
func testVolumeAvailableCapacityForOpportunisticUsage() {
|
||||
XCTAssertNotNil(Device.volumeAvailableCapacityForOpportunisticUsage)
|
||||
}
|
||||
|
||||
@available(iOS 11.0, tvOS 11.0, *)
|
||||
@available(iOS 11.0, *)
|
||||
func testVolumes() {
|
||||
XCTAssertNotNil(Device.volumes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user