Merge pull request #11546 from nextcloud/remoteOperation

Use resultData for Push and Notifications
This commit is contained in:
Andy Scherzinger 2023-06-02 18:03:35 +02:00 committed by GitHub
commit 36e3f42e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 10 deletions

View file

@ -220,14 +220,14 @@ public final class PushUtils {
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, context);
RemoteOperationResult remoteOperationResult =
RemoteOperationResult<PushResponse> 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),

View file

@ -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) {

View file

@ -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<List<Notification>> result = getRemoteNotificationOperation.execute(client);
if (result.isSuccess() && result.getNotificationData() != null) {
final List<Notification> 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