diff --git a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/NonFreeSyncProviderInfoFactory.kt b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/NonFreeSyncProviderInfoFactory.kt index 52277e425..9af4a0bd5 100644 --- a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/NonFreeSyncProviderInfoFactory.kt +++ b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/NonFreeSyncProviderInfoFactory.kt @@ -4,6 +4,7 @@ import android.app.Activity import android.content.Context import android.content.Intent import android.content.SharedPreferences +import org.mariotaku.twidere.BuildConfig import org.mariotaku.twidere.R import org.mariotaku.twidere.activity.sync.DropboxAuthStarterActivity import org.mariotaku.twidere.activity.sync.GoogleDriveAuthActivity @@ -11,6 +12,7 @@ import org.mariotaku.twidere.model.sync.DropboxSyncProviderInfo import org.mariotaku.twidere.model.sync.GoogleDriveSyncProviderInfo import org.mariotaku.twidere.model.sync.SyncProviderEntry import org.mariotaku.twidere.model.sync.SyncProviderInfo +import java.util.* /** * Created by mariotaku on 2017/1/2. @@ -26,14 +28,16 @@ class NonFreeSyncProviderInfoFactory : SyncProviderInfoFactory() { } override fun getSupportedProviders(context: Context): List { - return listOf( - SyncProviderEntry(DropboxSyncProviderInfo.TYPE, - context.getString(R.string.sync_provider_name_dropbox), - Intent(context, DropboxAuthStarterActivity::class.java)), - SyncProviderEntry(GoogleDriveSyncProviderInfo.TYPE, - context.getString(R.string.sync_provider_name_google_drive), - Intent(context, GoogleDriveAuthActivity::class.java)) - ) + val list = ArrayList() + list.add(SyncProviderEntry(DropboxSyncProviderInfo.TYPE, + context.getString(R.string.sync_provider_name_dropbox), + Intent(context, DropboxAuthStarterActivity::class.java))) + if (BuildConfig.DEBUG) { + list.add(SyncProviderEntry(GoogleDriveSyncProviderInfo.TYPE, + context.getString(R.string.sync_provider_name_google_drive), + Intent(context, GoogleDriveAuthActivity::class.java))) + } + return list } } diff --git a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveDraftsSyncAction.kt b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveDraftsSyncAction.kt index 5b1288d14..cec277a1d 100644 --- a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveDraftsSyncAction.kt +++ b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveDraftsSyncAction.kt @@ -20,9 +20,9 @@ class GoogleDriveDraftsSyncAction( try { val filename = "/Drafts/$filename" val modifiedTime = DateTime(timestamp) - val create = drive.files().create(File().setName(filename).setModifiedTime(modifiedTime)) + val create = drive.files().create(File().setOriginalFilename(filename).setModifiedTime(modifiedTime)) val file = create.execute() - return DriveFileInfo(file.id, file.originalFilename, Date()) + return DriveFileInfo(file.id, file.originalFilename, Date(timestamp)) } catch (e: Exception) { throw IOException(e) } diff --git a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveSyncTaskRunner.kt b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveSyncTaskRunner.kt index 0b702ba14..f7b8fd2dc 100644 --- a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveSyncTaskRunner.kt +++ b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/google/GoogleDriveSyncTaskRunner.kt @@ -27,6 +27,8 @@ class GoogleDriveSyncTaskRunner(context: Context, val accessToken: String) : Syn else -> null } ?: return false task { + val about = drive.about().get().execute() + println(about) syncAction.execute() }.successUi { callback(true)