forked from openMF/mobile-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Desktop app setup for ComposeMultiplatform (openMF#1716)
* Implement DesktopSetup for ComposeMultiplatform * Configure windows DesktopSetup
- Loading branch information
1 parent
15d47f7
commit 62993d3
Showing
8 changed files
with
122 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
alias(libs.plugins.jetbrainsCompose) | ||
} | ||
|
||
|
||
kotlin { | ||
jvm { | ||
jvmToolchain(17) | ||
withJava() | ||
} | ||
|
||
sourceSets { | ||
val jvmMain by getting { | ||
dependencies { | ||
implementation(project(":shared")) | ||
implementation(compose.desktop.currentOs) | ||
} | ||
} | ||
} | ||
} | ||
|
||
compose.desktop { | ||
application { | ||
mainClass = "MainKt" | ||
nativeDistributions { | ||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) | ||
packageName = "org.mifospay.desktop" | ||
packageVersion = "1.0.0" | ||
windows { | ||
// a version for all Windows distributables | ||
packageVersion = "1.0.0" | ||
// a version only for the msi package | ||
msiPackageVersion = "1.0.0" | ||
// a version only for the exe package | ||
exePackageVersion = "1.0.0" | ||
menu = true | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
import androidx.compose.ui.window.Window | ||
import androidx.compose.ui.window.application | ||
import androidx.compose.ui.window.rememberWindowState | ||
import org.mifospay.shared.MainView | ||
|
||
fun main() { | ||
application { | ||
val windowState = rememberWindowState() | ||
Window( | ||
onCloseRequest = ::exitApplication, | ||
state = windowState, | ||
title = "MifosWallet" | ||
) { | ||
MainView() | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.mifospay.shared | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material.Text | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
|
||
|
||
@Composable | ||
fun App() { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Text( | ||
text = "MifosWallet", | ||
style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold), | ||
color = MaterialTheme.colorScheme.onSurface, | ||
) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
shared/src/desktopMain/kotlin/org/mifospay/shared/Platform.desktop.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,12 @@ | ||
package org.mifospay.shared | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
fun MainView() = App() | ||
|
||
class JVMPlatform: Platform { | ||
override val name: String ="Windows" | ||
} | ||
|
||
actual fun getPlatform(): Platform = JVMPlatform() |