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)
|
val status = client.executeHttpMethod(propfindMethod)
|
||||||
if (isSuccess(status)) {
|
if (isSuccess(status)) {
|
||||||
val remoteQuota = readData(propfindMethod.root.properties)
|
val remoteQuota = readData(propfindMethod.root.properties)
|
||||||
result = RemoteOperationResult(ResultCode.OK)
|
result = RemoteOperationResult<RemoteQuota>(ResultCode.OK).apply {
|
||||||
|
data = remoteQuota
|
||||||
// Add data to the result
|
|
||||||
if (result.isSuccess) {
|
|
||||||
result.data = remoteQuota
|
|
||||||
}
|
}
|
||||||
|
Timber.i("Get quota completed: ${result.data} and message: ${result.logMessage}")
|
||||||
|
|
||||||
} else { // synchronization failed
|
} else { // synchronization failed
|
||||||
result = RemoteOperationResult(propfindMethod)
|
result = RemoteOperationResult(propfindMethod)
|
||||||
|
Timber.e("Get quota without success: ${result.logMessage}")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
result = RemoteOperationResult(e)
|
result = RemoteOperationResult(e)
|
||||||
} finally {
|
Timber.e(result.exception, "Get quota: ${result.logMessage}")
|
||||||
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
|
return result
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user