Code cleanup

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-11-02 14:42:56 +01:00 committed by Alper Öztürk
parent 57564073b8
commit 3010f78f79
1 changed files with 6 additions and 4 deletions

View File

@ -53,8 +53,8 @@ class AuthenticatorAsyncTask(activity: Activity) : AsyncTask<Any?, Void?, Remote
if (params.size == 2 && mWeakContext.get() != null) {
val url = params[0] as String
val context = mWeakContext.get()
val credentials = params[1] as OwnCloudCredentials
val context = mWeakContext.get()
// Client
val uri = Uri.parse(url)
@ -72,9 +72,11 @@ class AuthenticatorAsyncTask(activity: Activity) : AsyncTask<Any?, Void?, Remote
// Operation - try credentials
if (userInfoResult.isSuccess) {
val client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true)
client.userId = userInfoResult.resultData!!.id
client.userId = userInfoResult.resultData?.id
client.credentials = credentials
val operation = ExistenceCheckRemoteOperation(OCFile.ROOT_PATH, SUCCESS_IF_ABSENT)
@Suppress("UNCHECKED_CAST")
result = operation.execute(client) as RemoteOperationResult<UserInfo?>
if (operation.wasRedirected()) {
val redirectionPath = operation.redirectionPath
@ -94,9 +96,9 @@ class AuthenticatorAsyncTask(activity: Activity) : AsyncTask<Any?, Void?, Remote
@Deprecated("Deprecated in Java")
override fun onPostExecute(result: RemoteOperationResult<UserInfo?>?) {
if (result != null) {
result?.let {
val listener = mListener.get()
listener?.onAuthenticatorTaskCallback(result)
listener?.onAuthenticatorTaskCallback(it)
}
}