mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Polish remote operation
This commit is contained in:
parent
337c57da1a
commit
bbac8d0278
@ -58,27 +58,18 @@ class GetRemoteUserQuotaOperation : RemoteOperation<RemoteQuota>() {
|
||||
val status = client.executeHttpMethod(propfindMethod)
|
||||
if (isSuccess(status)) {
|
||||
val remoteQuota = readData(propfindMethod.root.properties)
|
||||
result = RemoteOperationResult(ResultCode.OK)
|
||||
|
||||
// Add data to the result
|
||||
if (result.isSuccess) {
|
||||
result.data = remoteQuota
|
||||
result = RemoteOperationResult<RemoteQuota>(ResultCode.OK).apply {
|
||||
data = remoteQuota
|
||||
}
|
||||
Timber.i("Get quota completed: ${result.data} and message: ${result.logMessage}")
|
||||
|
||||
} else { // synchronization failed
|
||||
result = RemoteOperationResult(propfindMethod)
|
||||
Timber.e("Get quota without success: ${result.logMessage}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
result = RemoteOperationResult(e)
|
||||
} finally {
|
||||
if (result.isSuccess) {
|
||||
Timber.i("Get quota completed: ${result.data} and message: ${result.logMessage}")
|
||||
} else {
|
||||
if (result.isException) {
|
||||
Timber.e(result.exception, "Get quota: ${result.logMessage}")
|
||||
} else {
|
||||
Timber.e("Get quota without success: ${result.logMessage}")
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user