Files
SyncFlow/app/src/main/kotlin/com/syncflow/data/providers/CloudProvider.kt
T
amir cff4233de6 Initial commit — SyncFlow Android file sync app
Supports WebDAV, SFTP, SFTPGo, Nextcloud, ownCloud, Google Drive,
Dropbox, and OneDrive. Credentials encrypted with Android Keystore.
Biometric app-lock, conflict resolution, and auto-sync via WorkManager.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 20:21:20 +00:00

32 lines
1.1 KiB
Kotlin

package com.syncflow.data.providers
import com.syncflow.domain.model.CloudAccount
import com.syncflow.domain.model.RemoteFile
import kotlinx.coroutines.flow.Flow
import java.io.InputStream
import java.io.OutputStream
interface CloudProvider {
suspend fun testConnection(): Result<Unit>
suspend fun listFiles(remotePath: String): Result<List<RemoteFile>>
suspend fun uploadFile(
localStream: InputStream,
remotePath: String,
sizeBytes: Long,
onProgress: (bytesWritten: Long) -> Unit = {},
): Result<RemoteFile>
suspend fun downloadFile(
remotePath: String,
destination: OutputStream,
onProgress: (bytesRead: Long) -> Unit = {},
): Result<Unit>
suspend fun deleteFile(remotePath: String): Result<Unit>
suspend fun createDirectory(remotePath: String): Result<Unit>
suspend fun getFileMetadata(remotePath: String): Result<RemoteFile>
suspend fun moveFile(fromPath: String, toPath: String): Result<Unit>
companion object {
const val CHUNK_SIZE = 8 * 1024 * 1024L // 8 MB
}
}