├── .editorconfig
├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ ├── lint.yml
│ └── stale.yml
├── .gitignore
├── Android
├── app
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── elringus
│ │ │ └── unitygoogledriveandroid
│ │ │ └── ExampleInstrumentedTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── elringus
│ │ └── unitygoogledriveandroid
│ │ └── AuthorizationActivity.java
└── settings.gradle
├── Assets
├── Editor.meta
├── Editor
│ ├── PackageExporter.cs
│ ├── PackageExporter.cs.meta
│ ├── ProjectFileHook.cs
│ └── ProjectFileHook.cs.meta
├── Resources.meta
├── Resources
│ ├── TestImage.png
│ └── TestImage.png.meta
├── Runtime.meta
├── Runtime
│ ├── Common.cs
│ ├── Common.cs.meta
│ ├── Example.meta
│ ├── Example
│ │ ├── AdaptiveWindowGUI.cs
│ │ ├── AdaptiveWindowGUI.cs.meta
│ │ ├── ExampleExportDocument.cs
│ │ ├── ExampleExportDocument.cs.meta
│ │ ├── ExampleFindFilesByPathAsync.cs
│ │ ├── ExampleFindFilesByPathAsync.cs.meta
│ │ ├── ExampleGetFileByPath.cs
│ │ ├── ExampleGetFileByPath.cs.meta
│ │ ├── SceneSwitcher.cs
│ │ └── SceneSwitcher.cs.meta
│ ├── Test.meta
│ └── Test
│ │ ├── AutomatedTests.cs
│ │ ├── AutomatedTests.cs.meta
│ │ ├── TestAboutGet.cs
│ │ ├── TestAboutGet.cs.meta
│ │ ├── TestAboutGetAsync.cs
│ │ ├── TestAboutGetAsync.cs.meta
│ │ ├── TestFilesCopy.cs
│ │ ├── TestFilesCopy.cs.meta
│ │ ├── TestFilesCreate.cs
│ │ ├── TestFilesCreate.cs.meta
│ │ ├── TestFilesCreateResumable.cs
│ │ ├── TestFilesCreateResumable.cs.meta
│ │ ├── TestFilesDelete.cs
│ │ ├── TestFilesDelete.cs.meta
│ │ ├── TestFilesDownloadAudio.cs
│ │ ├── TestFilesDownloadAudio.cs.meta
│ │ ├── TestFilesDownloadRange.cs
│ │ ├── TestFilesDownloadRange.cs.meta
│ │ ├── TestFilesDownloadTexture.cs
│ │ ├── TestFilesDownloadTexture.cs.meta
│ │ ├── TestFilesEmptyTrash.cs
│ │ ├── TestFilesEmptyTrash.cs.meta
│ │ ├── TestFilesGet.cs
│ │ ├── TestFilesGet.cs.meta
│ │ ├── TestFilesList.cs
│ │ └── TestFilesList.cs.meta
├── Scenes.meta
├── Scenes
│ ├── AboutGet.unity
│ ├── AboutGet.unity.meta
│ ├── AboutGetAsync.unity
│ ├── AboutGetAsync.unity.meta
│ ├── ExportDocument.unity
│ ├── ExportDocument.unity.meta
│ ├── FilesCopy.unity
│ ├── FilesCopy.unity.meta
│ ├── FilesCreate.unity
│ ├── FilesCreate.unity.meta
│ ├── FilesCreateResumable.unity
│ ├── FilesCreateResumable.unity.meta
│ ├── FilesDelete.unity
│ ├── FilesDelete.unity.meta
│ ├── FilesDownloadAudio.unity
│ ├── FilesDownloadAudio.unity.meta
│ ├── FilesDownloadRange.unity
│ ├── FilesDownloadRange.unity.meta
│ ├── FilesDownloadTexture.unity
│ ├── FilesDownloadTexture.unity.meta
│ ├── FilesEmptyTrash.unity
│ ├── FilesEmptyTrash.unity.meta
│ ├── FilesGet.unity
│ ├── FilesGet.unity.meta
│ ├── FilesList.unity
│ ├── FilesList.unity.meta
│ ├── FindFilesByPathAsync.unity
│ ├── FindFilesByPathAsync.unity.meta
│ ├── GetFileByPath.unity
│ └── GetFileByPath.unity.meta
├── ThirdParty.meta
├── ThirdParty
│ ├── PlayServicesResolver.meta
│ └── PlayServicesResolver
│ │ ├── Editor.meta
│ │ └── Editor
│ │ ├── Google.IOSResolver_v1.2.124.0.dll
│ │ ├── Google.IOSResolver_v1.2.124.0.dll.mdb
│ │ ├── Google.IOSResolver_v1.2.124.0.dll.mdb.meta
│ │ ├── Google.IOSResolver_v1.2.124.0.dll.meta
│ │ ├── Google.JarResolver_v1.2.124.0.dll
│ │ ├── Google.JarResolver_v1.2.124.0.dll.mdb
│ │ ├── Google.JarResolver_v1.2.124.0.dll.mdb.meta
│ │ ├── Google.JarResolver_v1.2.124.0.dll.meta
│ │ ├── Google.VersionHandler.dll
│ │ ├── Google.VersionHandler.dll.mdb
│ │ ├── Google.VersionHandler.dll.mdb.meta
│ │ ├── Google.VersionHandler.dll.meta
│ │ ├── Google.VersionHandlerImpl_v1.2.124.0.dll
│ │ ├── Google.VersionHandlerImpl_v1.2.124.0.dll.mdb
│ │ ├── Google.VersionHandlerImpl_v1.2.124.0.dll.mdb.meta
│ │ ├── Google.VersionHandlerImpl_v1.2.124.0.dll.meta
│ │ ├── play-services-resolver_v1.2.124.0.txt
│ │ └── play-services-resolver_v1.2.124.0.txt.meta
├── UnityGoogleDrive.meta
└── UnityGoogleDrive
│ ├── Editor.meta
│ ├── Editor
│ ├── Dependencies.xml
│ ├── Dependencies.xml.meta
│ ├── Elringus.UnityGoogleDrive.Editor.asmdef
│ ├── Elringus.UnityGoogleDrive.Editor.asmdef.meta
│ ├── GoogleDriveSettingsEditor.cs
│ └── GoogleDriveSettingsEditor.cs.meta
│ ├── Plugins.meta
│ ├── Plugins
│ ├── com.elringus.unitygoogledriveandroid.aar
│ ├── com.elringus.unitygoogledriveandroid.aar.meta
│ ├── com.elringus.unitygoogledriveios.mm
│ └── com.elringus.unitygoogledriveios.mm.meta
│ ├── Runtime.meta
│ ├── Runtime
│ ├── API.meta
│ ├── API
│ │ ├── Data.meta
│ │ ├── Data
│ │ │ ├── About.cs
│ │ │ ├── About.cs.meta
│ │ │ ├── AudioFile.cs
│ │ │ ├── AudioFile.cs.meta
│ │ │ ├── Change.cs
│ │ │ ├── Change.cs.meta
│ │ │ ├── ChangeList.cs
│ │ │ ├── ChangeList.cs.meta
│ │ │ ├── Channel.cs
│ │ │ ├── Channel.cs.meta
│ │ │ ├── File.cs
│ │ │ ├── File.cs.meta
│ │ │ ├── FileList.cs
│ │ │ ├── FileList.cs.meta
│ │ │ ├── GeneratedIds.cs
│ │ │ ├── GeneratedIds.cs.meta
│ │ │ ├── Permission.cs
│ │ │ ├── Permission.cs.meta
│ │ │ ├── ResourceData.cs
│ │ │ ├── ResourceData.cs.meta
│ │ │ ├── StartPageToken.cs
│ │ │ ├── StartPageToken.cs.meta
│ │ │ ├── TeamDrive.cs
│ │ │ ├── TeamDrive.cs.meta
│ │ │ ├── TeamDriveList.cs
│ │ │ ├── TeamDriveList.cs.meta
│ │ │ ├── TextureFile.cs
│ │ │ ├── TextureFile.cs.meta
│ │ │ ├── User.cs
│ │ │ └── User.cs.meta
│ │ ├── GoogleDriveAbout.cs
│ │ ├── GoogleDriveAbout.cs.meta
│ │ ├── GoogleDriveChanges.cs
│ │ ├── GoogleDriveChanges.cs.meta
│ │ ├── GoogleDriveFiles.cs
│ │ ├── GoogleDriveFiles.cs.meta
│ │ ├── GoogleDriveTeamDrives.cs
│ │ └── GoogleDriveTeamDrives.cs.meta
│ ├── Authorization.meta
│ ├── Authorization
│ │ ├── AccessTokenRefresher.cs
│ │ ├── AccessTokenRefresher.cs.meta
│ │ ├── AndroidAccessTokenProvider.cs
│ │ ├── AndroidAccessTokenProvider.cs.meta
│ │ ├── AuthCodeExchanger.cs
│ │ ├── AuthCodeExchanger.cs.meta
│ │ ├── AuthController.cs
│ │ ├── AuthController.cs.meta
│ │ ├── GenericClientCredentials.cs
│ │ ├── GenericClientCredentials.cs.meta
│ │ ├── IAccessTokenProvider.cs
│ │ ├── IAccessTokenProvider.cs.meta
│ │ ├── IClientCredentials.cs
│ │ ├── IClientCredentials.cs.meta
│ │ ├── IOSAccessTokenProvider.cs
│ │ ├── IOSAccessTokenProvider.cs.meta
│ │ ├── LoopbackAccessTokenProvider.cs
│ │ ├── LoopbackAccessTokenProvider.cs.meta
│ │ ├── RedirectAccessTokenProvider.cs
│ │ ├── RedirectAccessTokenProvider.cs.meta
│ │ ├── UriSchemeClientCredentials.cs
│ │ └── UriSchemeClientCredentials.cs.meta
│ ├── Elringus.UnityGoogleDrive.Runtime.asmdef
│ ├── Elringus.UnityGoogleDrive.Runtime.asmdef.meta
│ ├── GoogleDriveRequest.cs
│ ├── GoogleDriveRequest.cs.meta
│ ├── GoogleDriveRequestYieldInstruction.cs
│ ├── GoogleDriveRequestYieldInstruction.cs.meta
│ ├── GoogleDriveResponseError.cs
│ ├── GoogleDriveResponseError.cs.meta
│ ├── GoogleDriveResumableUploadRequest.cs
│ ├── GoogleDriveResumableUploadRequest.cs.meta
│ ├── GoogleDriveSettings.cs
│ ├── GoogleDriveSettings.cs.meta
│ ├── GoogleDriveUploadRequest.cs
│ ├── GoogleDriveUploadRequest.cs.meta
│ ├── Utilities.meta
│ └── Utilities
│ │ ├── AsyncExtensions.cs
│ │ ├── AsyncExtensions.cs.meta
│ │ ├── CryptoUtils.cs
│ │ ├── CryptoUtils.cs.meta
│ │ ├── Error.cs
│ │ ├── Error.cs.meta
│ │ ├── Helpers.cs
│ │ ├── Helpers.cs.meta
│ │ ├── JsonUtils.cs
│ │ └── JsonUtils.cs.meta
│ ├── ThirdParty.meta
│ ├── ThirdParty
│ ├── JsonNet-Lite.meta
│ └── JsonNet-Lite
│ │ ├── LICENSE.txt
│ │ ├── LICENSE.txt.meta
│ │ ├── UnityGoogleDrive.Newtonsoft.Json.dll
│ │ └── UnityGoogleDrive.Newtonsoft.Json.dll.meta
│ ├── package.json
│ └── package.json.meta
├── LICENSE
├── Packages
├── manifest.json
└── packages-lock.json
├── ProjectSettings
├── AndroidResolverDependencies.xml
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── GvhProjectSettings.xml
├── InputManager.asset
├── NavMeshAreas.asset
├── NetworkManager.asset
├── PackageManagerSettings.asset
├── Physics2DSettings.asset
├── PresetManager.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── TagManager.asset
├── TimeManager.asset
├── UnityConnectSettings.asset
├── VFXManager.asset
└── XRSettings.asset
├── README.md
├── UnityGoogleDrive.unitypackage
└── publish.sh
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | trim_trailing_whitespace = true
8 | indent_style = space
9 | tab_width = 4
10 |
11 | csharp_new_line_before_members_in_object_initializers = false
12 | csharp_new_line_before_open_brace = accessors, control_blocks, events, indexers, local_functions, methods, properties, types
13 | csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async
14 | csharp_space_between_method_declaration_name_and_open_parenthesis = true
15 | csharp_style_var_elsewhere = true
16 | csharp_style_var_when_type_is_apparent = true
17 | dotnet_naming_rule.private_constants_rule.severity = none
18 | dotnet_naming_rule.private_constants_rule.style = lower_camel_case_style
19 | dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
20 | dotnet_naming_rule.private_instance_fields_rule.severity = none
21 | dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
22 | dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
23 | dotnet_naming_rule.private_static_fields_rule.severity = none
24 | dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
25 | dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
26 | dotnet_naming_rule.private_static_readonly_rule.severity = none
27 | dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
28 | dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
29 | dotnet_naming_rule.property_rule.severity = none
30 | dotnet_naming_rule.property_rule.style = upper_camel_case_style
31 | dotnet_naming_rule.property_rule.symbols = property_symbols
32 | dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
33 | dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
34 | dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
35 | dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
36 | dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
37 | dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
38 | dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
39 | dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
40 | dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
41 | dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
42 | dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
43 | dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
44 | dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly
45 | dotnet_naming_symbols.property_symbols.applicable_accessibilities = *
46 | dotnet_naming_symbols.property_symbols.applicable_kinds = property
47 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
48 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
49 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
50 | dotnet_style_predefined_type_for_locals_parameters_members = true
51 | dotnet_style_predefined_type_for_member_access = true
52 | dotnet_style_qualification_for_event = false
53 | dotnet_style_qualification_for_field = false
54 | dotnet_style_qualification_for_method = false
55 | dotnet_style_qualification_for_property = false
56 | dotnet_style_require_accessibility_modifiers = for_non_interface_members
57 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: elringus
2 |
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: lint
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | lint:
13 | name: lint editorconfig
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v2
17 | - name: editorconfig
18 | run: |
19 | docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker ec --exclude ".git|\.mdb$|\.mm$|\.meta$|\.anim$|\.controller$|\.asset$|\.unity$|\.asmdef$|ProjectSettings"
20 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | name: stale
2 |
3 | on:
4 | workflow_dispatch:
5 | schedule:
6 | - cron: '45 3 * * *'
7 |
8 | jobs:
9 | stale:
10 | name: close stale issues
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/stale@v4
14 | id: stale
15 | with:
16 | stale-issue-label: stale
17 | stale-pr-label: stale
18 | stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days.'
19 | stale-pr-message: 'This pull request is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days.'
20 | days-before-stale: 14
21 | days-before-close: 7
22 | exempt-issue-labels: 'bug,enhancement'
23 | exempt-pr-labels: 'bug,enhancement'
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 | /[Bb]uilds/
6 | /[Ll]ogs/
7 | /Assets/AssetStoreTools*
8 | /Assets/@Transient*
9 | /Assets/Plugins*
10 | .gradle*
11 | Assembly-CSharp.xml
12 |
13 | # Autogenerated VS/MD solution and project files
14 | .idea*
15 | .vs/
16 | ExportedObj/
17 | *.csproj
18 | *.unityproj
19 | *.sln
20 | *.suo
21 | *.tmp
22 | *.user
23 | *.userprefs
24 | *.pidb
25 | *.booproj
26 | *.svd
27 |
28 |
29 | # Unity3D generated meta files
30 | *.pidb.meta
31 |
32 | # Unity3D Generated File On Crash Reports
33 | sysinfo.txt
34 |
35 | # Builds
36 | *.apk
37 |
38 | # =========================
39 | # Operating System Files
40 | # =========================
41 |
42 | # OSX
43 | # =========================
44 |
45 | .DS_Store
46 | .AppleDouble
47 | .LSOverride
48 |
49 | # Thumbnails
50 | ._*
51 |
52 | # Files that might appear in the root of a volume
53 | .DocumentRevisions-V100
54 | .fseventsd
55 | .Spotlight-V100
56 | .TemporaryItems
57 | .Trashes
58 | .VolumeIcon.icns
59 |
60 | # Directories potentially created on remote AFP share
61 | .AppleDB
62 | .AppleDesktop
63 | Network Trash Folder
64 | Temporary Items
65 | .apdisk
66 |
67 | # Windows
68 | # =========================
69 |
70 | # Windows image file caches
71 | Thumbs.db
72 | ehthumbs.db
73 |
74 | # Folder config file
75 | Desktop.ini
76 |
77 | # Recycle Bin used on file shares
78 | $RECYCLE.BIN/
79 |
80 | # Windows Installer files
81 | *.cab
82 | *.msi
83 | *.msm
84 | *.msp
85 |
86 | # Windows shortcuts
87 | *.lnk
88 |
89 | # Allow dlls for plugins and 3rd party assets
90 | !*.dll
91 |
92 | # Ignore sensitive data
93 | /Assets/Resources/GoogleDriveSettings*
94 |
--------------------------------------------------------------------------------
/Android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.elringus.unitygoogledriveandroid"
7 | minSdkVersion 16
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
24 | testImplementation 'junit:junit:4.12'
25 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
26 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
27 | }
28 |
--------------------------------------------------------------------------------
/Android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Android/app/src/androidTest/java/com/elringus/unitygoogledriveandroid/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.elringus.unitygoogledriveandroid;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.elringus.unitygoogledriveandroid", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | UnityGoogleDriveAndroid
3 |
4 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Nov 16 16:42:34 MSK 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/Android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Android/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | minSdkVersion 16
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 |
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | api 'net.openid:appauth:0.7.0'
25 | }
26 |
--------------------------------------------------------------------------------
/Android/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Android/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android/library/src/main/java/com/elringus/unitygoogledriveandroid/AuthorizationActivity.java:
--------------------------------------------------------------------------------
1 | package com.elringus.unitygoogledriveandroid;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 |
8 | import net.openid.appauth.AuthorizationException;
9 | import net.openid.appauth.AuthorizationRequest;
10 | import net.openid.appauth.AuthorizationResponse;
11 | import net.openid.appauth.AuthorizationService;
12 | import net.openid.appauth.AuthorizationServiceConfiguration;
13 | import net.openid.appauth.ResponseTypeValues;
14 |
15 | public class AuthorizationActivity extends Activity {
16 | public interface OnAuthorizationResponseListener {
17 | void onAuthorizationResponse(Boolean isError, String error, String codeVerifier, String redirectUri, String authorizationCode);
18 | }
19 |
20 | private static final int RC_AUTH = 100;
21 | private static OnAuthorizationResponseListener responseListener;
22 | private AuthorizationService authorizationService;
23 |
24 | public static void SetResponseListener (OnAuthorizationResponseListener responseListener)
25 | {
26 | AuthorizationActivity.responseListener = responseListener;
27 | }
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | Intent intent = getIntent();
34 | String authorizationEndpoint = intent.getStringExtra("authorizationEndpoint");
35 | String tokenEndpoint = intent.getStringExtra("tokenEndpoint");
36 | String clientId = intent.getStringExtra("clientId");
37 | String redirectEndpoint = intent.getStringExtra("redirectEndpoint");
38 | String scope = intent.getStringExtra("scope");
39 |
40 | Uri authorizationUri = Uri.parse(authorizationEndpoint);
41 | Uri tokenUri = Uri.parse(tokenEndpoint);
42 | Uri redirectUri = Uri.parse(redirectEndpoint);
43 |
44 | AuthorizationServiceConfiguration configuration = new AuthorizationServiceConfiguration(authorizationUri, tokenUri);
45 | AuthorizationRequest.Builder requestBuilder = new AuthorizationRequest.Builder(configuration, clientId, ResponseTypeValues.CODE, redirectUri);
46 | requestBuilder.setScope(scope);
47 | AuthorizationRequest request = requestBuilder.build();
48 |
49 | authorizationService = new AuthorizationService(this);
50 | Intent authIntent = authorizationService.getAuthorizationRequestIntent(request);
51 | startActivityForResult(authIntent, RC_AUTH);
52 | }
53 |
54 | @Override
55 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
56 | super.onActivityResult(requestCode, resultCode, data);
57 |
58 | if (requestCode != RC_AUTH) return;
59 |
60 | AuthorizationResponse response = AuthorizationResponse.fromIntent(data);
61 | AuthorizationException exception = AuthorizationException.fromIntent(data);
62 |
63 | Boolean isError = exception != null;
64 | String error = isError ? exception.error : "";
65 | String authorizationCode = response != null ? response.authorizationCode : "";
66 | String codeVerifier = response != null ? response.request.codeVerifier : "";
67 | String redirectUri = response != null ? response.request.redirectUri.toString() : "";
68 |
69 | if (responseListener != null) responseListener.onAuthorizationResponse(isError, error, codeVerifier, redirectUri, authorizationCode);
70 |
71 | finish();
72 | }
73 |
74 | @Override
75 | protected void onDestroy() {
76 | super.onDestroy();
77 |
78 | responseListener = null;
79 | if (authorizationService != null) authorizationService.dispose();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------
/Assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 689946d18702f4e479b6fb4dcdc95609
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Editor/PackageExporter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d39fdb714e45c404fbbd6d6f500944c4
3 | timeCreated: 1506010554
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Editor/ProjectFileHook.cs:
--------------------------------------------------------------------------------
1 | #if ENABLE_VSTU
2 |
3 | using SyntaxTree.VisualStudio.Unity.Bridge;
4 | using System.IO;
5 | using System.Text;
6 | using System.Xml.Linq;
7 | using UnityEditor;
8 | using System.Linq;
9 |
10 | [InitializeOnLoad]
11 | public class ProjectFileHook
12 | {
13 | private static readonly XNamespace defaultNamespace = @"http://schemas.microsoft.com/developer/msbuild/2003";
14 |
15 | private class Utf8StringWriter : StringWriter
16 | {
17 | // Necessary for XLinq to save the xml project file in UTF-8 encoding.
18 | public override Encoding Encoding => Encoding.UTF8;
19 | }
20 |
21 | static ProjectFileHook ()
22 | {
23 | ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => {
24 | var document = XDocument.Parse(content);
25 |
26 | var propGroupElement = new XElement(defaultNamespace + "PropertyGroup");
27 | var docElement = new XElement(defaultNamespace + "DocumentationFile", "Assembly-CSharp.xml");
28 | propGroupElement.Add(docElement);
29 | document.Root.AddFirst(propGroupElement);
30 |
31 | var noWarnElements = document.Root.Elements().SelectMany(e => e.Elements().Where(ep => ep.Name.LocalName == "NoWarn"));
32 | foreach (var element in noWarnElements)
33 | element.SetValue(element.Value.ToString() + ";1591");
34 |
35 | var str = new Utf8StringWriter();
36 | document.Save(str);
37 |
38 | return str.ToString();
39 | };
40 | }
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/Assets/Editor/ProjectFileHook.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55c3669b2042a604a8b2589bd6667e20
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e631db240705e5f4e95faed76b7d56b2
3 | folderAsset: yes
4 | timeCreated: 1510594617
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/Resources/TestImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/Resources/TestImage.png
--------------------------------------------------------------------------------
/Assets/Resources/TestImage.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9273d1eccff736648800ece5ef73f189
3 | timeCreated: 1510594636
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | sRGBTexture: 1
12 | linearTexture: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 1
23 | grayScaleToAlpha: 0
24 | generateCubemap: 6
25 | cubemapConvolution: 0
26 | seamlessCubemap: 0
27 | textureFormat: 1
28 | maxTextureSize: 2048
29 | textureSettings:
30 | filterMode: -1
31 | aniso: -1
32 | mipBias: -1
33 | wrapMode: 1
34 | nPOTScale: 0
35 | lightmap: 0
36 | compressionQuality: 50
37 | spriteMode: 1
38 | spriteExtrude: 1
39 | spriteMeshType: 1
40 | alignment: 0
41 | spritePivot: {x: 0.5, y: 0.5}
42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
43 | spritePixelsToUnits: 100
44 | alphaUsage: 1
45 | alphaIsTransparency: 1
46 | spriteTessellationDetail: -1
47 | textureType: 0
48 | textureShape: 1
49 | maxTextureSizeSet: 0
50 | compressionQualitySet: 0
51 | textureFormatSet: 0
52 | platformSettings:
53 | - buildTarget: DefaultTexturePlatform
54 | maxTextureSize: 2048
55 | textureFormat: -1
56 | textureCompression: 0
57 | compressionQuality: 50
58 | crunchedCompression: 0
59 | allowsAlphaSplitting: 0
60 | overridden: 0
61 | - buildTarget: Standalone
62 | maxTextureSize: 2048
63 | textureFormat: -1
64 | textureCompression: 0
65 | compressionQuality: 50
66 | crunchedCompression: 0
67 | allowsAlphaSplitting: 0
68 | overridden: 0
69 | - buildTarget: iPhone
70 | maxTextureSize: 2048
71 | textureFormat: -1
72 | textureCompression: 0
73 | compressionQuality: 50
74 | crunchedCompression: 0
75 | allowsAlphaSplitting: 0
76 | overridden: 0
77 | - buildTarget: Android
78 | maxTextureSize: 2048
79 | textureFormat: -1
80 | textureCompression: 0
81 | compressionQuality: 50
82 | crunchedCompression: 0
83 | allowsAlphaSplitting: 0
84 | overridden: 0
85 | - buildTarget: WebGL
86 | maxTextureSize: 2048
87 | textureFormat: -1
88 | textureCompression: 0
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | spriteSheet:
94 | serializedVersion: 2
95 | sprites: []
96 | outline: []
97 | spritePackingTag:
98 | userData:
99 | assetBundleName:
100 | assetBundleVariant:
101 |
--------------------------------------------------------------------------------
/Assets/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 566e9006edffb4642b6f1963771d4dc7
3 | folderAsset: yes
4 | timeCreated: 1509466497
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/Runtime/Common.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | internal static class Common
4 | {
5 | ///
6 | /// Attempts to extract content before the specified match (on first occurence).
7 | ///
8 | public static string GetBefore (this string content, string matchString, StringComparison comp = StringComparison.Ordinal)
9 | {
10 | if (content.Contains(matchString))
11 | {
12 | var endIndex = content.IndexOf(matchString, comp);
13 | return content.Substring(0, endIndex);
14 | }
15 | return null;
16 | }
17 |
18 |
19 |
20 | ///
21 | /// Attempts to extract content after the specified match (on first occurence).
22 | ///
23 | public static string GetAfterFirst (this string content, string matchString, StringComparison comp = StringComparison.Ordinal)
24 | {
25 | if (content.Contains(matchString))
26 | {
27 | var startIndex = content.IndexOf(matchString, comp) + matchString.Length;
28 | if (content.Length <= startIndex) return string.Empty;
29 | return content.Substring(startIndex);
30 | }
31 | return null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Assets/Runtime/Common.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7d70525f26a733a4e93fff357a057b7d
3 | timeCreated: 1499437740
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 431ba1d92df310842b9184e5ab813f53
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/AdaptiveWindowGUI.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public abstract class AdaptiveWindowGUI : MonoBehaviour
4 | {
5 | public float LeftMargin = 150f, TopMargin, RightMargin, BottomMargin;
6 |
7 | private Rect windowRect;
8 | private string className;
9 |
10 | protected abstract void OnWindowGUI (int windowId);
11 |
12 | protected virtual string GetWindowTitle ()
13 | {
14 | return className;
15 | }
16 |
17 | protected virtual int GetWindowId ()
18 | {
19 | return 0;
20 | }
21 |
22 | protected virtual void Awake ()
23 | {
24 | className = GetType().Name;
25 | }
26 |
27 | protected virtual void OnGUI ()
28 | {
29 | GUILayout.Window(GetWindowId(), windowRect, OnWindowGUI, GetWindowTitle());
30 | }
31 |
32 | protected virtual void Update ()
33 | {
34 | SetWindowRect();
35 | }
36 |
37 | protected virtual void SetWindowRect ()
38 | {
39 | windowRect = new Rect(LeftMargin, TopMargin,
40 | Screen.width - LeftMargin - RightMargin,
41 | Screen.height - TopMargin - BottomMargin);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/AdaptiveWindowGUI.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b8b29b9ac21a55f4b9a3ac5b45ad7989
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleExportDocument.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class ExampleExportDocument : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveFiles.ExportRequest request;
8 | private string fileId = string.Empty;
9 | private string result = string.Empty;
10 |
11 | protected override void OnWindowGUI (int windowId)
12 | {
13 | if (request != null && request.IsRunning)
14 | {
15 | GUILayout.Label($"Loading: {request.Progress:P2}");
16 | }
17 | else
18 | {
19 | GUILayout.BeginHorizontal();
20 | GUILayout.Label("Doc file ID:", GUILayout.Width(85));
21 | fileId = GUILayout.TextField(fileId);
22 | if (GUILayout.Button("Download", GUILayout.Width(100))) ExportDocument();
23 | GUILayout.EndHorizontal();
24 |
25 | GUILayout.Label("Result:", GUILayout.Width(85));
26 | GUILayout.TextArea(result);
27 | }
28 | }
29 |
30 | private void ExportDocument ()
31 | {
32 | request = GoogleDriveFiles.Export(fileId, "text/plain");
33 | request.Send().OnDone += file => result = Encoding.UTF8.GetString(file.Content);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleExportDocument.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a11d367152a6ca643ba2c8d7b7a0a942
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleFindFilesByPathAsync.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using UnityEngine;
4 | using UnityGoogleDrive;
5 |
6 | public class ExampleFindFilesByPathAsync : AdaptiveWindowGUI
7 | {
8 | private bool running;
9 | private string filePath = string.Empty;
10 | private string uploadFilePath = string.Empty;
11 | private bool folder;
12 | private Dictionary results;
13 | private Vector2 scrollPos;
14 |
15 | protected override void OnWindowGUI (int windowId)
16 | {
17 | if (running) GUILayout.Label("Loading, please wait...");
18 |
19 | if (!running && results != null)
20 | {
21 | scrollPos = GUILayout.BeginScrollView(scrollPos);
22 | foreach (var result in results)
23 | {
24 | GUILayout.Label(result.Value);
25 | if (string.IsNullOrEmpty(result.Key)) continue;
26 | GUILayout.BeginHorizontal();
27 | GUILayout.Label("ID:", GUILayout.Width(20));
28 | GUILayout.TextField(result.Key);
29 | GUILayout.EndHorizontal();
30 | }
31 | GUILayout.EndScrollView();
32 | }
33 |
34 | if (!running)
35 | {
36 | GUILayout.BeginHorizontal();
37 | folder = GUILayout.Toggle(folder, "Folder", GUILayout.Width(65));
38 | GUILayout.Label("File path:", GUILayout.Width(70));
39 | filePath = GUILayout.TextField(filePath);
40 | if (GUILayout.Button("Search", GUILayout.Width(100))) FindFilesByPathAsync(filePath);
41 | GUILayout.EndHorizontal();
42 | GUILayout.BeginHorizontal();
43 | GUILayout.Label("Upload file path:", GUILayout.Width(100));
44 | uploadFilePath = GUILayout.TextField(uploadFilePath);
45 | GUILayout.EndHorizontal();
46 | }
47 | }
48 |
49 | private async void FindFilesByPathAsync (string path)
50 | {
51 | running = true;
52 |
53 | if (File.Exists(uploadFilePath))
54 | {
55 | var uploadFile = new UnityGoogleDrive.Data.File { Content = File.ReadAllBytes(uploadFilePath) };
56 | uploadFile.Id = await Helpers.CreateOrUpdateFileAtPathAsync(uploadFile, filePath);
57 | BuildResults(new List { uploadFile });
58 | }
59 | else
60 | {
61 | var files = await Helpers.FindFilesByPathAsync(path, fields: new List { "files(id, name, size, mimeType, modifiedTime)" }, mime: folder ? Helpers.FolderMimeType : null);
62 | BuildResults(files);
63 | }
64 |
65 | running = false;
66 | }
67 |
68 | private void BuildResults (List fileList)
69 | {
70 | if (fileList.Count == 0)
71 | {
72 | results = new Dictionary { [string.Empty] = "Non files found." };
73 | return;
74 | }
75 |
76 | results = new Dictionary();
77 |
78 | foreach (var file in fileList)
79 | {
80 | var fileInfo = string.Format("Name: {0} Size: {1:0.00}MB '{2}' Modified: {3:dd.MM.yyyy}",
81 | file.Name,
82 | file.Size * .000001f,
83 | file.MimeType,
84 | file.ModifiedTime);
85 | results.Add(file.Id ?? "Failed", fileInfo);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleFindFilesByPathAsync.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d0469bf23861cc74da2a442b791be455
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleGetFileByPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 | using UnityGoogleDrive;
6 |
7 | public class ExampleGetFileByPath : AdaptiveWindowGUI
8 | {
9 | private GoogleDriveFiles.ListRequest request;
10 | private string filePath = string.Empty;
11 | private string result = string.Empty;
12 |
13 | protected override void OnWindowGUI (int windowId)
14 | {
15 | if (request != null && request.IsRunning)
16 | {
17 | GUILayout.Label($"Loading: {request.Progress:P2}");
18 | }
19 | else
20 | {
21 | GUILayout.BeginHorizontal();
22 | GUILayout.Label("File path:", GUILayout.Width(70));
23 | filePath = GUILayout.TextField(filePath);
24 | if (GUILayout.Button("Get", GUILayout.Width(100)))
25 | StartCoroutine(GetFileByPathRoutine(filePath));
26 | GUILayout.EndHorizontal();
27 | }
28 |
29 | if (!string.IsNullOrEmpty(result))
30 | {
31 | GUILayout.BeginHorizontal();
32 | GUILayout.Label("Result:", GUILayout.Width(70));
33 | result = GUILayout.TextField(result);
34 | GUILayout.EndHorizontal();
35 | }
36 | }
37 |
38 | private IEnumerator GetFileByPathRoutine (string filePath)
39 | {
40 | // A folder in Google Drive is actually a file with the MIME type 'application/vnd.google-apps.folder'.
41 | // Hierarchy relationship is implemented via File's 'Parents' property. To get the actual file using it's path
42 | // we have to find ID of the file's parent folder, and for this we need IDs of all the folders in the chain.
43 | // Thus, we need to traverse the entire hierarchy chain using List requests.
44 | // More info about the Google Drive folders: https://developers.google.com/drive/v3/web/folder.
45 |
46 | var fileName = filePath.Contains("/") ? GetAfter(filePath, "/") : filePath;
47 | var parentNames = filePath.Contains("/") ? GetBeforeLast(filePath, "/").Split('/') : null;
48 |
49 | // Resolving folder IDs one by one to find ID of the file's parent folder.
50 | var parentId = "root"; // 'root' is alias ID for the root folder in Google Drive.
51 | if (parentNames != null)
52 | {
53 | for (int i = 0; i < parentNames.Length; i++)
54 | {
55 | request = new GoogleDriveFiles.ListRequest();
56 | request.Fields = new List { "files(id)" };
57 | request.Q = $"'{parentId}' in parents and name = '{parentNames[i]}' and mimeType = 'application/vnd.google-apps.folder' and trashed = false";
58 |
59 | yield return request.Send();
60 |
61 | if (request.IsError || request.ResponseData.Files == null || request.ResponseData.Files.Count == 0)
62 | {
63 | result = $"Failed to retrieve '{parentNames[i]}' part of '{filePath}' file path.";
64 | yield break;
65 | }
66 |
67 | if (request.ResponseData.Files.Count > 1)
68 | Debug.LogWarning($"Multiple '{parentNames[i]}' folders been found.");
69 |
70 | parentId = request.ResponseData.Files[0].Id;
71 | }
72 | }
73 |
74 | // Searching the file.
75 | request = new GoogleDriveFiles.ListRequest();
76 | request.Fields = new List { "files(id, size, modifiedTime)" };
77 | request.Q = $"'{parentId}' in parents and name = '{fileName}'";
78 |
79 | yield return request.Send();
80 |
81 | if (request.IsError || request.ResponseData.Files == null || request.ResponseData.Files.Count == 0)
82 | {
83 | result = $"Failed to retrieve '{filePath}' file.";
84 | yield break;
85 | }
86 |
87 | if (request.ResponseData.Files.Count > 1)
88 | Debug.LogWarning($"Multiple '{filePath}' files been found.");
89 |
90 | var file = request.ResponseData.Files[0];
91 |
92 | result = $"ID: {file.Id} Size: {file.Size * .000001f:0.00}MB Modified: {file.CreatedTime:dd.MM.yyyy HH:MM:ss}";
93 | }
94 |
95 | private static string GetBeforeLast (string content, string matchString)
96 | {
97 | if (content.Contains(matchString))
98 | {
99 | var endIndex = content.LastIndexOf(matchString, StringComparison.Ordinal);
100 | return content.Substring(0, endIndex);
101 | }
102 | return null;
103 | }
104 |
105 | private static string GetAfter (string content, string matchString)
106 | {
107 | if (content.Contains(matchString))
108 | {
109 | var startIndex = content.LastIndexOf(matchString, StringComparison.Ordinal) + matchString.Length;
110 | if (content.Length <= startIndex) return string.Empty;
111 | return content.Substring(startIndex);
112 | }
113 | return null;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/ExampleGetFileByPath.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4f1528bcf288fb64ab059e7d502a2931
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/SceneSwitcher.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using UnityEngine;
3 | using UnityEngine.SceneManagement;
4 |
5 | namespace Naninovel
6 | {
7 | public class SceneSwitcher : MonoBehaviour
8 | {
9 | private const int buttonHeight = 50;
10 | private const int buttonWidth = 150;
11 |
12 | private void OnGUI ()
13 | {
14 | for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
15 | if (GUI.Button(GetRectForSceneAt(i), GetNameForSceneAt(i)))
16 | SceneManager.LoadScene(i);
17 | }
18 |
19 | private static Rect GetRectForSceneAt (int index)
20 | {
21 | var yPos = Screen.height - (buttonHeight + buttonHeight * index);
22 | return new Rect(0, yPos, buttonWidth, buttonHeight);
23 | }
24 |
25 | private static string GetNameForSceneAt (int index)
26 | {
27 | var scenePath = SceneUtility.GetScenePathByBuildIndex(index);
28 | return Path.GetFileNameWithoutExtension(scenePath);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Assets/Runtime/Example/SceneSwitcher.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2d3ad1acf11bfaa499a9bfddc789a072
3 | timeCreated: 1506180101
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f9c45f2aaabd4db4cbbbf8bc946d8f79
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/AutomatedTests.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8d7cdc8fc7f4c184a93621b7fd2ad34c
3 | timeCreated: 1510757661
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestAboutGet.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestAboutGet : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveAbout.GetRequest request;
8 | private GoogleDriveSettings settings;
9 |
10 | protected override void Awake ()
11 | {
12 | base.Awake();
13 | settings = GoogleDriveSettings.LoadFromResources();
14 | }
15 |
16 | private void Start ()
17 | {
18 | UpdateInfo();
19 | }
20 |
21 | protected override void OnWindowGUI (int windowId)
22 | {
23 | if (request.IsRunning)
24 | {
25 | GUILayout.Label($"Loading: {request.Progress:P2}");
26 | }
27 | else
28 | {
29 | if (GUILayout.Button("Refresh"))
30 | UpdateInfo();
31 | }
32 |
33 | if (settings.IsAnyAuthTokenCached() && GUILayout.Button("Delete Cached Tokens"))
34 | settings.DeleteCachedAuthTokens();
35 |
36 | if (request.ResponseData != null)
37 | {
38 | GUILayout.Label(string.Format("User name: {0}\nUser email: {1}\nSpace used: {2:0}/{3:0} MB",
39 | request.ResponseData.User.DisplayName,
40 | request.ResponseData.User.EmailAddress,
41 | request.ResponseData.StorageQuota.Usage * .000001f,
42 | request.ResponseData.StorageQuota.Limit * .000001f));
43 | }
44 |
45 | if (request.IsError)
46 | GUILayout.Label(string.Format("Request failed: {0}", request.Error));
47 | }
48 |
49 | private void UpdateInfo ()
50 | {
51 | AuthController.CancelAuth();
52 |
53 | request = GoogleDriveAbout.Get();
54 | request.Fields = new List { "user", "storageQuota" };
55 | request.Send();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestAboutGet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4b1b7cd160ec7da4381ffbd00654b24d
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestAboutGetAsync.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestAboutGetAsync : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveAbout.GetRequest request;
8 | private UnityGoogleDrive.Data.About aboutData;
9 |
10 | private async void Start () => aboutData = await UpdateInfo();
11 |
12 | protected override void OnWindowGUI (int windowId)
13 | {
14 | if (aboutData != null)
15 | {
16 | GUILayout.Label(string.Format("User name: {0}\nUser email: {1}\nSpace used: {2:0}/{3:0} MB",
17 | aboutData.User.DisplayName,
18 | aboutData.User.EmailAddress,
19 | aboutData.StorageQuota.Usage * .000001f,
20 | aboutData.StorageQuota.Limit * .000001f));
21 | }
22 | else if (request != null && request.IsRunning) GUILayout.Label($"Loading: {request.Progress:P2}");
23 | }
24 |
25 | private async System.Threading.Tasks.Task UpdateInfo ()
26 | {
27 | AuthController.CancelAuth();
28 |
29 | request = GoogleDriveAbout.Get();
30 | request.Fields = new List { "user", "storageQuota" };
31 | return await request.Send();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestAboutGetAsync.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b739022f71cabf745914f02e8d19c5fa
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCopy.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesCopy : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveFiles.CopyRequest request;
8 | private string result;
9 | private string fileId = string.Empty;
10 | private string copyName = string.Empty;
11 |
12 | protected override void OnWindowGUI (int windowId)
13 | {
14 | if (request != null && request.IsRunning)
15 | {
16 | GUILayout.Label($"Loading: {request.Progress:P2}");
17 | }
18 | else
19 | {
20 | GUILayout.BeginHorizontal();
21 | GUILayout.Label("Source File ID:", GUILayout.Width(90));
22 | fileId = GUILayout.TextField(fileId);
23 | GUILayout.Label("Copy Name:", GUILayout.Width(80));
24 | copyName = GUILayout.TextField(copyName);
25 | if (GUILayout.Button("Copy", GUILayout.Width(100))) CopyFile();
26 | GUILayout.EndHorizontal();
27 | }
28 |
29 | if (!string.IsNullOrEmpty(result))
30 | {
31 | GUILayout.Label(result);
32 | }
33 | }
34 |
35 | private void CopyFile ()
36 | {
37 | var file = new UnityGoogleDrive.Data.File() { Id = fileId, Name = string.IsNullOrEmpty(copyName) ? null : copyName };
38 | request = GoogleDriveFiles.Copy(file);
39 | request.Fields = new List { "name, size, createdTime" };
40 | request.Send().OnDone += BuildResultString;
41 | }
42 |
43 | private void BuildResultString (UnityGoogleDrive.Data.File file)
44 | {
45 | result = string.Format("Copied File Name: {0} Size: {1:0.00}MB Created: {2:dd.MM.yyyy HH:MM:ss}",
46 | file.Name,
47 | file.Size * .000001f,
48 | file.CreatedTime);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCopy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4ebd76e59bf01954eb2ca16f14bed6e8
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCreate.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using UnityEngine;
4 | using UnityGoogleDrive;
5 |
6 | public class TestFilesCreate : AdaptiveWindowGUI
7 | {
8 | public string UploadFilePath;
9 |
10 | private GoogleDriveFiles.CreateRequest request;
11 | private string result;
12 |
13 | protected override void OnWindowGUI (int windowId)
14 | {
15 | if (request != null && request.IsRunning)
16 | {
17 | GUILayout.Label($"Loading: {request.Progress:P2}");
18 | }
19 | else
20 | {
21 | UploadFilePath = GUILayout.TextField(UploadFilePath);
22 | if (GUILayout.Button("Upload To Root")) Upload(false);
23 | if (GUILayout.Button("Upload To AddData")) Upload(true);
24 | }
25 |
26 | if (!string.IsNullOrEmpty(result))
27 | {
28 | GUILayout.TextField(result);
29 | }
30 | }
31 |
32 | private void Upload (bool toAppData)
33 | {
34 | var content = File.ReadAllBytes(UploadFilePath);
35 | var file = new UnityGoogleDrive.Data.File { Name = Path.GetFileName(UploadFilePath), Content = content };
36 | if (toAppData) file.Parents = new List { "appDataFolder" };
37 | request = GoogleDriveFiles.Create(file);
38 | request.Fields = new List { "id", "name", "size", "createdTime" };
39 | request.Send().OnDone += PrintResult;
40 | }
41 |
42 | private void PrintResult (UnityGoogleDrive.Data.File file)
43 | {
44 | result = string.Format("Name: {0} Size: {1:0.00}MB Created: {2:dd.MM.yyyy HH:MM:ss}\nID: {3}",
45 | file.Name,
46 | file.Size * .000001f,
47 | file.CreatedTime,
48 | file.Id);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCreate.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a254c8a62c219d44f821e541c63e043a
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCreateResumable.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesCreateResumable : AdaptiveWindowGUI
6 | {
7 | public string UploadFilePath;
8 |
9 | private GoogleDriveFiles.ResumableCreateRequest request;
10 | private string resumableSessionUri;
11 |
12 | protected override void OnWindowGUI (int windowId)
13 | {
14 | if (request != null && request.IsRunning)
15 | {
16 | GUILayout.Label($"Loading: {request.Progress:P2}");
17 | if (GUILayout.Button("Abort Upload")) request.Abort();
18 | }
19 | else
20 | {
21 | UploadFilePath = GUILayout.TextField(UploadFilePath);
22 | if (GUILayout.Button("Upload")) Upload();
23 | }
24 |
25 | if (!string.IsNullOrEmpty(resumableSessionUri))
26 | {
27 | GUILayout.Label(resumableSessionUri);
28 | }
29 | }
30 |
31 | private void Upload ()
32 | {
33 | var content = File.ReadAllBytes(UploadFilePath);
34 | if (content == null) return;
35 |
36 | var file = new UnityGoogleDrive.Data.File() { Name = Path.GetFileName(UploadFilePath), Content = content };
37 | request = GoogleDriveFiles.CreateResumable(file, resumableSessionUri);
38 | request.Send().OnDone += SaveSessionUri;
39 | }
40 |
41 | private void SaveSessionUri (string resumableSessionUri)
42 | {
43 | this.resumableSessionUri = resumableSessionUri;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesCreateResumable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 076a3873c9109634387408671c23c9bb
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDelete.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityGoogleDrive;
3 |
4 | public class TestFilesDelete : AdaptiveWindowGUI
5 | {
6 | private GoogleDriveFiles.DeleteRequest request;
7 | private string result;
8 | private string fileId = string.Empty;
9 |
10 | protected override void OnWindowGUI (int windowId)
11 | {
12 | if (request != null && request.IsRunning)
13 | {
14 | GUILayout.Label($"Loading: {request.Progress:P2}");
15 | }
16 | else
17 | {
18 | GUILayout.BeginHorizontal();
19 | GUILayout.Label("File ID:", GUILayout.Width(70));
20 | fileId = GUILayout.TextField(fileId);
21 | if (GUILayout.Button("Delete", GUILayout.Width(100))) DeleteFile();
22 | GUILayout.EndHorizontal();
23 | }
24 | if (!string.IsNullOrEmpty(result))
25 | {
26 | GUILayout.Label(result);
27 | }
28 | }
29 |
30 | private void DeleteFile ()
31 | {
32 | request = GoogleDriveFiles.Delete(fileId);
33 | request.Send().OnDone += _ => result = request.IsError ? request.Error : "file deleted";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDelete.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8480b87c9f9377342bb1a6a98c3f30fd
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadAudio.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesDownloadAudio : AdaptiveWindowGUI
6 | {
7 | public AudioSource AudioSource;
8 |
9 | private GoogleDriveFiles.GetRequest getRequest;
10 | private GoogleDriveFiles.DownloadAudioRequest downloadRequest;
11 | private string audioFileId = string.Empty;
12 |
13 | protected override void OnWindowGUI (int windowId)
14 | {
15 | if (IsRunning())
16 | {
17 | GUILayout.Label(string.Format("Loading: {0:P2}", downloadRequest != null ? downloadRequest.Progress : getRequest.Progress));
18 | }
19 | else
20 | {
21 | GUILayout.BeginHorizontal();
22 | GUILayout.Label("Audio file ID:", GUILayout.Width(85));
23 | audioFileId = GUILayout.TextField(audioFileId);
24 | if (GUILayout.Button("Download", GUILayout.Width(100))) GetInfoAndDownloadAudio();
25 | GUILayout.EndHorizontal();
26 | }
27 | }
28 |
29 | private bool IsRunning ()
30 | {
31 | return (getRequest != null && getRequest.IsRunning) || (downloadRequest != null && downloadRequest.IsRunning);
32 | }
33 |
34 | private void GetInfoAndDownloadAudio ()
35 | {
36 | // First, we should find out what the encoding format of the audio is.
37 | // In case you know that beforehand, you can use GoogleDriveFiles.DownloadAudio(fileId, audioType) right away.
38 | getRequest = GoogleDriveFiles.Get(audioFileId);
39 | getRequest.Fields = new List { "id, mimeType" };
40 | getRequest.Send().OnDone += DownloadAudio;
41 | }
42 |
43 | private void DownloadAudio (UnityGoogleDrive.Data.File file)
44 | {
45 | downloadRequest = GoogleDriveFiles.DownloadAudio(file.Id, AudioType.UNKNOWN);
46 | downloadRequest.Send().OnDone += PlayAudio;
47 | }
48 |
49 | private void PlayAudio (UnityGoogleDrive.Data.AudioFile audioFile)
50 | {
51 | AudioSource.clip = audioFile.AudioClip;
52 | AudioSource.Play();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadAudio.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5c32175d5185a5f478f031d51a3ee7f9
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadRange.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesDownloadRange : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveFiles.DownloadRequest request;
8 | private string fileId = string.Empty;
9 | private string result = string.Empty;
10 | private RangeInt range;
11 |
12 | protected override void OnWindowGUI (int windowId)
13 | {
14 | if (request != null && request.IsRunning)
15 | {
16 | GUILayout.Label($"Loading: {request.Progress:P2}");
17 | }
18 | else
19 | {
20 | GUILayout.BeginHorizontal();
21 | GUILayout.Label("Text file ID:", GUILayout.Width(70));
22 | fileId = GUILayout.TextField(fileId, GUILayout.Width(100));
23 | range.start = int.Parse(GUILayout.TextField(range.start.ToString(), GUILayout.Width(50)));
24 | GUILayout.Label("-", GUILayout.Width(5));
25 | range.length = int.Parse(GUILayout.TextField(range.length.ToString(), GUILayout.Width(50)));
26 | if (GUILayout.Button("Download", GUILayout.Width(100))) DownloadTexture();
27 | GUILayout.EndHorizontal();
28 | }
29 |
30 | if (!string.IsNullOrEmpty(result)) GUILayout.TextField(result);
31 | }
32 |
33 | private void DownloadTexture ()
34 | {
35 | request = GoogleDriveFiles.Download(fileId, range.start >= 0 ? (RangeInt?)range : null);
36 | request.Send().OnDone += SetResult;
37 | }
38 |
39 | private void SetResult (UnityGoogleDrive.Data.File file)
40 | {
41 | result = Encoding.UTF8.GetString(file.Content);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadRange.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b94ef58a16be6648877892852dc4e7a
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadTexture.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityGoogleDrive;
3 |
4 | public class TestFilesDownloadTexture : AdaptiveWindowGUI
5 | {
6 | public SpriteRenderer SpriteRenderer;
7 |
8 | private GoogleDriveFiles.DownloadTextureRequest request;
9 | private string fileId = string.Empty;
10 |
11 | protected override void OnWindowGUI (int windowId)
12 | {
13 | if (request != null && request.IsRunning)
14 | {
15 | GUILayout.Label($"Loading: {request.Progress:P2}");
16 | }
17 | else
18 | {
19 | GUILayout.BeginHorizontal();
20 | GUILayout.Label("Texture file ID:", GUILayout.Width(85));
21 | fileId = GUILayout.TextField(fileId);
22 | if (GUILayout.Button("Download", GUILayout.Width(100))) DownloadTexture();
23 | GUILayout.EndHorizontal();
24 | }
25 | }
26 |
27 | private void DownloadTexture ()
28 | {
29 | request = GoogleDriveFiles.DownloadTexture(fileId, true);
30 | request.Send().OnDone += RenderImage;
31 | }
32 |
33 | private void RenderImage (UnityGoogleDrive.Data.TextureFile textureFile)
34 | {
35 | var texture = textureFile.Texture;
36 | var rect = new Rect(0, 0, texture.width, texture.height);
37 | SpriteRenderer.sprite = Sprite.Create(texture, rect, Vector2.one * .5f);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesDownloadTexture.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6f807f9a9650d140a10681d42a8b3ac
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesEmptyTrash.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityGoogleDrive;
3 |
4 | public class TestFilesEmptyTrash : AdaptiveWindowGUI
5 | {
6 | private GoogleDriveFiles.EmptyTrashRequest request;
7 | private string result;
8 |
9 | protected override void OnWindowGUI (int windowId)
10 | {
11 | if (request != null && request.IsRunning)
12 | {
13 | GUILayout.Label($"Loading: {request.Progress:P2}");
14 | }
15 | else
16 | {
17 | if (GUILayout.Button("Empty Trash")) EmptyTrash();
18 | }
19 | if (!string.IsNullOrEmpty(result))
20 | {
21 | GUILayout.Label(result);
22 | }
23 | }
24 |
25 | private void EmptyTrash ()
26 | {
27 | request = GoogleDriveFiles.EmptyTrash();
28 | request.Send().OnDone += _ => result = request.IsError ? request.Error : "trash emptied";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesEmptyTrash.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 372b82f655402b5438f780f26fdf2871
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesGet.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesGet : AdaptiveWindowGUI
6 | {
7 | private GoogleDriveFiles.GetRequest request;
8 | private string result;
9 | private string fileId = string.Empty;
10 |
11 | protected override void OnWindowGUI (int windowId)
12 | {
13 | if (request != null && request.IsRunning)
14 | {
15 | GUILayout.Label($"Loading: {request.Progress:P2}");
16 | }
17 | else
18 | {
19 | GUILayout.BeginHorizontal();
20 | GUILayout.Label("File ID:", GUILayout.Width(70));
21 | fileId = GUILayout.TextField(fileId);
22 | if (GUILayout.Button("Get", GUILayout.Width(100))) GetFile();
23 | GUILayout.EndHorizontal();
24 | }
25 | if (!string.IsNullOrEmpty(result))
26 | {
27 | GUILayout.Label(result);
28 | }
29 | }
30 |
31 | private void GetFile ()
32 | {
33 | request = GoogleDriveFiles.Get(fileId);
34 | request.Fields = new List { "name, size, createdTime" };
35 | request.Send().OnDone += BuildResultString;
36 | }
37 |
38 | private void BuildResultString (UnityGoogleDrive.Data.File file)
39 | {
40 | result = string.Format("Name: {0} Size: {1:0.00}MB Created: {2:dd.MM.yyyy HH:MM:ss}",
41 | file.Name,
42 | file.Size * .000001f,
43 | file.CreatedTime);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesGet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4a7caa9c46fd5d64183af6af2f04cf62
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityGoogleDrive;
4 |
5 | public class TestFilesList : AdaptiveWindowGUI
6 | {
7 | [Range(1, 1000)]
8 | public int ResultsPerPage = 100;
9 |
10 | private GoogleDriveFiles.ListRequest request;
11 | private Dictionary results;
12 | private string query = string.Empty;
13 | private Vector2 scrollPos;
14 |
15 | private void Start ()
16 | {
17 | ListFiles();
18 | }
19 |
20 | protected override void OnWindowGUI (int windowId)
21 | {
22 | if (request.IsRunning)
23 | {
24 | GUILayout.Label($"Loading: {request.Progress:P2}");
25 | }
26 | else if (results != null)
27 | {
28 | scrollPos = GUILayout.BeginScrollView(scrollPos);
29 | foreach (var result in results)
30 | {
31 | GUILayout.Label(result.Value);
32 | GUILayout.BeginHorizontal();
33 | GUILayout.Label("ID:", GUILayout.Width(20));
34 | GUILayout.TextField(result.Key);
35 | GUILayout.EndHorizontal();
36 | }
37 | GUILayout.EndScrollView();
38 | }
39 |
40 | GUILayout.BeginHorizontal();
41 | GUILayout.Label("File name:", GUILayout.Width(70));
42 | query = GUILayout.TextField(query);
43 | if (GUILayout.Button("Search", GUILayout.Width(100))) ListFiles();
44 | if (NextPageExists() && GUILayout.Button(">>", GUILayout.Width(50)))
45 | ListFiles(request.ResponseData.NextPageToken);
46 | GUILayout.EndHorizontal();
47 | }
48 |
49 | private void ListFiles (string nextPageToken = null)
50 | {
51 | request = GoogleDriveFiles.List();
52 | request.Fields = new List { "nextPageToken, files(id, name, size, createdTime)" };
53 | request.PageSize = ResultsPerPage;
54 | if (!string.IsNullOrEmpty(query))
55 | request.Q = string.Format("name contains '{0}'", query);
56 | if (!string.IsNullOrEmpty(nextPageToken))
57 | request.PageToken = nextPageToken;
58 | request.Send().OnDone += BuildResults;
59 | }
60 |
61 | private void BuildResults (UnityGoogleDrive.Data.FileList fileList)
62 | {
63 | results = new Dictionary();
64 |
65 | foreach (var file in fileList.Files)
66 | {
67 | var fileInfo = string.Format("Name: {0} Size: {1:0.00}MB Created: {2:dd.MM.yyyy}",
68 | file.Name,
69 | file.Size * .000001f,
70 | file.CreatedTime);
71 | results.Add(file.Id, fileInfo);
72 | }
73 | }
74 |
75 | private bool NextPageExists ()
76 | {
77 | return request != null &&
78 | request.ResponseData != null &&
79 | !string.IsNullOrEmpty(request.ResponseData.NextPageToken);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Assets/Runtime/Test/TestFilesList.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed338b98aba2c054c999b7fd0c29a291
3 | timeCreated: 1510243463
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ebd3ab36d093b934cb51ad7ccaddde9c
3 | folderAsset: yes
4 | timeCreated: 1509308683
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/Scenes/AboutGet.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5d8e7c46f16d624fa4ad05318e05d68
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/AboutGetAsync.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ec076794c38d034caeaaeee51b2b385
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/ExportDocument.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a67bfa30d7186d7439bf59ae9b1fc851
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesCopy.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d6eeeea92142ab646b7c7848abeaf312
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesCreate.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2cf450ec146bc5b4299efdc922f12ac3
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesCreateResumable.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 51561e748737a4e4daa39cb1f92c4a7c
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesDelete.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8901625e531185848a30bd20c77e7e4f
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesDownloadAudio.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e6c1977f3c8f7a14f99776bd6babe26f
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesDownloadRange.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e1c1da107b2458c4289864cf49ac5901
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesDownloadTexture.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f11a9ba9822f0b34ab47045ffceee18b
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesEmptyTrash.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1050b1c463dab7343be11895d72e0a11
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesGet.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 87385a46bd7dc84498e448f28a72cf1b
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FilesList.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 76eb76d1d5cf8d74a849ad46d8f73d9a
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/FindFilesByPathAsync.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4e712e0a6343374abc71fd23426bb05
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/GetFileByPath.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6aecb61640546d542a05f3506af1bb59
3 | timeCreated: 1509308694
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ThirdParty.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 75d8cc6eae95deb47a87c3401b8fd658
3 | folderAsset: yes
4 | timeCreated: 1510495932
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 333d24e71d12446ba5c77815e64b0ca8
3 | folderAsset: yes
4 | timeCreated: 1448926447
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e105e00cdce8456482d26b1fcd1ca47d
3 | folderAsset: yes
4 | timeCreated: 1448926516
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll.mdb
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 21ae7451d6bb4af295ef971006ccdf43
3 | labels:
4 | - gvh
5 | - gvh_version-1.2.124.0
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 456c36c9fd2e4bf9a4fb4cc6d1d0a678
3 | labels:
4 | - gvh
5 | - gvh_targets-editor
6 | - gvh_version-1.2.124.0
7 | PluginImporter:
8 | externalObjects: {}
9 | serializedVersion: 2
10 | iconMap: {}
11 | executionOrder: {}
12 | defineConstraints: []
13 | isPreloaded: 0
14 | isOverridable: 0
15 | isExplicitlyReferenced: 0
16 | validateReferences: 1
17 | platformData:
18 | - first:
19 | Any:
20 | second:
21 | enabled: 0
22 | settings: {}
23 | - first:
24 | Editor: Editor
25 | second:
26 | enabled: 1
27 | settings:
28 | DefaultValueInitialized: true
29 | - first:
30 | Windows Store Apps: WindowsStoreApps
31 | second:
32 | enabled: 0
33 | settings:
34 | CPU: AnyCPU
35 | userData:
36 | assetBundleName:
37 | assetBundleVariant:
38 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll.mdb
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 518ffdaf3f704875ad5add87395e3f3f
3 | labels:
4 | - gvh
5 | - gvh_version-1.2.124.0
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3062ec93b45465faf4960a0535c3b1e
3 | labels:
4 | - gvh
5 | - gvh_targets-editor
6 | - gvh_version-1.2.124.0
7 | PluginImporter:
8 | externalObjects: {}
9 | serializedVersion: 2
10 | iconMap: {}
11 | executionOrder: {}
12 | defineConstraints: []
13 | isPreloaded: 0
14 | isOverridable: 0
15 | isExplicitlyReferenced: 0
16 | validateReferences: 1
17 | platformData:
18 | - first:
19 | Any:
20 | second:
21 | enabled: 0
22 | settings: {}
23 | - first:
24 | Editor: Editor
25 | second:
26 | enabled: 1
27 | settings:
28 | DefaultValueInitialized: true
29 | - first:
30 | Windows Store Apps: WindowsStoreApps
31 | second:
32 | enabled: 0
33 | settings:
34 | CPU: AnyCPU
35 | userData:
36 | assetBundleName:
37 | assetBundleVariant:
38 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll.mdb
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3aa17cd5f43042a1a7381759dc1258a7
3 | labels:
4 | - gvh
5 | - gvh_version-1.2.124.0
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandler.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb6999c8a5ce4ba99688ec579babe5b7
3 | labels:
4 | - gvh
5 | - gvh_targets-editor
6 | - gvh_version-1.2.124.0
7 | PluginImporter:
8 | externalObjects: {}
9 | serializedVersion: 2
10 | iconMap: {}
11 | executionOrder: {}
12 | defineConstraints: []
13 | isPreloaded: 0
14 | isOverridable: 0
15 | isExplicitlyReferenced: 0
16 | validateReferences: 1
17 | platformData:
18 | - first:
19 | Any:
20 | second:
21 | enabled: 0
22 | settings: {}
23 | - first:
24 | Editor: Editor
25 | second:
26 | enabled: 1
27 | settings:
28 | DefaultValueInitialized: true
29 | - first:
30 | Windows Store Apps: WindowsStoreApps
31 | second:
32 | enabled: 0
33 | settings:
34 | CPU: AnyCPU
35 | userData:
36 | assetBundleName:
37 | assetBundleVariant:
38 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll.mdb
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 87f9be4af8eb40fc83c1a98a91cc2a5d
3 | labels:
4 | - gvh
5 | - gvh_version-1.2.124.0
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b7cc057a55cf4da1b7ea39478c78c510
3 | labels:
4 | - gvh
5 | - gvh_targets-editor
6 | - gvh_version-1.2.124.0
7 | PluginImporter:
8 | externalObjects: {}
9 | serializedVersion: 2
10 | iconMap: {}
11 | executionOrder: {}
12 | defineConstraints: []
13 | isPreloaded: 0
14 | isOverridable: 0
15 | isExplicitlyReferenced: 0
16 | validateReferences: 1
17 | platformData:
18 | - first:
19 | Any:
20 | second:
21 | enabled: 0
22 | settings: {}
23 | - first:
24 | Editor: Editor
25 | second:
26 | enabled: 1
27 | settings:
28 | DefaultValueInitialized: true
29 | - first:
30 | Windows Store Apps: WindowsStoreApps
31 | second:
32 | enabled: 0
33 | settings:
34 | CPU: AnyCPU
35 | userData:
36 | assetBundleName:
37 | assetBundleVariant:
38 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/play-services-resolver_v1.2.124.0.txt:
--------------------------------------------------------------------------------
1 | Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll
2 | Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.124.0.dll.mdb
3 | Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll
4 | Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.124.0.dll.mdb
5 | Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
6 | Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll.mdb
7 | Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll
8 | Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.124.0.dll.mdb
9 |
--------------------------------------------------------------------------------
/Assets/ThirdParty/PlayServicesResolver/Editor/play-services-resolver_v1.2.124.0.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce9e00220ed74f90b423be0d494caf4d
3 | labels:
4 | - gvh
5 | - gvh_manifest
6 | - gvh_version-1.2.124.0
7 | TextScriptImporter:
8 | externalObjects: {}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0055a5452ac03b64eb4519e55b83185c
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f8b3983265b477d4f866810bbbaa3467
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor/Dependencies.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor/Dependencies.xml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 950b14fbd8ae3dd468e3ca7ecfc9762c
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor/Elringus.UnityGoogleDrive.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Elringus.UnityGoogleDrive.Editor",
3 | "references": [
4 | "GUID:26c3782e36cc1874587ef07692accab2"
5 | ],
6 | "optionalUnityReferences": [],
7 | "includePlatforms": [
8 | "Editor"
9 | ],
10 | "excludePlatforms": [],
11 | "allowUnsafeCode": false,
12 | "overrideReferences": false,
13 | "precompiledReferences": [],
14 | "autoReferenced": true,
15 | "defineConstraints": [],
16 | "versionDefines": []
17 | }
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor/Elringus.UnityGoogleDrive.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c57991372d65bbf4b8cd50a3687beaa0
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Editor/GoogleDriveSettingsEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 01c90511ebf27364d958f1e71bccda83
3 | timeCreated: 1509361143
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cdf68ce09dd5e9b4da5082b13db30971
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Plugins/com.elringus.unitygoogledriveandroid.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elringus/unity-google-drive/c77e6cd97e31cdf9a8d9575e452bf844ddcbbee6/Assets/UnityGoogleDrive/Plugins/com.elringus.unitygoogledriveandroid.aar
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Plugins/com.elringus.unitygoogledriveandroid.aar.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 83f5f6d78a702744ba8072dd05bbd678
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | isPreloaded: 0
9 | isOverridable: 0
10 | platformData:
11 | - first:
12 | Android: Android
13 | second:
14 | enabled: 1
15 | settings: {}
16 | - first:
17 | Any:
18 | second:
19 | enabled: 0
20 | settings: {}
21 | - first:
22 | Editor: Editor
23 | second:
24 | enabled: 0
25 | settings:
26 | DefaultValueInitialized: true
27 | userData:
28 | assetBundleName:
29 | assetBundleVariant:
30 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Plugins/com.elringus.unitygoogledriveios.mm:
--------------------------------------------------------------------------------
1 | #import
2 | #import "AppAuth.h"
3 |
4 | #define SendUnityMessage(m) UnitySendMessage("UnityGoogleDrive_IOSAccessTokenProvider_ResponseHandler", "HandleResponseMessage", m)
5 |
6 | extern "C" void UnitySendMessage(const char*, const char*, const char*);
7 | extern "C" UIViewController* UnityGetGLViewController();
8 |
9 | @interface UnityGoogleDriveIOS : NSObject
10 |
11 | + (UnityGoogleDriveIOS*)instance;
12 |
13 | - (void)performAuth:(NSURL*)authorizationEndpoint
14 | tokenEndpoint:(NSURL*)tokenEndpoint
15 | clientId:(NSString*)clientId
16 | redirectEndpoint:(NSURL*)redirectEndpoint
17 | scope:(NSString*)scope;
18 |
19 | @end
20 |
21 | @implementation UnityGoogleDriveIOS
22 |
23 | #pragma mark - singleton method
24 | + (UnityGoogleDriveIOS*)instance
25 | {
26 | static dispatch_once_t predicate = 0;
27 | __strong static id sharedObject = nil;
28 | dispatch_once(&predicate, ^{
29 | sharedObject = [[self alloc] init];
30 | });
31 | return sharedObject;
32 | }
33 |
34 | OIDAuthorizationService* service;
35 |
36 | - (void)performAuth:(NSURL*)authorizationEndpoint
37 | tokenEndpoint:(NSURL*)tokenEndpoint
38 | clientId:(NSString*)clientId
39 | redirectEndpoint:(NSURL*)redirectEndpoint
40 | scope:(NSString*)scope {
41 |
42 | OIDServiceConfiguration* configuration = [[OIDServiceConfiguration alloc]
43 | initWithAuthorizationEndpoint:authorizationEndpoint
44 | tokenEndpoint:tokenEndpoint];
45 |
46 | OIDAuthorizationRequest* request = [[OIDAuthorizationRequest alloc]
47 | initWithConfiguration:configuration
48 | clientId:clientId
49 | scopes:[scope componentsSeparatedByString:@" "]
50 | redirectURL:redirectEndpoint
51 | responseType:OIDResponseTypeCode
52 | additionalParameters:nil];
53 |
54 | service = [OIDAuthorizationService
55 | presentAuthorizationRequest:request
56 | presentingViewController:UnityGetGLViewController()
57 | callback:^(OIDAuthorizationResponse*_Nullable authorizationResponse, NSError*_Nullable error) {
58 | if (authorizationResponse) {
59 | NSString* response = [NSString stringWithFormat:@"%@ %@ %@",
60 | authorizationResponse.authorizationCode,
61 | authorizationResponse.request.codeVerifier,
62 | authorizationResponse.request.redirectURL.absoluteString];
63 | SendUnityMessage([response UTF8String]);
64 | } else {
65 | NSString* errorStr = [NSString stringWithFormat:@"Error: %@", [error localizedDescription]];
66 | SendUnityMessage([errorStr UTF8String]);
67 | }
68 | }];
69 | }
70 |
71 | @end
72 |
73 | extern "C" {
74 | void _UnityGoogleDriveIOS_PerformAuth(const char* authorizationEndpoint, const char* tokenEndpoint, const char* clientId, const char* redirectEndpoint, const char* scope);
75 | }
76 |
77 | void _UnityGoogleDriveIOS_PerformAuth(const char* authorizationEndpoint, const char* tokenEndpoint, const char* clientId, const char* redirectEndpoint, const char* scope)
78 | {
79 | [UnityGoogleDriveIOS.instance
80 | performAuth:[NSURL URLWithString:[[NSString stringWithUTF8String:authorizationEndpoint]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]
81 | tokenEndpoint:[NSURL URLWithString:[[NSString stringWithUTF8String:tokenEndpoint]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]
82 | clientId:[NSString stringWithUTF8String:clientId]
83 | redirectEndpoint:[NSURL URLWithString:[[NSString stringWithUTF8String:redirectEndpoint]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]
84 | scope:[NSString stringWithUTF8String:scope]];
85 | }
86 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Plugins/com.elringus.unitygoogledriveios.mm.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b87011963fdc6cc4bbedff19c3275394
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | isPreloaded: 0
9 | isOverridable: 0
10 | platformData:
11 | - first:
12 | Any:
13 | second:
14 | enabled: 0
15 | settings: {}
16 | - first:
17 | Editor: Editor
18 | second:
19 | enabled: 0
20 | settings:
21 | DefaultValueInitialized: true
22 | - first:
23 | iPhone: iOS
24 | second:
25 | enabled: 1
26 | settings: {}
27 | - first:
28 | tvOS: tvOS
29 | second:
30 | enabled: 1
31 | settings: {}
32 | userData:
33 | assetBundleName:
34 | assetBundleVariant:
35 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dcce716531c628c4889511c8197f2bf5
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 199d2f1692ba09b4a969dc9ad93f555f
3 | folderAsset: yes
4 | timeCreated: 1510150350
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b2e3012b9f0a00342a3bb721d9619986
3 | folderAsset: yes
4 | timeCreated: 1510328989
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/About.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// Information about the user, the user's Drive, and system capabilities.
8 | /// Prototype: https://developers.google.com/drive/v3/reference/about#resource-representations.
9 | ///
10 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
11 | public class About : ResourceData
12 | {
13 | ///
14 | /// The user's storage quota limits and usage. All fields are measured in bytes.
15 | ///
16 | public class StorageQuotaData
17 | {
18 | ///
19 | /// The usage limit, if applicable.
20 | /// This will not be present if the user has unlimited storage.
21 | ///
22 | public long? Limit { get; private set; }
23 | ///
24 | /// The total usage across all services.
25 | ///
26 | public long? Usage { get; private set; }
27 | ///
28 | /// The usage by all files in Google Drive.
29 | ///
30 | public long? UsageInDrive { get; private set; }
31 | ///
32 | /// The usage by trashed files in Google Drive.
33 | ///
34 | public long? UsageInDriveTrash { get; private set; }
35 | }
36 |
37 | public class TeamDriveThemesData
38 | {
39 | ///
40 | /// The ID of the theme.
41 | ///
42 | public string Id { get; private set; }
43 | ///
44 | /// A link to this Team Drive theme's background image.
45 | ///
46 | public string BackgroundImageLink { get; private set; }
47 | ///
48 | /// The color of this Team Drive theme as an RGB hex string.
49 | ///
50 | public string ColorRgb { get; private set; }
51 | }
52 |
53 | ///
54 | /// Identifies what kind of resource this is. Value: the fixed string "drive#about".
55 | ///
56 | public override string Kind => "drive#about";
57 | ///
58 | /// Whether the user has installed the requesting app.
59 | ///
60 | public bool? AppInstalled { get; private set; }
61 | ///
62 | /// A map of source MIME type to possible targets for all supported exports.
63 | ///
64 | public Dictionary> ExportFormats { get; private set; }
65 | ///
66 | /// The currently supported folder colors as RGB hex strings.
67 | ///
68 | public List FolderColorPalette { get; private set; }
69 | ///
70 | /// A map of source MIME type to possible targets for all supported imports.
71 | ///
72 | public Dictionary> ImportFormats { get; private set; }
73 | ///
74 | /// A map of maximum import sizes by MIME type, in bytes.
75 | ///
76 | public Dictionary MaxImportSizes { get; private set; }
77 | ///
78 | /// The maximum upload size in bytes.
79 | ///
80 | public long? MaxUploadSize { get; private set; }
81 | ///
82 | /// The user's storage quota limits and usage. All fields are measured in bytes.
83 | ///
84 | public StorageQuotaData StorageQuota { get; private set; }
85 | ///
86 | /// A list of themes that are supported for Team Drives.
87 | ///
88 | public List TeamDriveThemes { get; private set; }
89 | ///
90 | /// The authenticated user.
91 | ///
92 | public User User { get; private set; }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/About.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a5eb85816029ab40a7092fb2691e25a
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/AudioFile.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityGoogleDrive.Data
4 | {
5 | ///
6 | /// The metadata for an audio file stored in Google Drive.
7 | /// Unity-specific data to use with .
8 | ///
9 | public class AudioFile : File
10 | {
11 | [Newtonsoft.Json.JsonIgnore]
12 | public AudioClip AudioClip { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/AudioFile.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7114e1093029a7348b64f3c34334ab44
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/Change.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// A change to a file or Team Drive.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class Change : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#change".
14 | ///
15 | public override string Kind => "drive#change";
16 | ///
17 | /// The ID of the file which has changed.
18 | ///
19 | public string FileId { get; private set; }
20 | ///
21 | /// Whether the file or Team Drive has been removed from this list of changes,
22 | /// for example by deletion or loss of access.
23 | ///
24 | public bool? Removed { get; private set; }
25 | ///
26 | /// The time of this change (RFC 3339 date-time).
27 | ///
28 | public DateTime? Time { get; private set; }
29 | ///
30 | /// The updated state of the file. Present if the type is file and the file
31 | /// has not been removed from this list of changes.
32 | ///
33 | public File File { get; private set; }
34 | ///
35 | /// The type of the change. Possible values are file and teamDrive.
36 | ///
37 | public string Type { get; private set; }
38 | ///
39 | /// The ID of the Team Drive associated with this change.
40 | ///
41 | public string TeamDriveId { get; private set; }
42 | ///
43 | /// The updated state of the Team Drive. Present if the type is teamDrive,
44 | /// the user is still a member of the Team Drive, and the Team Drive has not been removed.
45 | ///
46 | public TeamDrive TeamDrive { get; private set; }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/Change.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a204368312e023c46b170c98c237d0a7
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/ChangeList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// A list of changes for a user.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class ChangeList : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#changeList".
14 | ///
15 | public override string Kind => "drive#changeList";
16 | ///
17 | /// The list of changes. If nextPageToken is populated, then this list may be incomplete
18 | /// and an additional page of results should be fetched.
19 | ///
20 | public List Changes { get; private set; }
21 | ///
22 | /// The starting page token for future changes. This will be present only if the
23 | /// end of the current changes list has been reached.
24 | ///
25 | public string NewStartPageToken { get; private set; }
26 | ///
27 | /// The page token for the next page of changes. This will be absent if the end of
28 | /// the changes list has been reached. If the token is rejected for any reason, it
29 | /// should be discarded, and pagination should be restarted from the first page of
30 | /// results.
31 | ///
32 | public string NextPageToken { get; private set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/ChangeList.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 618cca5ebaebafa4a9e10e5e6ec7c416
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/Channel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace UnityGoogleDrive.Data
4 | {
5 | ///
6 | /// A notification channel used to watch for resource changes.
7 | ///
8 | public class Channel : ResourceData
9 | {
10 | ///
11 | /// Identifies this as a notification channel used to watch for changes to a resource.
12 | /// Value: the fixed string "api#channel".
13 | ///
14 | public override string Kind => "api#channel";
15 | ///
16 | /// The address where notifications are delivered for this channel.
17 | ///
18 | public virtual string Address { get; set; }
19 | ///
20 | /// Date and time of notification channel expiration, expressed as a Unix timestamp,
21 | /// in milliseconds. Optional.
22 | ///
23 | public virtual long? Expiration { get; set; }
24 | ///
25 | /// A UUID or similar unique string that identifies this channel.
26 | ///
27 | public virtual string Id { get; set; }
28 | ///
29 | /// Additional parameters controlling delivery channel behavior. Optional.
30 | ///
31 | public virtual Dictionary Params { get; set; }
32 | ///
33 | /// A Boolean value to indicate whether payload is wanted. Optional.
34 | ///
35 | public virtual bool? Payload { get; set; }
36 | ///
37 | /// An opaque ID that identifies the resource being watched on this channel.
38 | /// Stable across different API versions.
39 | ///
40 | public virtual string ResourceId { get; set; }
41 | ///
42 | /// A version-specific identifier for the watched resource.
43 | ///
44 | public virtual string ResourceUri { get; set; }
45 | ///
46 | /// An arbitrary string delivered to the target address with each notification delivered
47 | /// over this channel. Optional.
48 | ///
49 | public virtual string Token { get; set; }
50 | ///
51 | /// The type of delivery mechanism used for this channel.
52 | ///
53 | public virtual string Type { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/Channel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d59876a977e1d60489aba2378754f4ac
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/File.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a41d17729c907c541b8311dd75c4481f
3 | timeCreated: 1510048898
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/FileList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// A list of files.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class FileList : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#fileList"
14 | ///
15 | public override string Kind => "drive#fileList";
16 | ///
17 | /// The list of files. If nextPageToken is populated, then this list may be incomplete
18 | /// and an additional page of results should be fetched.
19 | ///
20 | public List Files { get; private set; }
21 | ///
22 | /// Whether the search process was incomplete. If true, then some search results
23 | /// may be missing, since all documents were not searched. This may occur when searching
24 | /// multiple Team Drives with the "user,allTeamDrives" corpora, but all corpora could
25 | /// not be searched. When this happens, it is suggested that clients narrow their
26 | /// query by choosing a different corpus such as "user" or "teamDrive".
27 | ///
28 | public bool? IncompleteSearch { get; private set; }
29 | ///
30 | /// The page token for the next page of files. This will be absent if the end of
31 | /// the files list has been reached. If the token is rejected for any reason, it
32 | /// should be discarded, and pagination should be restarted from the first page of results.
33 | ///
34 | public string NextPageToken { get; private set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/FileList.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 01492d53a35692347a4b0fba7de3be51
3 | timeCreated: 1510328711
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/GeneratedIds.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// A list of generated file IDs which can be provided in create requests.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class GeneratedIds : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#generatedIds".
14 | ///
15 | public override string Kind => "drive#generatedIds";
16 | ///
17 | /// The IDs generated for the requesting user in the specified space.
18 | ///
19 | public List Ids { get; private set; }
20 | ///
21 | /// The type of file that can be created with these IDs.
22 | ///
23 | public string Space { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/GeneratedIds.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e919fdfe5d736504fb6cd328b0b8d588
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/Permission.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e0d22d717f8bc1948a231fc761c54887
3 | timeCreated: 1510062614
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/ResourceData.cs:
--------------------------------------------------------------------------------
1 | namespace UnityGoogleDrive.Data
2 | {
3 | ///
4 | /// Base class for a Google Drive resource data representation.
5 | ///
6 | public abstract class ResourceData
7 | {
8 | ///
9 | /// Identifies what kind of resource this is.
10 | ///
11 | public abstract string Kind { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/ResourceData.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b6354c24fd5887c4d90b782083fb4693
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/StartPageToken.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using UnityGoogleDrive.Newtonsoft.Json;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// The starting page token for listing changes.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class StartPageToken : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#startPageToken".
14 | ///
15 | public override string Kind => "drive#startPageToken";
16 | ///
17 | /// The value of the starting page token for listing changes.
18 | ///
19 | [JsonProperty("startPageToken")]
20 | public string StartPageTokenValue { get; private set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/StartPageToken.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b1d44dcc5d691e349a4bc23f52c6c911
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/TeamDrive.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 771004b2d29c7094a98d9770266f84cf
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/TeamDriveList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics.CodeAnalysis;
3 |
4 | namespace UnityGoogleDrive.Data
5 | {
6 | ///
7 | /// A list of Team Drives.
8 | ///
9 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
10 | public class TeamDriveList : ResourceData
11 | {
12 | ///
13 | /// Identifies what kind of resource this is. Value: the fixed string "drive#teamDriveList".
14 | ///
15 | public override string Kind => "drive#teamDriveList";
16 | ///
17 | /// The page token for the next page of Team Drives. This will be absent if the end
18 | /// of the Team Drives list has been reached. If the token is rejected for any reason,
19 | /// it should be discarded, and pagination should be restarted from the first page of results.
20 | ///
21 | public string NextPageToken { get; private set; }
22 | ///
23 | /// The list of Team Drives. If nextPageToken is populated, then this list may be
24 | /// incomplete and an additional page of results should be fetched.
25 | ///
26 | public List TeamDrives { get; private set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/TeamDriveList.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 923a2b8461f5afa44a943c78b8ccc8ca
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/TextureFile.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityGoogleDrive.Data
4 | {
5 | ///
6 | /// The metadata for a texture file stored in Google Drive.
7 | /// Unity-specific data to use with .
8 | ///
9 | public class TextureFile : File
10 | {
11 | [Newtonsoft.Json.JsonIgnore]
12 | public Texture2D Texture { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/TextureFile.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 22f97aa036ee66b4db8b4e7fb09ca303
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/User.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace UnityGoogleDrive.Data
4 | {
5 | ///
6 | /// Information about a Google Drive user.
7 | ///
8 | [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
9 | public class User : ResourceData
10 | {
11 | ///
12 | /// Identifies what kind of resource this is. Value: the fixed string "drive#user".
13 | ///
14 | public override string Kind => "drive#user";
15 | ///
16 | /// The user's ID as visible in Permission resources.
17 | ///
18 | public string PermissionId { get; private set; }
19 | ///
20 | /// A plain text displayable name for this user.
21 | ///
22 | public string DisplayName { get; private set; }
23 | ///
24 | /// The email address of the user. This may not be present in certain contexts if
25 | /// the user has not made their email address visible to the requester.
26 | ///
27 | public string EmailAddress { get; private set; }
28 | ///
29 | /// Whether this user is the requesting user.
30 | ///
31 | public bool? Me { get; private set; }
32 | ///
33 | /// A link to the user's profile photo, if available.
34 | ///
35 | public string PhotoLink { get; private set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/Data/User.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7e9b682ae7c92347949f4538ba6e33c
3 | timeCreated: 1510062602
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/GoogleDriveAbout.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.Networking;
2 |
3 | namespace UnityGoogleDrive
4 | {
5 | ///
6 | /// The resource collection of methods.
7 | /// Prototype: https://developers.google.com/drive/v3/reference/about.
8 | ///
9 | public static class GoogleDriveAbout
10 | {
11 | ///
12 | /// Gets information about the user, the user's Drive, and system capabilities.
13 | ///
14 | public class GetRequest : GoogleDriveRequest
15 | {
16 | public GetRequest ()
17 | : base("https://www.googleapis.com/drive/v3/about", UnityWebRequest.kHttpVerbGET) { }
18 | }
19 |
20 | ///
21 | /// Gets information about the user, the user's Drive, and system capabilities.
22 | ///
23 | public static GetRequest Get ()
24 | {
25 | return new GetRequest();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/GoogleDriveAbout.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5fc65c3dbda7c5c4b975ffecddd44fc0
3 | timeCreated: 1510331185
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/GoogleDriveChanges.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9680d06451848ad43a2f09d477846231
3 | timeCreated: 1510331185
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/GoogleDriveFiles.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7697812929677245a6d51104620cc9e
3 | timeCreated: 1510331185
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/API/GoogleDriveTeamDrives.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2d27d96f20f79014ba501e3a5af14b1c
3 | timeCreated: 1510331185
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a2704432671367429cf1421f676cdce
3 | folderAsset: yes
4 | timeCreated: 1510001970
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AccessTokenRefresher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.Networking;
4 |
5 | namespace UnityGoogleDrive
6 | {
7 | ///
8 | /// Issues a new access token using provided refresh token.
9 | /// Protocol: https://developers.google.com/identity/protocols/OAuth2WebServer#offline.
10 | ///
11 | public class AccessTokenRefresher
12 | {
13 | #pragma warning disable 0649
14 | // ReSharper disable NotAccessedField.Local
15 | [Serializable] private struct RefreshResponse { public string error, error_description, access_token, expires_in, token_type; }
16 | // ReSharper restore NotAccessedField.Local
17 | #pragma warning restore 0649
18 |
19 | public event Action OnDone;
20 |
21 | public bool IsDone { get; private set; }
22 | public bool IsError { get; private set; }
23 | public string Error { get; } = "";
24 | public string AccessToken { get; private set; }
25 |
26 | private readonly IClientCredentials credentials;
27 | private UnityWebRequest refreshRequest;
28 |
29 | public AccessTokenRefresher (IClientCredentials clientCredentials)
30 | {
31 | credentials = clientCredentials;
32 | }
33 |
34 | public void RefreshAccessToken (string refreshToken)
35 | {
36 | var refreshRequestForm = new WWWForm();
37 | refreshRequestForm.AddField("client_id", credentials.ClientId);
38 | if (!string.IsNullOrEmpty(credentials.ClientSecret))
39 | refreshRequestForm.AddField("client_secret", credentials.ClientSecret);
40 | refreshRequestForm.AddField("refresh_token", refreshToken);
41 | refreshRequestForm.AddField("grant_type", "refresh_token");
42 |
43 | refreshRequest = UnityWebRequest.Post(credentials.TokenUri, refreshRequestForm);
44 | refreshRequest.SetRequestHeader("Content-Type", GoogleDriveSettings.RequestContentType);
45 | refreshRequest.SetRequestHeader("Accept", "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
46 | refreshRequest.SendWebRequest().completed += HandleRequestComplete;
47 | }
48 |
49 | private void HandleRefreshComplete (bool error = false)
50 | {
51 | IsError = error;
52 | IsDone = true;
53 | OnDone?.Invoke(this);
54 | }
55 |
56 | private void HandleRequestComplete (AsyncOperation requestYield)
57 | {
58 | if (CheckRequestErrors(refreshRequest))
59 | {
60 | HandleRefreshComplete(true);
61 | return;
62 | }
63 |
64 | var response = JsonUtility.FromJson(refreshRequest.downloadHandler.text);
65 | AccessToken = response.access_token;
66 | HandleRefreshComplete();
67 | }
68 |
69 | private static bool CheckRequestErrors (UnityWebRequest request)
70 | {
71 | if (request == null)
72 | {
73 | Debug.LogError("UnityGoogleDrive: Refresh token request failed. Request object is null.");
74 | return true;
75 | }
76 |
77 | var errorDescription = string.Empty;
78 |
79 | if (!string.IsNullOrEmpty(request.error))
80 | errorDescription += " HTTP Error: " + request.error;
81 |
82 | if (request.downloadHandler != null && !string.IsNullOrEmpty(request.downloadHandler.text))
83 | {
84 | var response = JsonUtility.FromJson(request.downloadHandler.text);
85 | if (!string.IsNullOrEmpty(response.error))
86 | errorDescription += " API Error: " + response.error + " API Error Description: " + response.error_description;
87 | }
88 |
89 | var isError = errorDescription.Length > 0;
90 | if (isError) Debug.LogError("UnityGoogleDrive: Refresh token code request failed." + errorDescription);
91 | return isError;
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AccessTokenRefresher.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e181510717252a4f956ea44e3b28d15
3 | timeCreated: 1509823007
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AndroidAccessTokenProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7abcfba85634c9c498884bf7563c13fc
3 | timeCreated: 1509728429
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AuthCodeExchanger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.Networking;
4 |
5 | namespace UnityGoogleDrive
6 | {
7 | ///
8 | /// Retrieves access and refresh tokens using provided authorization code.
9 | /// Protocol: https://developers.google.com/identity/protocols/OAuth2WebServer#exchange-authorization-code.
10 | ///
11 | public class AuthCodeExchanger
12 | {
13 | #pragma warning disable 0649
14 | // ReSharper disable NotAccessedField.Local
15 | [Serializable] private struct ExchangeResponse { public string error, error_description, access_token, refresh_token, expires_in, id_token, token_type; }
16 | // ReSharper restore NotAccessedField.Local
17 | #pragma warning restore 0649
18 |
19 | public event Action OnDone;
20 |
21 | public bool IsDone { get; private set; }
22 | public bool IsError { get; private set; }
23 | public string AccessToken { get; private set; }
24 | public string RefreshToken { get; private set; }
25 |
26 | private readonly GoogleDriveSettings settings;
27 | private readonly IClientCredentials credentials;
28 | private UnityWebRequest exchangeRequest;
29 |
30 | public AuthCodeExchanger (GoogleDriveSettings googleDriveSettings, IClientCredentials clientCredentials)
31 | {
32 | settings = googleDriveSettings;
33 | credentials = clientCredentials;
34 | }
35 |
36 | public void ExchangeAuthCode (string authorizationCode, string codeVerifier, string redirectUri)
37 | {
38 | var tokenRequestForm = new WWWForm();
39 | tokenRequestForm.AddField("code", authorizationCode);
40 | tokenRequestForm.AddField("redirect_uri", redirectUri);
41 | tokenRequestForm.AddField("client_id", credentials.ClientId);
42 | tokenRequestForm.AddField("code_verifier", codeVerifier);
43 | if (!string.IsNullOrEmpty(credentials.ClientSecret))
44 | tokenRequestForm.AddField("client_secret", credentials.ClientSecret);
45 | tokenRequestForm.AddField("scope", settings.AccessScope);
46 | tokenRequestForm.AddField("grant_type", "authorization_code");
47 |
48 | exchangeRequest = UnityWebRequest.Post(credentials.TokenUri, tokenRequestForm);
49 | exchangeRequest.SetRequestHeader("Content-Type", GoogleDriveSettings.RequestContentType);
50 | exchangeRequest.SetRequestHeader("Accept", "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
51 | exchangeRequest.SendWebRequest().completed += HandleRequestComplete;
52 | }
53 |
54 | private void HandleExchangeComplete (bool error = false)
55 | {
56 | IsError = error;
57 | IsDone = true;
58 | OnDone?.Invoke(this);
59 | }
60 |
61 | private void HandleRequestComplete (AsyncOperation requestYield)
62 | {
63 | if (CheckRequestErrors(exchangeRequest))
64 | {
65 | HandleExchangeComplete(true);
66 | return;
67 | }
68 |
69 | var response = JsonUtility.FromJson(exchangeRequest.downloadHandler.text);
70 | AccessToken = response.access_token;
71 | RefreshToken = response.refresh_token;
72 | HandleExchangeComplete();
73 | }
74 |
75 | private static bool CheckRequestErrors (UnityWebRequest request)
76 | {
77 | if (request == null)
78 | {
79 | Debug.LogError("UnityGoogleDrive: Exchange auth code request failed. Request object is null.");
80 | return true;
81 | }
82 |
83 | var errorDescription = string.Empty;
84 |
85 | if (!string.IsNullOrEmpty(request.error))
86 | errorDescription += " HTTP Error: " + request.error;
87 |
88 | if (request.downloadHandler != null && !string.IsNullOrEmpty(request.downloadHandler.text))
89 | {
90 | var response = JsonUtility.FromJson(request.downloadHandler.text);
91 | if (!string.IsNullOrEmpty(response.error))
92 | errorDescription += " API Error: " + response.error + " API Error Description: " + response.error_description;
93 | }
94 |
95 | var isError = errorDescription.Length > 0;
96 | if (isError) Debug.LogError("UnityGoogleDrive: Exchange auth code request failed." + errorDescription);
97 | return isError;
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AuthCodeExchanger.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f1044f1f0331d4e479db838d3e16903c
3 | timeCreated: 1509823007
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AuthController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace UnityGoogleDrive
5 | {
6 | ///
7 | /// Controls authorization procedures and provides token to access Google APIs.
8 | /// Implementation based on Google OAuth 2.0 protocol: https://developers.google.com/identity/protocols/OAuth2.
9 | ///
10 | public static class AuthController
11 | {
12 | ///
13 | /// Invoked when has been refreshed.
14 | /// Return false on authorization fail.
15 | ///
16 | public static event Action OnAccessTokenRefreshed;
17 |
18 | public static string AccessToken => settings.CachedAccessToken;
19 | public static bool IsRefreshingAccessToken { get; private set; }
20 |
21 | private static readonly GoogleDriveSettings settings;
22 | private static readonly IAccessTokenProvider accessTokenProvider;
23 |
24 | static AuthController ()
25 | {
26 | settings = GoogleDriveSettings.LoadFromResources();
27 |
28 | #if UNITY_WEBGL && !UNITY_EDITOR // WebGL doesn't support loopback method; using redirection scheme instead.
29 | accessTokenProvider = new RedirectAccessTokenProvider(settings);
30 | #elif UNITY_ANDROID && !UNITY_EDITOR // On Android a native OpenID lib is used for better UX.
31 | accessTokenProvider = new AndroidAccessTokenProvider(settings);
32 | #elif UNITY_IOS && !UNITY_EDITOR // On iOS a native OpenID lib is used for better UX.
33 | accessTokenProvider = new IOSAccessTokenProvider(settings);
34 | #else // Loopback scheme is used on other platforms.
35 | accessTokenProvider = new LoopbackAccessTokenProvider(settings);
36 | #endif
37 | }
38 |
39 | public static void RefreshAccessToken ()
40 | {
41 | if (IsRefreshingAccessToken) return;
42 | IsRefreshingAccessToken = true;
43 |
44 | accessTokenProvider.OnDone += HandleAccessTokenProviderDone;
45 | accessTokenProvider.ProvideAccessToken();
46 | }
47 |
48 | public static void CancelAuth ()
49 | {
50 | if (IsRefreshingAccessToken)
51 | HandleAccessTokenProviderDone(accessTokenProvider);
52 | }
53 |
54 | private static void HandleAccessTokenProviderDone (IAccessTokenProvider provider)
55 | {
56 | accessTokenProvider.OnDone -= HandleAccessTokenProviderDone;
57 |
58 | var authFailed = !provider.IsDone || provider.IsError;
59 |
60 | if (authFailed)
61 | Debug.LogError("UnityGoogleDrive: Failed to execute authorization procedure. Check application settings and credentials.");
62 |
63 | IsRefreshingAccessToken = false;
64 |
65 | OnAccessTokenRefreshed?.Invoke(!authFailed);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/AuthController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 51033dafe7b0bad4db5dd74020db7b42
3 | timeCreated: 1509825522
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/GenericClientCredentials.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 |
4 | namespace UnityGoogleDrive
5 | {
6 | [System.Serializable]
7 | public class GenericClientCredentials : IClientCredentials
8 | {
9 | public string ClientId => client_id;
10 | public string ProjectId => project_id;
11 | public string AuthUri => auth_uri;
12 | public string TokenUri => token_uri;
13 | public string AuthProviderX509CertUrl => auth_provider_x509_cert_url;
14 | public string ClientSecret => client_secret;
15 | public List RedirectUris => redirect_uris;
16 |
17 | [SerializeField] private string client_id;
18 | [SerializeField] private string project_id;
19 | [SerializeField] private string auth_uri;
20 | [SerializeField] private string token_uri;
21 | [SerializeField] private string auth_provider_x509_cert_url;
22 | [SerializeField] private string client_secret;
23 | [SerializeField] private List redirect_uris;
24 |
25 | public static GenericClientCredentials FromJson (string json)
26 | {
27 | return JsonUtility.FromJson(json);
28 | }
29 |
30 | public void OverwriteFromJson (string json)
31 | {
32 | JsonUtility.FromJsonOverwrite(json, this);
33 | }
34 |
35 | public string ToJson (bool prettyPrint = false)
36 | {
37 | return JsonUtility.ToJson(this, prettyPrint);
38 | }
39 |
40 | public bool ContainsSensitiveData ()
41 | {
42 | return !string.IsNullOrEmpty(ClientId + ProjectId + ClientSecret);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/GenericClientCredentials.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 81cc6562e18b9f546aef68b07ce0465c
3 | timeCreated: 1509365098
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/IAccessTokenProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace UnityGoogleDrive
4 | {
5 | ///
6 | /// Implementation is able to retrieve access token.
7 | ///
8 | public interface IAccessTokenProvider
9 | {
10 | event Action OnDone;
11 |
12 | bool IsDone { get; }
13 | bool IsError { get; }
14 |
15 | void ProvideAccessToken ();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/IAccessTokenProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d9f6b95252f03d4499e45cf7abc82fdd
3 | timeCreated: 1509741148
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/IClientCredentials.cs:
--------------------------------------------------------------------------------
1 | namespace UnityGoogleDrive
2 | {
3 | public interface IClientCredentials
4 | {
5 | string AuthUri { get; }
6 | string TokenUri { get; }
7 | string ClientId { get; }
8 | string ClientSecret { get; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/IClientCredentials.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9e3f49480de66784ebbc1e01d2f9cf6e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/IOSAccessTokenProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 52324d87e8bce6d45879efff9d9ee969
3 | timeCreated: 1509728429
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/LoopbackAccessTokenProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aebd5b70d84513b4a9ccba6ec28da756
3 | timeCreated: 1509728429
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/RedirectAccessTokenProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using UnityEngine;
4 |
5 | namespace UnityGoogleDrive
6 | {
7 | ///
8 | /// Provides access token extracting it from the redirection url (when running in web).
9 | /// Protocol: https://developers.google.com/identity/protocols/OAuth2UserAgent.
10 | ///
11 | public class RedirectAccessTokenProvider : IAccessTokenProvider
12 | {
13 | public event Action OnDone;
14 |
15 | public bool IsDone { get; private set; }
16 | public bool IsError { get; private set; }
17 |
18 | private const string tokenArgName = "access_token";
19 |
20 | private readonly GoogleDriveSettings settings;
21 |
22 | public RedirectAccessTokenProvider (GoogleDriveSettings googleDriveSettings)
23 | {
24 | settings = googleDriveSettings;
25 | }
26 |
27 | public void ProvideAccessToken ()
28 | {
29 | if (!settings.GenericClientCredentials.ContainsSensitiveData())
30 | {
31 | HandleProvideAccessTokenComplete(true);
32 | return;
33 | }
34 |
35 | var accessToken = ExtractAccessTokenFromApplicationUrl();
36 | if (string.IsNullOrEmpty(accessToken)) // Access token isn't available; retrieve it.
37 | {
38 | var authRequest = string.Format("{0}?response_type=token&scope={1}&redirect_uri={2}&client_id={3}",
39 | settings.GenericClientCredentials.AuthUri,
40 | settings.AccessScope,
41 | Uri.EscapeDataString(Application.absoluteURL),
42 | settings.GenericClientCredentials.ClientId);
43 |
44 | Application.OpenURL(authRequest);
45 | }
46 | else // Access token is already injected to the URL; using it.
47 | {
48 | settings.CachedAccessToken = accessToken;
49 | HandleProvideAccessTokenComplete();
50 | }
51 | }
52 |
53 | private void HandleProvideAccessTokenComplete (bool error = false)
54 | {
55 | IsError = error;
56 | IsDone = true;
57 | OnDone?.Invoke(this);
58 | }
59 |
60 | private string ExtractAccessTokenFromApplicationUrl ()
61 | {
62 | var applicationUrl = Application.absoluteURL;
63 |
64 | if (!applicationUrl.Contains(tokenArgName))
65 | return null;
66 |
67 | var arguments = applicationUrl.Substring(applicationUrl.IndexOf(tokenArgName, StringComparison.Ordinal)).Split('&')
68 | .Select(q => q.Split('=')).ToDictionary(q => q.FirstOrDefault(), q => q.Skip(1).FirstOrDefault());
69 |
70 | if (!arguments.ContainsKey(tokenArgName)) return null;
71 | return arguments[tokenArgName];
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/RedirectAccessTokenProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4e36bb4ed985ff4b814498fecc3c10d
3 | timeCreated: 1509728429
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/UriSchemeClientCredentials.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Xml;
4 | using UnityEngine;
5 |
6 | namespace UnityGoogleDrive
7 | {
8 | [System.Serializable]
9 | public class UriSchemeClientCredentials : IClientCredentials
10 | {
11 | public string AuthUri => "https://accounts.google.com/o/oauth2/v2/auth";
12 | public string TokenUri => "https://accounts.google.com/o/oauth2/token";
13 | public string ClientId => clientId;
14 | public string ClientSecret => null; // Client secret is not required in custom URI scheme.
15 | public string ReversedClientId => reversedClientId;
16 | public string PlistVersion => plistVersion;
17 | public string BundleId => bundleId;
18 |
19 | [SerializeField] private string clientId;
20 | [SerializeField] private string reversedClientId;
21 | [SerializeField] private string plistVersion;
22 | [SerializeField] private string bundleId;
23 |
24 | public void OverwriteFromXml (string xmlString)
25 | {
26 | var xml = new XmlDocument();
27 | xml.XmlResolver = null;
28 | using (TextReader reader = new StringReader(xmlString))
29 | xml.Load(reader);
30 | var rootNode = xml.DocumentElement?.ChildNodes[0];
31 | var dict = ParsePlistDictionary(rootNode);
32 |
33 | clientId = dict["CLIENT_ID"];
34 | reversedClientId = dict["REVERSED_CLIENT_ID"];
35 | plistVersion = dict["PLIST_VERSION"];
36 | bundleId = dict["BUNDLE_ID"];
37 | }
38 |
39 | public bool ContainsSensitiveData ()
40 | {
41 | return !string.IsNullOrEmpty(ClientId + ReversedClientId + BundleId);
42 | }
43 |
44 | private static Dictionary ParsePlistDictionary (XmlNode node)
45 | {
46 | var children = node.ChildNodes;
47 | if (children.Count % 2 != 0)
48 | {
49 | Debug.LogError("Dictionary elements must have an even number of child nodes");
50 | return null;
51 | }
52 |
53 | var dict = new Dictionary();
54 | for (int i = 0; i < children.Count; i += 2)
55 | {
56 | var keyNode = children[i];
57 | var valueNode = children[i + 1];
58 | if (keyNode.Name != "key")
59 | {
60 | Debug.LogError("Expected a key node.");
61 | return null;
62 | }
63 | dict.Add(keyNode.InnerText, valueNode.InnerText);
64 | }
65 |
66 | return dict;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Authorization/UriSchemeClientCredentials.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc8adf351bad1d245906b0582e165a0a
3 | timeCreated: 1509365098
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Elringus.UnityGoogleDrive.Runtime.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Elringus.UnityGoogleDrive.Runtime",
3 | "references": [],
4 | "includePlatforms": [],
5 | "excludePlatforms": [],
6 | "allowUnsafeCode": false,
7 | "overrideReferences": true,
8 | "precompiledReferences": [
9 | "UnityGoogleDrive.Newtonsoft.Json.dll"
10 | ],
11 | "autoReferenced": true,
12 | "defineConstraints": [],
13 | "versionDefines": [],
14 | "noEngineReferences": false
15 | }
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Elringus.UnityGoogleDrive.Runtime.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26c3782e36cc1874587ef07692accab2
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveRequest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ad613a1202f052e47a16d1c394bd1e92
3 | timeCreated: 1509456967
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveRequestYieldInstruction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace UnityGoogleDrive
5 | {
6 | public abstract class GoogleDriveRequestYieldInstruction : CustomYieldInstruction
7 | {
8 | public event Action OnDoneNonGeneric;
9 | public abstract bool IsDone { get; }
10 |
11 | protected void InvokeOnDoneNonGeneric ()
12 | {
13 | OnDoneNonGeneric?.Invoke();
14 | }
15 | }
16 |
17 | ///
18 | /// Yield instruction to suspend coroutines while is running.
19 | ///
20 | /// Type of the response data of the request the instruction is serving for.
21 | public class GoogleDriveRequestYieldInstruction : GoogleDriveRequestYieldInstruction
22 | {
23 | ///
24 | /// Event invoked when corresponding request is done running.
25 | /// Make sure to check for before using the response data.
26 | ///
27 | public event Action OnDone;
28 |
29 | public override bool IsDone => GoogleDriveRequest.IsDone;
30 | public override bool keepWaiting => !IsDone;
31 | public float Progress => GoogleDriveRequest.Progress;
32 | public GoogleDriveRequest GoogleDriveRequest { get; private set; }
33 |
34 | public GoogleDriveRequestYieldInstruction (GoogleDriveRequest googleDriveRequest)
35 | {
36 | GoogleDriveRequest = googleDriveRequest;
37 | GoogleDriveRequest.OnDone += HandleRequestDone;
38 | }
39 |
40 | private void HandleRequestDone (TResponse responseData)
41 | {
42 | GoogleDriveRequest.OnDone -= HandleRequestDone;
43 | OnDone?.Invoke(responseData);
44 | InvokeOnDoneNonGeneric();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveRequestYieldInstruction.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fe301b64a0da4714f9d90bbc45fb590f
3 | timeCreated: 1509461386
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveResponseError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace UnityGoogleDrive
6 | {
7 | [Serializable]
8 | public class GoogleDriveResponseError
9 | {
10 | [Serializable]
11 | public class ErrorDescription
12 | {
13 | public List Errors => errors;
14 | public int Code => code;
15 | public string Message => message;
16 |
17 | [SerializeField] private List errors = new List();
18 | [SerializeField] private int code;
19 | [SerializeField] private string message;
20 |
21 | public override string ToString ()
22 | {
23 | var output = $"Google Drive API Error Description: Code '{Code}' Message: '{Message}'";
24 | foreach (var error in Errors)
25 | output += Environment.NewLine + " - " + error;
26 | return output;
27 | }
28 | }
29 |
30 | [Serializable]
31 | public class ErrorDefinition
32 | {
33 | public string Domain => domain;
34 | public string Reason => reason;
35 | public string Message => message;
36 | public string LocationType => locationType;
37 | public string Location => location;
38 |
39 | [SerializeField] private string domain;
40 | [SerializeField] private string reason;
41 | [SerializeField] private string message;
42 | [SerializeField] private string locationType;
43 | [SerializeField] private string location;
44 |
45 | public override string ToString ()
46 | {
47 | return $"Domain: '{Domain}' Reason: '{Reason}' Message: '{Message}' LocationType: '{LocationType}' Location: '{Location}'";
48 | }
49 | }
50 |
51 | public bool IsError => Error != null && Error.Code != 0;
52 | public ErrorDescription Error => error;
53 |
54 | [SerializeField] private ErrorDescription error;
55 |
56 | public override string ToString ()
57 | {
58 | if (!IsError) return null;
59 | return Error.ToString();
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveResponseError.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 66b49ab270fff224ea237449b87262c9
3 | timeCreated: 1510247533
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveResumableUploadRequest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: acded5ab62dc60b42a64e246ca5a77b1
3 | timeCreated: 1509456967
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveSettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1eca7773dbc7f5b47878b382f321f62e
3 | timeCreated: 1509365098
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveUploadRequest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text;
3 | using UnityEngine.Networking;
4 |
5 | namespace UnityGoogleDrive
6 | {
7 | ///
8 | /// A request intended to communicate with the Google Drive API.
9 | /// Allows uploading a and (optionally) raw payload data.
10 | ///
11 | /// Type of the uploaded data.
12 | /// Type of the response data.
13 | public class GoogleDriveUploadRequest : GoogleDriveRequest where TRequest : Data.ResourceData
14 | {
15 | ///
16 | /// The uploaded meta data of the request.
17 | ///
18 | public TRequest RequestData { get; protected set; }
19 | ///
20 | /// The uploaded raw payload data of the request.
21 | ///
22 | public byte[] RequestPayload { get; protected set; }
23 | ///
24 | /// MIME type of the .
25 | ///
26 | public string PayloadMimeType { get; protected set; }
27 | ///
28 | /// Whether the request has .
29 | ///
30 | public bool HasPayload => RequestPayload != null;
31 | ///
32 | /// Progress of the data upload, in 0.0 to 1.0 range.
33 | ///
34 | public override float Progress => WebRequest?.uploadProgress ?? 0;
35 |
36 | ///
37 | /// The type of upload request to the /upload URI. Acceptable values are:
38 | /// - media - Simple upload. Upload the media only, without any metadata.
39 | /// - multipart - Multipart upload. Upload both the media and its metadata, in a single request.
40 | /// - resumable - Resumable upload. Upload the file in a resumable fashion.
41 | ///
42 | [QueryParameter] public virtual string UploadType => HasPayload ? "multipart" : null;
43 |
44 | private const string RequestContentType = "application/json; charset=UTF-8";
45 | private const string DefaultMimeType = "application/octet-stream";
46 |
47 | public GoogleDriveUploadRequest (string uri, string method, TRequest requestData,
48 | byte[] requestPayload = null, string payloadMimeType = null) : base(uri, method)
49 | {
50 | RequestData = requestData;
51 | if (requestPayload != null)
52 | {
53 | RequestPayload = requestPayload;
54 | PayloadMimeType = string.IsNullOrEmpty(payloadMimeType) ? DefaultMimeType : payloadMimeType;
55 | }
56 | }
57 |
58 | protected override UnityWebRequest CreateWebRequest ()
59 | {
60 | var webRequest = base.CreateWebRequest();
61 | return HasPayload ? CreateMultipartUpload(webRequest) : CreateSimpleUpload(webRequest);
62 | }
63 |
64 | protected UnityWebRequest CreateMultipartUpload (UnityWebRequest webRequest)
65 | {
66 | // Can't use MultipartFormDataSection utils to build multipart body,
67 | // because Google has added strict requirements for the body format.
68 | // Issue: https://github.com/Elringus/UnityGoogleDrive/issues/30).
69 |
70 | var newLine = "\r\n";
71 | var newLineDouble = newLine + newLine;
72 | var boundary = Encoding.ASCII.GetString(UnityWebRequest.GenerateBoundary());
73 | var boundaryDelimiter = newLineDouble + "--" + boundary;
74 |
75 | var dataList = new List();
76 | dataList.AddRange(Encoding.UTF8.GetBytes(
77 | boundaryDelimiter +
78 | newLine + "Content-Type: " + RequestContentType +
79 | newLineDouble + JsonUtils.ToJsonPrivateCamel(RequestData) +
80 | boundaryDelimiter +
81 | newLine + "Content-Type: " + DefaultMimeType +
82 | newLineDouble));
83 | dataList.AddRange(RequestPayload);
84 | dataList.AddRange(Encoding.UTF8.GetBytes(newLine + "--" + boundary + "--"));
85 |
86 | webRequest.uploadHandler = new UploadHandlerRaw(dataList.ToArray());
87 | webRequest.SetRequestHeader("Content-Type", string.Concat("multipart/related; boundary=", boundary));
88 |
89 | return webRequest;
90 | }
91 |
92 | protected UnityWebRequest CreateSimpleUpload (UnityWebRequest webRequest)
93 | {
94 | var requestJson = JsonUtils.ToJsonPrivateCamel(RequestData);
95 | var requestData = Encoding.UTF8.GetBytes(requestJson);
96 | webRequest.uploadHandler = new UploadHandlerRaw(requestData);
97 | webRequest.SetRequestHeader("Content-Type", RequestContentType);
98 | return webRequest;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/GoogleDriveUploadRequest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18ea7d9092110464eaf9d7a3e18562b0
3 | timeCreated: 1509456967
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Utilities.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d363fa7283c5314fbc8b31fb30ac7ab
3 | folderAsset: yes
4 | timeCreated: 1510143343
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/UnityGoogleDrive/Runtime/Utilities/AsyncExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 | using System.Threading.Tasks;
3 |
4 | namespace UnityGoogleDrive
5 | {
6 | public static class AsyncExtensions
7 | {
8 | ///
9 | /// Allows awaiting objects in async methods.
10 | ///
11 | public static TaskAwaiter GetAwaiter (this GoogleDriveRequestYieldInstruction yieldInstruction)
12 | {
13 | var taskCompletionSource = new TaskCompletionSource();
14 | if (yieldInstruction.GoogleDriveRequest.IsDone) taskCompletionSource.SetResult(yieldInstruction.GoogleDriveRequest.ResponseData);
15 | else yieldInstruction.OnDone += responseData => taskCompletionSource.SetResult(responseData);
16 | return taskCompletionSource.Task.GetAwaiter();
17 | }
18 |
19 | public static TaskAwaiter GetAwaiter (this GoogleDriveRequestYieldInstruction yieldInstruction)
20 | {
21 | var taskCompletionSource = new TaskCompletionSource