Skip to content

Commit 49623a2

Browse files
committed
UPM package
1 parent f453f6c commit 49623a2

File tree

76 files changed

+144
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+144
-226
lines changed

CONTRIBUTING.md.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GoogleSignIn.asmdef

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "GoogleSignin"
3+
}

GoogleSignIn.asmdef.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.

GoogleSignInPlugin/Assets/GoogleSignIn/Future.cs GoogleSignIn/Future.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ internal Future(FutureAPIImpl<T> impl) {
7171
/// <param name="tcs">Tcs.</param>
7272
internal IEnumerator WaitForResult(TaskCompletionSource<T> tcs) {
7373
yield return new WaitUntil(() => !Pending);
74-
if (Status == GoogleSignInStatusCode.Canceled) {
74+
if (Status == GoogleSignInStatusCode.CANCELED) {
7575
tcs.SetCanceled();
76-
} else if (Status == GoogleSignInStatusCode.Success ||
77-
Status == GoogleSignInStatusCode.SuccessCached) {
76+
} else if (Status == GoogleSignInStatusCode.SUCCESS ||
77+
Status == GoogleSignInStatusCode.SUCCESS_CACHE) {
7878
tcs.SetResult(Result);
7979
} else {
8080
tcs.SetException(new GoogleSignIn.SignInException(Status));

GoogleSignInPlugin/Assets/GoogleSignIn/GoogleSignIn.cs GoogleSignIn/GoogleSignIn.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static GoogleSignInConfiguration Configuration {
6969
if (theInstance == null || theConfiguration == value || theConfiguration == null) {
7070
theConfiguration = value;
7171
} else {
72-
throw new SignInException(GoogleSignInStatusCode.DeveloperError,
72+
throw new SignInException(GoogleSignInStatusCode.DEVELOPER_ERROR,
7373
"DefaultInstance already created. " +
7474
" Cannot change configuration after creation.");
7575
}

GoogleSignInPlugin/Assets/GoogleSignIn/GoogleSignInConfiguration.cs GoogleSignIn/GoogleSignInConfiguration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class GoogleSignInConfiguration {
5050
/// <summary>Request id token, requires consent.</summary>
5151
public bool RequestIdToken = false;
5252
/// <summary>Request profile information, requires consent.</summary>
53-
public bool RequestProfile = false;
53+
public bool RequestProfile = true;
5454
/// <summary>Hides popup UIs from games services.</summary>
5555
/// <remarks>Used with games signin to show or hide the connecting popup UI
5656
/// and to associate an invisible view for other popups. This is
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// <copyright file="GoogleSignInStatusCode.cs" company="Google Inc.">
2+
// Copyright (C) 2017 Google Inc. All Rights Reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// </copyright>
16+
17+
namespace Google {
18+
19+
/// <summary>
20+
/// Status code for the SignIn operations.
21+
/// </summary>
22+
/// <remarks>All successful status codes are less than or equal to 0.
23+
/// </remarks>
24+
public enum GoogleSignInStatusCode {
25+
SUCCESS_CACHE = -1,
26+
SUCCESS = 0,
27+
[System.Obsolete]
28+
SERVICE_MISSING = 1,
29+
[System.Obsolete]
30+
SERVICE_VERSION_UPDATE_REQUIRED = 2,
31+
[System.Obsolete]
32+
SERVICE_DISABLED = 3,
33+
SIGN_IN_REQUIRED = 4,
34+
INVALID_ACCOUNT = 5,
35+
RESOLUTION_REQUIRED = 6,
36+
NETWORK_ERROR = 7,
37+
INTERNAL_ERROR = 8,
38+
SERVICE_INVALID = 9,
39+
DEVELOPER_ERROR = 10,
40+
LICENSE_CHECK_FAILED = 11,
41+
ERROR = 13,
42+
INTERRUPTED = 14,
43+
TIMEOUT = 15,
44+
CANCELED = 16,
45+
API_NOT_CONNECTED = 17,
46+
DEAD_CLIENT = 18,
47+
REMOTE_EXCEPTION = 19,
48+
CONNECTION_SUSPENDED_DURING_CALL = 20,
49+
RECONNECTION_TIMED_OUT_DURING_UPDATE = 21,
50+
RECONNECTION_TIMED_OUT = 22
51+
}
52+
} // namespace GoogleSignIn
53+
File renamed without changes.

GoogleSignInPlugin/Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs GoogleSignIn/Impl/GoogleSignInImpl.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public SignInListener() : base("com.google.googlesignin.IListener")
132132

133133
public void OnResult(int result, AndroidJavaObject acct)
134134
{
135-
135+
Debug.Log("googlesignin.IListener : " + acct.Call<string>("toString"));
136+
Debug.Log("ID : " + acct.Call<string>("getId"));
136137
}
137138
}
138139

GoogleSignInPlugin/Assets/GoogleSignIn/Impl/GoogleSignInImplEditor.cs GoogleSignIn/Impl/GoogleSignInImplEditor.cs

+4-9
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ static HttpListener BindLocalHostFirstAvailablePort()
8282

8383
void SigningIn()
8484
{
85-
Debug.Log("SigningIn");
8685
Pending = true;
8786
var httpListener = BindLocalHostFirstAvailablePort();
8887
try
8988
{
90-
var openURL = "https://accounts.google.com/o/oauth2/v2/auth?scope=openid email profile&response_type=code&redirect_uri=" + httpListener.Prefixes.FirstOrDefault() + "&client_id=" + configuration.WebClientId;
91-
Debug.Log(openURL);
89+
var openURL = "https://accounts.google.com/o/oauth2/v2/auth?" + Uri.EscapeUriString("scope=openid email profile&response_type=code&redirect_uri=" + httpListener.Prefixes.FirstOrDefault() + "&client_id=" + configuration.WebClientId);
9290
Application.OpenURL(openURL);
9391
}
9492
catch(Exception e)
@@ -103,12 +101,10 @@ void SigningIn()
103101
{
104102
var context = task.Result;
105103
var queryString = context.Request.Url.Query;
106-
Debug.Log(queryString);
107104
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);
108105
if(queryDictionary == null || queryDictionary.Get("code") is not string code || string.IsNullOrEmpty(code))
109106
{
110-
Status = GoogleSignInStatusCode.InvalidAccount;
111-
Debug.Log("no code? : " + context.Request.Url);
107+
Status = GoogleSignInStatusCode.INVALID_ACCOUNT;
112108

113109
context.Response.StatusCode = 404;
114110
context.Response.OutputStream.Write(Encoding.UTF8.GetBytes("Cannot get code"));
@@ -122,7 +118,6 @@ void SigningIn()
122118

123119
var result = await HttpWebRequest.CreateHttp("https://www.googleapis.com/oauth2/v4/token").Post("application/x-www-form-urlencoded","code=" + code + "&client_id=" + configuration.WebClientId + "&client_secret=" + configuration.ClientSecret + "&redirect_uri=" + httpListener.Prefixes.FirstOrDefault() + "&grant_type=authorization_code").ContinueWith((task) => task.Result,taskScheduler);
124120
var jobj = JObject.Parse(result);
125-
Debug.Log(jobj);
126121

127122
var accessToken = (string)jobj.GetValue("access_token");
128123
var expiresIn = (int)jobj.GetValue("expires_in");
@@ -152,11 +147,11 @@ void SigningIn()
152147

153148
Result = user;
154149

155-
Status = GoogleSignInStatusCode.Success;
150+
Status = GoogleSignInStatusCode.SUCCESS;
156151
}
157152
catch(Exception e)
158153
{
159-
Status = GoogleSignInStatusCode.Error;
154+
Status = GoogleSignInStatusCode.ERROR;
160155
Debug.LogException(e);
161156
throw;
162157
}

GoogleSignInPlugin/Assets/GoogleSignIn/Impl/NativeFuture.cs GoogleSignIn/Impl/NativeFuture.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ public GoogleSignInUser Result {
4848
var user = new GoogleSignInUser();
4949
var userPtr = new HandleRef(user, ptr);
5050

51-
user.DisplayName = GoogleSignInImpl.GoogleSignIn_GetDisplayName(userPtr);
51+
user.UserId = GoogleSignInImpl.GoogleSignIn_GetUserId(userPtr);
5252

5353
user.Email = GoogleSignInImpl.GoogleSignIn_GetEmail(userPtr);
5454

55+
user.DisplayName = GoogleSignInImpl.GoogleSignIn_GetDisplayName(userPtr);
56+
5557
user.FamilyName = GoogleSignInImpl.GoogleSignIn_GetFamilyName(userPtr);
5658

5759
user.GivenName = GoogleSignInImpl.GoogleSignIn_GetGivenName(userPtr);
@@ -65,7 +67,9 @@ public GoogleSignInUser Result {
6567
user.ImageUrl = new System.Uri(url);
6668
}
6769

68-
user.UserId = GoogleSignInImpl.GoogleSignIn_GetUserId(userPtr);
70+
/** Require for no reason (tree shaking ?) */
71+
var obj = (user.UserId,user.Email,user.DisplayName,user.FamilyName,user.GivenName,user.IdToken,user.AuthCode,user.ImageUrl);
72+
6973
return user;
7074
}
7175
}

GoogleSignInPlugin/Assets/GoogleSignIn/GoogleSignInStatusCode.cs

-72
This file was deleted.

GoogleSignInPlugin/Assets/Parse.meta

-9
This file was deleted.

GoogleSignInPlugin/Assets/Parse/LICENSE

-30
This file was deleted.

GoogleSignInPlugin/Assets/Parse/Plugins.meta

-9
This file was deleted.
Binary file not shown.

GoogleSignInPlugin/Assets/Parse/Plugins/Unity.Compat.dll.meta

-36
This file was deleted.
Binary file not shown.

GoogleSignInPlugin/Assets/Parse/Plugins/Unity.Tasks.dll.meta

-36
This file was deleted.

0 commit comments

Comments
 (0)