Skip to content
Snippets Groups Projects
Unverified Commit 6d1e6771 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

fix: wrong account load crash

parent db1d2d74
No related branches found
No related tags found
No related merge requests found
...@@ -87,24 +87,26 @@ fun MeteroidRouter( ...@@ -87,24 +87,26 @@ fun MeteroidRouter(
MeteroidScreen.Home.Purchase.route, arguments = listOf( MeteroidScreen.Home.Purchase.route, arguments = listOf(
navArgument("server") { navArgument("server") {
type = NavType.LongType type = NavType.LongType
initialAccount.server?.let { defaultValue = it.value } defaultValue = initialAccount.server?.value ?: -1L
}, },
navArgument("user") { navArgument("user") {
type = NavType.LongType type = NavType.LongType
initialAccount.user?.let { defaultValue = it.value } defaultValue = initialAccount.user?.value ?: -1L
}, },
) )
) { entry -> ) { entry ->
val serverId = entry.arguments?.getLong("server")?.let(::ServerId) val serverId = entry.arguments?.getLong("server")?.let(::ServerId)
?: ServerId(-1L)
val userId = entry.arguments?.getLong("user")?.let(::UserId) val userId = entry.arguments?.getLong("user")?.let(::UserId)
?: UserId(-1L)
LaunchedEffect(serverId, userId) { LaunchedEffect(serverId, userId) {
if (serverId == null || userId == null) { if (!serverId.isValid() || !userId.isValid()) {
navigationViewModel.expanded.value = true navigationViewModel.expanded.value = true
} }
} }
if (serverId != null && userId != null) { if (serverId.isValid() && userId.isValid()) {
val viewModel: PurchaseViewModel = hiltViewModel( val viewModel: PurchaseViewModel = hiltViewModel(
key = MeteroidScreen.Home.Purchase.build(serverId, userId) key = MeteroidScreen.Home.Purchase.build(serverId, userId)
) )
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m org.gradle.jvmargs=-Xmx4096m
org.gradle.configuration-cache=true
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
......
package util package util
import org.gradle.api.Project import org.gradle.api.Project
import java.io.ByteArrayOutputStream
import java.util.* import java.util.*
@Suppress("UnstableApiUsage")
fun Project.cmd(vararg command: String) = try { fun Project.cmd(vararg command: String) = try {
val stdOut = ByteArrayOutputStream() providers.exec {
exec {
commandLine(*command) commandLine(*command)
standardOutput = stdOut }.standardOutput.asText.get().trim()
}
stdOut.toString(Charsets.UTF_8.name()).trim()
} catch (e: Throwable) { } catch (e: Throwable) {
e.printStackTrace() e.printStackTrace()
null null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment