mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 18:59:18 +03:00
Replace OwnCloudClient instances
Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
This commit is contained in:
parent
739bcd0029
commit
1897ad19d6
1 changed files with 4 additions and 3 deletions
|
@ -29,6 +29,7 @@ import com.nextcloud.client.integrations.deck.DeckApi
|
||||||
import com.owncloud.android.R
|
import com.owncloud.android.R
|
||||||
import com.owncloud.android.datamodel.DecryptedPushMessage
|
import com.owncloud.android.datamodel.DecryptedPushMessage
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient
|
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.OwnCloudClientManagerFactory
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperation
|
import com.owncloud.android.lib.common.operations.RemoteOperation
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC
|
import com.owncloud.android.lib.common.utils.Log_OC
|
||||||
|
@ -236,8 +237,7 @@ class NotificationWork constructor(
|
||||||
}
|
}
|
||||||
val user = optionalUser.get()
|
val user = optionalUser.get()
|
||||||
try {
|
try {
|
||||||
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
val client = OwnCloudClientFactory.createNextcloudClient(user, context)
|
||||||
.getClientFor(user.toOwnCloudAccount(), context)
|
|
||||||
val result = GetNotificationRemoteOperation(decryptedPushMessage.nid)
|
val result = GetNotificationRemoteOperation(decryptedPushMessage.nid)
|
||||||
.execute(client)
|
.execute(client)
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
|
@ -287,6 +287,7 @@ class NotificationWork constructor(
|
||||||
val user = optionalUser.get()
|
val user = optionalUser.get()
|
||||||
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
||||||
.getClientFor(user.toOwnCloudAccount(), context)
|
.getClientFor(user.toOwnCloudAccount(), context)
|
||||||
|
val nextcloudClient = OwnCloudClientFactory.createNextcloudClient(user, context)
|
||||||
val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
|
val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
|
||||||
val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
|
val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
|
||||||
val success: Boolean = if (!actionType.isNullOrEmpty() && !actionLink.isNullOrEmpty()) {
|
val success: Boolean = if (!actionType.isNullOrEmpty() && !actionLink.isNullOrEmpty()) {
|
||||||
|
@ -294,7 +295,7 @@ class NotificationWork constructor(
|
||||||
resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
|
resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
|
||||||
} else {
|
} else {
|
||||||
DeleteNotificationRemoteOperation(numericNotificationId)
|
DeleteNotificationRemoteOperation(numericNotificationId)
|
||||||
.execute(client).isSuccess
|
.execute(nextcloudClient).isSuccess
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
if (oldNotification == null) {
|
if (oldNotification == null) {
|
||||||
|
|
Loading…
Reference in a new issue