Add GenericOCS

responses contain "ocs" which was deleted by aab00c5e8f

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-05-27 16:02:46 +02:00
parent 10753d039e
commit 2435d8d296
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
5 changed files with 47 additions and 7 deletions

View file

@ -988,7 +988,7 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
} }
override fun onNext(genericOverall: GenericOverall) { override fun onNext(genericOverall: GenericOverall) {
val statusCode = genericOverall.meta?.statusCode val statusCode = genericOverall.ocs?.meta?.statusCode
if (statusCode == HTTP_CODE) { if (statusCode == HTTP_CODE) {
dialog.dismiss() dialog.dismiss()
Toast.makeText( Toast.makeText(

View file

@ -35,6 +35,7 @@ import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi; import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.database.UserEntity; 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.generic.GenericOverall;
import com.nextcloud.talk.models.json.push.PushConfigurationState; import com.nextcloud.talk.models.json.push.PushConfigurationState;
import com.nextcloud.talk.utils.ApiUtils; import com.nextcloud.talk.utils.ApiUtils;
@ -110,8 +111,10 @@ public class AccountRemovalWorker extends Worker {
@Override @Override
public void onNext(@NotNull GenericOverall genericOverall) { public void onNext(@NotNull GenericOverall genericOverall) {
if (Objects.requireNonNull(genericOverall.getMeta()).getStatusCode() == 200 || GenericMeta meta = Objects.requireNonNull(genericOverall.getOcs()).getMeta();
genericOverall.getMeta().getStatusCode() == 202) { int statusCode = Objects.requireNonNull(meta).getStatusCode();
if (statusCode == 200 || statusCode == 202) {
HashMap<String, String> queryMap = new HashMap<>(); HashMap<String, String> queryMap = new HashMap<>();
queryMap.put("deviceIdentifier", queryMap.put("deviceIdentifier",
finalPushConfigurationState.getDeviceIdentifier()); finalPushConfigurationState.getDeviceIdentifier());

View file

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

View file

@ -29,8 +29,8 @@ import kotlinx.android.parcel.Parcelize
@Parcelize @Parcelize
@JsonObject @JsonObject
data class GenericOverall( data class GenericOverall(
@JsonField(name = ["meta"]) @JsonField(name = ["ocs"])
var meta: GenericMeta? = null var ocs: GenericOCS? = null
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null) constructor() : this(null)

View file

@ -321,7 +321,7 @@ class MessageActionsDialog(
} }
override fun onNext(@NonNull genericOverall: GenericOverall) { override fun onNext(@NonNull genericOverall: GenericOverall) {
val statusCode = genericOverall.meta?.statusCode val statusCode = genericOverall.ocs?.meta?.statusCode
if (statusCode == HTTP_CREATED) { if (statusCode == HTTP_CREATED) {
chatController.updateAdapterAfterSendReaction(message, emoji) chatController.updateAdapterAfterSendReaction(message, emoji)
} }