-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #612 from appwrite/fix-tvos-watchos
- Loading branch information
Showing
24 changed files
with
1,171 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
templates/swift/Sources/DeviceInfo/MacOS/MacOSDeviceInfo.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 7 additions & 22 deletions
29
templates/swift/Sources/DeviceInfo/Windows/WindowsDeviceInfo.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,16 @@ | ||
#if os(Windows) | ||
import Foundation | ||
|
||
class WindowsDeviceInfo : DeviceInfo { | ||
class WindowsDeviceInfo { | ||
|
||
let numberOfCores: String | ||
let computerName: String | ||
let systemMemoryInMegabytes: UInt64 | ||
|
||
public init( | ||
numberOfCores: String, | ||
computerName: String, | ||
systemMemoryInMegabytes: UInt64 | ||
) { | ||
self.numberOfCores = numberOfCores | ||
self.computerName = computerName | ||
self.systemMemoryInMegabytes = systemMemoryInMegabytes | ||
} | ||
|
||
public static func get() -> WindowsDeviceInfo { | ||
let memory = ProcessInfo.processInfo.physicalMemory / 1000 / 1000 // Bytes to MB | ||
|
||
return WindowsDeviceInfo( | ||
numberOfCores: ProcessInfo.processInfo.processorCount.description, | ||
computerName: Host.current().localizedName ?? "", | ||
systemMemoryInMegabytes: memory | ||
) | ||
public init() { | ||
numberOfCores = ProcessInfo.processInfo.processorCount.description | ||
computerName = Host.current().localizedName ?? "" | ||
systemMemoryInMegabytes = ProcessInfo.processInfo.physicalMemory / 1000 / 1000 // Bytes to MB | ||
} | ||
} | ||
#endif | ||
|
||
#endif |
27 changes: 27 additions & 0 deletions
27
templates/swift/Sources/DeviceInfo/iOS/IOSDeviceInfo.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#if os(iOS) || os(tvOS) | ||
import Foundation | ||
import UIKit | ||
|
||
class IOSDeviceInfo { | ||
|
||
let name: String | ||
let systemName: String | ||
let systemVersion: String | ||
let model: String | ||
let localizedModel: String | ||
let identifierForVendor: String | ||
let modelIdentifier: String | ||
|
||
public init() { | ||
let device = UIDevice.current | ||
|
||
name = device.name | ||
systemName = device.systemName | ||
systemVersion = device.systemVersion | ||
model = device.model | ||
localizedModel = device.localizedModel | ||
identifierForVendor = device.identifierForVendor?.uuidString ?? "" | ||
modelIdentifier = UIDevice.modelName | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.