コード例 #1
0
    public static bool LoginUser(Action <bool> callback, bool isSilent, bool enableServerAuth = false, bool forceCodeForeRefreshToken = false, List <string> requestedScopes = null)
    {
        LCGoogleLoginBridge.SharedInstance();
        authCallback = callback;
        string[] strScopesArray = null;
        if (requestedScopes == null || requestedScopes.Count <= 0)
        {
            strScopesArray = new string[0];
        }
        else
        {
            strScopesArray = requestedScopes.ToArray();
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidLoginMethod(LCGoogleLoginAndroid.kUserLogin, isSilent, enableServerAuth,
                                                               forceCodeForeRefreshToken, strScopesArray));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            int noOfScopes = (strScopesArray == null) ? 0 : strScopesArray.Length;
            return(LCGoogleLoginiOS.userLogin(isSilent, enableServerAuth, forceCodeForeRefreshToken, strScopesArray, noOfScopes));
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: LoginUser: Unsupported platform");
            }
        }
        return(false);
    }
コード例 #2
0
    public static string GSIRefreshToken()
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: GSIRefreshToken: Always null for android. Check google docs for why so");
            }
            return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrRefreshToken));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            return(LCGoogleLoginiOS.refreshToken());
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: GSIRefreshToken: Unsupported platform");
            }
        }

        return(null);
    }
コード例 #3
0
    public static void InitWithClientID(string clientID)
    {
        if (instance == null)
        {
            instance = FindObjectOfType(typeof(LCGoogleLoginBridge)) as LCGoogleLoginBridge;
            if (instance == null)
            {
                instance = new GameObject("LCGoogleLoginBridge").AddComponent <LCGoogleLoginBridge>();

                if (string.IsNullOrEmpty(clientID))
                {
                    Debug.LogError("LCGoogleLoginBridge: InitWithClientID: Google Web Client ID is required");
                    return;
                }

                if (Application.platform == RuntimePlatform.Android)
                {
                    LCGoogleLoginAndroid.InitiateWithClientID(clientID);
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    LCGoogleLoginiOS.initiateWithClientID(clientID);
                }
                else
                {
                    if (debugLogs)
                    {
                        Debug.Log("LCGoogleLogin: LoginUserBasic: Unsupported platform");
                    }
                }
            }
        }
    }
コード例 #4
0
    public static bool LogoutUser()
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidBoolMethod(LCGoogleLoginAndroid.kUserLogout));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            return(LCGoogleLoginiOS.userLogout());
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: LogoutUser: Unsupported platform");
            }
        }
        return(false);
    }
コード例 #5
0
    public static string GSIServerAuthCode()
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrServerAuthCode));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            return(LCGoogleLoginiOS.serverAuthCode());
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: GSIIDUserToken: Unsupported platform");
            }
        }

        return(null);
    }
コード例 #6
0
    public static string GSIEmail()
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrUserEmail));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            return(LCGoogleLoginiOS.userEmail());
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: GSIPhotoUrl: Unsupported platform");
            }
        }

        return(null);
    }
コード例 #7
0
    static bool ChangeLoggingDevLevel(bool enabled)
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidInBoolMethod(LCGoogleLoginAndroid.kInBoolChangeDevLogLevel, enabled));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            LCGoogleLoginiOS.changeDevLogLevel(enabled);
            return(true);
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: ChangeLoggingDevLevel: Unsupported platform");
            }
        }

        return(false);
    }
コード例 #8
0
    public static string[] GSIGrantedScopes()
    {
        LCGoogleLoginBridge.SharedInstance();

        if (Application.platform == RuntimePlatform.Android)
        {
            return(LCGoogleLoginAndroid.CallAndroidStringArrayMethod(LCGoogleLoginAndroid.kStrArrScopes));
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            IntPtr scopesArray = LCGoogleLoginiOS.avalableScopes();
            int    noScopes    = LCGoogleLoginiOS.noOfAvalableScopes();
            return(LCGoogleLoginiOS.GetCListFromiOSNativeSentData(scopesArray, noScopes));
        }
        else
        {
            if (debugLogs)
            {
                Debug.Log("LCGoogleLogin: GSIGrantedScopes: Unsupported platform");
            }
        }

        return(null);
    }