-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tobiasKaminsky <[email protected]>
- Loading branch information
1 parent
4366946
commit 977ff27
Showing
6 changed files
with
30 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,14 @@ | |
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]> | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package com.owncloud.android.lib.resources.notifications; | ||
package com.owncloud.android.lib.resources.notifications | ||
|
||
import com.nextcloud.common.NextcloudClient; | ||
import com.nextcloud.operations.DeleteMethod; | ||
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.nextcloud.common.NextcloudClient | ||
import com.nextcloud.operations.DeleteMethod | ||
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 java.io.IOException | ||
|
||
/** | ||
* Delete all notification, specified at | ||
|
@@ -24,17 +25,17 @@ class DeleteAllNotificationsRemoteOperation : RemoteOperation<Void>() { | |
var delete: DeleteMethod? = null | ||
val url = client.baseUri.toString() + OCS_ROUTE_LIST_V12_AND_UP | ||
try { | ||
delete = new DeleteMethod(url, true) | ||
delete = DeleteMethod(url, true) | ||
|
||
status = client.execute(delete); | ||
String response = delete.getResponseBodyAsString() | ||
status = client.execute(delete) | ||
val response = delete.getResponseBodyAsString() | ||
|
||
if (delete.isSuccess()) { | ||
result = new RemoteOperationResult<>(true, delete) | ||
Log_OC.d(this, "Successful response: " + response) | ||
result = RemoteOperationResult(true, delete) | ||
Log_OC.d(this, "Successful response: $response") | ||
} else { | ||
result = new RemoteOperationResult<>(false, delete) | ||
Log_OC.e(this, "Failed response while deleting user notifications ") | ||
result = RemoteOperationResult(false, delete) | ||
Log_OC.e(this, "Failed response while deleting all user notifications") | ||
Log_OC.e(this, "*** status code: $status ;response message: $response") | ||
} | ||
} catch (e: IOException) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,14 @@ | |
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]> | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package com.owncloud.android.lib.resources.notifications; | ||
package com.owncloud.android.lib.resources.notifications | ||
|
||
import com.nextcloud.common.NextcloudClient; | ||
import com.nextcloud.operations.DeleteMethod; | ||
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.nextcloud.common.NextcloudClient | ||
import com.nextcloud.operations.DeleteMethod | ||
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 java.io.IOException | ||
|
||
/** | ||
* Delete a notification, specified at | ||
|
@@ -46,13 +47,8 @@ class DeleteNotificationRemoteOperation(private val id: Int) : RemoteOperation<V | |
return result | ||
} | ||
|
||
private fun isSuccess(status: Int): Boolean { | ||
return status == HttpStatus.SC_OK | ||
} | ||
|
||
companion object { | ||
// OCS Route | ||
private const val OCS_ROUTE_LIST_V12_AND_UP = | ||
"/ocs/v2.php/apps/notifications/api/v2/notifications/" | ||
private const val OCS_ROUTE_LIST_V12_AND_UP = "/ocs/v2.php/apps/notifications/api/v2/notifications/" | ||
} | ||
} |