Skip to content

Commit 1c2d294

Browse files
ozdemir08copybara-github
authored andcommitted
Swap parameters of RequestPermissions API.
PiperOrigin-RevId: 289901802 Change-Id: Id050a14831d04ce167b3e3599649c0d16c2f5e97
1 parent b1357da commit 1c2d294

File tree

7 files changed

+16
-18
lines changed

7 files changed

+16
-18
lines changed

samples/SmokeTest/Source/Assets/SmokeTest/MainGui.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,7 @@ private void ShowPermissionsUi()
968968
else if (GUI.Button(CalcGrid(1, 1), "Request Permission- Email"))
969969
{
970970
Status = "Asking permission for email";
971-
PlayGamesPlatform.Instance.RequestPermission(
972-
code => { Status = "Result code " + code; },
973-
"email");
971+
PlayGamesPlatform.Instance.RequestPermission("email", code => { Status = "Result code " + code; });
974972
}
975973
else if (GUI.Button(CalcGrid(1, 6), "Back"))
976974
{

source/PluginDev/Assets/GooglePlayGames/BasicApi/DummyClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ public void SubmitScore(
374374
}
375375

376376
/// <summary>Asks user to give permissions for the given scopes.</summary>
377-
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
378377
/// <param name="scopes">Scope to ask permission for</param>
379-
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
378+
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
379+
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
380380
{
381381
LogUsage();
382382
if (callback != null)

source/PluginDev/Assets/GooglePlayGames/BasicApi/IPlayGamesClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ void SubmitScore(string leaderboardId, long score, string metadata,
307307
/// <summary>
308308
/// Asks user to give permissions for the given scopes.
309309
/// </summary>
310-
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
311310
/// <param name="scopes">list of scopes to ask permission for</param>
312-
void RequestPermissions(Action<SignInStatus> callback, string[] scopes);
311+
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
312+
void RequestPermissions(string[] scopes, Action<SignInStatus> callback);
313313

314314
/// <summary>
315315
/// Returns whether or not user has given permissions for given scopes

source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,17 +1398,17 @@ public void LoadScores(ILeaderboard board, Action<bool> callback)
13981398
}
13991399

14001400
/// <summary>Asks user to give permissions for the given scopes.</summary>
1401-
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
14021401
/// <param name="scopes">Scope to ask permission for</param>
1403-
public void RequestPermission(Action<SignInStatus> callback, string scope)
1402+
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
1403+
public void RequestPermission(string scope, Action<SignInStatus> callback)
14041404
{
1405-
RequestPermissions(callback, new string[] {scope});
1405+
RequestPermissions(new string[] {scope}, callback);
14061406
}
14071407

14081408
/// <summary>Asks user to give permissions for the given scopes.</summary>
1409-
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
14101409
/// <param name="scopes">List of scopes to ask permission for</param>
1411-
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
1410+
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
1411+
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
14121412
{
14131413
if (!IsAuthenticated())
14141414
{
@@ -1418,7 +1418,7 @@ public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
14181418
return;
14191419
}
14201420

1421-
mClient.RequestPermissions(callback, scopes);
1421+
mClient.RequestPermissions(scopes, callback);
14221422
}
14231423

14241424
/// <summary>Returns whether or not user has given permissions for given scopes.</summary>

source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,14 +1020,14 @@ public void SubmitScore(string leaderboardId, long score, string metadata,
10201020
}
10211021
}
10221022

1023-
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
1023+
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
10241024
{
10251025
callback = AsOnGameThreadCallback(callback);
1026-
mTokenClient.RequestPermissions((code =>
1026+
mTokenClient.RequestPermissions(scopes, code =>
10271027
{
10281028
UpdateClients();
10291029
callback(code);
1030-
}), scopes);
1030+
});
10311031
}
10321032

10331033
private void UpdateClients()

source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidTokenClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void FetchTokens(bool silent, Action<int> callback)
133133
PlayGamesHelperObject.RunOnGameThread(() => DoFetchToken(silent, callback));
134134
}
135135

136-
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
136+
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
137137
{
138138
using (var bridgeClass = new AndroidJavaClass(HelperFragmentClass))
139139
using (var currentActivity = AndroidHelperFragment.GetActivity())

source/PluginDev/Assets/GooglePlayGames/Platforms/TokenClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void GetAnotherServerAuthCode(bool reAuthenticateIfNeeded,
6969

7070
void FetchTokens(bool silent, Action<int> callback);
7171

72-
void RequestPermissions(Action<SignInStatus> callback, string[] scopes);
72+
void RequestPermissions(string[] scopes, Action<SignInStatus> callback);
7373

7474
bool HasPermissions(string[] scopes);
7575
}

0 commit comments

Comments
 (0)