Skip to content

Commit

Permalink
Submit score as Long instead of Int.
Browse files Browse the repository at this point in the history
  • Loading branch information
theLee3 committed Aug 12, 2024
1 parent 610a8b1 commit 7714a99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class GamesServicesPlugin : FlutterPlugin,
}
Method.SubmitScore -> {
val leaderboardID = call.argument<String>("leaderboardID") ?: ""
val score = call.argument<Int>("value") ?: 0
val scoreValue = call.argument<Any>("value") ?: 0L
val score = if (scoreValue is Int) scoreValue.toLong() else scoreValue as Long
val token = call.argument<String>("token") ?: ""
leaderboards?.submitScore(leaderboardID, score, token, result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class Leaderboards(private var activityPluginBinding: ActivityPluginBinding) :
}
}

fun submitScore(leaderboardID: String, score: Int, token: String, result: MethodChannel.Result) {
leaderboardsClient.submitScoreImmediate(leaderboardID, score.toLong(), token).addOnSuccessListener {
fun submitScore(leaderboardID: String, score: Long, token: String, result: MethodChannel.Result) {
leaderboardsClient.submitScoreImmediate(leaderboardID, score, token).addOnSuccessListener {
result.success(null)
}
.addOnFailureListener {
Expand Down

0 comments on commit 7714a99

Please sign in to comment.