diff --git a/source/PluginDev/Assets/GooglePlayGames/BasicApi/DummyClient.cs b/source/PluginDev/Assets/GooglePlayGames/BasicApi/DummyClient.cs
index c946e229e..1182d9921 100644
--- a/source/PluginDev/Assets/GooglePlayGames/BasicApi/DummyClient.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/BasicApi/DummyClient.cs
@@ -492,6 +492,22 @@ private static void LogUsage()
{
Logger.d("Received method call on DummyClient - using stub implementation.");
}
+
+ ///
+ /// Shows the Player Games Profile UI for the given user identifier.
+ ///
+ /// User Identifier.
+ /// Callback to invoke when complete.
+ public void ShowCompareProfileUI(
+ string userId,
+ Action callback)
+ {
+ LogUsage();
+ if (callback != null)
+ {
+ callback.Invoke(UIStatus.VersionUpdateRequired);
+ }
+ }
}
}
#endif
\ No newline at end of file
diff --git a/source/PluginDev/Assets/GooglePlayGames/BasicApi/IPlayGamesClient.cs b/source/PluginDev/Assets/GooglePlayGames/BasicApi/IPlayGamesClient.cs
index f0e3a0918..ea1dfdc56 100644
--- a/source/PluginDev/Assets/GooglePlayGames/BasicApi/IPlayGamesClient.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/BasicApi/IPlayGamesClient.cs
@@ -350,6 +350,13 @@ void SubmitScore(string leaderboardId, long score, string metadata,
/// popups for achievements and other game services elements.
/// Gravity for the popup.
void SetGravityForPopups(Gravity gravity);
+
+ ///
+ /// Shows the Play Games Player Profile UI for a specific player.
+ ///
+ /// User identifier. It cannot be null.
+ /// Callback.
+ void ShowCompareProfileUI(string userId, Action callback);
}
///
diff --git a/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs b/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs
index 5efea466e..79b8f7e07 100644
--- a/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs
@@ -713,6 +713,28 @@ public void ReportProgress(string achievementID, double progress, Action c
});
}
+ ///
+ /// Shows the Player Profile UI for the given player Id
+ ///
+ /// User Identifier. It cannot be null.
+ /// Callback to call. If null, nothing is called.
+ public void ShowCompareProfileUI(string userId, Action callback)
+ {
+ if (!IsAuthenticated())
+ {
+ GooglePlayGames.OurUtils.Logger.e("ShowCompareProfileUI can only be called after authentication.");
+ if (callback != null)
+ {
+ callback(UIStatus.NotAuthorized);
+ }
+
+ return;
+ }
+ GooglePlayGames.OurUtils.Logger.d("ShowCompareProfileUI, userId=" +
+ userId + " callback is " + callback);
+ mClient.ShowCompareProfileUI(userId, callback);
+ }
+
///
/// Reveals the achievement with the passed identifier. This is a Play Games extension of the ISocialPlatform API.
///
diff --git a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs
index 0ca6bb603..f052d4963 100644
--- a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs
@@ -568,6 +568,34 @@ public void GetPlayerStats(Action callback)
});
}
}
+
+ ///
+ ///
+ public void ShowCompareProfileUI(string userId, Action callback)
+ {
+ if (!IsAuthenticated())
+ {
+ InvokeCallbackOnGameThread(callback, UIStatus.NotAuthorized);
+ return;
+ }
+
+ using (var playersClient = getPlayersClient())
+ using (var task = playersClient.Call("loadPlayer", userId))
+ {
+ AndroidTaskUtils.AddOnSuccessListener(
+ task, annotatedData =>
+ {
+ using (var user = annotatedData.Call("get"))
+ {
+ AndroidHelperFragment.ShowCompareProfileUI(user, AsOnGameThreadCallback(callback));
+ }
+ });
+ AndroidTaskUtils.AddOnFailureListener(task, exception =>
+ {
+ InvokeCallbackOnGameThread(callback, UIStatus.NotAuthorized);
+ });
+ }
+ }
///
///
diff --git a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidHelperFragment.cs b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidHelperFragment.cs
index c66b4a2b0..6a64892cb 100644
--- a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidHelperFragment.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidHelperFragment.cs
@@ -128,6 +128,29 @@ public static void ShowLeaderboardUI(string leaderboardId, LeaderboardTimeSpan t
}
}
+ public static void ShowCompareProfileUI(AndroidJavaObject user, Action cb)
+ {
+ using (var helperFragment = new AndroidJavaClass(HelperFragmentClass))
+ using (var task = helperFragment.CallStatic("showCompareProfileUI",
+ AndroidHelperFragment.GetActivity(), user))
+ {
+ AndroidTaskUtils.AddOnSuccessListener(
+ task,
+ uiCode =>
+ {
+ Debug.Log("ShowCompareProfileUI result " + uiCode);
+ cb.Invoke((UIStatus) uiCode);
+ });
+ AndroidTaskUtils.AddOnFailureListener(
+ task,
+ exception =>
+ {
+ Debug.Log("ShowCompareProfileUI failed with exception");
+ cb.Invoke(UIStatus.InternalError);
+ });
+ }
+ }
+
public static void ShowSelectSnapshotUI(bool showCreateSaveUI, bool showDeleteSaveUI,
int maxDisplayedSavedGames, string uiTitle, Action cb)
{
diff --git a/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CompareProfileUiRequest.java b/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CompareProfileUiRequest.java
new file mode 100644
index 000000000..25fddfa35
--- /dev/null
+++ b/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CompareProfileUiRequest.java
@@ -0,0 +1,26 @@
+package com.google.games.bridge;
+
+import android.app.Activity;
+import android.content.Intent;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import com.google.android.gms.games.Games;
+import com.google.android.gms.games.PlayersClient;
+import com.google.android.gms.games.Player;
+import com.google.android.gms.tasks.Task;
+
+class CompareProfileUiRequest extends SimpleUiRequest {
+ private static final String TAG = "CompareProfileUiRequest";
+ private Player player;
+
+ CompareProfileUiRequest(Player player) {
+ this.player = player;
+ }
+
+ @Override
+ protected Task getIntent(Activity activity) {
+ GoogleSignInAccount account = HelperFragment.getAccount(activity);
+ PlayersClient playersClient = Games.getPlayersClient(activity, account);
+ return playersClient.getCompareProfileIntent(player);
+ }
+}
+
diff --git a/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java b/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java
index 799316619..1dbe734a1 100644
--- a/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java
+++ b/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java
@@ -35,6 +35,7 @@
import com.google.android.gms.common.api.Status;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesActivityResultCodes;
+import com.google.android.gms.games.Player;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.realtime.Room;
import com.google.android.gms.tasks.Task;
@@ -173,6 +174,17 @@ public static Task showRtmpSelectOpponentsU
return request.getTask();
}
+
+ public static Task showCompareProfileUI(Activity parentActivity, Player player) {
+ CompareProfileUiRequest request = new CompareProfileUiRequest(player);
+
+ if(!HelperFragment.startRequest(parentActivity, request)) {
+ request.setResult(CommonUIStatus.UI_BUSY);
+ }
+
+ return request.getTask();
+ }
+
public static Task showTbmpSelectOpponentsUi(Activity parentActivity, int minOpponents, int maxOpponents) {
TbmpSelectOpponentsUiRequest request = new TbmpSelectOpponentsUiRequest(minOpponents, maxOpponents);