Skip to content

Commit

Permalink
fix: override onMainActivityResult to receive intents
Browse files Browse the repository at this point in the history
  • Loading branch information
Iakobs committed Oct 28, 2024
1 parent 5ee0ce4 commit 2e4dd4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jacobibanez.godot.gpgs

import android.content.Intent
import android.util.Log
import com.google.android.gms.games.PlayGamesSdk
import com.jacobibanez.godot.gpgs.achievements.AchievementsProxy
Expand Down Expand Up @@ -36,6 +37,13 @@ class GodotGooglePlayGameServices(
return getSignals()
}

/** @suppress */
override fun onMainActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onMainActivityResult(requestCode, resultCode, data)
playersProxy.onActivityResult(requestCode, resultCode, data)
snapshotsProxy.onActivityResult(requestCode, resultCode, data)
}

@UsedByGodot
fun initialize() {
Log.d(tag, "Initializing Google Play Game Services")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SnapshotsProxy(
private val showSavedGamesRequestCode = 9010

fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Log.d(tag, "on activity result $requestCode $resultCode $data")
if (requestCode == showSavedGamesRequestCode && resultCode == Activity.RESULT_OK) {
data?.let { intent ->
if (intent.hasExtra(EXTRA_SNAPSHOT_METADATA)) {
Expand Down

0 comments on commit 2e4dd4e

Please sign in to comment.