From 1897ad19d65c081ee78c8bbc95395be9f4f2a137 Mon Sep 17 00:00:00 2001 From: ZetaTom <70907959+ZetaTom@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:50:12 +0100 Subject: [PATCH] Replace OwnCloudClient instances Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com> --- .../java/com/nextcloud/client/jobs/NotificationWork.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt b/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt index 9e560a907f..e6f37a16e2 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt @@ -29,6 +29,7 @@ import com.nextcloud.client.integrations.deck.DeckApi import com.owncloud.android.R import com.owncloud.android.datamodel.DecryptedPushMessage import com.owncloud.android.lib.common.OwnCloudClient +import com.owncloud.android.lib.common.OwnCloudClientFactory import com.owncloud.android.lib.common.OwnCloudClientManagerFactory import com.owncloud.android.lib.common.operations.RemoteOperation import com.owncloud.android.lib.common.utils.Log_OC @@ -236,8 +237,7 @@ class NotificationWork constructor( } val user = optionalUser.get() try { - val client = OwnCloudClientManagerFactory.getDefaultSingleton() - .getClientFor(user.toOwnCloudAccount(), context) + val client = OwnCloudClientFactory.createNextcloudClient(user, context) val result = GetNotificationRemoteOperation(decryptedPushMessage.nid) .execute(client) if (result.isSuccess) { @@ -287,6 +287,7 @@ class NotificationWork constructor( val user = optionalUser.get() val client = OwnCloudClientManagerFactory.getDefaultSingleton() .getClientFor(user.toOwnCloudAccount(), context) + val nextcloudClient = OwnCloudClientFactory.createNextcloudClient(user, context) val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE) val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK) val success: Boolean = if (!actionType.isNullOrEmpty() && !actionLink.isNullOrEmpty()) { @@ -294,7 +295,7 @@ class NotificationWork constructor( resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED } else { DeleteNotificationRemoteOperation(numericNotificationId) - .execute(client).isSuccess + .execute(nextcloudClient).isSuccess } if (success) { if (oldNotification == null) {