-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apollo to support all apple devices
- tvOS - watchOS - macOS
- Loading branch information
Showing
6 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
Apollo/src/macosX64Main/kotlin/io.iohk.prism.apollo/Platform.kt
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,11 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import platform.Foundation.NSProcessInfo | ||
|
||
actual object Platform { | ||
actual val OS: String | ||
get() { | ||
val processInfo = NSProcessInfo.processInfo() | ||
return "${processInfo.operatingSystemName()}-${processInfo.operatingSystemVersionString()}" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Apollo/src/macosX64Test/kotlin/io.iohk.prism.apollo/PlatformTest.kt
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,13 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class PlatformTest { | ||
|
||
@Test | ||
fun testPlatformName() { | ||
println(Platform.OS) | ||
assertTrue(Platform.OS.lowercase().contains("mac"), "Check macOS is mentioned") | ||
} | ||
} |
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,7 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
actual object Platform { | ||
actual val OS: String = "${UIDevice.currentDevice.systemName()}-${UIDevice.currentDevice.systemVersion}" | ||
} |
13 changes: 13 additions & 0 deletions
13
Apollo/src/tvosTest/kotlin/io.iohk.prism.apollo/PlatformTest.kt
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,13 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class PlatformTest { | ||
|
||
@Test | ||
fun testPlatformName() { | ||
println(Platform.OS) | ||
assertTrue(Platform.OS.lowercase().contains("tvos"), "Check tvOS is mentioned") | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Apollo/src/watchosMain/kotlin/io.iohk.prism.apollo/Platform.kt
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,11 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import platform.WatchKit.WKInterfaceDevice | ||
|
||
actual object Platform { | ||
actual val OS: String | ||
get() { | ||
val wkInterfaceDevice = WKInterfaceDevice.currentDevice() | ||
return "${wkInterfaceDevice.systemName}-${wkInterfaceDevice.systemVersion}" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Apollo/src/watchosTest/kotlin/io.iohk.prism.apollo/PlatformTest.kt
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,13 @@ | ||
package io.iohk.prism.apollo | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class PlatformTest { | ||
|
||
@Test | ||
fun testPlatformName() { | ||
println(Platform.OS) | ||
assertTrue(Platform.OS.lowercase().contains("watchos"), "Check watchOS is mentioned") | ||
} | ||
} |