disabled google drive for release builds
This commit is contained in:
parent
48d37e9d32
commit
70b5eb2f0f
|
@ -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<SyncProviderEntry> {
|
||||
return listOf(
|
||||
SyncProviderEntry(DropboxSyncProviderInfo.TYPE,
|
||||
val list = ArrayList<SyncProviderEntry>()
|
||||
list.add(SyncProviderEntry(DropboxSyncProviderInfo.TYPE,
|
||||
context.getString(R.string.sync_provider_name_dropbox),
|
||||
Intent(context, DropboxAuthStarterActivity::class.java)),
|
||||
SyncProviderEntry(GoogleDriveSyncProviderInfo.TYPE,
|
||||
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))
|
||||
)
|
||||
Intent(context, GoogleDriveAuthActivity::class.java)))
|
||||
}
|
||||
return list
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue