mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 14:05:40 +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) {
|
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(
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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
|
@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)
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue