From cd0aa47855a5c93aa2638b9f06f16c3e408c83f6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 20 Apr 2023 12:17:47 +0200 Subject: [PATCH 1/2] Use resultData for Push and Notifications Signed-off-by: tobiasKaminsky --- .../java/com/owncloud/android/utils/PushUtils.java | 4 ++-- .../com/nextcloud/client/jobs/NotificationWork.kt | 2 +- .../android/ui/activity/NotificationsActivity.java | 11 ++++------- build.gradle | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/gplay/java/com/owncloud/android/utils/PushUtils.java b/app/src/gplay/java/com/owncloud/android/utils/PushUtils.java index 57ae513486..a6ce47396b 100644 --- a/app/src/gplay/java/com/owncloud/android/utils/PushUtils.java +++ b/app/src/gplay/java/com/owncloud/android/utils/PushUtils.java @@ -220,14 +220,14 @@ public final class PushUtils { OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton(). getClientFor(ocAccount, context); - RemoteOperationResult remoteOperationResult = + RemoteOperationResult remoteOperationResult = new RegisterAccountDeviceForNotificationsOperation(pushTokenHash, publicKey, context.getResources().getString(R.string.push_server_url)) .execute(client); if (remoteOperationResult.isSuccess()) { - PushResponse pushResponse = remoteOperationResult.getPushResponseData(); + PushResponse pushResponse = remoteOperationResult.getResultData(); RemoteOperationResult resultProxy = new RegisterAccountDeviceForProxyOperation( context.getResources().getString(R.string.push_server_url), 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 311567c11c..0c4d2466c6 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt @@ -256,7 +256,7 @@ class NotificationWork constructor( val result = GetNotificationRemoteOperation(decryptedPushMessage.nid) .execute(client) if (result.isSuccess) { - val notification = result.notificationData[0] + val notification = result.resultData sendNotification(notification, account) } } catch (e: Exception) { diff --git a/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java index 4308de3b8b..21bc674acc 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java @@ -40,7 +40,6 @@ import com.owncloud.android.databinding.NotificationsLayoutBinding; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.ArbitraryDataProviderImpl; import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.notifications.GetNotificationsRemoteOperation; @@ -226,13 +225,11 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio Thread t = new Thread(() -> { initializeAdapter(); - RemoteOperation getRemoteNotificationOperation = new GetNotificationsRemoteOperation(); - final RemoteOperationResult result = getRemoteNotificationOperation.execute(client); + GetNotificationsRemoteOperation getRemoteNotificationOperation = new GetNotificationsRemoteOperation(); + final RemoteOperationResult> result = getRemoteNotificationOperation.execute(client); - if (result.isSuccess() && result.getNotificationData() != null) { - final List notifications = result.getNotificationData(); - - runOnUiThread(() -> populateList(notifications)); + if (result.isSuccess() && result.getResultData() != null) { + runOnUiThread(() -> populateList(result.getResultData())); } else { Log_OC.d(TAG, result.getLogMessage()); // show error diff --git a/build.gradle b/build.gradle index f4772b6722..28744e64e4 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { daggerVersion = "2.46.1" markwonVersion = "4.6.2" prismVersion = "2.0.0" - androidLibraryVersion = "master-SNAPSHOT" + androidLibraryVersion = "remoteOperation-SNAPSHOT" mockitoVersion = "4.11.0" mockitoKotlinVersion = "4.1.0" mockkVersion = "1.13.3" From aaa0fc08758bb1667c2a82409e1704c8a1a66e62 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 2 Jun 2023 16:29:16 +0200 Subject: [PATCH 2/2] revert back to master lib Signed-off-by: Andy Scherzinger --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 28744e64e4..f4772b6722 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { daggerVersion = "2.46.1" markwonVersion = "4.6.2" prismVersion = "2.0.0" - androidLibraryVersion = "remoteOperation-SNAPSHOT" + androidLibraryVersion = "master-SNAPSHOT" mockitoVersion = "4.11.0" mockitoKotlinVersion = "4.1.0" mockkVersion = "1.13.3"