Skip to content

Commit

Permalink
Swap parameters of RequestPermissions API.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 289901802
Change-Id: Id050a14831d04ce167b3e3599649c0d16c2f5e97
  • Loading branch information
ozdemir08 authored and copybara-github committed Jan 15, 2020
1 parent b1357da commit 1c2d294
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
4 changes: 1 addition & 3 deletions samples/SmokeTest/Source/Assets/SmokeTest/MainGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,7 @@ private void ShowPermissionsUi()
else if (GUI.Button(CalcGrid(1, 1), "Request Permission- Email"))
{
Status = "Asking permission for email";
PlayGamesPlatform.Instance.RequestPermission(
code => { Status = "Result code " + code; },
"email");
PlayGamesPlatform.Instance.RequestPermission("email", code => { Status = "Result code " + code; });
}
else if (GUI.Button(CalcGrid(1, 6), "Back"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ public void SubmitScore(
}

/// <summary>Asks user to give permissions for the given scopes.</summary>
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
/// <param name="scopes">Scope to ask permission for</param>
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
{
LogUsage();
if (callback != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ void SubmitScore(string leaderboardId, long score, string metadata,
/// <summary>
/// Asks user to give permissions for the given scopes.
/// </summary>
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
/// <param name="scopes">list of scopes to ask permission for</param>
void RequestPermissions(Action<SignInStatus> callback, string[] scopes);
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
void RequestPermissions(string[] scopes, Action<SignInStatus> callback);

/// <summary>
/// Returns whether or not user has given permissions for given scopes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1398,17 +1398,17 @@ public void LoadScores(ILeaderboard board, Action<bool> callback)
}

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

/// <summary>Asks user to give permissions for the given scopes.</summary>
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
/// <param name="scopes">List of scopes to ask permission for</param>
public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
/// <param name="callback">Callback used to indicate the outcome of the operation.</param>
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
{
if (!IsAuthenticated())
{
Expand All @@ -1418,7 +1418,7 @@ public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
return;
}

mClient.RequestPermissions(callback, scopes);
mClient.RequestPermissions(scopes, callback);
}

/// <summary>Returns whether or not user has given permissions for given scopes.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1020,14 +1020,14 @@ public void SubmitScore(string leaderboardId, long score, string metadata,
}
}

public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
{
callback = AsOnGameThreadCallback(callback);
mTokenClient.RequestPermissions((code =>
mTokenClient.RequestPermissions(scopes, code =>
{
UpdateClients();
callback(code);
}), scopes);
});
}

private void UpdateClients()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void FetchTokens(bool silent, Action<int> callback)
PlayGamesHelperObject.RunOnGameThread(() => DoFetchToken(silent, callback));
}

public void RequestPermissions(Action<SignInStatus> callback, string[] scopes)
public void RequestPermissions(string[] scopes, Action<SignInStatus> callback)
{
using (var bridgeClass = new AndroidJavaClass(HelperFragmentClass))
using (var currentActivity = AndroidHelperFragment.GetActivity())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void GetAnotherServerAuthCode(bool reAuthenticateIfNeeded,

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

void RequestPermissions(Action<SignInStatus> callback, string[] scopes);
void RequestPermissions(string[] scopes, Action<SignInStatus> callback);

bool HasPermissions(string[] scopes);
}
Expand Down

0 comments on commit 1c2d294

Please sign in to comment.