Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active December 3, 2021 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilrajsingh1997/124ef29c97218262ac02a0661ea3f8da to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/124ef29c97218262ac02a0661ea3f8da to your computer and use it in GitHub Desktop.
file addLine "return \"$route${if (propertyMap.isNotEmpty()) "?" else ""}\" + "
tabs++
tabs++
count = 0
properties.forEach { property ->
count++
val propertyInfo = propertyMap[property] ?: run {
logger.error("Invalid type argument", property)
return
}
val argumentName = propertyInfo.propertyName
file addLine "\"$argumentName="
file addPhrase when (propertyInfo.composeArgumentType) {
ComposeArgumentType.INT,
ComposeArgumentType.BOOLEAN,
ComposeArgumentType.LONG,
ComposeArgumentType.FLOAT,
ComposeArgumentType.STRING -> "$$argumentName"
else -> "\${Uri.encode(gson.toJson($argumentName))}"
}
if (count == propertyMap.size) {
file addPhrase "\""
} else {
file addPhrase ",\""
}
file addPhrase " + "
}
file addLine "\"\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment