Initial QSfera import
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
android {
|
||||
compileSdkVersion sdkCompileVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion sdkMinVersion
|
||||
targetSdkVersion sdkTargetVersion
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
test.java.srcDirs += "src/test-common/java"
|
||||
}
|
||||
namespace "eu.qsfera.android.domain"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation libs.androidx.appcompat
|
||||
|
||||
// Kotlin
|
||||
implementation libs.kotlin.stdlib
|
||||
implementation libs.kotlinx.coroutines.core
|
||||
|
||||
// Dependencies for unit tests
|
||||
testImplementation project(":qsferaTestUtil")
|
||||
testImplementation libs.androidx.arch.core.testing
|
||||
testImplementation libs.junit4
|
||||
testImplementation libs.kotlinx.coroutines.test
|
||||
testImplementation libs.mockk
|
||||
|
||||
// Detekt
|
||||
detektPlugins libs.detekt.formatting
|
||||
detektPlugins libs.detekt.libraries
|
||||
}
|
||||
|
||||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1 @@
|
||||
<manifest />
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain
|
||||
|
||||
/**
|
||||
* Parent class for use cases that do not need error handling, e.g. get data from database,
|
||||
* as opposed to [eu.qsfera.android.domain.BaseUseCaseWithResult]
|
||||
*/
|
||||
abstract class BaseUseCase<out Type, in Params> {
|
||||
|
||||
protected abstract fun run(params: Params): Type
|
||||
|
||||
operator fun invoke(params: Params): Type = run(params)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain
|
||||
|
||||
/**
|
||||
* Parent class for use cases that need error handling
|
||||
*/
|
||||
abstract class BaseUseCaseWithResult<out Type, in Params> {
|
||||
protected abstract fun run(params: Params): Type
|
||||
|
||||
operator fun invoke(params: Params): UseCaseResult<Type> =
|
||||
try {
|
||||
UseCaseResult.Success(run(params))
|
||||
} catch (throwable: Throwable) {
|
||||
UseCaseResult.Error(throwable)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain
|
||||
|
||||
sealed class UseCaseResult<out T> {
|
||||
data class Success<out T>(val data: T) : UseCaseResult<T>()
|
||||
data class Error<out T>(val throwable: Throwable) : UseCaseResult<T>()
|
||||
|
||||
val isSuccess get() = this is Success
|
||||
val isError get() = this is Error
|
||||
|
||||
fun getDataOrNull(): T? =
|
||||
if (this is Success) {
|
||||
data
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
fun getThrowableOrNull(): Throwable? =
|
||||
if (this is Error) {
|
||||
throwable
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.appregistry
|
||||
|
||||
import eu.qsfera.android.domain.appregistry.model.AppRegistryMimeType
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface AppRegistryRepository {
|
||||
fun refreshAppRegistryForAccount(accountName: String)
|
||||
|
||||
fun getAppRegistryForMimeTypeAsStream(accountName: String, mimeType: String): Flow<AppRegistryMimeType?>
|
||||
|
||||
fun getAppRegistryWhichAllowCreation(accountName: String): Flow<List<AppRegistryMimeType>>
|
||||
|
||||
fun getUrlToOpenInWeb(accountName: String, openWebEndpoint: String, fileId: String, appName: String): String
|
||||
|
||||
fun createFileWithAppProvider(accountName: String, createFileWithAppProviderEndpoint: String, parentContainerId: String, filename: String): String
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.appregistry.model
|
||||
|
||||
data class AppRegistry(
|
||||
val accountName: String,
|
||||
val mimetypes: List<AppRegistryMimeType>
|
||||
)
|
||||
|
||||
data class AppRegistryMimeType(
|
||||
val mimeType: String,
|
||||
val ext: String? = null,
|
||||
val appProviders: List<AppRegistryProvider>,
|
||||
val name: String? = null,
|
||||
val icon: String? = null,
|
||||
val description: String? = null,
|
||||
val allowCreation: Boolean? = null,
|
||||
val defaultApplication: String? = null
|
||||
)
|
||||
|
||||
data class AppRegistryProvider(
|
||||
val name: String,
|
||||
val productName: String = "",
|
||||
val icon: String,
|
||||
)
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.appregistry.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.appregistry.AppRegistryRepository
|
||||
import eu.qsfera.android.domain.capabilities.CapabilityRepository
|
||||
|
||||
class CreateFileWithAppProviderUseCase(
|
||||
private val capabilitiesRepository: CapabilityRepository,
|
||||
private val appRegistryRepository: AppRegistryRepository,
|
||||
) : BaseUseCaseWithResult<String, CreateFileWithAppProviderUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): String {
|
||||
val capabilities = capabilitiesRepository.getStoredCapabilities(params.accountName)
|
||||
val createFileWithAppProviderUrl = capabilities?.filesAppProviders?.newUrl
|
||||
|
||||
requireNotNull(createFileWithAppProviderUrl)
|
||||
|
||||
return appRegistryRepository.createFileWithAppProvider(
|
||||
accountName = params.accountName,
|
||||
createFileWithAppProviderEndpoint = createFileWithAppProviderUrl,
|
||||
parentContainerId = params.parentContainerId,
|
||||
filename = params.filename,
|
||||
)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val accountName: String,
|
||||
val parentContainerId: String,
|
||||
val filename: String,
|
||||
)
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.appregistry.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.appregistry.AppRegistryRepository
|
||||
import eu.qsfera.android.domain.appregistry.model.AppRegistryMimeType
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetAppRegistryForMimeTypeAsStreamUseCase(
|
||||
private val appRegistryRepository: AppRegistryRepository,
|
||||
) : BaseUseCase<Flow<AppRegistryMimeType?>, GetAppRegistryForMimeTypeAsStreamUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) =
|
||||
appRegistryRepository.getAppRegistryForMimeTypeAsStream(accountName = params.accountName, mimeType = params.mimeType)
|
||||
|
||||
data class Params(
|
||||
val accountName: String,
|
||||
val mimeType: String,
|
||||
)
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.appregistry.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.appregistry.AppRegistryRepository
|
||||
import eu.qsfera.android.domain.appregistry.model.AppRegistryMimeType
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetAppRegistryWhichAllowCreationAsStreamUseCase(
|
||||
private val appRegistryRepository: AppRegistryRepository,
|
||||
) : BaseUseCase<Flow<List<AppRegistryMimeType>>, GetAppRegistryWhichAllowCreationAsStreamUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) =
|
||||
appRegistryRepository.getAppRegistryWhichAllowCreation(accountName = params.accountName)
|
||||
|
||||
data class Params(
|
||||
val accountName: String,
|
||||
)
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.appregistry.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.appregistry.AppRegistryRepository
|
||||
import eu.qsfera.android.domain.capabilities.CapabilityRepository
|
||||
|
||||
class GetUrlToOpenInWebUseCase(
|
||||
private val capabilitiesRepository: CapabilityRepository,
|
||||
private val appRegistryRepository: AppRegistryRepository,
|
||||
) : BaseUseCaseWithResult<String, GetUrlToOpenInWebUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): String {
|
||||
val capabilities = capabilitiesRepository.getStoredCapabilities(params.accountName)
|
||||
val openInWebUrl = capabilities?.filesAppProviders?.openWebUrl
|
||||
|
||||
requireNotNull(openInWebUrl)
|
||||
|
||||
return appRegistryRepository.getUrlToOpenInWeb(
|
||||
accountName = params.accountName,
|
||||
openWebEndpoint = openInWebUrl,
|
||||
fileId = params.fileId,
|
||||
appName = params.appName,
|
||||
)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val accountName: String,
|
||||
val fileId: String,
|
||||
val appName: String,
|
||||
)
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication
|
||||
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationInfo
|
||||
import eu.qsfera.android.domain.server.model.ServerInfo
|
||||
|
||||
interface AuthenticationRepository {
|
||||
fun loginBasic(
|
||||
serverInfo: ServerInfo,
|
||||
username: String,
|
||||
password: String,
|
||||
updateAccountWithUsername: String?
|
||||
): String
|
||||
|
||||
fun loginOAuth(
|
||||
serverInfo: ServerInfo,
|
||||
username: String,
|
||||
authTokenType: String,
|
||||
accessToken: String,
|
||||
refreshToken: String,
|
||||
scope: String?,
|
||||
updateAccountWithUsername: String?,
|
||||
clientRegistrationInfo: ClientRegistrationInfo?
|
||||
): String
|
||||
|
||||
fun supportsOAuth2UseCase(accountName: String): Boolean
|
||||
|
||||
fun getBaseUrl(accountName: String): String
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.authentication.oauth
|
||||
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationInfo
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationRequest
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.OIDCServerConfiguration
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.TokenRequest
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.TokenResponse
|
||||
|
||||
interface OAuthRepository {
|
||||
fun performOIDCDiscovery(baseUrl: String): OIDCServerConfiguration
|
||||
fun performTokenRequest(tokenRequest: TokenRequest): TokenResponse
|
||||
|
||||
fun registerClient(clientRegistrationRequest: ClientRegistrationRequest): ClientRegistrationInfo
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.authentication.oauth
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.OIDCServerConfiguration
|
||||
|
||||
class OIDCDiscoveryUseCase(
|
||||
private val oAuthRepository: OAuthRepository
|
||||
) : BaseUseCaseWithResult<OIDCServerConfiguration, OIDCDiscoveryUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): OIDCServerConfiguration {
|
||||
require(params.baseUrl.isNotEmpty()) { "Invalid URL" }
|
||||
return oAuthRepository.performOIDCDiscovery(params.baseUrl)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val baseUrl: String
|
||||
)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.authentication.oauth
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationInfo
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationRequest
|
||||
|
||||
class RegisterClientUseCase(
|
||||
private val oAuthRepository: OAuthRepository
|
||||
) : BaseUseCaseWithResult<ClientRegistrationInfo, RegisterClientUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): ClientRegistrationInfo =
|
||||
oAuthRepository.registerClient(clientRegistrationRequest = params.clientRegistrationRequest)
|
||||
|
||||
data class Params(
|
||||
val clientRegistrationRequest: ClientRegistrationRequest
|
||||
)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.authentication.oauth
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.TokenRequest
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.TokenResponse
|
||||
|
||||
class RequestTokenUseCase(
|
||||
private val oAuthRepository: OAuthRepository
|
||||
) : BaseUseCaseWithResult<TokenResponse, RequestTokenUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): TokenResponse =
|
||||
oAuthRepository.performTokenRequest(params.tokenRequest)
|
||||
|
||||
data class Params(
|
||||
val tokenRequest: TokenRequest
|
||||
)
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
data class ClientRegistrationInfo(
|
||||
val clientId: String,
|
||||
val clientSecret: String?,
|
||||
val clientIdIssuedAt: Int?,
|
||||
val clientSecretExpiration: Int,
|
||||
)
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
data class ClientRegistrationRequest(
|
||||
val registrationEndpoint: String,
|
||||
val clientName: String,
|
||||
val redirectUris: List<String>,
|
||||
val tokenEndpointAuthMethod: String = CLIENT_REGISTRATION_AUTH_METHOD,
|
||||
val applicationType: String = CLIENT_REGISTRATION_APPLICATION_TYPE
|
||||
) {
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The client uses HTTP Basic as defined in OAuth 2.0, Section 2.3.1.
|
||||
* https://tools.ietf.org/html/rfc7591#section-2.3.1
|
||||
* Use this auth method for the moment. We should check if it is allowed in the OIDC Discovery.
|
||||
*/
|
||||
private const val CLIENT_REGISTRATION_AUTH_METHOD = "client_secret_basic"
|
||||
private const val CLIENT_REGISTRATION_APPLICATION_TYPE = "native"
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2024 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
data class OIDCServerConfiguration(
|
||||
val authorizationEndpoint: String,
|
||||
val checkSessionIframe: String?,
|
||||
val endSessionEndpoint: String?,
|
||||
val issuer: String,
|
||||
val registrationEndpoint: String?,
|
||||
val responseTypesSupported: List<String>?, // To do: provisional, remove nullability ASAP
|
||||
val scopesSupported: List<String>?,
|
||||
val tokenEndpoint: String,
|
||||
val tokenEndpointAuthMethodsSupported: List<String>?,
|
||||
val userInfoEndpoint: String?,
|
||||
) {
|
||||
fun isTokenEndpointAuthMethodSupportedClientSecretPost(): Boolean =
|
||||
tokenEndpointAuthMethodsSupported?.any { it == "client_secret_post" } ?: false
|
||||
|
||||
fun isTokenEndpointAuthMethodNone(): Boolean =
|
||||
tokenEndpointAuthMethodsSupported?.any { it == "none" } ?: false
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
/**
|
||||
* Response type values defined by the
|
||||
* [OAuth 2.0](https://tools.ietf.org/html/rfc6749#section-3.1.1)
|
||||
*/
|
||||
enum class ResponseType(val string: String) {
|
||||
/**
|
||||
* For requesting an authorization code.
|
||||
*/
|
||||
CODE("code")
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2024 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
sealed class TokenRequest(
|
||||
val baseUrl: String,
|
||||
val tokenEndpoint: String,
|
||||
val clientAuth: String,
|
||||
val grantType: String,
|
||||
val scope: String,
|
||||
val clientId: String?,
|
||||
val clientSecret: String?,
|
||||
) {
|
||||
class AccessToken(
|
||||
baseUrl: String,
|
||||
tokenEndpoint: String,
|
||||
clientAuth: String,
|
||||
scope: String,
|
||||
clientId: String? = null,
|
||||
clientSecret: String? = null,
|
||||
val authorizationCode: String,
|
||||
val redirectUri: String,
|
||||
val codeVerifier: String
|
||||
) : TokenRequest(baseUrl, tokenEndpoint, clientAuth, GrantType.ACCESS_TOKEN.string, scope, clientId, clientSecret)
|
||||
|
||||
class RefreshToken(
|
||||
baseUrl: String,
|
||||
tokenEndpoint: String,
|
||||
clientAuth: String,
|
||||
scope: String,
|
||||
clientId: String? = null,
|
||||
clientSecret: String? = null,
|
||||
val refreshToken: String? = null
|
||||
) : TokenRequest(baseUrl, tokenEndpoint, clientAuth, GrantType.REFRESH_TOKEN.string, scope, clientId, clientSecret)
|
||||
|
||||
enum class GrantType(val string: String) {
|
||||
/** Request access token. [More info](https://tools.ietf.org/html/rfc6749#section-4.1.3) */
|
||||
ACCESS_TOKEN("authorization_code"),
|
||||
|
||||
/** Refresh access token. [More info](https://tools.ietf.org/html/rfc6749#section-6) */
|
||||
REFRESH_TOKEN("refresh_token")
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.oauth.model
|
||||
|
||||
data class TokenResponse(
|
||||
val accessToken: String,
|
||||
val expiresIn: Int,
|
||||
val refreshToken: String?,
|
||||
val tokenType: String,
|
||||
val userId: String?,
|
||||
val scope: String?,
|
||||
val idToken: String? = null,
|
||||
val additionalParameters: Map<String, String>?
|
||||
)
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.AuthenticationRepository
|
||||
|
||||
class GetBaseUrlUseCase(
|
||||
private val authenticationRepository: AuthenticationRepository
|
||||
) : BaseUseCaseWithResult<String, GetBaseUrlUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): String {
|
||||
require(params.accountName.isNotEmpty()) { "Invalid account name" }
|
||||
return authenticationRepository.getBaseUrl(params.accountName)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val accountName: String
|
||||
)
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.AuthenticationRepository
|
||||
import eu.qsfera.android.domain.server.model.ServerInfo
|
||||
|
||||
class LoginBasicAsyncUseCase(
|
||||
private val authenticationRepository: AuthenticationRepository
|
||||
) : BaseUseCaseWithResult<String, LoginBasicAsyncUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): String {
|
||||
require(params.serverInfo != null) { "Invalid server info" }
|
||||
require(params.username.isNotEmpty()) { "Invalid username" }
|
||||
require(params.password.isNotEmpty()) { "Invalid password" }
|
||||
|
||||
return authenticationRepository.loginBasic(
|
||||
params.serverInfo,
|
||||
params.username,
|
||||
params.password,
|
||||
params.updateAccountWithUsername
|
||||
)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val serverInfo: ServerInfo?,
|
||||
val username: String,
|
||||
val password: String,
|
||||
val updateAccountWithUsername: String? = null
|
||||
)
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.AuthenticationRepository
|
||||
import eu.qsfera.android.domain.authentication.oauth.model.ClientRegistrationInfo
|
||||
import eu.qsfera.android.domain.server.model.ServerInfo
|
||||
|
||||
class LoginOAuthAsyncUseCase(
|
||||
private val authenticationRepository: AuthenticationRepository
|
||||
) : BaseUseCaseWithResult<String, LoginOAuthAsyncUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): String {
|
||||
require(params.serverInfo != null) { "Invalid server info" }
|
||||
require(params.authTokenType.isNotEmpty()) { "Invalid authorization token type" }
|
||||
require(params.accessToken.isNotEmpty()) { "Invalid access token" }
|
||||
require(params.refreshToken.isNotEmpty()) { "Invalid refresh token" }
|
||||
|
||||
val accountName = authenticationRepository.loginOAuth(
|
||||
params.serverInfo,
|
||||
params.username,
|
||||
params.authTokenType,
|
||||
params.accessToken,
|
||||
params.refreshToken,
|
||||
params.scope,
|
||||
params.updateAccountWithUsername,
|
||||
params.clientRegistrationInfo
|
||||
)
|
||||
|
||||
return accountName
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val serverInfo: ServerInfo?,
|
||||
val username: String,
|
||||
val authTokenType: String,
|
||||
val accessToken: String,
|
||||
val refreshToken: String,
|
||||
val scope: String?,
|
||||
val updateAccountWithUsername: String?,
|
||||
val clientRegistrationInfo: ClientRegistrationInfo?
|
||||
)
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.authentication.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.authentication.AuthenticationRepository
|
||||
|
||||
class SupportsOAuth2UseCase(
|
||||
private val authenticationRepository: AuthenticationRepository
|
||||
) : BaseUseCaseWithResult<Boolean, SupportsOAuth2UseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): Boolean {
|
||||
require(params.accountName.isNotEmpty()) { "Invalid account name" }
|
||||
return authenticationRepository.supportsOAuth2UseCase(params.accountName)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val accountName: String
|
||||
)
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads
|
||||
|
||||
import eu.qsfera.android.domain.automaticuploads.model.AutomaticUploadsConfiguration
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface FolderBackupRepository {
|
||||
fun getAutomaticUploadsConfiguration(): AutomaticUploadsConfiguration?
|
||||
|
||||
fun getFolderBackupConfigurationByNameAsFlow(name: String): Flow<FolderBackUpConfiguration?>
|
||||
|
||||
fun saveFolderBackupConfiguration(folderBackUpConfiguration: FolderBackUpConfiguration)
|
||||
|
||||
fun resetFolderBackupConfigurationByName(name: String)
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.model
|
||||
|
||||
data class AutomaticUploadsConfiguration(
|
||||
val pictureUploadsConfiguration: FolderBackUpConfiguration?,
|
||||
val videoUploadsConfiguration: FolderBackUpConfiguration?
|
||||
) {
|
||||
fun areAutomaticUploadsDisabled() = pictureUploadsConfiguration == null && videoUploadsConfiguration == null
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.automaticuploads.model
|
||||
|
||||
data class FolderBackUpConfiguration(
|
||||
val accountName: String,
|
||||
val behavior: UploadBehavior,
|
||||
val sourcePath: String,
|
||||
val uploadPath: String,
|
||||
val wifiOnly: Boolean,
|
||||
val chargingOnly: Boolean,
|
||||
val lastSyncTimestamp: Long,
|
||||
val name: String,
|
||||
val spaceId: String?,
|
||||
) {
|
||||
|
||||
val isPictureUploads get() = name == pictureUploadsName
|
||||
val isVideoUploads get() = name == videoUploadsName
|
||||
val sourcePaths get() = parseSourcePaths(sourcePath)
|
||||
|
||||
companion object {
|
||||
const val pictureUploadsName = "Picture uploads"
|
||||
const val videoUploadsName = "Video uploads"
|
||||
|
||||
fun parseSourcePaths(sourcePath: String): List<String> =
|
||||
sourcePath
|
||||
.split(SOURCE_PATH_SEPARATOR)
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
.distinct()
|
||||
|
||||
fun encodeSourcePaths(sourcePaths: List<String>): String =
|
||||
sourcePaths
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
.distinct()
|
||||
.joinToString(SOURCE_PATH_SEPARATOR)
|
||||
|
||||
private const val SOURCE_PATH_SEPARATOR = "\n"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Behaviour to after uploading a file.
|
||||
*
|
||||
* Move - Remove the source file after a successful upload
|
||||
* Copy - Keep the source file after a successful upload
|
||||
*/
|
||||
enum class UploadBehavior {
|
||||
MOVE, COPY;
|
||||
|
||||
@Deprecated("Legacy Local Behavior. Remove asap")
|
||||
fun toLegacyLocalBehavior(): Int =
|
||||
when (this) {
|
||||
MOVE -> LEGACY_LOCAL_BEHAVIOUR_MOVE
|
||||
COPY -> LEGACY_LOCAL_BEHAVIOUR_COPY
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val LEGACY_LOCAL_BEHAVIOUR_COPY = 0
|
||||
private const val LEGACY_LOCAL_BEHAVIOUR_MOVE = 1
|
||||
|
||||
fun fromString(string: String): UploadBehavior =
|
||||
if (string.equals("MOVE", ignoreCase = true)) {
|
||||
MOVE
|
||||
} else {
|
||||
COPY
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.AutomaticUploadsConfiguration
|
||||
|
||||
class GetAutomaticUploadsConfigurationUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCaseWithResult<AutomaticUploadsConfiguration?, Unit>() {
|
||||
|
||||
override fun run(params: Unit): AutomaticUploadsConfiguration? =
|
||||
folderBackupRepository.getAutomaticUploadsConfiguration()
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetPictureUploadsConfigurationStreamUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCase<Flow<FolderBackUpConfiguration?>, Unit>() {
|
||||
|
||||
override fun run(params: Unit): Flow<FolderBackUpConfiguration?> =
|
||||
folderBackupRepository.getFolderBackupConfigurationByNameAsFlow(FolderBackUpConfiguration.pictureUploadsName)
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration.Companion.videoUploadsName
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetVideoUploadsConfigurationStreamUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCase<Flow<FolderBackUpConfiguration?>, Unit>() {
|
||||
|
||||
override fun run(params: Unit): Flow<FolderBackUpConfiguration?> =
|
||||
folderBackupRepository.getFolderBackupConfigurationByNameAsFlow(videoUploadsName)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration.Companion.pictureUploadsName
|
||||
|
||||
class ResetPictureUploadsUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCase<Unit, Unit>() {
|
||||
|
||||
override fun run(params: Unit) =
|
||||
folderBackupRepository.resetFolderBackupConfigurationByName(pictureUploadsName)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration.Companion.videoUploadsName
|
||||
|
||||
class ResetVideoUploadsUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCase<Unit, Unit>() {
|
||||
|
||||
override fun run(params: Unit) =
|
||||
folderBackupRepository.resetFolderBackupConfigurationByName(videoUploadsName)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration
|
||||
|
||||
class SavePictureUploadsConfigurationUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCaseWithResult<Unit, SavePictureUploadsConfigurationUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) =
|
||||
folderBackupRepository.saveFolderBackupConfiguration(params.pictureUploadsConfiguration)
|
||||
|
||||
data class Params(
|
||||
val pictureUploadsConfiguration: FolderBackUpConfiguration
|
||||
)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.automaticuploads.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.automaticuploads.FolderBackupRepository
|
||||
import eu.qsfera.android.domain.automaticuploads.model.FolderBackUpConfiguration
|
||||
|
||||
class SaveVideoUploadsConfigurationUseCase(
|
||||
private val folderBackupRepository: FolderBackupRepository
|
||||
) : BaseUseCaseWithResult<Unit, SaveVideoUploadsConfigurationUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) =
|
||||
folderBackupRepository.saveFolderBackupConfiguration(params.videoUploadsConfiguration)
|
||||
|
||||
data class Params(
|
||||
val videoUploadsConfiguration: FolderBackUpConfiguration
|
||||
)
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.model
|
||||
|
||||
|
||||
enum class AvailableOfflineStatus {
|
||||
/**
|
||||
* File is not available offline
|
||||
*/
|
||||
NOT_AVAILABLE_OFFLINE,
|
||||
|
||||
/**
|
||||
* File is available offline
|
||||
*/
|
||||
AVAILABLE_OFFLINE,
|
||||
|
||||
/**
|
||||
* File belongs to an available offline folder
|
||||
*/
|
||||
AVAILABLE_OFFLINE_PARENT;
|
||||
|
||||
companion object {
|
||||
fun fromValue(value: Int?): AvailableOfflineStatus =
|
||||
when (value) {
|
||||
AVAILABLE_OFFLINE.ordinal -> AVAILABLE_OFFLINE
|
||||
AVAILABLE_OFFLINE_PARENT.ordinal -> AVAILABLE_OFFLINE_PARENT
|
||||
else -> NOT_AVAILABLE_OFFLINE
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* qsfera Android client application
|
||||
*
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.files.FileRepository
|
||||
import eu.qsfera.android.domain.files.model.OCFileWithSyncInfo
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetFilesAvailableOfflineFromAccountAsStreamUseCase(
|
||||
private val fileRepository: FileRepository
|
||||
) : BaseUseCase<Flow<List<OCFileWithSyncInfo>>, GetFilesAvailableOfflineFromAccountAsStreamUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): Flow<List<OCFileWithSyncInfo>> =
|
||||
fileRepository.getFilesWithSyncInfoAvailableOfflineFromAccountAsFlow(params.owner)
|
||||
|
||||
data class Params(
|
||||
val owner: String
|
||||
)
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* qsfera Android client application
|
||||
*
|
||||
* Copyright (C) 2021 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.files.FileRepository
|
||||
import eu.qsfera.android.domain.files.model.OCFile
|
||||
|
||||
class GetFilesAvailableOfflineFromAccountUseCase(
|
||||
private val fileRepository: FileRepository
|
||||
) : BaseUseCaseWithResult<List<OCFile>, GetFilesAvailableOfflineFromAccountUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): List<OCFile> = fileRepository.getFilesAvailableOfflineFromAccount(params.owner)
|
||||
|
||||
data class Params(
|
||||
val owner: String
|
||||
)
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.files.FileRepository
|
||||
import eu.qsfera.android.domain.files.model.OCFile
|
||||
|
||||
class GetFilesAvailableOfflineFromEveryAccountUseCase(
|
||||
private val fileRepository: FileRepository
|
||||
) : BaseUseCase<List<OCFile>, Unit>() {
|
||||
|
||||
override fun run(params: Unit): List<OCFile> = fileRepository.getFilesAvailableOfflineFromEveryAccount()
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.availableoffline.model.AvailableOfflineStatus
|
||||
import eu.qsfera.android.domain.files.FileRepository
|
||||
import eu.qsfera.android.domain.files.model.OCFile
|
||||
|
||||
class SetFilesAsAvailableOfflineUseCase(
|
||||
private val fileRepository: FileRepository,
|
||||
) : BaseUseCaseWithResult<Unit, SetFilesAsAvailableOfflineUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) {
|
||||
params.filesToSetAsAvailableOffline.forEach { fileToSetAsAvailableOffline ->
|
||||
// Its possible to multiselect several files including already available offline files.
|
||||
// If it is already available offline, we will ignore it.
|
||||
if (!fileToSetAsAvailableOffline.isAvailableOffline) {
|
||||
fileRepository.updateFileWithNewAvailableOfflineStatus(
|
||||
ocFile = fileToSetAsAvailableOffline,
|
||||
newAvailableOfflineStatus = AvailableOfflineStatus.AVAILABLE_OFFLINE,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val filesToSetAsAvailableOffline: List<OCFile>
|
||||
)
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package eu.qsfera.android.domain.availableoffline.usecases
|
||||
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
import eu.qsfera.android.domain.availableoffline.model.AvailableOfflineStatus
|
||||
import eu.qsfera.android.domain.files.FileRepository
|
||||
import eu.qsfera.android.domain.files.model.OCFile
|
||||
|
||||
class UnsetFilesAsAvailableOfflineUseCase(
|
||||
private val fileRepository: FileRepository,
|
||||
) : BaseUseCaseWithResult<Unit, UnsetFilesAsAvailableOfflineUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) {
|
||||
params.filesToUnsetAsAvailableOffline.forEach { fileToUnsetAsAvailableOffline ->
|
||||
// Its possible to multiselect several files including not available offline files.
|
||||
// If it is not available offline, we will ignore it.
|
||||
if (fileToUnsetAsAvailableOffline.availableOfflineStatus == AvailableOfflineStatus.AVAILABLE_OFFLINE) {
|
||||
fileRepository.updateFileWithNewAvailableOfflineStatus(
|
||||
ocFile = fileToUnsetAsAvailableOffline,
|
||||
newAvailableOfflineStatus = AvailableOfflineStatus.NOT_AVAILABLE_OFFLINE,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val filesToUnsetAsAvailableOffline: List<OCFile>
|
||||
)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.capabilities
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import eu.qsfera.android.domain.capabilities.model.OCCapability
|
||||
|
||||
interface CapabilityRepository {
|
||||
fun getCapabilitiesAsLiveData(accountName: String): LiveData<OCCapability?>
|
||||
fun getStoredCapabilities(accountName: String): OCCapability?
|
||||
fun refreshCapabilitiesForAccount(accountName: String)
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2024 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.capabilities.model
|
||||
|
||||
data class OCCapability(
|
||||
val id: Int? = null,
|
||||
var accountName: String?,
|
||||
val versionMajor: Int,
|
||||
val versionMinor: Int,
|
||||
val versionMicro: Int,
|
||||
val versionString: String?,
|
||||
val versionEdition: String?,
|
||||
val corePollInterval: Int,
|
||||
val davChunkingVersion: String,
|
||||
val filesSharingApiEnabled: CapabilityBooleanType,
|
||||
val filesSharingPublicEnabled: CapabilityBooleanType,
|
||||
val filesSharingPublicPasswordEnforced: CapabilityBooleanType,
|
||||
val filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType,
|
||||
val filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType,
|
||||
val filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType,
|
||||
val filesSharingPublicExpireDateEnabled: CapabilityBooleanType,
|
||||
val filesSharingPublicExpireDateDays: Int,
|
||||
val filesSharingPublicExpireDateEnforced: CapabilityBooleanType,
|
||||
val filesSharingPublicUpload: CapabilityBooleanType,
|
||||
val filesSharingPublicMultiple: CapabilityBooleanType,
|
||||
val filesSharingPublicSupportsUploadOnly: CapabilityBooleanType,
|
||||
val filesSharingResharing: CapabilityBooleanType,
|
||||
val filesSharingFederationOutgoing: CapabilityBooleanType,
|
||||
val filesSharingFederationIncoming: CapabilityBooleanType,
|
||||
val filesSharingUserProfilePicture: CapabilityBooleanType,
|
||||
val filesBigFileChunking: CapabilityBooleanType,
|
||||
val filesUndelete: CapabilityBooleanType,
|
||||
val filesVersioning: CapabilityBooleanType,
|
||||
val filesPrivateLinks: CapabilityBooleanType,
|
||||
val filesAppProviders: AppProviders?,
|
||||
val filesTusSupport: TusSupport?,
|
||||
val spaces: Spaces?,
|
||||
val passwordPolicy: PasswordPolicy?,
|
||||
) {
|
||||
fun isChunkingAllowed(): Boolean {
|
||||
val doubleChunkingVersion = davChunkingVersion.toDoubleOrNull()
|
||||
return (filesBigFileChunking.isTrue && doubleChunkingVersion != null && doubleChunkingVersion >= 1.0)
|
||||
}
|
||||
|
||||
fun isOpenInWebAllowed(): Boolean = filesAppProviders?.openWebUrl?.isNotBlank() ?: false
|
||||
|
||||
fun isSpacesAllowed(): Boolean = spaces?.enabled == true
|
||||
|
||||
fun isSpacesProjectsAllowed(): Boolean = spaces?.projects == true
|
||||
|
||||
data class AppProviders(
|
||||
val enabled: Boolean,
|
||||
val version: String,
|
||||
val appsUrl: String?,
|
||||
val openUrl: String?,
|
||||
val openWebUrl: String?,
|
||||
val newUrl: String?,
|
||||
)
|
||||
|
||||
data class TusSupport(
|
||||
val version: String?,
|
||||
val resumable: String?,
|
||||
val extension: String?,
|
||||
val maxChunkSize: Int?,
|
||||
val httpMethodOverride: String?,
|
||||
)
|
||||
|
||||
data class Spaces(
|
||||
val enabled: Boolean,
|
||||
val projects: Boolean,
|
||||
val shareJail: Boolean?,
|
||||
val hasMultiplePersonalSpaces: Boolean?,
|
||||
)
|
||||
|
||||
data class PasswordPolicy(
|
||||
val maxCharacters: Int?,
|
||||
val minCharacters: Int?,
|
||||
val minDigits: Int?,
|
||||
val minLowercaseCharacters: Int?,
|
||||
val minSpecialCharacters: Int?,
|
||||
val minUppercaseCharacters: Int?,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for Boolean Type in capabilities, with values:
|
||||
* -1 - Unknown
|
||||
* 0 - False
|
||||
* 1 - True
|
||||
*/
|
||||
enum class CapabilityBooleanType constructor(val value: Int) {
|
||||
UNKNOWN(-1),
|
||||
FALSE(0),
|
||||
TRUE(1);
|
||||
|
||||
val isUnknown: Boolean
|
||||
get() = value == -1
|
||||
|
||||
val isFalse: Boolean
|
||||
get() = value == 0
|
||||
|
||||
val isTrue: Boolean
|
||||
get() = value == 1
|
||||
|
||||
companion object {
|
||||
const val capabilityBooleanTypeUnknownString = "-1"
|
||||
|
||||
fun fromValue(value: Int): CapabilityBooleanType =
|
||||
when (value) {
|
||||
0 -> FALSE
|
||||
1 -> TRUE
|
||||
else -> UNKNOWN
|
||||
}
|
||||
|
||||
fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType =
|
||||
if (boolValue) {
|
||||
TRUE
|
||||
} else {
|
||||
FALSE
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.capabilities.usecases
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
import eu.qsfera.android.domain.capabilities.CapabilityRepository
|
||||
import eu.qsfera.android.domain.capabilities.model.OCCapability
|
||||
|
||||
class GetCapabilitiesAsLiveDataUseCase(
|
||||
private val capabilityRepository: CapabilityRepository
|
||||
) : BaseUseCase<LiveData<OCCapability?>, GetCapabilitiesAsLiveDataUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params): LiveData<OCCapability?> = capabilityRepository.getCapabilitiesAsLiveData(
|
||||
params.accountName
|
||||
)
|
||||
|
||||
data class Params(
|
||||
val accountName: String
|
||||
)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.capabilities.usecases
|
||||
|
||||
import eu.qsfera.android.domain.capabilities.CapabilityRepository
|
||||
import eu.qsfera.android.domain.capabilities.model.OCCapability
|
||||
import eu.qsfera.android.domain.BaseUseCase
|
||||
|
||||
class GetStoredCapabilitiesUseCase(
|
||||
private val capabilityRepository: CapabilityRepository
|
||||
) : BaseUseCase<OCCapability?, GetStoredCapabilitiesUseCase.Params>() {
|
||||
override fun run(params: Params): OCCapability? =
|
||||
capabilityRepository.getStoredCapabilities(params.accountName)
|
||||
|
||||
data class Params(
|
||||
val accountName: String
|
||||
)
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.capabilities.usecases
|
||||
|
||||
import eu.qsfera.android.domain.capabilities.CapabilityRepository
|
||||
import eu.qsfera.android.domain.BaseUseCaseWithResult
|
||||
|
||||
class RefreshCapabilitiesFromServerAsyncUseCase(
|
||||
private val capabilityRepository: CapabilityRepository
|
||||
) : BaseUseCaseWithResult<Unit, RefreshCapabilitiesFromServerAsyncUseCase.Params>() {
|
||||
|
||||
override fun run(params: Params) =
|
||||
capabilityRepository.refreshCapabilitiesForAccount(
|
||||
params.accountName
|
||||
)
|
||||
|
||||
data class Params(
|
||||
val accountName: String
|
||||
)
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class AccountException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class AccountNotFoundException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class AccountNotNewException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class AccountNotTheSameException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class BadOcVersionException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class CancelledException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ConflictException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class CopyIntoDescendantException : Exception()
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class CopyIntoSameFolderException : Exception()
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Manuel Plazas Palacio
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
class DeepLinkException : Exception(INVALID_FORMAT)
|
||||
|
||||
const val INVALID_FORMAT = "Invalid deep link format"
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class DelayedForWifiException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class FileAlreadyExistsException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class FileNotFoundException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ForbiddenException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class IncorrectAddressException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class InstanceNotConfiguredException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class InvalidCharacterException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class InvalidCharacterInNameException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class InvalidLocalFileNameException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class InvalidOverwriteException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class LocalFileNotFoundException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class LocalStorageFullException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class LocalStorageNotCopiedException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class LocalStorageNotMovedException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class LocalStorageNotRemovedException : Exception()
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class MoveIntoAnotherSpaceException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class MoveIntoDescendantException : Exception()
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class MoveIntoSameFolderException : Exception()
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2023 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class NetworkErrorException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class NoConnectionWithServerException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class NoNetworkConnectionException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class OAuth2ErrorAccessDeniedException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class OAuth2ErrorException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class PartialCopyDoneException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class PartialMoveDoneException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class QSferaVersionNotSupportedException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class QuotaExceededException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class RedirectToNonSecureException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author Parneet Singh
|
||||
* Copyright (C) 2024 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ResourceLockedException : Exception()
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class SSLErrorException(override val message: String? = null, val code: SSLErrorCode = SSLErrorCode.GENERIC) : Exception(message)
|
||||
|
||||
enum class SSLErrorCode { GENERIC, NOT_HTTP_ALLOWED }
|
||||
|
||||
const val NOT_HTTP_ALLOWED_MESSAGE = "Connection is not secure, http traffic is not allowed."
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class SSLRecoverablePeerUnverifiedException : Exception()
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
class ServerConnectionTimeoutException : Exception()
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
class ServerNotReachableException : Exception()
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
class ServerResponseTimeoutException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ServiceUnavailableException : Exception()
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ShareForbiddenException(
|
||||
message: String
|
||||
) : Exception(message)
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
class ShareNotFoundException(
|
||||
message: String
|
||||
) : Exception(message)
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class ShareWrongParameterException : Exception()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class SpecificForbiddenException : Exception()
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
|
||||
class SpecificMethodNotAllowedException(
|
||||
httpPhrase: String?,
|
||||
) : Throwable(message = httpPhrase)
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class SpecificServiceUnavailableException(
|
||||
message: String
|
||||
) : Exception(message)
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* @author David González Verdugo
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.qsfera.android.domain.exceptions
|
||||
|
||||
import java.lang.Exception
|
||||
|
||||
class SpecificUnsupportedMediaTypeException : Exception()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user