Before upgrade
This commit is contained in:
parent
a2c0383433
commit
81c5788a02
9
Assets/GoogleSignIn.meta
Normal file
9
Assets/GoogleSignIn.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a089c79cc334748a5a29c5f219b7cfd4
|
||||
folderAsset: yes
|
||||
timeCreated: 1490807626
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/GoogleSignIn/Editor.meta
Normal file
9
Assets/GoogleSignIn/Editor.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a7e77ece57ef34772969fad4915b1a4c
|
||||
folderAsset: yes
|
||||
timeCreated: 1490978071
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml
Normal file
19
Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dependencies>
|
||||
<!-- See https://github.com/googlesamples/unity-jar-resolver#usage for
|
||||
how to configure dependencies -->
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.google.android.gms:play-services-auth:16+">
|
||||
<androidSdkPackageIds>
|
||||
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
|
||||
</androidSdkPackageIds>
|
||||
</androidPackage>
|
||||
</androidPackages>
|
||||
|
||||
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
|
||||
<iosPods>
|
||||
<iosPod name="GoogleSignIn" version=">= 4.0.2" bitcodeEnabled="false"
|
||||
minTargetSdk="6.0">
|
||||
</iosPod>
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
10
Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml.meta
Normal file
10
Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 938014c9994164100b26d82840a88fbb
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dependencies>
|
||||
<!-- Internal library dependency generated at build time. -->
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.google.signin:google-signin-support:1.0.4">
|
||||
<repositories>
|
||||
<repository>Assets/GoogleSignIn/Editor/m2repository</repository>
|
||||
</repositories>
|
||||
</androidPackage>
|
||||
</androidPackages>
|
||||
</dependencies>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e8689106c65f445c19cec6044d615c19
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/GoogleSignIn/Editor/google-signin-plugin_v1.0.4.txt
Normal file
33
Assets/GoogleSignIn/Editor/google-signin-plugin_v1.0.4.txt
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.89.0.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.89.0.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.89.0.dll
|
||||
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.mm
|
||||
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.h
|
||||
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.h
|
||||
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.mm
|
||||
Assets/Parse/LICENSE
|
||||
Assets/Parse/Plugins/Unity.Compat.dll
|
||||
Assets/Parse/Plugins/Unity.Tasks.dll
|
||||
Assets/SignInSample/MainScene.unity
|
||||
Assets/SignInSample/SigninSampleScript.cs
|
||||
Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs
|
||||
Assets/GoogleSignIn/Impl/SignInHelperObject.cs
|
||||
Assets/GoogleSignIn/Impl/NativeFuture.cs
|
||||
Assets/GoogleSignIn/Impl/BaseObject.cs
|
||||
Assets/GoogleSignIn/GoogleSignIn.cs
|
||||
Assets/GoogleSignIn/GoogleSignInConfiguration.cs
|
||||
Assets/GoogleSignIn/Future.cs
|
||||
Assets/GoogleSignIn/GoogleSignInUser.cs
|
||||
Assets/GoogleSignIn/GoogleSignInStatusCode.cs
|
||||
Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml
|
||||
Assets/GoogleSignIn/Editor/GoogleSignInSupportDependencies.xml
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/maven-metadata.xml
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/maven-metadata.xml.md5
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/maven-metadata.xml.sha1
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.pom.md5
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.srcaar.sha1
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.pom.sha1
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.srcaar
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.pom
|
||||
Assets/GoogleSignIn/Editor/m2repository/com/google/signin/google-signin-support/1.0.4/google-signin-support-1.0.4.srcaar.md5
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a67d5f0cfc09749e6b1ce13e8b8e6e1d
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_manifest
|
||||
- gvh_version-1.0.4
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/GoogleSignIn/Editor/m2repository.meta
Normal file
10
Assets/GoogleSignIn/Editor/m2repository.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eefc3dc8b56e545998952bd59ab36247
|
||||
folderAsset: yes
|
||||
timeCreated: 1508956004
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/GoogleSignIn/Editor/m2repository/com.meta
Normal file
10
Assets/GoogleSignIn/Editor/m2repository/com.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ade49ef91c70440a0baeac322ecaa2d7
|
||||
folderAsset: yes
|
||||
timeCreated: 1508956004
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/GoogleSignIn/Editor/m2repository/com/google.meta
Normal file
10
Assets/GoogleSignIn/Editor/m2repository/com/google.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 707de6ade212a46b1ab4bf4d42325176
|
||||
folderAsset: yes
|
||||
timeCreated: 1508956004
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 34b86fc2e934d482ea5f9d1f5354b0f9
|
||||
folderAsset: yes
|
||||
timeCreated: 1508956004
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e3becceb8680148d59e5bb93e5eb5a24
|
||||
folderAsset: yes
|
||||
timeCreated: 1508956004
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 001a15402063b4df983ba8bc4ddb269f
|
||||
folderAsset: yes
|
||||
timeCreated: 1537405253
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.google.signin</groupId>
|
||||
<artifactId>google-signin-support</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<packaging>srcaar</packaging>
|
||||
</project>
|
||||
|
|
@ -0,0 +1 @@
|
|||
7cd48eaf454469c04dae63043d467d69
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 907bf7a19cd7848cabf1f641f61343ee
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a3f74b3d329a24e81a6c6f9f1d2f46f1
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
f30d09407a5b0e439bfc0e54e33f3a34f7c7d35c
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e1a3ff77f802d43818521ff3db2bf944
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
040097cf545e84135c0e4d783e3b1143
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 79f9d122dd99b483282294f3b1f1bd36
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6eab7a3cbdbf34cffaf951dc9210a32c
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
632874f93336b4f05e15f55b63656dace924fa72
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d508eb0e16bb14c8a962b343e755ef01
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.google.signin</groupId>
|
||||
<artifactId>google-signin-support</artifactId>
|
||||
<versioning>
|
||||
<release>1.0.4</release>
|
||||
<versions>
|
||||
<version>1.0.4</version>
|
||||
</versions>
|
||||
<lastUpdated>20180920010048</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
|
|
@ -0,0 +1 @@
|
|||
e243363a85b4f7bd1170918ba674061b
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c020582c1a85d47c7934908f00a0bd37
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3911d467587242978192a8723c68395
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
43ebede449c3782df517a7156c18c28cde4fd4f4
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 16b8065a143bb4277af08381a56157dd
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/GoogleSignIn/Future.cs
Normal file
84
Assets/GoogleSignIn/Future.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
// <copyright file="Future.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
namespace Google {
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for implementations of the Future<T> API.
|
||||
/// </summary>
|
||||
internal interface FutureAPIImpl<T> {
|
||||
bool Pending { get; }
|
||||
GoogleSignInStatusCode Status { get; }
|
||||
T Result { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Future return value.
|
||||
/// </summary>
|
||||
/// <remarks>This class provides a promise of a result from a method call.
|
||||
/// The typical usage is to check the Pending property until it is false.
|
||||
/// At this time either the Status or Result will be available for use.
|
||||
/// Result is only set if the operation was successful.
|
||||
/// As a convience, a coroutine to complete a Task is provided.
|
||||
/// </remarks>
|
||||
public class Future<T> {
|
||||
|
||||
private FutureAPIImpl<T> apiImpl;
|
||||
|
||||
internal Future(FutureAPIImpl<T> impl) {
|
||||
apiImpl = impl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this
|
||||
/// <see cref="T:Google.Future`1"/> is pending.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if pending; otherwise, <c>false</c>.</value>
|
||||
public bool Pending { get { return apiImpl.Pending; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status.
|
||||
/// </summary>
|
||||
/// <value>The status is set when Pending == false.</value>
|
||||
GoogleSignInStatusCode Status { get { return apiImpl.Status; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the result.
|
||||
/// </summary>
|
||||
/// <value>The result is set when Pending == false and there is no error.
|
||||
/// </value>
|
||||
T Result { get { return apiImpl.Result; } }
|
||||
|
||||
/// <summary>
|
||||
/// Waits for result then completes the TaskCompleationSource.
|
||||
/// </summary>
|
||||
/// <returns>The for result.</returns>
|
||||
/// <param name="tcs">Tcs.</param>
|
||||
internal IEnumerator WaitForResult(TaskCompletionSource<T> tcs) {
|
||||
yield return new WaitUntil(() => !Pending);
|
||||
if (Status == GoogleSignInStatusCode.Canceled) {
|
||||
tcs.SetCanceled();
|
||||
} else if (Status == GoogleSignInStatusCode.Success ||
|
||||
Status == GoogleSignInStatusCode.SuccessCached) {
|
||||
tcs.SetResult(Result);
|
||||
} else {
|
||||
tcs.SetException(new GoogleSignIn.SignInException(Status));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/Future.cs.meta
Normal file
14
Assets/GoogleSignIn/Future.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad3b09fb652fb4ff0a68d1966f13160e
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
202
Assets/GoogleSignIn/GoogleSignIn.cs
Normal file
202
Assets/GoogleSignIn/GoogleSignIn.cs
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
// <copyright file="GoogleSignIn.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google {
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Google.Impl;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Google sign in API.
|
||||
/// </summary>
|
||||
/// <remarks>This class implements the GoogleSignInAPI for Unity.
|
||||
/// Typical usage is to set the Configuration options as needed, then
|
||||
/// get the DefaultInstance and call signIn or signInSilently. See
|
||||
/// the <a href="https://developers.google.com/identity">
|
||||
/// Google Sign-In API documentation for more details.</a>
|
||||
/// <para>
|
||||
/// <code>
|
||||
/// private static readonly GoogleSignInConfiguration configuration =
|
||||
/// new GoogleSignInConfiguration {
|
||||
/// WebClientId = "<your client id here >",
|
||||
/// RequestIdToken = true
|
||||
/// };
|
||||
///
|
||||
/// public void OnSignIn() {
|
||||
/// GoogleSignIn.Configuration = configuration;
|
||||
/// GoogleSignIn.Configuration.UseGameSignIn = false;
|
||||
/// GoogleSignIn.Configuration.RequestIdToken = true;
|
||||
/// GoogleSignIn.DefaultInstance.SignIn().ContinueWith(
|
||||
/// OnAuthenticationFinished);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public class GoogleSignIn {
|
||||
|
||||
#if !UNITY_ANDROID && !UNITY_IOS
|
||||
static GoogleSignIn() {
|
||||
Debug.LogError("This platform is not supported");
|
||||
}
|
||||
#endif
|
||||
|
||||
private static GoogleSignIn theInstance = null;
|
||||
private static GoogleSignInConfiguration theConfiguration = null;
|
||||
private ISignInImpl impl;
|
||||
|
||||
///<summary> The configuration settings for Google Sign-in.</summary>
|
||||
///<remarks> The configuration should be set before calling the sign-in
|
||||
/// methods. Once the configuration is set it cannot be changed.
|
||||
///</remarks>
|
||||
public static GoogleSignInConfiguration Configuration {
|
||||
set {
|
||||
// Can set the configuration until the singleton is created.
|
||||
if (theInstance == null || theConfiguration == value || theConfiguration == null) {
|
||||
theConfiguration = value;
|
||||
} else {
|
||||
throw new SignInException(GoogleSignInStatusCode.DeveloperError,
|
||||
"DefaultInstance already created. " +
|
||||
" Cannot change configuration after creation.");
|
||||
}
|
||||
}
|
||||
|
||||
get {
|
||||
return theConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Singleton instance of this class.
|
||||
/// </summary>
|
||||
/// <value>The instance.</value>
|
||||
public static GoogleSignIn DefaultInstance {
|
||||
get {
|
||||
if (theInstance == null) {
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
theInstance = new GoogleSignIn(new GoogleSignInImpl(Configuration));
|
||||
#else
|
||||
theInstance = new GoogleSignIn(null);
|
||||
throw new SignInException(
|
||||
GoogleSignInStatusCode.DeveloperError,
|
||||
"This platform is not supported by GoogleSignIn");
|
||||
#endif
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
}
|
||||
|
||||
internal GoogleSignIn(GoogleSignInImpl impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
public void EnableDebugLogging(bool flag) {
|
||||
impl.EnableDebugLogging(flag);
|
||||
}
|
||||
|
||||
/// <summary>Starts the authentication process.</summary>
|
||||
/// <remarks>
|
||||
/// The authenication process is started and may display account picker
|
||||
/// popups and consent prompts based on the state of authentication and
|
||||
/// the requested elements.
|
||||
/// </remarks>
|
||||
public Task<GoogleSignInUser> SignIn() {
|
||||
var tcs = new TaskCompletionSource<GoogleSignInUser>();
|
||||
SignInHelperObject.Instance.StartCoroutine(
|
||||
impl.SignIn().WaitForResult(tcs));
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
/// <summary>Starts the silent authentication process.</summary>
|
||||
/// <remarks>
|
||||
/// The authenication process is started and will attempt to sign in without
|
||||
/// displaying any UI. If this cannot be done, the developer should call
|
||||
/// SignIn().
|
||||
/// </remarks>
|
||||
public Task<GoogleSignInUser> SignInSilently() {
|
||||
var tcs = new TaskCompletionSource<GoogleSignInUser>();
|
||||
SignInHelperObject.Instance.StartCoroutine(
|
||||
impl.SignInSilently().WaitForResult(tcs));
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signs out the User.
|
||||
/// </summary>
|
||||
/// <remarks>Future sign-in attempts will require the user to select the
|
||||
/// account to use when signing in.
|
||||
/// </remarks>
|
||||
public void SignOut() {
|
||||
theConfiguration = null;
|
||||
impl.SignOut();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnect this instance.
|
||||
/// </summary>
|
||||
/// <remarks>When the user is disconnected, it revokes all access that may
|
||||
/// have been granted to this application. This includes any server side
|
||||
/// access tokens derived from server auth codes. As a result, future
|
||||
/// sign-in attempts will require the user to re-consent to the requested
|
||||
/// scopes.
|
||||
/// </remarks>
|
||||
public void Disconnect() {
|
||||
impl.Disconnect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sign in exception. This is a checked exception for handling specific
|
||||
/// errors during the sign-in process.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SignInException : Exception {
|
||||
internal SignInException(GoogleSignInStatusCode status) {
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public SignInException(GoogleSignInStatusCode status, string message) :
|
||||
base(message) {
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public SignInException(GoogleSignInStatusCode status, string message,
|
||||
Exception innerException) : base(message, innerException) {
|
||||
Status = status;
|
||||
}
|
||||
|
||||
protected SignInException(GoogleSignInStatusCode status,
|
||||
SerializationInfo info,
|
||||
StreamingContext context) :
|
||||
base(info, context) {
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public GoogleSignInStatusCode Status {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal interface ISignInImpl {
|
||||
Future<GoogleSignInUser> SignIn();
|
||||
Future<GoogleSignInUser> SignInSilently();
|
||||
void EnableDebugLogging(bool flag);
|
||||
void SignOut();
|
||||
void Disconnect();
|
||||
}
|
||||
} // namespace Google
|
||||
14
Assets/GoogleSignIn/GoogleSignIn.cs.meta
Normal file
14
Assets/GoogleSignIn/GoogleSignIn.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 138b984208e394be797ce8905a44fd54
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/GoogleSignIn/GoogleSignInConfiguration.cs
Normal file
63
Assets/GoogleSignIn/GoogleSignInConfiguration.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// <copyright file="GoogleSignInConfiguration.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google {
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration properties for Google Sign-In.
|
||||
/// </summary>
|
||||
public class GoogleSignInConfiguration {
|
||||
/// <summary>Set to true to use games signin, false for default signin.
|
||||
/// </summary>
|
||||
/// <remarks>Note: The Games configuration is not supported on non-Android
|
||||
/// platforms.
|
||||
/// If games configuration is used, you must also add the
|
||||
/// play-services-games libraries and dependencies.
|
||||
/// See the README for more details.
|
||||
/// </remarks>
|
||||
public bool UseGameSignIn = false;
|
||||
/// <summary>Web client id associated with this app.</summary>
|
||||
/// <remarks>Required for requesting auth code or id token.</remarks>
|
||||
public string WebClientId = null;
|
||||
/// <summary>Set to true for getting an auth code when authenticating.
|
||||
/// </summary>
|
||||
public bool RequestAuthCode = false;
|
||||
/// <summary>Set to true to request to reset the refresh token.
|
||||
/// Causes re-consent.
|
||||
/// </summary>
|
||||
public bool ForceTokenRefresh = false;
|
||||
/// <summary>Request email address, requires consent.</summary>
|
||||
public bool RequestEmail = false;
|
||||
/// <summary>Request id token, requires consent.</summary>
|
||||
public bool RequestIdToken = false;
|
||||
/// <summary>Request profile information, requires consent.</summary>
|
||||
public bool RequestProfile = false;
|
||||
/// <summary>Hides popup UIs from games services.</summary>
|
||||
/// <remarks>Used with games signin to show or hide the connecting popup UI
|
||||
/// and to associate an invisible view for other popups. This is
|
||||
/// recommended for VR applications. This has no effect if UseGameSignIn is
|
||||
/// false.
|
||||
/// </remarks>
|
||||
public bool HidePopups = false;
|
||||
/// <summary>Account name to use when authenticating,
|
||||
/// null indicates use default.</summary>
|
||||
public string AccountName = null;
|
||||
/// <summary>Additional scopes to request, requires consent.</summary>
|
||||
public IEnumerable<string> AdditionalScopes = null;
|
||||
}
|
||||
}
|
||||
|
||||
14
Assets/GoogleSignIn/GoogleSignInConfiguration.cs.meta
Normal file
14
Assets/GoogleSignIn/GoogleSignInConfiguration.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0c3999c0f68f04ae08f04fb3bf2a2050
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
72
Assets/GoogleSignIn/GoogleSignInStatusCode.cs
Normal file
72
Assets/GoogleSignIn/GoogleSignInStatusCode.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// <copyright file="GoogleSignInStatusCode.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google {
|
||||
|
||||
/// <summary>
|
||||
/// Status code for the SignIn operations.
|
||||
/// </summary>
|
||||
/// <remarks>All successful status codes are less than or equal to 0.
|
||||
/// </remarks>
|
||||
public enum GoogleSignInStatusCode {
|
||||
/// <summary>The operation was successful, but used the device's cache.
|
||||
/// </summary>
|
||||
SuccessCached = -1,
|
||||
|
||||
/// <summary>The operation was successful.</summary>
|
||||
Success = 0,
|
||||
|
||||
/// <summary>The client attempted to call a method from an API that
|
||||
/// failed to connect.</summary>
|
||||
ApiNotConnected = 1,
|
||||
|
||||
/// <summary>The result was canceled either due to client disconnect
|
||||
/// or cancel().</summary>
|
||||
Canceled = 2,
|
||||
|
||||
/// <summary> A blocking call was interrupted while waiting and did not
|
||||
/// run to completion.</summary>
|
||||
Interrupted = 3,
|
||||
|
||||
/// <summary> The client attempted to connect to the service with an
|
||||
/// invalid account name specified. </summary>
|
||||
InvalidAccount = 4,
|
||||
|
||||
/// <summary>Timed out while awaiting the result.</summary>
|
||||
Timeout = 5,
|
||||
|
||||
/// <summary>The application is misconfigured.
|
||||
/// This error is not recoverable.</summary>
|
||||
/// <remarks>
|
||||
/// The developer should look at the logs after this to determine
|
||||
/// more actionable information.
|
||||
/// </remarks>
|
||||
DeveloperError = 6,
|
||||
|
||||
/// <summary>An internal error occurred. Retrying should resolve the
|
||||
/// problem.</summary>
|
||||
InternalError = 7,
|
||||
|
||||
/// <summary>A network error occurred. Retrying should resolve the problem.
|
||||
/// </summary>
|
||||
NetworkError = 8,
|
||||
|
||||
/// <summary> The operation failed with no more detailed information.
|
||||
/// </summary>
|
||||
Error = 9,
|
||||
}
|
||||
} // namespace GoogleSignIn
|
||||
|
||||
14
Assets/GoogleSignIn/GoogleSignInStatusCode.cs.meta
Normal file
14
Assets/GoogleSignIn/GoogleSignInStatusCode.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 077933fcaedac412d9762bf3e0a3be68
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/GoogleSignIn/GoogleSignInUser.cs
Normal file
76
Assets/GoogleSignIn/GoogleSignInUser.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
// <copyright file="GoogleSignInUser.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google {
|
||||
using System;
|
||||
|
||||
/// <summary> Information for the authenticated user.</summary>
|
||||
public class GoogleSignInUser {
|
||||
|
||||
/// <summary> Server AuthCode to be exchanged for an auth token.</summary>
|
||||
///<remarks> null if not requested, or if there was an error.</remarks>
|
||||
public string AuthCode {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Email address.</summary>
|
||||
///<remarks> null if not requested, or if there was an error.</remarks>
|
||||
public string Email {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Id token.</summary>
|
||||
///<remarks> null if not requested, or if there was an error.</remarks>
|
||||
public string IdToken {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Display Name.</summary>
|
||||
public string DisplayName {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Given Name.</summary>
|
||||
public string GivenName {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Family Name.</summary>
|
||||
public string FamilyName {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> Profile photo</summary>
|
||||
/// <remarks> Can be null if the profile is not requested,
|
||||
/// or none set.</remarks>
|
||||
public Uri ImageUrl {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary> User ID</summary>
|
||||
public string UserId {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/GoogleSignInUser.cs.meta
Normal file
14
Assets/GoogleSignIn/GoogleSignInUser.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c56b92217d0144af5907627d1235e0a5
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/GoogleSignIn/Impl.meta
Normal file
9
Assets/GoogleSignIn/Impl.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2fbe4f3ec9db4415e849f9bb89e63a92
|
||||
folderAsset: yes
|
||||
timeCreated: 1502761839
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
70
Assets/GoogleSignIn/Impl/BaseObject.cs
Normal file
70
Assets/GoogleSignIn/Impl/BaseObject.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
// <copyright file="BaseObject.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google.Impl {
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Base object manages the pointer to a native object which provides the
|
||||
/// implementation of a C# object.
|
||||
/// </summary>
|
||||
internal abstract class BaseObject : IDisposable {
|
||||
// handle to native object.
|
||||
private HandleRef selfHandleRef;
|
||||
private static HandleRef nullSelf = new HandleRef();
|
||||
|
||||
public BaseObject(IntPtr intPtr) {
|
||||
selfHandleRef = new HandleRef(this, intPtr);
|
||||
}
|
||||
|
||||
protected HandleRef SelfPtr() {
|
||||
if (selfHandleRef.Equals(nullSelf)) {
|
||||
throw new InvalidOperationException(
|
||||
"Attempted to use object after it was cleaned up");
|
||||
}
|
||||
return selfHandleRef;
|
||||
}
|
||||
|
||||
public virtual void Dispose() {
|
||||
selfHandleRef = nullSelf;
|
||||
}
|
||||
|
||||
internal delegate UIntPtr OutStringMethod([In, Out] byte[] out_bytes,
|
||||
UIntPtr out_size);
|
||||
|
||||
internal static String OutParamsToString(OutStringMethod outStringMethod) {
|
||||
UIntPtr requiredSize = outStringMethod(null, UIntPtr.Zero);
|
||||
if (requiredSize.Equals(UIntPtr.Zero)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
string str = null;
|
||||
try {
|
||||
byte[] array = new byte[requiredSize.ToUInt32()];
|
||||
outStringMethod(array, requiredSize);
|
||||
str = Encoding.UTF8.GetString(array, 0,
|
||||
(int)requiredSize.ToUInt32() - 1);
|
||||
} catch (Exception e) {
|
||||
Debug.LogError("Exception creating string from char array: " + e);
|
||||
str = string.Empty;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/Impl/BaseObject.cs.meta
Normal file
14
Assets/GoogleSignIn/Impl/BaseObject.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fe250cda690a44cb08f8f7d26c9723b4
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
187
Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs
Normal file
187
Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
// <copyright file="GoogleSignInImpl.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google.Impl {
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal class GoogleSignInImpl : BaseObject, ISignInImpl {
|
||||
|
||||
#if UNITY_ANDROID
|
||||
private const string DllName = "native-googlesignin";
|
||||
#else
|
||||
private const string DllName = "__Internal";
|
||||
#endif
|
||||
|
||||
internal GoogleSignInImpl(GoogleSignInConfiguration configuration)
|
||||
: base(GoogleSignIn_Create(GetPlayerActivity())) {
|
||||
|
||||
if (configuration != null) {
|
||||
List<string> scopes = new List<string>();
|
||||
if (configuration.AdditionalScopes != null) {
|
||||
scopes.AddRange(configuration.AdditionalScopes);
|
||||
}
|
||||
GoogleSignIn_Configure(SelfPtr(), configuration.UseGameSignIn,
|
||||
configuration.WebClientId,
|
||||
configuration.RequestAuthCode,
|
||||
configuration.ForceTokenRefresh,
|
||||
configuration.RequestEmail,
|
||||
configuration.RequestIdToken,
|
||||
configuration.HidePopups,
|
||||
scopes.ToArray(),
|
||||
scopes.Count,
|
||||
configuration.AccountName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Enables/Disables verbose logging to help troubleshooting</summary>
|
||||
public void EnableDebugLogging(bool flag) {
|
||||
GoogleSignIn_EnableDebugLogging(SelfPtr(), flag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the authentication process.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The authenication process is started and may display account picker
|
||||
/// popups and consent prompts based on the state of authentication and
|
||||
/// the requested elements.
|
||||
/// </remarks>
|
||||
public Future<GoogleSignInUser> SignIn() {
|
||||
IntPtr nativeFuture = GoogleSignIn_SignIn(SelfPtr());
|
||||
return new Future<GoogleSignInUser>(new NativeFuture(nativeFuture));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the authentication process.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The authenication process is started and may display account picker
|
||||
/// popups and consent prompts based on the state of authentication and
|
||||
/// the requested elements.
|
||||
/// </remarks>
|
||||
public Future<GoogleSignInUser> SignInSilently() {
|
||||
IntPtr nativeFuture = GoogleSignIn_SignInSilently(SelfPtr());
|
||||
return new Future<GoogleSignInUser>(new NativeFuture(nativeFuture));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signs out the User.
|
||||
/// </summary>
|
||||
public void SignOut() {
|
||||
GoogleSignIn_Signout(SelfPtr());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects the user from the application and revokes all consent.
|
||||
/// </summary>
|
||||
public void Disconnect() {
|
||||
GoogleSignIn_Disconnect(SelfPtr());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the native Google Sign-In implementation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For Android this must be the JNI raw object for the parentActivity.
|
||||
/// For iOS it is ignored.
|
||||
/// </remarks>
|
||||
/// <returns>The pointer to the instance.</returns>
|
||||
/// <param name="data">Data used in creating the instance.</param>
|
||||
[DllImport(DllName)]
|
||||
static extern IntPtr GoogleSignIn_Create(IntPtr data);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern void GoogleSignIn_EnableDebugLogging(HandleRef self, bool flag);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern bool GoogleSignIn_Configure(HandleRef self,
|
||||
bool useGameSignIn, string webClientId,
|
||||
bool requestAuthCode, bool forceTokenRefresh, bool requestEmail,
|
||||
bool requestIdToken, bool hidePopups, string[] additionalScopes,
|
||||
int scopeCount, string accountName);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern IntPtr GoogleSignIn_SignIn(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern IntPtr GoogleSignIn_SignInSilently(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern void GoogleSignIn_Signout(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
static extern void GoogleSignIn_Disconnect(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern void GoogleSignIn_DisposeFuture(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern bool GoogleSignIn_Pending(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern IntPtr GoogleSignIn_Result(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern int GoogleSignIn_Status(HandleRef self);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetServerAuthCode(
|
||||
HandleRef self, [In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetDisplayName(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetEmail(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetFamilyName(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetGivenName(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetIdToken(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetImageUrl(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
[DllImport(DllName)]
|
||||
internal static extern UIntPtr GoogleSignIn_GetUserId(HandleRef self,
|
||||
[In, Out] byte[] bytes, UIntPtr len);
|
||||
|
||||
// Gets the Unity player activity.
|
||||
// For iOS, this returns Zero.
|
||||
private static IntPtr GetPlayerActivity() {
|
||||
#if UNITY_ANDROID
|
||||
UnityEngine.AndroidJavaClass jc = new UnityEngine.AndroidJavaClass(
|
||||
"com.unity3d.player.UnityPlayer");
|
||||
return jc.GetStatic<UnityEngine.AndroidJavaObject>("currentActivity")
|
||||
.GetRawObject();
|
||||
#else
|
||||
return IntPtr.Zero;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs.meta
Normal file
14
Assets/GoogleSignIn/Impl/GoogleSignInImpl.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ae1f008f9f994b9c96c1a14067d7b48
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
102
Assets/GoogleSignIn/Impl/NativeFuture.cs
Normal file
102
Assets/GoogleSignIn/Impl/NativeFuture.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
// <copyright file="NativeFuture.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
namespace Google.Impl {
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// Native future is an interal class that implements the FutureAPIImpl
|
||||
/// by calling native methods which are implemented in the native code.
|
||||
/// </summary>
|
||||
internal class NativeFuture : BaseObject, FutureAPIImpl<GoogleSignInUser> {
|
||||
|
||||
internal NativeFuture(IntPtr ptr) : base(ptr) {
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
GoogleSignInImpl.GoogleSignIn_DisposeFuture(SelfPtr());
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public bool Pending {
|
||||
get {
|
||||
return GoogleSignInImpl.GoogleSignIn_Pending(SelfPtr());
|
||||
}
|
||||
}
|
||||
|
||||
public GoogleSignInUser Result {
|
||||
get {
|
||||
IntPtr ptr = GoogleSignInImpl.GoogleSignIn_Result(SelfPtr());
|
||||
if (ptr != IntPtr.Zero) {
|
||||
GoogleSignInUser user = new GoogleSignInUser();
|
||||
HandleRef userPtr = new HandleRef(user, ptr);
|
||||
|
||||
user.DisplayName = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetDisplayName(userPtr,
|
||||
out_string,
|
||||
out_size));
|
||||
user.Email = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetEmail(userPtr, out_string,
|
||||
out_size));
|
||||
|
||||
user.FamilyName = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetFamilyName(userPtr, out_string,
|
||||
out_size));
|
||||
|
||||
user.GivenName = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetGivenName(userPtr, out_string,
|
||||
out_size));
|
||||
|
||||
user.IdToken = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetIdToken(userPtr, out_string,
|
||||
out_size));
|
||||
|
||||
user.AuthCode = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetServerAuthCode(userPtr, out_string,
|
||||
out_size));
|
||||
|
||||
string url = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetImageUrl(userPtr, out_string,
|
||||
out_size));
|
||||
if (url.Length > 0) {
|
||||
user.ImageUrl = new System.Uri(url);
|
||||
}
|
||||
|
||||
user.UserId = OutParamsToString((out_string, out_size) =>
|
||||
GoogleSignInImpl.GoogleSignIn_GetUserId(userPtr, out_string,
|
||||
out_size));
|
||||
return user;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status.
|
||||
/// </summary>
|
||||
/// <remarks>The platform specific implementation maps the platform specific
|
||||
/// code to one defined in GoogleSignStatusCode.</remarks>
|
||||
/// <value>The status.</value>
|
||||
public GoogleSignInStatusCode Status {
|
||||
get {
|
||||
return (GoogleSignInStatusCode)GoogleSignInImpl.GoogleSignIn_Status(
|
||||
SelfPtr());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/Impl/NativeFuture.cs.meta
Normal file
14
Assets/GoogleSignIn/Impl/NativeFuture.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f1aae79b1ca4432d9d8ec382c54bf46
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/GoogleSignIn/Impl/SignInHelperObject.cs
Normal file
42
Assets/GoogleSignIn/Impl/SignInHelperObject.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// <copyright file="SignInHelperObject.cs" company="Google Inc.">
|
||||
// Copyright (C) 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
namespace Google.Impl {
|
||||
using UnityEngine;
|
||||
|
||||
///<summary>Helper object to connect the Sign-in API to the Unity Game Scene.
|
||||
///</summary>
|
||||
///<remarks>This class is added to the scene so that the Google Sign-in API
|
||||
/// can start coroutines.
|
||||
///</remarks>
|
||||
public class SignInHelperObject : MonoBehaviour {
|
||||
|
||||
private static SignInHelperObject instance;
|
||||
|
||||
internal static SignInHelperObject Instance {
|
||||
get {
|
||||
if (Application.isPlaying) {
|
||||
// add an invisible game object to the scene
|
||||
GameObject obj = new GameObject("GoogleSignInHelperObject");
|
||||
DontDestroyOnLoad(obj);
|
||||
instance = obj.AddComponent<SignInHelperObject>();
|
||||
} else {
|
||||
instance = new SignInHelperObject();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Assets/GoogleSignIn/Impl/SignInHelperObject.cs.meta
Normal file
14
Assets/GoogleSignIn/Impl/SignInHelperObject.cs.meta
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad98e5b48888e44eb81dd5884d3a1754
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/PlayServicesResolver.meta
Normal file
9
Assets/PlayServicesResolver.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 333d24e71d12446ba5c77815e64b0ca8
|
||||
folderAsset: yes
|
||||
timeCreated: 1448926447
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/PlayServicesResolver/Editor.meta
Normal file
9
Assets/PlayServicesResolver/Editor.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e105e00cdce8456482d26b1fcd1ca47d
|
||||
folderAsset: yes
|
||||
timeCreated: 1448926516
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,37 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdc56cdbdca243b288646b7e19b761fa
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_targets-editor
|
||||
- gvh_version-1.2.89.0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,37 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8655c1cd7e594c9f821d0bb41d32da26
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_targets-editor
|
||||
- gvh_version-1.2.89.0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
Normal file
BIN
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
Normal file
Binary file not shown.
|
|
@ -0,0 +1,37 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d654a5d600b4aa9a3a6aa6593a081b5
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_targets-editor
|
||||
- gvh_version-1.2.89.0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,37 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f4b50512886d48a3bed0c231ab6b8c56
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_targets-editor
|
||||
- gvh_version-1.2.89.0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.89.0.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.89.0.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
|
||||
Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.89.0.dll
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8d20710ab72d42e88abaab55cc7c066a
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_manifest
|
||||
- gvh_version-1.2.89.0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Plugins.meta
Normal file
9
Assets/Plugins.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 11bf9545a722341b6ba971705a514a4b
|
||||
folderAsset: yes
|
||||
timeCreated: 1490826122
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Plugins/Android.meta
Normal file
8
Assets/Plugins/Android.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bef9d49f86fa0b34aafe37663b652dfb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Plugins/iOS.meta
Normal file
9
Assets/Plugins/iOS.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 367a2849a95b040e2ab7533314f868f4
|
||||
folderAsset: yes
|
||||
timeCreated: 1490995881
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Plugins/iOS/GoogleSignIn.meta
Normal file
9
Assets/Plugins/iOS/GoogleSignIn.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 07c86a3f84f494e589218ed67d10255a
|
||||
folderAsset: yes
|
||||
timeCreated: 1490995894
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.h
Normal file
20
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#import <GoogleSignIn/GIDSignIn.h>
|
||||
@interface GoogleSignInHandler
|
||||
: NSObject <GIDSignInDelegate, GIDSignInUIDelegate>
|
||||
|
||||
@end
|
||||
35
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.h.meta
Normal file
35
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.h.meta
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 62c129704e1ec48179ba285e1af154b8
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
345
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.mm
Normal file
345
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.mm
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
/**
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#import "GoogleSignIn.h"
|
||||
#import <GoogleSignIn/GIDAuthentication.h>
|
||||
#import <GoogleSignIn/GIDGoogleUser.h>
|
||||
#import <GoogleSignIn/GIDProfileData.h>
|
||||
#import <GoogleSignIn/GIDSignIn.h>
|
||||
|
||||
#import <memory>
|
||||
|
||||
// These values are in the Unity plugin code. The iOS specific
|
||||
// codes are mapped to these.
|
||||
static const int kStatusCodeSuccessCached = -1;
|
||||
static const int kStatusCodeSuccess = 0;
|
||||
static const int kStatusCodeApiNotConnected = 1;
|
||||
static const int kStatusCodeCanceled = 2;
|
||||
static const int kStatusCodeInterrupted = 3;
|
||||
static const int kStatusCodeInvalidAccount = 4;
|
||||
static const int kStatusCodeTimeout = 5;
|
||||
static const int kStatusCodeDeveloperError = 6;
|
||||
static const int kStatusCodeInternalError = 7;
|
||||
static const int kStatusCodeNetworkError = 8;
|
||||
static const int kStatusCodeError = 9;
|
||||
|
||||
/**
|
||||
* Helper method to pause the Unity player. This is done when showing any UI.
|
||||
*/
|
||||
void UnpauseUnityPlayer() {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (UnityIsPaused() > 0) {
|
||||
UnityPause(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// result for pending operation. Access to this should be protected using the
|
||||
// resultLock.
|
||||
struct SignInResult {
|
||||
int result_code;
|
||||
bool finished;
|
||||
};
|
||||
|
||||
std::unique_ptr<SignInResult> currentResult_;
|
||||
|
||||
NSRecursiveLock *resultLock = [NSRecursiveLock alloc];
|
||||
|
||||
@implementation GoogleSignInHandler
|
||||
|
||||
/**
|
||||
* Overload the presenting of the UI so we can pause the Unity player.
|
||||
*/
|
||||
- (void)signIn:(GIDSignIn *)signIn
|
||||
presentViewController:(UIViewController *)viewController {
|
||||
UnityPause(true);
|
||||
[UnityGetGLViewController() presentViewController:viewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the dismissing so we can resume the Unity player.
|
||||
*/
|
||||
- (void)signIn:(GIDSignIn *)signIn
|
||||
dismissViewController:(UIViewController *)viewController {
|
||||
UnityPause(false);
|
||||
[UnityGetGLViewController() dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* The sign-in flow has finished and was successful if |error| is |nil|.
|
||||
* Map the errors from the iOS SDK back to the Android values for consistency's
|
||||
* sake in the Unity layer.
|
||||
*/
|
||||
- (void)signIn:(GIDSignIn *)signIn
|
||||
didSignInForUser:(GIDGoogleUser *)user
|
||||
withError:(NSError *)_error {
|
||||
if (_error == nil) {
|
||||
if (currentResult_) {
|
||||
currentResult_->result_code = kStatusCodeSuccess;
|
||||
currentResult_->finished = true;
|
||||
} else {
|
||||
NSLog(@"No currentResult to set status on!");
|
||||
}
|
||||
NSLog(@"didSignInForUser: SUCCESS");
|
||||
} else {
|
||||
NSLog(@"didSignInForUser: %@", _error.localizedDescription);
|
||||
if (currentResult_) {
|
||||
switch (_error.code) {
|
||||
case kGIDSignInErrorCodeUnknown:
|
||||
currentResult_->result_code = kStatusCodeError;
|
||||
break;
|
||||
case kGIDSignInErrorCodeKeychain:
|
||||
currentResult_->result_code = kStatusCodeInternalError;
|
||||
break;
|
||||
case kGIDSignInErrorCodeNoSignInHandlersInstalled:
|
||||
currentResult_->result_code = kStatusCodeDeveloperError;
|
||||
break;
|
||||
case kGIDSignInErrorCodeHasNoAuthInKeychain:
|
||||
currentResult_->result_code = kStatusCodeError;
|
||||
break;
|
||||
case kGIDSignInErrorCodeCanceled:
|
||||
currentResult_->result_code = kStatusCodeCanceled;
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Unmapped error code: %ld, returning Error",
|
||||
static_cast<long>(_error.code));
|
||||
currentResult_->result_code = kStatusCodeError;
|
||||
}
|
||||
|
||||
currentResult_->finished = true;
|
||||
UnpauseUnityPlayer();
|
||||
} else {
|
||||
NSLog(@"No currentResult to set status on!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finished disconnecting |user| from the app successfully if |error| is |nil|.
|
||||
- (void)signIn:(GIDSignIn *)signIn
|
||||
didDisconnectWithUser:(GIDGoogleUser *)user
|
||||
withError:(NSError *)_error {
|
||||
if (_error == nil) {
|
||||
NSLog(@"didDisconnectWithUser: SUCCESS");
|
||||
} else {
|
||||
NSLog(@"didDisconnectWithUser: %@", _error);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* These are the external "C" methods that are imported by the Unity C# code.
|
||||
* The parameters are intended to be primative, easy to marshall.
|
||||
*/
|
||||
extern "C" {
|
||||
/**
|
||||
* This method does nothing in the iOS implementation. It is here
|
||||
* to make the API uniform between Android and iOS.
|
||||
*/
|
||||
void *GoogleSignIn_Create(void *data) { return NULL; }
|
||||
|
||||
void GoogleSignIn_EnableDebugLogging(void *unused, bool flag) {
|
||||
if (flag) {
|
||||
NSLog(@"GoogleSignIn: No optional logging available on iOS");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the GIDSignIn instance. The first parameter is unused in iOS.
|
||||
* It is here to make the API between Android and iOS uniform.
|
||||
*/
|
||||
bool GoogleSignIn_Configure(void *unused, bool useGameSignIn,
|
||||
const char *webClientId, bool requestAuthCode,
|
||||
bool forceTokenRefresh, bool requestEmail,
|
||||
bool requestIdToken, bool hidePopups,
|
||||
const char **additionalScopes, int scopeCount,
|
||||
const char *accountName) {
|
||||
if (webClientId) {
|
||||
[GIDSignIn sharedInstance].serverClientID =
|
||||
[NSString stringWithUTF8String:webClientId];
|
||||
}
|
||||
|
||||
[GIDSignIn sharedInstance].shouldFetchBasicProfile = true;
|
||||
|
||||
int scopeSize = scopeCount;
|
||||
|
||||
if (scopeSize) {
|
||||
NSMutableArray *tmpary =
|
||||
[[NSMutableArray alloc] initWithCapacity:scopeSize];
|
||||
for (int i = 0; i < scopeCount; i++) {
|
||||
[tmpary addObject:[NSString stringWithUTF8String:additionalScopes[i]]];
|
||||
}
|
||||
|
||||
[GIDSignIn sharedInstance].scopes = tmpary;
|
||||
}
|
||||
|
||||
if (accountName) {
|
||||
[GIDSignIn sharedInstance].loginHint =
|
||||
[NSString stringWithUTF8String:accountName];
|
||||
}
|
||||
|
||||
return !useGameSignIn;
|
||||
}
|
||||
|
||||
/**
|
||||
Starts the sign-in process. Returns and error result if error, null otherwise.
|
||||
*/
|
||||
static SignInResult *startSignIn() {
|
||||
bool busy = false;
|
||||
[resultLock lock];
|
||||
if (!currentResult_ || currentResult_->finished) {
|
||||
currentResult_.reset(new SignInResult());
|
||||
currentResult_->result_code = 0;
|
||||
currentResult_->finished = false;
|
||||
} else {
|
||||
busy = true;
|
||||
}
|
||||
[resultLock unlock];
|
||||
|
||||
if (busy) {
|
||||
NSLog(@"ERROR: There is already a pending sign-in operation.");
|
||||
// Returned to the caller, should be deleted by calling
|
||||
// GoogleSignIn_DisposeFuture().
|
||||
return new SignInResult{.result_code = kStatusCodeDeveloperError,
|
||||
.finished = true};
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign-In. The return value is a pointer to the currentResult object.
|
||||
*/
|
||||
void *GoogleSignIn_SignIn() {
|
||||
SignInResult *result = startSignIn();
|
||||
if (!result) {
|
||||
[[GIDSignIn sharedInstance] signIn];
|
||||
result = currentResult_.get();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt a silent sign-in. Return value is the pointer to the currentResult
|
||||
* object.
|
||||
*/
|
||||
void *GoogleSignIn_SignInSilently() {
|
||||
SignInResult *result = startSignIn();
|
||||
if (!result) {
|
||||
[[GIDSignIn sharedInstance] signInSilently];
|
||||
result = currentResult_.get();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void GoogleSignIn_Signout() {
|
||||
GIDSignIn *signIn = [GIDSignIn sharedInstance];
|
||||
[signIn signOut];
|
||||
}
|
||||
|
||||
void GoogleSignIn_Disconnect() {
|
||||
GIDSignIn *signIn = [GIDSignIn sharedInstance];
|
||||
[signIn disconnect];
|
||||
}
|
||||
|
||||
bool GoogleSignIn_Pending(SignInResult *result) {
|
||||
volatile bool ret;
|
||||
[resultLock lock];
|
||||
ret = !result->finished;
|
||||
[resultLock unlock];
|
||||
return ret;
|
||||
}
|
||||
|
||||
GIDGoogleUser *GoogleSignIn_Result(SignInResult *result) {
|
||||
if (result && result->finished) {
|
||||
GIDGoogleUser *guser = [GIDSignIn sharedInstance].currentUser;
|
||||
return guser;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int GoogleSignIn_Status(SignInResult *result) {
|
||||
if (result) {
|
||||
return result->result_code;
|
||||
}
|
||||
return kStatusCodeDeveloperError;
|
||||
}
|
||||
|
||||
void GoogleSignIn_DisposeFuture(SignInResult *result) {
|
||||
if (result == currentResult_.get()) {
|
||||
currentResult_.reset(nullptr);
|
||||
} else {
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private helper function to copy NSString to char*. If the destination is
|
||||
* non-null, the contents of src are copied up to len bytes (using strncpy). The
|
||||
* then len is returned. Otherwise returns length of the string to copy + 1.
|
||||
*/
|
||||
static size_t CopyNSString(NSString *src, char *dest, size_t len) {
|
||||
if (dest && src && len) {
|
||||
const char *string = [src UTF8String];
|
||||
strncpy(dest, string, len);
|
||||
return len;
|
||||
}
|
||||
return src ? src.length + 1 : 0;
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetServerAuthCode(GIDGoogleUser *guser, char *buf,
|
||||
size_t len) {
|
||||
NSString *val = [guser serverAuthCode];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetDisplayName(GIDGoogleUser *guser, char *buf,
|
||||
size_t len) {
|
||||
NSString *val = [guser.profile name];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetEmail(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSString *val = [guser.profile email];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetFamilyName(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSString *val = [guser.profile familyName];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetGivenName(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSString *val = [guser.profile givenName];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetIdToken(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSString *val = [guser.authentication idToken];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetImageUrl(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSURL *url = [guser.profile imageURLWithDimension:128];
|
||||
NSString *val = url ? [url absoluteString] : nullptr;
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
|
||||
size_t GoogleSignIn_GetUserId(GIDGoogleUser *guser, char *buf, size_t len) {
|
||||
NSString *val = [guser userID];
|
||||
return CopyNSString(val, buf, len);
|
||||
}
|
||||
} // extern "C"
|
||||
35
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.mm.meta
Normal file
35
Assets/Plugins/iOS/GoogleSignIn/GoogleSignIn.mm.meta
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 521784ee6b2184e0e947a8fd1508afbc
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.h
Normal file
37
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#import "GoogleSignIn.h"
|
||||
#import <UnityAppController.h>
|
||||
|
||||
// Controller to handle Google SignIn. The AppController methods are swizzled
|
||||
// into the UnityAppController in order to avoid breaking other code that needs
|
||||
// to handle these messages also.
|
||||
@interface UnityAppController (GoogleSignInAppController)
|
||||
// These are the implementations for GSI. The signatures match the
|
||||
// AppController methods.
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<NSString *, id> *)options;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce40e3e7b37a54617a4683dfc0479c71
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
124
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.mm
Normal file
124
Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.mm
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "GoogleSignInAppController.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
// Handles Google SignIn UI and events.
|
||||
GoogleSignInHandler *gsiHandler;
|
||||
|
||||
/*
|
||||
* Create a category to customize the application. When this is loaded the
|
||||
* method for the existing application and GoogleSignIn are swizzled into the
|
||||
* other's class selector. Then we call our "own" msthod which is actually the
|
||||
* original application's implementation. See more info at:
|
||||
* https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html
|
||||
*/
|
||||
|
||||
@implementation UnityAppController (GoogleSignInController)
|
||||
|
||||
/*
|
||||
Called when the category is loaded. This is where the methods are swizzled
|
||||
out.
|
||||
*/
|
||||
+ (void)load {
|
||||
Method original;
|
||||
Method swizzled;
|
||||
|
||||
original = class_getInstanceMethod(
|
||||
self, @selector(application:didFinishLaunchingWithOptions:));
|
||||
swizzled = class_getInstanceMethod(
|
||||
self,
|
||||
@selector(GoogleSignInAppController:didFinishLaunchingWithOptions:));
|
||||
method_exchangeImplementations(original, swizzled);
|
||||
|
||||
original = class_getInstanceMethod(
|
||||
self, @selector(application:openURL:sourceApplication:annotation:));
|
||||
swizzled = class_getInstanceMethod(
|
||||
self, @selector
|
||||
(GoogleSignInAppController:openURL:sourceApplication:annotation:));
|
||||
method_exchangeImplementations(original, swizzled);
|
||||
|
||||
original =
|
||||
class_getInstanceMethod(self, @selector(application:openURL:options:));
|
||||
swizzled = class_getInstanceMethod(
|
||||
self, @selector(GoogleSignInAppController:openURL:options:));
|
||||
method_exchangeImplementations(original, swizzled);
|
||||
}
|
||||
|
||||
- (BOOL)GoogleSignInAppController:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
// IMPORTANT: IF you are not supplying a GoogleService-Info.plist in your
|
||||
// project that contains the client id, you need to set the client id here.
|
||||
|
||||
NSString *path = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info"
|
||||
ofType:@"plist"];
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
NSString *clientId = [dict objectForKey:@"CLIENT_ID"];
|
||||
|
||||
gsiHandler = [GoogleSignInHandler alloc];
|
||||
|
||||
// Setup the Sign-In instance.
|
||||
GIDSignIn *signIn = [GIDSignIn sharedInstance];
|
||||
signIn.clientID = clientId;
|
||||
signIn.uiDelegate = gsiHandler;
|
||||
signIn.delegate = gsiHandler;
|
||||
|
||||
// looks like it's just calling itself, but the implementations were swapped
|
||||
// so we're actually calling the original once we're done
|
||||
return [self GoogleSignInAppController:application
|
||||
didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the auth URL
|
||||
*/
|
||||
- (BOOL)GoogleSignInAppController:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation {
|
||||
BOOL handled = [self GoogleSignInAppController:application
|
||||
openURL:url
|
||||
sourceApplication:sourceApplication
|
||||
annotation:annotation];
|
||||
|
||||
return [[GIDSignIn sharedInstance] handleURL:url
|
||||
sourceApplication:sourceApplication
|
||||
annotation:annotation] ||
|
||||
handled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the auth URL.
|
||||
*/
|
||||
- (BOOL)GoogleSignInAppController:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary *)options {
|
||||
|
||||
BOOL handled =
|
||||
[self GoogleSignInAppController:app openURL:url options:options];
|
||||
|
||||
return [[GIDSignIn sharedInstance]
|
||||
handleURL:url
|
||||
sourceApplication:
|
||||
options[UIApplicationOpenURLOptionsSourceApplicationKey]
|
||||
annotation:
|
||||
options[UIApplicationOpenURLOptionsAnnotationKey]] ||
|
||||
handled;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 50b2e1c9319e4446e9dbd9b183790472
|
||||
labels:
|
||||
- gvh
|
||||
- gvh_version-1.0.4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1093,7 +1093,7 @@ GameObject:
|
|||
- component: {fileID: 405806873}
|
||||
- component: {fileID: 405806872}
|
||||
m_Layer: 5
|
||||
m_Name: GoogleLogin (2)
|
||||
m_Name: guestLogin
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
|
@ -1118,7 +1118,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -276.6, y: -194.72}
|
||||
m_SizeDelta: {x: 110.515, y: 110.9932}
|
||||
m_SizeDelta: {x: 105.95, y: 110.9932}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &405806872
|
||||
MonoBehaviour:
|
||||
|
|
@ -1717,7 +1717,7 @@ GameObject:
|
|||
- component: {fileID: 665364049}
|
||||
- component: {fileID: 665364050}
|
||||
m_Layer: 0
|
||||
m_Name: Menu
|
||||
m_Name: Login
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
|
@ -1746,13 +1746,13 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 665364048}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a507081d00d64e14693b0a4025bbf7a6, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: c24071a71036c7f41b150275160859dd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MainMenuPanel: {fileID: 1498716666}
|
||||
SettingsPanel: {fileID: 0}
|
||||
transitionTime: 0.6
|
||||
transitionEffect: 26
|
||||
helpBtn: {fileID: 1625975698}
|
||||
googleLoginBtn: {fileID: 0}
|
||||
guestLoginBtn: {fileID: 0}
|
||||
statusTxt: {fileID: 508363373}
|
||||
--- !u!1 &769394020
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -2600,7 +2600,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1337463900}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
|
|
@ -3336,6 +3336,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 801880202}
|
||||
- {fileID: 1651693092}
|
||||
- {fileID: 930103305}
|
||||
- {fileID: 2037751866}
|
||||
- {fileID: 2082929642}
|
||||
|
|
@ -4197,8 +4198,9 @@ GameObject:
|
|||
- component: {fileID: 1625975697}
|
||||
- component: {fileID: 1625975696}
|
||||
- component: {fileID: 1625975695}
|
||||
- component: {fileID: 1625975698}
|
||||
m_Layer: 5
|
||||
m_Name: GoogleLogin (3)
|
||||
m_Name: btnHelp
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
|
@ -4277,6 +4279,125 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1625975693}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1625975698
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1625975693}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1625975696}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &1651693091
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1651693092}
|
||||
- component: {fileID: 1651693094}
|
||||
- component: {fileID: 1651693093}
|
||||
m_Layer: 5
|
||||
m_Name: BG (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1651693092
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651693091}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1337463900}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1651693093
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651693091}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.8352941}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1651693094
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651693091}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1688121852
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -4640,7 +4761,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1337463900}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
|
|
@ -4853,7 +4974,7 @@ RectTransform:
|
|||
m_Children:
|
||||
- {fileID: 112647383}
|
||||
m_Father: {fileID: 1337463900}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
|
|
|
|||
29
Assets/Scripts/Login.cs
Normal file
29
Assets/Scripts/Login.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Login : MonoBehaviour
|
||||
{
|
||||
public Button helpBtn;
|
||||
public Button googleLoginBtn;
|
||||
public Button guestLoginBtn;
|
||||
public Text statusTxt;
|
||||
|
||||
void Awake(){
|
||||
helpBtn.onClick.AddListener(OnHelp);
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OnHelp(){
|
||||
MessageBox.ShowMessage("This game saves your progress in cloud, in order to preserve the data. We need you to login with either Google or Guest login.", "Why Login?");
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Login.cs.meta
Normal file
11
Assets/Scripts/Login.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c24071a71036c7f41b150275160859dd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -68,14 +68,14 @@ Material:
|
|||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Radius: 35
|
||||
- _Size: 4.3
|
||||
- _Size: 4.6
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _AdditiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _AdditiveColor: {r: 0, g: 0.043106545, b: 0.047169805, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _MultiplyColor: {r: 0.6603774, g: 0.6603774, b: 0.6603774, a: 1}
|
||||
|
|
|
|||
7
ProjectSettings/AndroidResolverDependencies.xml
Normal file
7
ProjectSettings/AndroidResolverDependencies.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<dependencies>
|
||||
<packages>
|
||||
<package>com.google.android.gms:play-services-auth:16+</package>
|
||||
<package>com.google.signin:google-signin-support:1.0.4</package>
|
||||
</packages>
|
||||
<files />
|
||||
</dependencies>
|
||||
Loading…
Reference in New Issue
Block a user