mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
Add GenericOCS
responses contain "ocs" which was deleted by aab00c5e8f
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
10753d039e
commit
2435d8d296
5 changed files with 47 additions and 7 deletions
|
@ -988,7 +988,7 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||
}
|
||||
|
||||
override fun onNext(genericOverall: GenericOverall) {
|
||||
val statusCode = genericOverall.meta?.statusCode
|
||||
val statusCode = genericOverall.ocs?.meta?.statusCode
|
||||
if (statusCode == HTTP_CODE) {
|
||||
dialog.dismiss()
|
||||
Toast.makeText(
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.nextcloud.talk.R;
|
|||
import com.nextcloud.talk.api.NcApi;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.models.json.generic.GenericMeta;
|
||||
import com.nextcloud.talk.models.json.generic.GenericOverall;
|
||||
import com.nextcloud.talk.models.json.push.PushConfigurationState;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
|
@ -110,14 +111,16 @@ public class AccountRemovalWorker extends Worker {
|
|||
|
||||
@Override
|
||||
public void onNext(@NotNull GenericOverall genericOverall) {
|
||||
if (Objects.requireNonNull(genericOverall.getMeta()).getStatusCode() == 200 ||
|
||||
genericOverall.getMeta().getStatusCode() == 202) {
|
||||
GenericMeta meta = Objects.requireNonNull(genericOverall.getOcs()).getMeta();
|
||||
int statusCode = Objects.requireNonNull(meta).getStatusCode();
|
||||
|
||||
if (statusCode == 200 || statusCode == 202) {
|
||||
HashMap<String, String> queryMap = new HashMap<>();
|
||||
queryMap.put("deviceIdentifier",
|
||||
finalPushConfigurationState.getDeviceIdentifier());
|
||||
queryMap.put("userPublicKey", finalPushConfigurationState.getUserPublicKey());
|
||||
queryMap.put("deviceIdentifierSignature",
|
||||
finalPushConfigurationState.getDeviceIdentifierSignature());
|
||||
finalPushConfigurationState.getDeviceIdentifierSignature());
|
||||
unregisterDeviceForNotificationWithProxy(queryMap, userEntity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.generic
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@JsonObject
|
||||
data class GenericOCS(
|
||||
@JsonField(name = ["meta"])
|
||||
var meta: GenericMeta? = null
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null)
|
||||
}
|
|
@ -29,8 +29,8 @@ import kotlinx.android.parcel.Parcelize
|
|||
@Parcelize
|
||||
@JsonObject
|
||||
data class GenericOverall(
|
||||
@JsonField(name = ["meta"])
|
||||
var meta: GenericMeta? = null
|
||||
@JsonField(name = ["ocs"])
|
||||
var ocs: GenericOCS? = null
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null)
|
||||
|
|
|
@ -321,7 +321,7 @@ class MessageActionsDialog(
|
|||
}
|
||||
|
||||
override fun onNext(@NonNull genericOverall: GenericOverall) {
|
||||
val statusCode = genericOverall.meta?.statusCode
|
||||
val statusCode = genericOverall.ocs?.meta?.statusCode
|
||||
if (statusCode == HTTP_CREATED) {
|
||||
chatController.updateAdapterAfterSendReaction(message, emoji)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue