Beispiel #1
0
        public GoogleDriveRequest(string uri, string method)
        {
            Uri    = uri;
            Method = method;

            if (Settings == null)
            {
                Settings = GoogleDriveSettings.LoadFromResources();
            }
            if (AuthController == null)
            {
                AuthController = new AuthController(Settings);
            }
        }
Beispiel #2
0
        static AuthController()
        {
            settings = GoogleDriveSettings.LoadFromResources();

            #if UNITY_WEBGL && !UNITY_EDITOR     // WebGL doesn't support loopback method; using redirection scheme instead.
            accessTokenProvider = new RedirectAccessTokenProvider(settings);
            #elif UNITY_ANDROID && !UNITY_EDITOR // On Android a native OpenID lib is used for better UX.
            accessTokenProvider = new AndroidAccessTokenProvider(settings);
            #elif UNITY_IOS && !UNITY_EDITOR     // On iOS a native OpenID lib is used for better UX.
            accessTokenProvider = new IOSAccessTokenProvider(settings);
            #else // Loopback scheme is used on other platforms.
            accessTokenProvider = new LoopbackAccessTokenProvider(settings);
            #endif
        }
Beispiel #3
0
        private static GoogleDriveSettings GetOrCreateSettings()
        {
            var settings = GoogleDriveSettings.LoadFromResources(true);

            if (!settings)
            {
                settings = CreateInstance <GoogleDriveSettings>();
                Directory.CreateDirectory(Application.dataPath + "/UnityGoogleDrive/Resources");
                const string path = "Assets/UnityGoogleDrive/Resources/GoogleDriveSettings.asset";
                AssetDatabase.CreateAsset(settings, path);
                AssetDatabase.Refresh();
                AssetDatabase.SaveAssets();
                Debug.Log($"UnityGoogleDrive: Settings file didn't exist and was created at: {path}.\n" +
                          "You're free to move it, just make sure it stays in the root of a 'Resources' folder.");
            }
            return(settings);
        }