|
@@ -25,6 +25,8 @@ package com.nextcloud.ui
|
|
|
import android.accounts.Account
|
|
|
import android.content.Context
|
|
|
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
|
|
+import com.owncloud.android.lib.common.accounts.AccountUtils
|
|
|
+import com.owncloud.android.lib.common.utils.Log_OC
|
|
|
import com.owncloud.android.lib.resources.users.SetUserDefinedCustomStatusMessageRemoteOperation
|
|
|
|
|
|
public class SetUserDefinedCustomStatusTask(
|
|
@@ -35,8 +37,14 @@ public class SetUserDefinedCustomStatusTask(
|
|
|
val context: Context?
|
|
|
) : Function0<Boolean> {
|
|
|
override fun invoke(): Boolean {
|
|
|
- val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
|
|
+ return try {
|
|
|
+ val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
|
|
|
|
|
- return SetUserDefinedCustomStatusMessageRemoteOperation(message, icon, clearAt).execute(client).isSuccess
|
|
|
+ return SetUserDefinedCustomStatusMessageRemoteOperation(message, icon, clearAt).execute(client).isSuccess
|
|
|
+ } catch (e: AccountUtils.AccountNotFoundException) {
|
|
|
+ Log_OC.e(this, "Error setting user defined custom status", e)
|
|
|
+
|
|
|
+ false
|
|
|
+ }
|
|
|
}
|
|
|
}
|