diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallNotificationActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallNotificationActivity.java
index c680e0fed..2aeb763e6 100644
--- a/app/src/main/java/com/nextcloud/talk/activities/CallNotificationActivity.java
+++ b/app/src/main/java/com/nextcloud/talk/activities/CallNotificationActivity.java
@@ -280,7 +280,7 @@ public class CallNotificationActivity extends CallBaseActivity {
@Override
public void onNext(@io.reactivex.annotations.NonNull RoomOverall roomOverall) {
- currentConversation = roomOverall.getOcs().data;
+ currentConversation = roomOverall.getOcs().getData();
setUpAfterConversationIsKnown();
if (apiVersion >= 3) {
diff --git a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt
index fbaae9fbf..9fb13ad74 100644
--- a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt
@@ -256,8 +256,8 @@ class MainActivity : BaseActivity(), ActionBarProvider {
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, currentUser)
- bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs.data.token)
- bundle.putString(KEY_ROOM_ID, roomOverall.ocs.data.roomId)
+ bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// FIXME once APIv2 or later is used only, the createRoom already returns all the data
ncApi.getRoom(
@@ -265,7 +265,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
ApiUtils.getUrlForRoom(
apiVersion,
currentUser.baseUrl,
- roomOverall.ocs.data.token
+ roomOverall.ocs!!.data!!.token
)
)
.subscribeOn(Schedulers.io())
@@ -277,11 +277,11 @@ class MainActivity : BaseActivity(), ActionBarProvider {
override fun onNext(roomOverall: RoomOverall) {
bundle.putParcelable(
KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.ocs.data)
+ Parcels.wrap(roomOverall.ocs!!.data)
)
remapChatController(
router!!, currentUser.id,
- roomOverall.ocs.data.token!!, bundle, true
+ roomOverall.ocs!!.data!!.token!!, bundle, true
)
}
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt
index 7da999bcc..4d7f74c5f 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt
@@ -336,7 +336,7 @@ class ChatController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(roomOverall: RoomOverall) {
Log.d(TAG, "getRoomInfo - getRoom - got response: " + startNanoTime)
- currentConversation = roomOverall.ocs.data
+ currentConversation = roomOverall.ocs!!.data
Log.d(
TAG,
"getRoomInfo. token: " + currentConversation?.token +
@@ -401,7 +401,7 @@ class ChatController(args: Bundle) :
override fun onNext(roomsOverall: RoomsOverall) {
Log.d(TAG, "handleFromNotification - getRooms - got response")
- for (conversation in roomsOverall.ocs.data) {
+ for (conversation in roomsOverall.ocs!!.data!!) {
if (roomId == conversation.roomId) {
roomToken = conversation.token
currentConversation = conversation
@@ -1792,7 +1792,7 @@ class ChatController(args: Bundle) :
override fun onNext(roomOverall: RoomOverall) {
Log.d(TAG, "joinRoomWithPassword - joinRoom - got response: " + startNanoTime)
inConversation = true
- currentConversation?.sessionId = roomOverall.ocs.data.sessionId
+ currentConversation?.sessionId = roomOverall.ocs!!.data!!.sessionId
Log.d(TAG, "joinRoomWithPassword - sessionId: " + currentConversation?.sessionId)
ApplicationWideCurrentRoomHolder.getInstance().session =
@@ -2653,15 +2653,15 @@ class ChatController(args: Bundle) :
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
- bundle.putString(KEY_ROOM_TOKEN, roomOverall.getOcs().getData().token)
- bundle.putString(KEY_ROOM_ID, roomOverall.getOcs().getData().roomId)
+ bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// FIXME once APIv2+ is used only, the createRoom already returns all the data
ncApi!!.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, conversationUser?.baseUrl,
- roomOverall.getOcs().getData().token
+ roomOverall.ocs!!.data!!.token
)
)
.subscribeOn(Schedulers.io())
@@ -2674,11 +2674,11 @@ class ChatController(args: Bundle) :
override fun onNext(roomOverall: RoomOverall) {
bundle.putParcelable(
KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.getOcs().getData())
+ Parcels.wrap(roomOverall.ocs!!.data!!)
)
remapChatController(
router, conversationUser!!.id,
- roomOverall.getOcs().getData().token!!, bundle, true
+ roomOverall.ocs!!.data!!.token!!, bundle, true
)
}
@@ -2968,19 +2968,19 @@ class ChatController(args: Bundle) :
val conversationIntent = Intent(activity, CallActivity::class.java)
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
- bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs.data.token)
- bundle.putString(KEY_ROOM_ID, roomOverall.ocs.data.roomId)
+ bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
if (conversationUser != null) {
bundle.putParcelable(
KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.ocs.data)
+ Parcels.wrap(roomOverall.ocs!!.data)
)
conversationIntent.putExtras(bundle)
ConductorRemapping.remapChatController(
router, conversationUser.id,
- roomOverall.ocs.data.token!!, bundle, false
+ roomOverall.ocs!!.data!!.token!!, bundle, false
)
} else {
conversationIntent.putExtras(bundle)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
index 352a81f4e..4af52ea52 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
@@ -263,15 +263,15 @@ class ContactsController(args: Bundle) :
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
- bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().token)
- bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().roomId)
+ bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// FIXME once APIv2 or later is used only, the createRoom already returns all the data
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, currentUser!!.baseUrl,
- roomOverall.getOcs().getData().token
+ roomOverall.ocs!!.data!!.token
)
)
.subscribeOn(Schedulers.io())
@@ -283,11 +283,11 @@ class ContactsController(args: Bundle) :
override fun onNext(roomOverall: RoomOverall) {
bundle.putParcelable(
BundleKeys.KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.getOcs().getData())
+ Parcels.wrap(roomOverall.ocs!!.data!!)
)
ConductorRemapping.remapChatController(
router, currentUser!!.id,
- roomOverall.getOcs().getData().token!!, bundle, true
+ roomOverall.ocs!!.data!!.token!!, bundle, true
)
}
@@ -827,16 +827,16 @@ class ContactsController(args: Bundle) :
if (activity != null) {
val bundle = Bundle()
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
- bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().token)
- bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().roomId)
+ bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
bundle.putParcelable(
BundleKeys.KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.getOcs().getData())
+ Parcels.wrap(roomOverall.ocs!!.data!!)
)
ConductorRemapping.remapChatController(
router,
currentUser!!.id,
- roomOverall.getOcs().getData().token!!,
+ roomOverall.ocs!!.data!!.token!!,
bundle,
true
)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
index 833d757b2..bc6c25a1e 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
@@ -618,7 +618,7 @@ class ConversationInfoController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(roomOverall: RoomOverall) {
try {
- conversation = roomOverall.ocs.data
+ conversation = roomOverall.ocs!!.data
val conversationCopy = conversation
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
index 07facb088..272a7be22 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
@@ -401,7 +401,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController(
}
override fun onNext(roomOverall: RoomOverall) {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
@@ -419,7 +419,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController(
override fun onNext(
roomOverall: RoomOverall
) {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
inviteUsersToAConversation()
}
@@ -460,7 +460,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController(
}
override fun onNext(roomOverall: RoomOverall) {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
if (conversation!!.hasPassword && conversation!!.isGuest) {
eventBus.post(ConversationsListFetchDataEvent())
val bundle = Bundle()
@@ -504,7 +504,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController(
}
override fun onNext(roomOverall: RoomOverall) {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
initiateConversation()
}
@@ -771,11 +771,11 @@ class OperationsMenuController(args: Bundle) : NewBaseController(
}
override fun onNext(roomOverall: RoomOverall) {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
if (operation !== ConversationOperationEnum.OPS_CODE_JOIN_ROOM) {
showResultImage(everythingOK = true, isGuestSupportError = false)
} else {
- conversation = roomOverall.getOcs().getData()
+ conversation = roomOverall.ocs!!.data
initiateConversation()
}
}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.java
deleted file mode 100644
index a86a31802..000000000
--- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * 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 .
- */
-package com.nextcloud.talk.models.json.conversations;
-
-import com.bluelinelabs.logansquare.annotation.JsonField;
-import com.bluelinelabs.logansquare.annotation.JsonObject;
-import com.nextcloud.talk.models.json.generic.GenericOCS;
-
-@JsonObject
-public class RoomOCS extends GenericOCS {
- @JsonField(name = "data")
- public Conversation data;
-
- public Conversation getData() {
- return this.data;
- }
-
- public void setData(Conversation data) {
- this.data = data;
- }
-
- public boolean equals(final Object o) {
- if (o == this) {
- return true;
- }
- if (!(o instanceof RoomOCS)) {
- return false;
- }
- final RoomOCS other = (RoomOCS) o;
- if (!other.canEqual((Object) this)) {
- return false;
- }
- final Object this$data = this.getData();
- final Object other$data = other.getData();
-
- return this$data == null ? other$data == null : this$data.equals(other$data);
- }
-
- protected boolean canEqual(final Object other) {
- return other instanceof RoomOCS;
- }
-
- public int hashCode() {
- final int PRIME = 59;
- int result = 1;
- final Object $data = this.getData();
- result = result * PRIME + ($data == null ? 43 : $data.hashCode());
- return result;
- }
-
- public String toString() {
- return "RoomOCS(data=" + this.getData() + ")";
- }
-}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.kt
new file mode 100644
index 000000000..6ae6fbe67
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOCS.kt
@@ -0,0 +1,40 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Andy Scherzinger
+ * @author Mario Danic
+ * Copyright (C) 2022 Andy Scherzinger
+ * Copyright (C) 2017 Mario Danic
+ *
+ * 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 .
+ */
+package com.nextcloud.talk.models.json.conversations
+
+import android.os.Parcelable
+import com.bluelinelabs.logansquare.annotation.JsonField
+import com.bluelinelabs.logansquare.annotation.JsonObject
+import com.nextcloud.talk.models.json.generic.GenericMeta
+import kotlinx.android.parcel.Parcelize
+
+@Parcelize
+@JsonObject
+data class RoomOCS(
+ @JsonField(name = ["meta"])
+ var meta: GenericMeta?,
+ @JsonField(name = ["data"])
+ var data: Conversation? = null
+) : Parcelable {
+ // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
+ constructor() : this(null, null)
+}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.java
deleted file mode 100644
index e4c53d7cc..000000000
--- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * 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 .
- */
-package com.nextcloud.talk.models.json.conversations;
-
-import com.bluelinelabs.logansquare.annotation.JsonField;
-import com.bluelinelabs.logansquare.annotation.JsonObject;
-
-@JsonObject
-public class RoomOverall {
- @JsonField(name = "ocs")
- public RoomOCS ocs;
-
- public RoomOCS getOcs() {
- return this.ocs;
- }
-
- public void setOcs(RoomOCS ocs) {
- this.ocs = ocs;
- }
-
- public boolean equals(final Object o) {
- if (o == this) {
- return true;
- }
- if (!(o instanceof RoomOverall)) {
- return false;
- }
- final RoomOverall other = (RoomOverall) o;
- if (!other.canEqual((Object) this)) {
- return false;
- }
- final Object this$ocs = this.getOcs();
- final Object other$ocs = other.getOcs();
-
- return this$ocs == null ? other$ocs == null : this$ocs.equals(other$ocs);
- }
-
- protected boolean canEqual(final Object other) {
- return other instanceof RoomOverall;
- }
-
- public int hashCode() {
- final int PRIME = 59;
- int result = 1;
- final Object $ocs = this.getOcs();
- result = result * PRIME + ($ocs == null ? 43 : $ocs.hashCode());
- return result;
- }
-
- public String toString() {
- return "RoomOverall(ocs=" + this.getOcs() + ")";
- }
-}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.kt
new file mode 100644
index 000000000..689f07278
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomOverall.kt
@@ -0,0 +1,37 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Andy Scherzinger
+ * @author Mario Danic
+ * Copyright (C) 2022 Andy Scherzinger
+ * Copyright (C) 2017 Mario Danic
+ *
+ * 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 .
+ */
+package com.nextcloud.talk.models.json.conversations
+
+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 RoomOverall(
+ @JsonField(name = ["ocs"])
+ var ocs: RoomOCS? = null
+) : Parcelable {
+ // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
+ constructor() : this(null)
+}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.java
deleted file mode 100644
index 58555de39..000000000
--- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * 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 .
- */
-package com.nextcloud.talk.models.json.conversations;
-
-import com.bluelinelabs.logansquare.annotation.JsonField;
-import com.bluelinelabs.logansquare.annotation.JsonObject;
-import com.nextcloud.talk.models.json.generic.GenericOCS;
-
-import org.parceler.Parcel;
-
-import java.util.List;
-
-@Parcel
-@JsonObject
-public class RoomsOCS extends GenericOCS {
- @JsonField(name = "data")
- public List data;
-
- public List getData() {
- return this.data;
- }
-
- public void setData(List data) {
- this.data = data;
- }
-
- public boolean equals(final Object o) {
- if (o == this) {
- return true;
- }
- if (!(o instanceof RoomsOCS)) {
- return false;
- }
- final RoomsOCS other = (RoomsOCS) o;
- if (!other.canEqual((Object) this)) {
- return false;
- }
- final Object this$data = this.getData();
- final Object other$data = other.getData();
-
- return this$data == null ? other$data == null : this$data.equals(other$data);
- }
-
- protected boolean canEqual(final Object other) {
- return other instanceof RoomsOCS;
- }
-
- public int hashCode() {
- final int PRIME = 59;
- int result = 1;
- final Object $data = this.getData();
- result = result * PRIME + ($data == null ? 43 : $data.hashCode());
- return result;
- }
-
- public String toString() {
- return "RoomsOCS(data=" + this.getData() + ")";
- }
-}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.kt
new file mode 100644
index 000000000..b99436bc8
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOCS.kt
@@ -0,0 +1,40 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Andy Scherzinger
+ * @author Mario Danic
+ * Copyright (C) 2022 Andy Scherzinger
+ * Copyright (C) 2017 Mario Danic
+ *
+ * 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 .
+ */
+package com.nextcloud.talk.models.json.conversations
+
+import android.os.Parcelable
+import com.bluelinelabs.logansquare.annotation.JsonField
+import com.bluelinelabs.logansquare.annotation.JsonObject
+import com.nextcloud.talk.models.json.generic.GenericMeta
+import kotlinx.android.parcel.Parcelize
+
+@Parcelize
+@JsonObject
+data class RoomsOCS(
+ @JsonField(name = ["meta"])
+ var meta: GenericMeta?,
+ @JsonField(name = ["data"])
+ var data: List? = null
+) : Parcelable {
+ // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
+ constructor() : this(null, null)
+}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.java
deleted file mode 100644
index f8a5c6b24..000000000
--- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * 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 .
- */
-package com.nextcloud.talk.models.json.conversations;
-
-import com.bluelinelabs.logansquare.annotation.JsonField;
-import com.bluelinelabs.logansquare.annotation.JsonObject;
-
-import org.parceler.Parcel;
-
-@Parcel
-@JsonObject
-public class RoomsOverall {
- @JsonField(name = "ocs")
- public RoomsOCS ocs;
-
- public RoomsOCS getOcs() {
- return this.ocs;
- }
-
- public void setOcs(RoomsOCS ocs) {
- this.ocs = ocs;
- }
-
- public boolean equals(final Object o) {
- if (o == this) {
- return true;
- }
- if (!(o instanceof RoomsOverall)) {
- return false;
- }
- final RoomsOverall other = (RoomsOverall) o;
- if (!other.canEqual((Object) this)) {
- return false;
- }
- final Object this$ocs = this.getOcs();
- final Object other$ocs = other.getOcs();
-
- return this$ocs == null ? other$ocs == null : this$ocs.equals(other$ocs);
- }
-
- protected boolean canEqual(final Object other) {
- return other instanceof RoomsOverall;
- }
-
- public int hashCode() {
- final int PRIME = 59;
- int result = 1;
- final Object $ocs = this.getOcs();
- result = result * PRIME + ($ocs == null ? 43 : $ocs.hashCode());
- return result;
- }
-
- public String toString() {
- return "RoomsOverall(ocs=" + this.getOcs() + ")";
- }
-}
diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.kt
new file mode 100644
index 000000000..fb0883c8b
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/RoomsOverall.kt
@@ -0,0 +1,37 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Andy Scherzinger
+ * @author Mario Danic
+ * Copyright (C) 2022 Andy Scherzinger
+ * Copyright (C) 2017 Mario Danic
+ *
+ * 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 .
+ */
+package com.nextcloud.talk.models.json.conversations
+
+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 RoomsOverall(
+ @JsonField(name = ["ocs"])
+ var ocs: RoomsOCS? = null
+) : Parcelable {
+ // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
+ constructor() : this(null)
+}
diff --git a/app/src/main/java/com/nextcloud/talk/ui/bottom/sheet/ProfileBottomSheet.kt b/app/src/main/java/com/nextcloud/talk/ui/bottom/sheet/ProfileBottomSheet.kt
index 1a1cea5df..cb6ea4c12 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/bottom/sheet/ProfileBottomSheet.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/bottom/sheet/ProfileBottomSheet.kt
@@ -149,15 +149,15 @@ class ProfileBottomSheet(val ncApi: NcApi, val userEntity: UserEntity, val route
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, userEntity)
- bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().token)
- bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().roomId)
+ bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
+ bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// FIXME once APIv2+ is used only, the createRoom already returns all the data
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, userEntity.baseUrl,
- roomOverall.getOcs().getData().token
+ roomOverall.ocs!!.data!!.token
)
)
.subscribeOn(Schedulers.io())
@@ -170,11 +170,11 @@ class ProfileBottomSheet(val ncApi: NcApi, val userEntity: UserEntity, val route
override fun onNext(roomOverall: RoomOverall) {
bundle.putParcelable(
BundleKeys.KEY_ACTIVE_CONVERSATION,
- Parcels.wrap(roomOverall.getOcs().getData())
+ Parcels.wrap(roomOverall.ocs!!.data)
)
ConductorRemapping.remapChatController(
router, userEntity.id,
- roomOverall.getOcs().getData().token!!, bundle, true
+ roomOverall.ocs!!.data!!.token!!, bundle, true
)
}