-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
15 changed files
with
237 additions
and
88 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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: 29 additions & 0 deletions
29
target/desktop/src/main/kotlin/app/cleanmeter/target/desktop/DesktopMain.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,29 @@ | ||
package app.cleanmeter.target.desktop | ||
|
||
import app.cleanmeter.core.common.process.singleInstance | ||
import app.cleanmeter.core.common.reporting.ApplicationParams | ||
import app.cleanmeter.core.os.ProcessManager | ||
import app.cleanmeter.core.os.util.isDev | ||
import app.cleanmeter.core.os.win32.WindowsService | ||
import app.cleanmeter.target.desktop.data.PREFERENCE_PERMISSION_CONSENT | ||
import app.cleanmeter.target.desktop.data.PreferencesRepository | ||
|
||
fun main(vararg args: String) = singleInstance(args) { | ||
if (PreferencesRepository.getPreferenceBoolean(PREFERENCE_PERMISSION_CONSENT, false)) { | ||
WindowsService.tryElevateProcess(ApplicationParams.isAutostart) | ||
|
||
if (isDev()) { | ||
Runtime.getRuntime().addShutdownHook(Thread { | ||
ProcessManager.stop() | ||
}) | ||
} else { | ||
KeyboardManager.registerKeyboardHook() | ||
} | ||
|
||
if (!ApplicationParams.isAutostart) { | ||
ProcessManager.start() | ||
} | ||
} | ||
|
||
composeApp() | ||
} |
28 changes: 0 additions & 28 deletions
28
target/desktop/src/main/kotlin/app/cleanmeter/target/desktop/ServerMain.kt
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
61 changes: 61 additions & 0 deletions
61
target/desktop/src/main/kotlin/app/cleanmeter/target/desktop/ui/components/Button.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,61 @@ | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Text | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.unit.dp | ||
import app.cleanmeter.core.designsystem.LocalColorScheme | ||
import app.cleanmeter.core.designsystem.LocalTypography | ||
|
||
@Composable | ||
internal fun ClearButton( | ||
label: String, | ||
textColor: Color = LocalColorScheme.current.text.inverse, | ||
onClick: () -> Unit | ||
) { | ||
Button( | ||
onClick = onClick, | ||
colors = ButtonDefaults.textButtonColors( | ||
containerColor = Color.Transparent, | ||
), | ||
contentPadding = PaddingValues(horizontal = 8.dp, vertical = 0.dp), | ||
) { | ||
Text( | ||
text = label, | ||
style = LocalTypography.current.labelLMedium, | ||
color = textColor, | ||
modifier = Modifier.wrapContentHeight(), | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
internal fun FilledButton( | ||
label: String, | ||
containerColor: Color = LocalColorScheme.current.background.surfaceRaised, | ||
textColor: Color = LocalColorScheme.current.text.heading, | ||
textStyle: TextStyle = LocalTypography.current.labelLMedium, | ||
contentPadding: PaddingValues = PaddingValues(horizontal = 8.dp, vertical = 0.dp), | ||
onClick: () -> Unit | ||
) { | ||
Button( | ||
onClick = onClick, | ||
colors = ButtonDefaults.textButtonColors( | ||
containerColor = containerColor, | ||
), | ||
contentPadding = contentPadding, | ||
shape = RoundedCornerShape(100), | ||
) { | ||
Text( | ||
text = label, | ||
color = textColor, | ||
style = textStyle, | ||
modifier = Modifier.wrapContentHeight(), | ||
) | ||
} | ||
} |
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.