-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7b1378
commit 2e2b4c3
Showing
5 changed files
with
86 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test Desktop | ||
on: | ||
push: | ||
branches: [ "desktop_support" ] | ||
|
||
|
||
|
||
|
||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | ||
cancel-in-progress: true | ||
|
||
|
||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
config: [ | ||
{ target: macos, os: macos-latest, tasks: jvmTest}, | ||
{ target: linux, os: ubuntu-latest, tasks: jvmTest iosSimulatorArm64Test}, | ||
{ target: windows, os: windows-latest, tasks: jvmTest iosSimulatorArm64Test}, | ||
] | ||
runs-on: ${{ matrix.config.os }} | ||
name: Testing on ${{ matrix.config.target }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup gradle | ||
uses: gradle/[email protected] | ||
|
||
- name: Test ${{ matrix.config.target }} targets | ||
continue-on-error: false | ||
run: ./gradlew ${{ matrix.config.tasks }} |
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: 17 additions & 0 deletions
17
kmpnotifier/src/jvmMain/kotlin/com/mmk/kmpnotifier/extensions/DesktopPlatformExt.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,17 @@ | ||
package com.mmk.kmpnotifier.extensions | ||
|
||
internal sealed interface DesktopPlatform { | ||
data object Linux:DesktopPlatform | ||
data object Windows:DesktopPlatform | ||
data object MacOs:DesktopPlatform | ||
} | ||
|
||
internal fun getDesktopPlatformType(): DesktopPlatform? { | ||
val name = System.getProperty("os.name") | ||
return when { | ||
name?.contains("Linux") == true -> DesktopPlatform.Linux | ||
name?.contains("Win") == true -> DesktopPlatform.Windows | ||
name?.contains("Mac") == true -> DesktopPlatform.MacOs | ||
else -> null | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
kmpnotifier/src/jvmTest/kotlin/NotificationSupporterTest.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,14 @@ | ||
import org.junit.Assert | ||
import org.junit.Test | ||
import java.awt.SystemTray | ||
|
||
class NotificationSupporterTest { | ||
|
||
|
||
@Test | ||
fun testIsTraySupported() { | ||
println("Os name: ${System.getProperty("os.name")}") | ||
val isTraySupported = SystemTray.isSupported() | ||
Assert.assertTrue(isTraySupported) | ||
} | ||
} |