disabled google drive for release builds

This commit is contained in:
Mariotaku Lee 2017-01-20 18:04:06 +08:00
parent 48d37e9d32
commit 70b5eb2f0f
No known key found for this signature in database
GPG Key ID: 9C0706AE47FCE2AD
3 changed files with 16 additions and 10 deletions

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import org.mariotaku.twidere.BuildConfig
import org.mariotaku.twidere.R import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.sync.DropboxAuthStarterActivity import org.mariotaku.twidere.activity.sync.DropboxAuthStarterActivity
import org.mariotaku.twidere.activity.sync.GoogleDriveAuthActivity 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.GoogleDriveSyncProviderInfo
import org.mariotaku.twidere.model.sync.SyncProviderEntry import org.mariotaku.twidere.model.sync.SyncProviderEntry
import org.mariotaku.twidere.model.sync.SyncProviderInfo import org.mariotaku.twidere.model.sync.SyncProviderInfo
import java.util.*
/** /**
* Created by mariotaku on 2017/1/2. * Created by mariotaku on 2017/1/2.
@ -26,14 +28,16 @@ class NonFreeSyncProviderInfoFactory : SyncProviderInfoFactory() {
} }
override fun getSupportedProviders(context: Context): List<SyncProviderEntry> { override fun getSupportedProviders(context: Context): List<SyncProviderEntry> {
return listOf( val list = ArrayList<SyncProviderEntry>()
SyncProviderEntry(DropboxSyncProviderInfo.TYPE, list.add(SyncProviderEntry(DropboxSyncProviderInfo.TYPE,
context.getString(R.string.sync_provider_name_dropbox), context.getString(R.string.sync_provider_name_dropbox),
Intent(context, DropboxAuthStarterActivity::class.java)), Intent(context, DropboxAuthStarterActivity::class.java)))
SyncProviderEntry(GoogleDriveSyncProviderInfo.TYPE, if (BuildConfig.DEBUG) {
list.add(SyncProviderEntry(GoogleDriveSyncProviderInfo.TYPE,
context.getString(R.string.sync_provider_name_google_drive), context.getString(R.string.sync_provider_name_google_drive),
Intent(context, GoogleDriveAuthActivity::class.java)) Intent(context, GoogleDriveAuthActivity::class.java)))
) }
return list
} }
} }

View File

@ -20,9 +20,9 @@ class GoogleDriveDraftsSyncAction(
try { try {
val filename = "/Drafts/$filename" val filename = "/Drafts/$filename"
val modifiedTime = DateTime(timestamp) 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() val file = create.execute()
return DriveFileInfo(file.id, file.originalFilename, Date()) return DriveFileInfo(file.id, file.originalFilename, Date(timestamp))
} catch (e: Exception) { } catch (e: Exception) {
throw IOException(e) throw IOException(e)
} }

View File

@ -27,6 +27,8 @@ class GoogleDriveSyncTaskRunner(context: Context, val accessToken: String) : Syn
else -> null else -> null
} ?: return false } ?: return false
task { task {
val about = drive.about().get().execute()
println(about)
syncAction.execute() syncAction.execute()
}.successUi { }.successUi {
callback(true) callback(true)