Skip to content

Commit

Permalink
Add null check for nullable properties because google doesn't know ho…
Browse files Browse the repository at this point in the history
…w to use kotlin, apparently
  • Loading branch information
Iakobs committed Dec 17, 2023
1 parent 299649e commit ec5b4f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fun fromAchievement(achievement: Achievement): Dictionary = Dictionary().apply {
put("state", it.name)
}
put("xpValue", achievement.xpValue)
put("revealedImageUri", achievement.revealedImageUri.toString())
put("unlockedImageUri", achievement.unlockedImageUri.toString())
put("revealedImageUri", achievement.revealedImageUri?.toString())
put("unlockedImageUri", achievement.unlockedImageUri?.toString())
put("currentSteps", if (achievement.type == 1) achievement.currentSteps else 0)
put("totalSteps", if (achievement.type == 1) achievement.totalSteps else 0)
put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import org.godotengine.godot.Dictionary

fun fromPlayer(player: Player?): Dictionary = if (player != null) {
Dictionary().apply {
put("bannerImageLandscapeUri", player.bannerImageLandscapeUri.toString())
put("bannerImagePortraitUri", player.bannerImagePortraitUri.toString())
put("bannerImageLandscapeUri", player.bannerImageLandscapeUri?.toString())
put("bannerImagePortraitUri", player.bannerImagePortraitUri?.toString())
put(
"friendsListVisibilityStatus", if (player.currentPlayerInfo != null) {
getVisibilityStatus(player.currentPlayerInfo!!.friendsListVisibilityStatus)
Expand All @@ -24,7 +24,7 @@ fun fromPlayer(player: Player?): Dictionary = if (player != null) {
}
)
put("displayName", player.displayName)
put("hiResImageUri", player.hiResImageUri.toString())
put("hiResImageUri", player.hiResImageUri?.toString())
put("levelInfo", fromPlayerLevelInfo(player.levelInfo))
put("playerId", player.playerId)
put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ fun fromLeaderboardScore(score: LeaderboardScore): Dictionary = Dictionary().app
put("rawScore", score.rawScore)
put("scoreHolder", fromPlayer(score.scoreHolder))
put("scoreHolderDisplayName", score.scoreHolderDisplayName)
put("scoreHolderHiResImageUri", score.scoreHolderHiResImageUri.toString())
put("scoreHolderIconImageUri", score.scoreHolderIconImageUri.toString())
put("scoreHolderHiResImageUri", score.scoreHolderHiResImageUri?.toString())
put("scoreHolderIconImageUri", score.scoreHolderIconImageUri?.toString())
put("scoreTag", score.scoreTag)
put("timestampMillis", score.timestampMillis)
}
Expand All @@ -24,7 +24,7 @@ fun fromLeaderboardScore(score: LeaderboardScore): Dictionary = Dictionary().app
fun fromLeaderboard(leaderboard: Leaderboard): Dictionary = Dictionary().apply {
put("leaderboardId", leaderboard.leaderboardId)
put("displayName", leaderboard.displayName)
put("iconImageUri", leaderboard.iconImageUri.toString())
put("iconImageUri", leaderboard.iconImageUri?.toString())
ScoreOrder.fromOrder(leaderboard.scoreOrder)?.let {
put("scoreOrder", it.name)
}
Expand Down

0 comments on commit ec5b4f2

Please sign in to comment.