mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 14:24:05 +01:00
Migrate conversation model to kotlin data classes
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
961ed32206
commit
9312a62af9
@ -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) {
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* 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.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)
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* 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.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)
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Conversation> data;
|
||||
|
||||
public List<Conversation> getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public void setData(List<Conversation> 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() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* 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.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<Conversation>? = null
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null, 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* 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.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)
|
||||
}
|
@ -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
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user