diff --git a/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt b/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt index 87a41d545..02668fb98 100644 --- a/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt +++ b/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt @@ -191,16 +191,16 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { if (delete) { cancelExistingNotificationWithId( applicationContext, - signatureVerification!!.userEntity, + signatureVerification!!.userEntity!!, notificationId ) } else if (deleteAll) { - cancelAllNotificationsForAccount(applicationContext, signatureVerification!!.userEntity) + cancelAllNotificationsForAccount(applicationContext, signatureVerification!!.userEntity!!) } else if (deleteMultiple) { notificationIds!!.forEach { cancelExistingNotificationWithId( applicationContext, - signatureVerification!!.userEntity, + signatureVerification!!.userEntity!!, it ) } @@ -222,7 +222,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { val soundUri = getCallRingtoneUri(applicationContext!!, appPreferences!!) val notificationChannelId = NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V4 - val uri = Uri.parse(signatureVerification!!.userEntity.baseUrl) + val uri = Uri.parse(signatureVerification!!.userEntity!!.baseUrl) val baseUrl = uri.host val notification = @@ -275,10 +275,13 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { ) ncApi.getPeersForCall( - ApiUtils.getCredentials(signatureVerification.userEntity.username, signatureVerification.userEntity.token), + ApiUtils.getCredentials( + signatureVerification.userEntity!!.username, + signatureVerification.userEntity!!.token + ), ApiUtils.getUrlForCall( apiVersion, - signatureVerification.userEntity.baseUrl, + signatureVerification.userEntity!!.baseUrl, decryptedPushMessage.id ) ) @@ -298,7 +301,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { hasParticipantsInCall = participantList.isNotEmpty() if (hasParticipantsInCall) { for (participant in participantList) { - if (participant.actorId == signatureVerification.userEntity.userId && + if (participant.actorId == signatureVerification.userEntity!!.userId && participant.actorType == Participant.ActorType.USERS ) { inCallOnDifferentDevice = true diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index b4430b314..541f259dd 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -268,11 +268,6 @@ public class CallActivity extends CallBaseActivity { private AudioOutputDialog audioOutputDialog; - @Parcel - public enum CallStatus { - CONNECTING, CALLING_TIMEOUT, JOINED, IN_CONVERSATION, RECONNECTING, OFFLINE, LEAVING, PUBLISHER_FAILED - } - @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { 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 34a73294b..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) { @@ -288,7 +288,7 @@ public class CallNotificationActivity extends CallBaseActivity { CapabilitiesUtil.hasSpreedFeatureCapability(userBeingCalled, "conversation-call-flags"); if (hasCallFlags) { - if (isInCallWithVideo(currentConversation.callFlag)) { + if (isInCallWithVideo(currentConversation.getCallFlag())) { binding.incomingCallVoiceOrVideoTextView.setText( String.format(getResources().getString(R.string.nc_call_video), getResources().getString(R.string.nc_app_product_name))); diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallStatus.kt b/app/src/main/java/com/nextcloud/talk/activities/CallStatus.kt new file mode 100644 index 000000000..6810544b9 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/activities/CallStatus.kt @@ -0,0 +1,28 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * + * 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.activities + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +@Parcelize +enum class CallStatus : Parcelable { + CONNECTING, CALLING_TIMEOUT, JOINED, IN_CONVERSATION, RECONNECTING, OFFLINE, LEAVING, PUBLISHER_FAILED +} 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 c3ca78e90..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/adapters/items/ConversationItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java index a88ca786f..104523f8a 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java @@ -165,10 +165,10 @@ public class ConversationItem extends AbstractFlexibleItem 0) { - for (key in message.messageParameters.keys) { - val individualHashMap: Map = message.messageParameters[key]!! + if (message.messageParameters != null && message.messageParameters!!.size > 0) { + for (key in message.messageParameters!!.keys) { + val individualHashMap: Map = message.messageParameters!![key]!! if (individualHashMap["type"] == "geo-location") { locationLon = individualHashMap["longitude"] locationLat = individualHashMap["latitude"] diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt index 1467ee5eb..a7e904da4 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt @@ -154,7 +154,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message private fun updateDownloadState(message: ChatMessage) { // check if download worker is already running - val fileId = message.getSelectedIndividualHashMap()["id"] + val fileId = message.selectedIndividualHashMap!!["id"] val workers = WorkManager.getInstance(context!!).getWorkInfosByTag(fileId!!) try { @@ -206,11 +206,11 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message } private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) { - val author: String = message.actorDisplayName + val author: String = message.actorDisplayName!! if (!TextUtils.isEmpty(author)) { binding.messageAuthor.text = author binding.messageUserAvatar.setOnClickListener { - (payload as? ProfileBottomSheet)?.showFor(message.actorId, itemView.context) + (payload as? ProfileBottomSheet)?.showFor(message.actorId!!, itemView.context) } } else { binding.messageAuthor.setText(R.string.nc_nick_guest) @@ -281,13 +281,13 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message private fun setParentMessageDataOnMessageItem(message: ChatMessage) { if (!message.isDeleted && message.parentMessage != null) { val parentChatMessage = message.parentMessage - parentChatMessage.activeUser = message.activeUser - parentChatMessage.imageUrl?.let { + parentChatMessage!!.activeUser = message.activeUser + parentChatMessage!!.imageUrl?.let { binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE binding.messageQuote.quotedMessageImage.load(it) { addHeader( "Authorization", - ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token) + ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token) ) } } ?: run { @@ -300,7 +300,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message binding.messageQuote.quotedMessageAuthor .setTextColor(ContextCompat.getColor(context!!, R.color.textColorMaxContrast)) - if (parentChatMessage.actorId?.equals(message.activeUser.userId) == true) { + if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) { binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.colorPrimary) } else { binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.kt index 2f51e9f63..d098ba697 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.kt @@ -120,7 +120,7 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message binding.messageQuote.quotedChatMessageView.visibility = View.GONE } - itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.isReplyable) + itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.replyable) Reaction().showReactions(message, binding.reactions, binding.messageText.context, false) binding.reactions.reactionsEmojiWrapper.setOnClickListener { @@ -136,7 +136,7 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message if (!TextUtils.isEmpty(message.actorDisplayName)) { binding.messageAuthor.text = message.actorDisplayName binding.messageUserAvatar.setOnClickListener { - (payload as? ProfileBottomSheet)?.showFor(message.actorId, itemView.context) + (payload as? ProfileBottomSheet)?.showFor(message.actorId!!, itemView.context) } } else { binding.messageAuthor.setText(R.string.nc_nick_guest) @@ -169,13 +169,13 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message private fun processParentMessage(message: ChatMessage) { val parentChatMessage = message.parentMessage - parentChatMessage.activeUser = message.activeUser + parentChatMessage!!.activeUser = message.activeUser parentChatMessage.imageUrl?.let { binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE binding.messageQuote.quotedMessageImage.load(it) { addHeader( "Authorization", - ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token) + ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token) ) } } ?: run { @@ -188,7 +188,7 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message binding.messageQuote.quotedMessageAuthor .setTextColor(ContextCompat.getColor(context!!, R.color.textColorMaxContrast)) - if (parentChatMessage.actorId?.equals(message.activeUser.userId) == true) { + if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) { binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.colorPrimary) } else { binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast) @@ -226,13 +226,13 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message } private fun processMessageParameters( - messageParameters: HashMap>, + messageParameters: HashMap>, message: ChatMessage, messageString: Spannable ): Spannable { var messageStringInternal = messageString for (key in messageParameters.keys) { - val individualHashMap = message.messageParameters[key] + val individualHashMap = message.messageParameters!![key] if (individualHashMap != null) { if ( individualHashMap["type"] == "user" || diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.kt index 83bb89d1f..d4508c8e1 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.kt @@ -66,7 +66,7 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage override fun onBind(message: ChatMessage) { super.onBind(message) sharedApplication!!.componentApplication.inject(this) - val messageParameters: HashMap>? = message.messageParameters + val messageParameters: HashMap>? = message.messageParameters var messageString: Spannable = SpannableString(message.text) realView.isSelected = false binding.messageTime.setTextColor(context!!.resources.getColor(R.color.white60)) @@ -119,7 +119,7 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage binding.checkMark.setContentDescription(readStatusContentDescriptionString) - itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.isReplyable) + itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.replyable) Reaction().showReactions(message, binding.reactions, context!!, true) binding.reactions.reactionsEmojiWrapper.setOnClickListener { @@ -133,13 +133,13 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage private fun processParentMessage(message: ChatMessage) { val parentChatMessage = message.parentMessage - parentChatMessage.activeUser = message.activeUser + parentChatMessage!!.activeUser = message.activeUser parentChatMessage.imageUrl?.let { binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE binding.messageQuote.quotedMessageImage.load(it) { addHeader( "Authorization", - ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token) + ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token) ) } } ?: run { @@ -183,13 +183,13 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage } private fun processMessageParameters( - messageParameters: HashMap>, + messageParameters: HashMap>, message: ChatMessage, messageString: Spannable ): Spannable { var messageString1 = messageString for (key in messageParameters.keys) { - val individualHashMap: HashMap? = message.messageParameters[key] + val individualHashMap: HashMap? = message.messageParameters!![key] if (individualHashMap != null) { if (individualHashMap["type"] == "user" || individualHashMap["type"] == "guest" || diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java index 753dc3604..8cce972d4 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java @@ -116,8 +116,8 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom public void onBind(ChatMessage message) { super.onBind(message); if (userAvatar != null) { - if (message.isGrouped || message.isOneToOneConversation) { - if (message.isOneToOneConversation) { + if (message.isGrouped() || message.isOneToOneConversation()) { + if (message.isOneToOneConversation()) { userAvatar.setVisibility(View.GONE); } else { userAvatar.setVisibility(View.INVISIBLE); @@ -126,11 +126,11 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom userAvatar.setVisibility(View.VISIBLE); userAvatar.setOnClickListener(v -> { if (payload instanceof ProfileBottomSheet) { - ((ProfileBottomSheet) payload).showFor(message.actorId, v.getContext()); + ((ProfileBottomSheet) payload).showFor(message.getActorId(), v.getContext()); } }); - if (ACTOR_TYPE_BOTS.equals(message.actorType) && ACTOR_ID_CHANGELOG.equals(message.actorId)) { + if (ACTOR_TYPE_BOTS.equals(message.getActorType()) && ACTOR_ID_CHANGELOG.equals(message.getActorId())) { if (context != null) { Drawable[] layers = new Drawable[2]; layers[0] = ContextCompat.getDrawable(context, R.drawable.ic_launcher_background); @@ -148,9 +148,9 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom clickView = getImage(); getMessageText().setVisibility(View.VISIBLE); - if (message.getMessageType() == ChatMessage.MessageType.SINGLE_NC_ATTACHMENT_MESSAGE) { + if (message.getCalculateMessageType() == ChatMessage.MessageType.SINGLE_NC_ATTACHMENT_MESSAGE) { - fileViewerUtils = new FileViewerUtils(context, message.activeUser); + fileViewerUtils = new FileViewerUtils(context, message.getActiveUser()); String fileName = message.getSelectedIndividualHashMap().get(KEY_NAME); getMessageText().setText(fileName); @@ -177,10 +177,13 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom Drawable drawable = ContextCompat.getDrawable(context, drawableResourceId); image.getHierarchy().setPlaceholderImage(drawable); } else { - fetchFileInformation("/" + message.getSelectedIndividualHashMap().get(KEY_PATH), message.activeUser); + fetchFileInformation("/" + message.getSelectedIndividualHashMap().get(KEY_PATH), + message.getActiveUser()); } - if (message.activeUser != null && message.activeUser.getUsername() != null && message.activeUser.getBaseUrl() != null) { + if (message.getActiveUser() != null && + message.getActiveUser().getUsername() != null && + message.getActiveUser().getBaseUrl() != null) { clickView.setOnClickListener(v -> fileViewerUtils.openFile( message, @@ -202,10 +205,10 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom message.getSelectedIndividualHashMap().get(MagicPreviewMessageViewHolder.KEY_MIMETYPE), new FileViewerUtils.ProgressUi(progressBar, getMessageText(), image)); - } else if (message.getMessageType() == ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE) { + } else if (message.getCalculateMessageType() == ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE) { getMessageText().setText("GIPHY"); DisplayUtils.setClickableString("GIPHY", "https://giphy.com", getMessageText()); - } else if (message.getMessageType() == ChatMessage.MessageType.SINGLE_LINK_TENOR_MESSAGE) { + } else if (message.getCalculateMessageType() == ChatMessage.MessageType.SINGLE_LINK_TENOR_MESSAGE) { getMessageText().setText("Tenor"); DisplayUtils.setClickableString("Tenor", "https://tenor.com", getMessageText()); } else { @@ -221,7 +224,7 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom getMessageText().setText(""); } - itemView.setTag(REPLYABLE_VIEW_TAG, message.isReplyable()); + itemView.setTag(REPLYABLE_VIEW_TAG, message.getReplyable()); reactionsBinding = getReactionsBinding(); new Reaction().showReactions(message, reactionsBinding, getMessageText().getContext(), true); @@ -307,7 +310,7 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom new Handler(context.getMainLooper()).post(() -> { int resourceId = DrawableUtils .INSTANCE - .getDrawableResourceIdForMimeType(browserFileList.get(0).mimeType); + .getDrawableResourceIdForMimeType(browserFileList.get(0).getMimeType()); Drawable drawable = ContextCompat.getDrawable(context, resourceId); image.getHierarchy().setPlaceholderImage(drawable); }); diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicSystemMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicSystemMessageViewHolder.java index f61407da3..21fda08be 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicSystemMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicSystemMessageViewHolder.java @@ -76,9 +76,9 @@ public class MagicSystemMessageViewHolder extends MessageHolders.IncomingTextMes Spannable messageString = new SpannableString(message.getText()); - if (message.messageParameters != null && message.messageParameters.size() > 0) { - for (String key : message.messageParameters.keySet()) { - Map individualMap = message.messageParameters.get(key); + if (message.getMessageParameters() != null && message.getMessageParameters().size() > 0) { + for (String key : message.getMessageParameters().keySet()) { + Map individualMap = message.getMessageParameters().get(key); if (individualMap != null && individualMap.containsKey("name")) { String searchText; @@ -97,6 +97,6 @@ public class MagicSystemMessageViewHolder extends MessageHolders.IncomingTextMes text.setText(messageString); - itemView.setTag(REPLYABLE_VIEW_TAG, message.isReplyable()); + itemView.setTag(REPLYABLE_VIEW_TAG, message.getReplyable()); } } diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingLocationMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingLocationMessageViewHolder.kt index 40b85ca97..91fb93583 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingLocationMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingLocationMessageViewHolder.kt @@ -126,9 +126,9 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders @SuppressLint("SetJavaScriptEnabled", "ClickableViewAccessibility") private fun setLocationDataOnMessageItem(message: ChatMessage) { - if (message.messageParameters != null && message.messageParameters.size > 0) { - for (key in message.messageParameters.keys) { - val individualHashMap: Map = message.messageParameters[key]!! + if (message.messageParameters != null && message.messageParameters!!.size > 0) { + for (key in message.messageParameters!!.keys) { + val individualHashMap: Map = message.messageParameters!![key]!! if (individualHashMap["type"] == "geo-location") { locationLon = individualHashMap["longitude"] locationLat = individualHashMap["latitude"] @@ -185,13 +185,13 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders private fun setParentMessageDataOnMessageItem(message: ChatMessage) { if (!message.isDeleted && message.parentMessage != null) { val parentChatMessage = message.parentMessage - parentChatMessage.activeUser = message.activeUser + parentChatMessage!!.activeUser = message.activeUser parentChatMessage.imageUrl?.let { binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE binding.messageQuote.quotedMessageImage.load(it) { addHeader( "Authorization", - ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token) + ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token) ) } } ?: run { diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt index 198ccb29c..b964d3b1f 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt @@ -180,7 +180,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders private fun updateDownloadState(message: ChatMessage) { // check if download worker is already running - val fileId = message.getSelectedIndividualHashMap()["id"] + val fileId = message.selectedIndividualHashMap!!["id"] val workers = WorkManager.getInstance(context!!).getWorkInfosByTag(fileId!!) try { @@ -235,13 +235,13 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders private fun setParentMessageDataOnMessageItem(message: ChatMessage) { if (!message.isDeleted && message.parentMessage != null) { val parentChatMessage = message.parentMessage - parentChatMessage.activeUser = message.activeUser + parentChatMessage!!.activeUser = message.activeUser parentChatMessage.imageUrl?.let { binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE binding.messageQuote.quotedMessageImage.load(it) { addHeader( "Authorization", - ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token) + ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token) ) } } ?: run { diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt index c4eafffe4..08ae5d868 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt @@ -44,10 +44,10 @@ class Reaction { isOutgoingMessage: Boolean ) { binding.reactionsEmojiWrapper.removeAllViews() - if (message.reactions != null && message.reactions.isNotEmpty()) { + if (message.reactions != null && message.reactions!!.isNotEmpty()) { var remainingEmojisToDisplay = MAX_EMOJIS_TO_DISPLAY - val showInfoAboutMoreEmojis = message.reactions.size > MAX_EMOJIS_TO_DISPLAY + val showInfoAboutMoreEmojis = message.reactions!!.size > MAX_EMOJIS_TO_DISPLAY val textColor = getTextColor(context, isOutgoingMessage, binding) val amountParams = getAmountLayoutParams(context) @@ -57,7 +57,7 @@ class Reaction { val paddingTop = DisplayUtils.convertDpToPixel(WRAPPER_PADDING_TOP, context).toInt() val paddingBottom = DisplayUtils.convertDpToPixel(WRAPPER_PADDING_BOTTOM, context).toInt() - for ((emoji, amount) in message.reactions) { + for ((emoji, amount) in message.reactions!!) { val emojiWithAmountWrapper = getEmojiWithAmountWrapperLayout( context, message, @@ -99,8 +99,8 @@ class Reaction { emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams if (message.reactionsSelf != null && - message.reactionsSelf.isNotEmpty() && - message.reactionsSelf.contains(emoji) + message.reactionsSelf!!.isNotEmpty() && + message.reactionsSelf!!.contains(emoji) ) { emojiWithAmountWrapper.background = AppCompatResources.getDrawable(context, R.drawable.reaction_self_background) diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/adapters/items/BrowserFileItem.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/adapters/items/BrowserFileItem.java index 9486cd8df..274b849f6 100644 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/adapters/items/BrowserFileItem.java +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/adapters/items/BrowserFileItem.java @@ -129,7 +129,7 @@ public class BrowserFileItem extends AbstractFlexibleItem - currentPath = objectList[0].getPath() + currentPath = objectList[0].path!! if (activity != null) { activity!!.runOnUiThread { setTitle() } } @@ -256,8 +257,8 @@ abstract class BrowserController(args: Bundle) : override fun onItemClick(view: View, position: Int): Boolean { val browserFile = (adapter!!.getItem(position) as BrowserFileItem).model - if ("inode/directory" == browserFile.getMimeType()) { - fetchPath(browserFile.getPath()) + if ("inode/directory" == browserFile.mimeType) { + fetchPath(browserFile.path!!) return true } return false @@ -294,8 +295,8 @@ abstract class BrowserController(args: Bundle) : abstract override fun shouldOnlySelectOneImageFile(): Boolean - @Parcel - enum class BrowserType { + @Parcelize + enum class BrowserType : Parcelable { FILE_BROWSER, DAV_BROWSER } diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.java deleted file mode 100644 index ac3dde1be..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.components.filebrowser.models; - -import android.net.Uri; -import android.text.TextUtils; - -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted; -import com.nextcloud.talk.components.filebrowser.models.properties.NCPermission; -import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview; -import com.nextcloud.talk.components.filebrowser.models.properties.OCFavorite; -import com.nextcloud.talk.components.filebrowser.models.properties.OCId; -import com.nextcloud.talk.components.filebrowser.models.properties.OCSize; - -import org.parceler.Parcel; - -import java.io.File; -import java.util.List; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.Response; -import at.bitfire.dav4jvm.property.DisplayName; -import at.bitfire.dav4jvm.property.GetContentType; -import at.bitfire.dav4jvm.property.GetLastModified; -import at.bitfire.dav4jvm.property.ResourceType; - -@JsonObject -@Parcel -public class BrowserFile { - public String path; - public String displayName; - public String mimeType; - public long modifiedTimestamp; - public long size; - public boolean isFile; - // Used for remote files - public String remoteId; - public boolean hasPreview; - public boolean favorite; - public boolean encrypted; - public String permissions; - private boolean isAllowedToReShare = false; - - public static BrowserFile getModelFromResponse(Response response, String remotePath) { - BrowserFile browserFile = new BrowserFile(); - browserFile.setPath(Uri.decode(remotePath)); - browserFile.setDisplayName(Uri.decode(new File(remotePath).getName())); - final List properties = response.getProperties(); - - for (Property property : properties) { - if (property instanceof OCId) { - browserFile.setRemoteId(((OCId) property).getOcId()); - } - - if (property instanceof ResourceType) { - browserFile.isFile = - !(((ResourceType) property).getTypes().contains(ResourceType.Companion.getCOLLECTION())); - } - - if (property instanceof GetLastModified) { - browserFile.setModifiedTimestamp(((GetLastModified) property).getLastModified()); - } - - if (property instanceof GetContentType) { - browserFile.setMimeType(((GetContentType) property).getType()); - } - - if (property instanceof OCSize) { - browserFile.setSize(((OCSize) property).getOcSize()); - } - - if (property instanceof NCPreview) { - browserFile.setHasPreview(((NCPreview) property).isNcPreview()); - } - - if (property instanceof OCFavorite) { - browserFile.setFavorite(((OCFavorite) property).isOcFavorite()); - } - - if (property instanceof DisplayName) { - browserFile.setDisplayName(((DisplayName) property).getDisplayName()); - } - - if (property instanceof NCEncrypted) { - browserFile.setEncrypted(((NCEncrypted) property).isNcEncrypted()); - } - - if (property instanceof NCPermission) { - browserFile.setPermissions(((NCPermission) property).getNcPermission()); - } - } - - if (browserFile.getPermissions() != null && browserFile.getPermissions().contains("R")) { - browserFile.isAllowedToReShare = true; - } - - if (TextUtils.isEmpty(browserFile.getMimeType()) && !browserFile.isFile()) { - browserFile.setMimeType("inode/directory"); - } - - return browserFile; - } - - public String getPath() { - return this.path; - } - - public String getDisplayName() { - return this.displayName; - } - - public String getMimeType() { - return this.mimeType; - } - - public long getModifiedTimestamp() { - return this.modifiedTimestamp; - } - - public long getSize() { - return this.size; - } - - public boolean isFile() { - return this.isFile; - } - - public String getRemoteId() { - return this.remoteId; - } - - public boolean isHasPreview() { - return this.hasPreview; - } - - public boolean isFavorite() { - return this.favorite; - } - - public boolean isEncrypted() { - return this.encrypted; - } - - public String getPermissions() { - return this.permissions; - } - - public boolean isAllowedToReShare() { - return this.isAllowedToReShare; - } - - public void setPath(String path) { - this.path = path; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public void setModifiedTimestamp(long modifiedTimestamp) { - this.modifiedTimestamp = modifiedTimestamp; - } - - public void setSize(long size) { - this.size = size; - } - - public void setFile(boolean isFile) { - this.isFile = isFile; - } - - public void setRemoteId(String remoteId) { - this.remoteId = remoteId; - } - - public void setHasPreview(boolean hasPreview) { - this.hasPreview = hasPreview; - } - - public void setFavorite(boolean favorite) { - this.favorite = favorite; - } - - public void setEncrypted(boolean encrypted) { - this.encrypted = encrypted; - } - - public void setPermissions(String permissions) { - this.permissions = permissions; - } - - public void setAllowedToReShare(boolean isAllowedToReShare) { - this.isAllowedToReShare = isAllowedToReShare; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof BrowserFile)) { - return false; - } - final BrowserFile other = (BrowserFile) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$path = this.getPath(); - final Object other$path = other.getPath(); - if (this$path == null ? other$path != null : !this$path.equals(other$path)) { - return false; - } - final Object this$displayName = this.getDisplayName(); - final Object other$displayName = other.getDisplayName(); - if (this$displayName == null ? other$displayName != null : !this$displayName.equals(other$displayName)) { - return false; - } - final Object this$mimeType = this.getMimeType(); - final Object other$mimeType = other.getMimeType(); - if (this$mimeType == null ? other$mimeType != null : !this$mimeType.equals(other$mimeType)) { - return false; - } - if (this.getModifiedTimestamp() != other.getModifiedTimestamp()) { - return false; - } - if (this.getSize() != other.getSize()) { - return false; - } - if (this.isFile() != other.isFile()) { - return false; - } - final Object this$remoteId = this.getRemoteId(); - final Object other$remoteId = other.getRemoteId(); - if (this$remoteId == null ? other$remoteId != null : !this$remoteId.equals(other$remoteId)) { - return false; - } - if (this.isHasPreview() != other.isHasPreview()) { - return false; - } - if (this.isFavorite() != other.isFavorite()) { - return false; - } - if (this.isEncrypted() != other.isEncrypted()) { - return false; - } - final Object this$permissions = this.getPermissions(); - final Object other$permissions = other.getPermissions(); - if (this$permissions == null ? other$permissions != null : !this$permissions.equals(other$permissions)) { - return false; - } - - return this.isAllowedToReShare() == other.isAllowedToReShare(); - } - - protected boolean canEqual(final Object other) { - return other instanceof BrowserFile; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $path = this.getPath(); - result = result * PRIME + ($path == null ? 43 : $path.hashCode()); - final Object $displayName = this.getDisplayName(); - result = result * PRIME + ($displayName == null ? 43 : $displayName.hashCode()); - final Object $mimeType = this.getMimeType(); - result = result * PRIME + ($mimeType == null ? 43 : $mimeType.hashCode()); - final long $modifiedTimestamp = this.getModifiedTimestamp(); - result = result * PRIME + (int) ($modifiedTimestamp >>> 32 ^ $modifiedTimestamp); - final long $size = this.getSize(); - result = result * PRIME + (int) ($size >>> 32 ^ $size); - result = result * PRIME + (this.isFile() ? 79 : 97); - final Object $remoteId = this.getRemoteId(); - result = result * PRIME + ($remoteId == null ? 43 : $remoteId.hashCode()); - result = result * PRIME + (this.isHasPreview() ? 79 : 97); - result = result * PRIME + (this.isFavorite() ? 79 : 97); - result = result * PRIME + (this.isEncrypted() ? 79 : 97); - final Object $permissions = this.getPermissions(); - result = result * PRIME + ($permissions == null ? 43 : $permissions.hashCode()); - result = result * PRIME + (this.isAllowedToReShare() ? 79 : 97); - return result; - } - - public String toString() { - return "BrowserFile(path=" + this.getPath() + ", displayName=" + this.getDisplayName() + ", mimeType=" + this.getMimeType() + ", modifiedTimestamp=" + this.getModifiedTimestamp() + ", size=" + this.getSize() + ", isFile=" + this.isFile() + ", remoteId=" + this.getRemoteId() + ", hasPreview=" + this.isHasPreview() + ", favorite=" + this.isFavorite() + ", encrypted=" + this.isEncrypted() + ", permissions=" + this.getPermissions() + ", isAllowedToReShare=" + this.isAllowedToReShare() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.kt new file mode 100644 index 000000000..b800fc6bc --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/BrowserFile.kt @@ -0,0 +1,118 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 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.components.filebrowser.models + +import android.net.Uri +import android.os.Parcelable +import android.text.TextUtils +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.Response +import at.bitfire.dav4jvm.property.DisplayName +import at.bitfire.dav4jvm.property.GetContentType +import at.bitfire.dav4jvm.property.GetLastModified +import at.bitfire.dav4jvm.property.ResourceType +import at.bitfire.dav4jvm.property.ResourceType.Companion.COLLECTION +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted +import com.nextcloud.talk.components.filebrowser.models.properties.NCPermission +import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview +import com.nextcloud.talk.components.filebrowser.models.properties.OCFavorite +import com.nextcloud.talk.components.filebrowser.models.properties.OCId +import com.nextcloud.talk.components.filebrowser.models.properties.OCSize +import kotlinx.android.parcel.Parcelize +import java.io.File + +@Parcelize +@JsonObject +data class BrowserFile( + var path: String? = null, + var displayName: String? = null, + var mimeType: String? = null, + var modifiedTimestamp: Long = 0, + var size: Long = 0, + var isFile: Boolean = false, + + // Used for remote files + var remoteId: String? = null, + var hasPreview: Boolean = false, + var isFavorite: Boolean = false, + var isEncrypted: Boolean = false, + var permissions: String? = null, + var isAllowedToReShare: Boolean = false +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null, 0, 0, false, null, false, false, false, null, false) + + companion object { + fun getModelFromResponse(response: Response, remotePath: String): BrowserFile { + val browserFile = BrowserFile() + browserFile.path = Uri.decode(remotePath) + browserFile.displayName = Uri.decode(File(remotePath).name) + val properties = response.properties + for (property in properties) { + mapPropertyToBrowserFile(property, browserFile) + } + if (browserFile.permissions != null && browserFile.permissions!!.contains("R")) { + browserFile.isAllowedToReShare = true + } + if (TextUtils.isEmpty(browserFile.mimeType) && !browserFile.isFile) { + browserFile.mimeType = "inode/directory" + } + + return browserFile + } + + @Suppress("Detekt.ComplexMethod") + private fun mapPropertyToBrowserFile(property: Property, browserFile: BrowserFile) { + when (property) { + is OCId -> { + browserFile.remoteId = property.ocId + } + is ResourceType -> { + browserFile.isFile = !property.types.contains(COLLECTION) + } + is GetLastModified -> { + browserFile.modifiedTimestamp = property.lastModified + } + is GetContentType -> { + browserFile.mimeType = property.type + } + is OCSize -> { + browserFile.size = property.ocSize + } + is NCPreview -> { + browserFile.hasPreview = property.isNcPreview + } + is OCFavorite -> { + browserFile.isFavorite = property.isOcFavorite + } + is DisplayName -> { + browserFile.displayName = property.displayName + } + is NCEncrypted -> { + browserFile.isEncrypted = property.isNcEncrypted + } + is NCPermission -> { + browserFile.permissions = property.ncPermission + } + } + } + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java index 29d0ce775..ed8e978cf 100644 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java @@ -94,10 +94,10 @@ public class ReadFilesystemOperation { Log.w("", "Error reading remote path"); } - remoteFiles.add(BrowserFile.getModelFromResponse(rootElement[0], + remoteFiles.add(BrowserFile.Companion.getModelFromResponse(rootElement[0], rootElement[0].getHref().toString().substring(basePath.length()))); for (Response memberElement : memberElements) { - remoteFiles.add(BrowserFile.getModelFromResponse(memberElement, + remoteFiles.add(BrowserFile.Companion.getModelFromResponse(memberElement, memberElement.getHref().toString().substring(basePath.length()))); } 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 d62bf095e..d66e4135b 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -336,10 +336,10 @@ 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?.getToken() + + "getRoomInfo. token: " + currentConversation?.token + " sessionId: " + currentConversation?.sessionId ) loadAvatarForStatusBar() @@ -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 @@ -548,7 +548,7 @@ class ChatController(args: Bundle) : if (!conversationUser?.userId.equals("?")) { senderId = "users/" + conversationUser?.userId } else { - senderId = currentConversation?.getActorType() + "/" + currentConversation?.getActorId() + senderId = currentConversation?.actorType + "/" + currentConversation?.actorId } Log.d(TAG, "Initialize TalkMessagesListAdapter with senderId: " + senderId) @@ -579,7 +579,7 @@ class ChatController(args: Bundle) : adapter?.registerViewClickListener( R.id.playPauseBtn ) { view, message -> - val filename = message.getSelectedIndividualHashMap()["name"] + val filename = message.selectedIndividualHashMap!!["name"] val file = File(context!!.cacheDir, filename!!) if (file.exists()) { if (message.isPlayingVoiceMessage) { @@ -934,7 +934,7 @@ class ChatController(args: Bundle) : } if (mediaPlayer == null) { - val fileName = message.getSelectedIndividualHashMap()["name"] + val fileName = message.selectedIndividualHashMap!!["name"] val absolutePath = context!!.cacheDir.absolutePath + "/" + fileName mediaPlayer = MediaPlayer().apply { setDataSource(absolutePath) @@ -978,17 +978,17 @@ class ChatController(args: Bundle) : message.isDownloadingVoiceMessage = true adapter?.update(message) - val baseUrl = message.activeUser.baseUrl - val userId = message.activeUser.userId + val baseUrl = message.activeUser!!.baseUrl + val userId = message.activeUser!!.userId val attachmentFolder = CapabilitiesUtil.getAttachmentFolder(message.activeUser) - val fileName = message.getSelectedIndividualHashMap()["name"] - var size = message.getSelectedIndividualHashMap()["size"] + val fileName = message.selectedIndividualHashMap!!["name"] + var size = message.selectedIndividualHashMap!!["size"] if (size == null) { size = "-1" } val fileSize = size.toLong() - val fileId = message.getSelectedIndividualHashMap()["id"] - val path = message.getSelectedIndividualHashMap()["path"] + val fileId = message.selectedIndividualHashMap!!["id"] + val path = message.selectedIndividualHashMap!!["path"] // check if download worker is already running val workers = WorkManager.getInstance( @@ -1223,7 +1223,7 @@ class ChatController(args: Bundle) : private fun shouldShowLobby(): Boolean { if (currentConversation != null) { - return currentConversation?.shouldShowLobby(conversationUser) == true + return currentConversation?.shouldShowLobby(conversationUser!!) == true } return false } @@ -1262,7 +1262,7 @@ class ChatController(args: Bundle) : private fun checkLobbyState() { if (currentConversation != null && - currentConversation?.isLobbyViewApplicable(conversationUser) ?: false && + currentConversation?.isLobbyViewApplicable(conversationUser!!) ?: false && isAlive() ) { @@ -1270,7 +1270,7 @@ class ChatController(args: Bundle) : getRoomInfo() } - if (currentConversation?.shouldShowLobby(conversationUser) ?: false) { + if (currentConversation?.shouldShowLobby(conversationUser!!) ?: false) { binding.lobby.lobbyView.visibility = View.VISIBLE binding.messagesListView.visibility = View.GONE binding.messageInputView.visibility = View.GONE @@ -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 = @@ -2026,7 +2026,7 @@ class ChatController(args: Bundle) : } pullChatMessagesPending = true - if (currentConversation != null && currentConversation!!.shouldShowLobby(conversationUser)) { + if (currentConversation != null && currentConversation!!.shouldShowLobby(conversationUser!!)) { // return } @@ -2181,7 +2181,7 @@ class ChatController(args: Bundle) : if (response.code() == HTTP_CODE_OK) { val chatOverall = response.body() as ChatOverall? - val chatMessageList = handleSystemMessages(chatOverall?.ocs!!.data) + val chatMessageList = handleSystemMessages(chatOverall?.ocs!!.data!!) if (chatMessageList.isNotEmpty() && ChatMessage.SystemMessageType.CLEARED_CHAT == chatMessageList[0].systemMessageType @@ -2455,19 +2455,19 @@ class ChatController(args: Bundle) : // setDeletionFlagsAndRemoveInfomessages if (isInfoMessageAboutDeletion(currentMessage)) { - if (!chatMessageMap.containsKey(currentMessage.value.parentMessage.id)) { + if (!chatMessageMap.containsKey(currentMessage.value.parentMessage!!.id)) { // if chatMessageMap doesn't contain message to delete (this happens when lookingIntoFuture), // the message to delete has to be modified directly inside the adapter setMessageAsDeleted(currentMessage.value.parentMessage) } else { - chatMessageMap[currentMessage.value.parentMessage.id]!!.isDeleted = true + chatMessageMap[currentMessage.value.parentMessage!!.id]!!.isDeleted = true } chatMessageIterator.remove() } // delete reactions system messages else if (isReactionsMessage(currentMessage)) { - if (!chatMessageMap.containsKey(currentMessage.value.parentMessage.id)) { + if (!chatMessageMap.containsKey(currentMessage.value.parentMessage!!.id)) { updateAdapterForReaction(currentMessage.value.parentMessage) } @@ -2569,7 +2569,7 @@ class ChatController(args: Bundle) : } private fun isSystemMessage(message: ChatMessage): Boolean { - return ChatMessage.MessageType.SYSTEM_MESSAGE == message.getMessageType() + return ChatMessage.MessageType.SYSTEM_MESSAGE == message.getCalculateMessageType() } fun deleteMessage(message: IMessage?) { @@ -2603,7 +2603,7 @@ class ChatController(args: Bundle) : } override fun onNext(t: ChatOverallSingleMessage) { - if (t.ocs.meta.statusCode == HttpURLConnection.HTTP_ACCEPTED) { + if (t.ocs!!.meta!!.statusCode == HttpURLConnection.HTTP_ACCEPTED) { Toast.makeText( context, R.string.nc_delete_message_leaked_to_matterbridge, Toast.LENGTH_LONG @@ -2641,7 +2641,7 @@ class ChatController(args: Bundle) : ) ncApi!!.createRoom( credentials, - retrofitBucket.getUrl(), retrofitBucket.getQueryMap() + retrofitBucket.url, retrofitBucket.queryMap ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -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().getToken()) - bundle.putString(KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId()) + 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().getToken() + 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().getToken(), bundle, true + roomOverall.ocs!!.data!!.token!!, bundle, true ) } @@ -2767,9 +2767,9 @@ class ChatController(args: Bundle) : message.user.id.substring(ACTOR_LENGTH) != currentConversation?.actorId && currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL || isShowMessageDeletionButton(message) || // delete - ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getMessageType() || // forward + ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() || // forward message.previousMessageId > NO_PREVIOUS_MESSAGE_ID && // mark as unread - ChatMessage.MessageType.SYSTEM_MESSAGE != message.getMessageType() && + ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType() && BuildConfig.DEBUG } @@ -2867,12 +2867,12 @@ class ChatController(args: Bundle) : message.reactionsSelf = ArrayList() } - var amount = message.reactions[emoji] + var amount = message.reactions!![emoji] if (amount == null) { amount = 0 } - message.reactions[emoji] = amount + 1 - message.reactionsSelf.add(emoji) + message.reactions!![emoji] = amount + 1 + message.reactionsSelf!!.add(emoji) adapter?.update(message) } @@ -2905,7 +2905,7 @@ class ChatController(args: Bundle) : override fun hasContentFor(message: ChatMessage, type: Byte): Boolean { return when (type) { CONTENT_TYPE_LOCATION -> message.hasGeoLocation() - CONTENT_TYPE_VOICE_MESSAGE -> message.isVoiceMessage() + CONTENT_TYPE_VOICE_MESSAGE -> message.isVoiceMessage CONTENT_TYPE_SYSTEM_MESSAGE -> !TextUtils.isEmpty(message.systemMessage) CONTENT_TYPE_UNREAD_NOTICE_MESSAGE -> message.id == "-1" else -> false @@ -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 4aa1cb9fd..0c4caa6f6 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt @@ -252,7 +252,7 @@ class ContactsController(args: Bundle) : ) ncApi.createRoom( credentials, - retrofitBucket.getUrl(), retrofitBucket.getQueryMap() + retrofitBucket.url, retrofitBucket.queryMap ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -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().getToken()) - bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId()) + 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().getToken() + 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().getToken(), bundle, true + roomOverall.ocs!!.data!!.token!!, bundle, true ) } @@ -393,7 +393,7 @@ class ContactsController(args: Bundle) : val query = adapter!!.getFilter(String::class.java) as String? val retrofitBucket: RetrofitBucket = ApiUtils.getRetrofitBucketForContactsSearchFor14(currentUser!!.baseUrl, query) - val modifiedQueryMap: HashMap = HashMap(retrofitBucket.getQueryMap()) + val modifiedQueryMap: HashMap = HashMap(retrofitBucket.queryMap) modifiedQueryMap.put("limit", CONTACTS_BATCH_SIZE) if (isAddingParticipantsView) { modifiedQueryMap.put("itemId", conversationToken) @@ -417,7 +417,7 @@ class ContactsController(args: Bundle) : modifiedQueryMap.put("shareTypes[]", shareTypesList) ncApi.getContactsWithSearchParam( credentials, - retrofitBucket.getUrl(), shareTypesList, modifiedQueryMap + retrofitBucket.url, shareTypesList, modifiedQueryMap ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -752,7 +752,7 @@ class ContactsController(args: Bundle) : fun onMessageEvent(openConversationEvent: OpenConversationEvent) { ConductorRemapping.remapChatController( router, currentUser!!.id, - openConversationEvent.conversation!!.getToken(), + openConversationEvent.conversation!!.token!!, openConversationEvent.bundle!!, true ) contactsBottomDialog?.dismiss() @@ -815,7 +815,7 @@ class ContactsController(args: Bundle) : ) ncApi.createRoom( credentials, - retrofitBucket.getUrl(), retrofitBucket.getQueryMap() + retrofitBucket.url, retrofitBucket.queryMap ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -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().getToken()) - bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId()) + 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().getToken(), + 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 c04d17140..bc6c25a1e 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt @@ -208,7 +208,7 @@ class ConversationInfoController(args: Bundle) : private fun setupWebinaryView() { if (CapabilitiesUtil.hasSpreedFeatureCapability(conversationUser, "webinary-lobby") && webinaryRoomType(conversation!!) && - conversation!!.canModerate(conversationUser) + conversation!!.canModerate(conversationUser!!) ) { binding.webinarInfoView.webinarSettings.visibility = View.VISIBLE @@ -223,7 +223,7 @@ class ConversationInfoController(args: Bundle) : MaterialDialog(activity!!, BottomSheet(WRAP_CONTENT)).show { val currentTimeCalendar = Calendar.getInstance() if (conversation!!.lobbyTimer != null && conversation!!.lobbyTimer != 0L) { - currentTimeCalendar.timeInMillis = conversation!!.lobbyTimer * DateConstants.SECOND_DIVIDER + currentTimeCalendar.timeInMillis = conversation!!.lobbyTimer!! * DateConstants.SECOND_DIVIDER } dateTimePicker( @@ -278,7 +278,7 @@ class ConversationInfoController(args: Bundle) : ) { binding.webinarInfoView.startTimePreferences.setSummary( DateUtils.getLocalDateStringFromTimestampForLobby( - conversation!!.lobbyTimer + conversation!!.lobbyTimer!! ) ) } else { @@ -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 @@ -639,7 +639,7 @@ class ConversationInfoController(args: Bundle) : setupWebinaryView() - if (!conversation!!.canLeave(conversationUser)) { + if (!conversation!!.canLeave()) { binding.leaveConversationAction.visibility = View.GONE } else { binding.leaveConversationAction.visibility = View.VISIBLE @@ -670,7 +670,7 @@ class ConversationInfoController(args: Bundle) : binding.displayNameText.text = conversation!!.displayName - if (conversation!!.description != null && !conversation!!.description.isEmpty()) { + if (conversation!!.description != null && !conversation!!.description!!.isEmpty()) { binding.descriptionText.text = conversation!!.description binding.conversationDescription.visibility = View.VISIBLE } @@ -979,7 +979,7 @@ class ConversationInfoController(args: Bundle) : } override fun onItemClick(view: View?, position: Int): Boolean { - if (!conversation!!.canModerate(conversationUser)) { + if (!conversation!!.canModerate(conversationUser!!)) { return true } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index 5feab71f2..dfb72b333 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -561,8 +561,10 @@ public class ConversationsListController extends BaseController implements Searc } for (Conversation conversation : roomsOverall.getOcs().getData()) { - if (bundle.containsKey(BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM()) && conversation.roomId.equals(bundle.getString( - BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM()))) { + if (bundle.containsKey(BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM()) && + conversation.getRoomId().equals(bundle.getString( + BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM())) + ) { continue; } @@ -581,7 +583,7 @@ public class ConversationsListController extends BaseController implements Searc conversation, currentUser, getActivity(), - userStatuses.get(conversation.name)); + userStatuses.get(conversation.getName())); conversationItems.add(conversationItem); ConversationItem conversationItemWithHeader = new ConversationItem( @@ -589,7 +591,7 @@ public class ConversationsListController extends BaseController implements Searc currentUser, getActivity(), callHeaderItems.get(headerTitle), - userStatuses.get(conversation.name)); + userStatuses.get(conversation.getName())); conversationItemsWithHeader.add(conversationItemWithHeader); } } @@ -628,7 +630,7 @@ public class ConversationsListController extends BaseController implements Searc Conversation conversation1 = ((ConversationItem) o1).getModel(); Conversation conversation2 = ((ConversationItem) o2).getModel(); return new CompareToBuilder() - .append(conversation2.isFavorite(), conversation1.isFavorite()) + .append(conversation2.getFavorite(), conversation1.getFavorite()) .append(conversation2.getLastActivity(), conversation1.getLastActivity()) .toComparison(); }); @@ -662,7 +664,7 @@ public class ConversationsListController extends BaseController implements Searc currentUser, getActivity(), callHeaderItems.get(headerTitle), - userStatuses.get(conversation.name)); + userStatuses.get(conversation.getName())); openConversationItems.add(conversationItem); } @@ -770,9 +772,9 @@ public class ConversationsListController extends BaseController implements Searc for (AbstractFlexibleItem flexItem : conversationItems) { Conversation conversationItem = ((ConversationItem) flexItem).getModel(); int position = adapter.getGlobalPositionOf(flexItem); - if ((conversationItem.unreadMention || - (conversationItem.unreadMessages > 0 && - conversationItem.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL)) && + if ((conversationItem.getUnreadMention() || + (conversationItem.getUnreadMessages() > 0 && + conversationItem.getType() == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL)) && position > lastVisibleItem) { nextUnreadConversationScrollPosition = position; if (!newMentionPopupBubble.isShown()) { @@ -874,7 +876,7 @@ public class ConversationsListController extends BaseController implements Searc if (selectedConversation != null && getActivity() != null) { boolean hasChatPermission = - new AttendeePermissionsUtil(selectedConversation.permissions).hasChatPermission(currentUser); + new AttendeePermissionsUtil(selectedConversation.getPermissions()).hasChatPermission(currentUser); if (showShareToScreen) { if (hasChatPermission && !isReadOnlyConversation(selectedConversation)) { @@ -902,7 +904,7 @@ public class ConversationsListController extends BaseController implements Searc } private Boolean isReadOnlyConversation(Conversation conversation) { - return conversation.conversationReadOnlyState == + return conversation.getConversationReadOnlyState() == Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY; } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.kt b/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.kt index 9fc320bd6..4ed149d2b 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.kt @@ -119,16 +119,16 @@ class RingtoneSelectionController(args: Bundle) : try { val ringtoneSettings: RingtoneSettings = LoganSquare.parse(preferencesString, RingtoneSettings::class.java) - if (ringtoneSettings.getRingtoneUri() == null) { + if (ringtoneSettings.ringtoneUri == null) { adapter!!.toggleSelection(0) - } else if (ringtoneSettings.getRingtoneUri().toString() == ringtoneString) { + } else if (ringtoneSettings.ringtoneUri!!.toString() == ringtoneString) { adapter!!.toggleSelection(1) } else { var notificationSoundItem: NotificationSoundItem? for (i in 2 until adapter!!.itemCount) { notificationSoundItem = adapter!!.getItem(i) as NotificationSoundItem? if ( - notificationSoundItem!!.notificationSoundUri == ringtoneSettings.getRingtoneUri().toString() + notificationSoundItem!!.notificationSoundUri == ringtoneSettings.ringtoneUri!!.toString() ) { adapter!!.toggleSelection(i) break @@ -199,8 +199,8 @@ class RingtoneSelectionController(args: Bundle) : } if (adapter!!.selectedPositions.size == 0 || adapter!!.selectedPositions[0] != position) { val ringtoneSettings = RingtoneSettings() - ringtoneSettings.setRingtoneName(notificationSoundItem.notificationSoundName) - ringtoneSettings.setRingtoneUri(ringtoneUri) + ringtoneSettings.ringtoneName = notificationSoundItem.notificationSoundName + ringtoneSettings.ringtoneUri = ringtoneUri if (callNotificationSounds) { try { appPreferences!!.callRingtoneUri = LoganSquare.serialize(ringtoneSettings) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt index d6a77a86a..49120a540 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt @@ -103,7 +103,7 @@ class EntryMenuController(args: Bundle) : super.onViewBound(view) if (conversation != null && operation === ConversationOperationEnum.OPS_CODE_RENAME_ROOM) { - binding.textEdit.setText(conversation!!.getName()) + binding.textEdit.setText(conversation!!.name) } binding.textEdit.setOnEditorActionListener { v, actionId, event -> @@ -127,7 +127,7 @@ class EntryMenuController(args: Bundle) : override fun afterTextChanged(s: Editable) { if (!TextUtils.isEmpty(s)) { if (operation === ConversationOperationEnum.OPS_CODE_RENAME_ROOM) { - if (conversation!!.getName() == null || !conversation!!.getName().equals(s.toString())) { + if (conversation!!.name == null || !conversation!!.name.equals(s.toString())) { if (!binding.okButton.isEnabled) { binding.okButton.isEnabled = true binding.okButton.alpha = OPACITY_ENABLED @@ -260,9 +260,9 @@ class EntryMenuController(args: Bundle) : if (operation === ConversationOperationEnum.OPS_CODE_CHANGE_PASSWORD || operation === ConversationOperationEnum.OPS_CODE_SET_PASSWORD ) { - conversation!!.setPassword(binding.textEdit.text.toString()) + conversation!!.password = binding.textEdit.text.toString() } else { - conversation!!.setName(binding.textEdit.text.toString()) + conversation!!.name = binding.textEdit.text.toString() } bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(conversation)) bundle.putSerializable(BundleKeys.KEY_OPERATION_CODE, operation) 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 5f0c587a3..680ba0420 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 @@ -257,9 +257,9 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForSetChatReadMarker( chatApiVersion(), currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ), - conversation!!.lastMessage.jsonMessageId + conversation!!.lastMessage!!.jsonMessageId ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -273,7 +273,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForRoomPublic( apiVersion(), currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ) ) .subscribeOn(Schedulers.io()) @@ -284,15 +284,15 @@ class OperationsMenuController(args: Bundle) : NewBaseController( private fun operationChangePassword() { var pass: String? = "" - if (conversation!!.getPassword() != null) { - pass = conversation!!.getPassword() + if (conversation!!.password != null) { + pass = conversation!!.password } ncApi.setPassword( credentials, ApiUtils.getUrlForRoomPassword( apiVersion(), currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ), pass ) @@ -308,7 +308,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForRoomPublic( apiVersion(), currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ) ) .subscribeOn(Schedulers.io()) @@ -323,9 +323,9 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForRoom( apiVersion(), currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ), - conversation!!.getName() + conversation!!.name ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -342,7 +342,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForRoomFavorite( apiVersion, currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ) ) .subscribeOn(Schedulers.io()) @@ -355,7 +355,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( ApiUtils.getUrlForRoomFavorite( apiVersion, currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ) ) .subscribeOn(Schedulers.io()) @@ -391,7 +391,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( conversationName ) } - ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + ncApi.createRoom(credentials, retrofitBucket.url, retrofitBucket.queryMap) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .retry(1) @@ -401,12 +401,12 @@ class OperationsMenuController(args: Bundle) : NewBaseController( } override fun onNext(roomOverall: RoomOverall) { - conversation = roomOverall.getOcs().getData() + conversation = roomOverall.ocs!!.data ncApi.getRoom( credentials, ApiUtils.getUrlForRoom( apiVersion, currentUser!!.baseUrl, - conversation!!.getToken() + conversation!!.token ) ) .subscribeOn(Schedulers.io()) @@ -419,7 +419,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( override fun onNext( roomOverall: RoomOverall ) { - conversation = roomOverall.getOcs().getData() + conversation = roomOverall.ocs!!.data inviteUsersToAConversation() } @@ -460,8 +460,8 @@ class OperationsMenuController(args: Bundle) : NewBaseController( } override fun onNext(roomOverall: RoomOverall) { - conversation = roomOverall.getOcs().getData() - if (conversation!!.isHasPassword && conversation!!.isGuest) { + conversation = roomOverall.ocs!!.data + if (conversation!!.hasPassword && conversation!!.isGuest) { eventBus.post(ConversationsListFetchDataEvent()) val bundle = Bundle() bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation)) @@ -504,7 +504,7 @@ class OperationsMenuController(args: Bundle) : NewBaseController( } override fun onNext(roomOverall: RoomOverall) { - conversation = roomOverall.getOcs().getData() + conversation = roomOverall.ocs!!.data initiateConversation() } @@ -639,10 +639,10 @@ class OperationsMenuController(args: Bundle) : NewBaseController( retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant( apiVersion, currentUser!!.baseUrl, - conversation!!.getToken(), + conversation!!.token, userId ) - ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + ncApi.addParticipant(credentials, retrofitBucket.url, retrofitBucket.queryMap) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .retry(1) @@ -683,11 +683,11 @@ class OperationsMenuController(args: Bundle) : NewBaseController( retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource( apiVersion, currentUser!!.baseUrl, - conversation!!.getToken(), + conversation!!.token, "groups", groupId ) - ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + ncApi.addParticipant(credentials, retrofitBucket.url, retrofitBucket.queryMap) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .retry(1) @@ -718,9 +718,9 @@ class OperationsMenuController(args: Bundle) : NewBaseController( private fun initiateConversation() { eventBus.post(ConversationsListFetchDataEvent()) val bundle = Bundle() - bundle.putString(KEY_ROOM_TOKEN, conversation!!.getToken()) - bundle.putString(KEY_ROOM_ID, conversation!!.getRoomId()) - bundle.putString(KEY_CONVERSATION_NAME, conversation!!.getDisplayName()) + bundle.putString(KEY_ROOM_TOKEN, conversation!!.token) + bundle.putString(KEY_ROOM_ID, conversation!!.roomId) + bundle.putString(KEY_CONVERSATION_NAME, conversation!!.displayName) bundle.putParcelable(KEY_USER_ENTITY, currentUser) bundle.putParcelable(KEY_ACTIVE_CONVERSATION, Parcels.wrap(conversation)) bundle.putString(KEY_CONVERSATION_PASSWORD, callPassword) @@ -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/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index da1b8d074..eebb764d3 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -170,7 +170,7 @@ public class NotificationWorker extends Worker { } } - muteCall = !(conversation.notificationCalls == 1); + muteCall = !(conversation.getNotificationCalls() == 1); } @Override @@ -510,7 +510,7 @@ public class NotificationWorker extends Worker { signatureVerification = pushUtils.verifySignature(base64DecodedSignature, base64DecodedSubject); - if (signatureVerification.isSignatureValid()) { + if (signatureVerification.getSignatureValid()) { Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding"); cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] decryptedSubject = cipher.doFinal(base64DecodedSubject); diff --git a/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.java b/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.java deleted file mode 100644 index 4c16b5ddc..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ExternalSignalingServer { - @JsonField(name = "externalSignalingServer") - String externalSignalingServer; - @JsonField(name = "externalSignalingTicket") - String externalSignalingTicket; - - public String getExternalSignalingServer() { - return this.externalSignalingServer; - } - - public String getExternalSignalingTicket() { - return this.externalSignalingTicket; - } - - public void setExternalSignalingServer(String externalSignalingServer) { - this.externalSignalingServer = externalSignalingServer; - } - - public void setExternalSignalingTicket(String externalSignalingTicket) { - this.externalSignalingTicket = externalSignalingTicket; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ExternalSignalingServer)) { - return false; - } - final ExternalSignalingServer other = (ExternalSignalingServer) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$externalSignalingServer = this.getExternalSignalingServer(); - final Object other$externalSignalingServer = other.getExternalSignalingServer(); - if (this$externalSignalingServer == null ? other$externalSignalingServer != null : !this$externalSignalingServer.equals(other$externalSignalingServer)) { - return false; - } - final Object this$externalSignalingTicket = this.getExternalSignalingTicket(); - final Object other$externalSignalingTicket = other.getExternalSignalingTicket(); - - return this$externalSignalingTicket == null ? other$externalSignalingTicket == null : this$externalSignalingTicket.equals(other$externalSignalingTicket); - } - - protected boolean canEqual(final Object other) { - return other instanceof ExternalSignalingServer; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $externalSignalingServer = this.getExternalSignalingServer(); - result = result * PRIME + ($externalSignalingServer == null ? 43 : $externalSignalingServer.hashCode()); - final Object $externalSignalingTicket = this.getExternalSignalingTicket(); - result = result * PRIME + ($externalSignalingTicket == null ? 43 : $externalSignalingTicket.hashCode()); - return result; - } - - public String toString() { - return "ExternalSignalingServer(externalSignalingServer=" + this.getExternalSignalingServer() + ", externalSignalingTicket=" + this.getExternalSignalingTicket() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.kt b/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.kt new file mode 100644 index 000000000..c1b476e76 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/ExternalSignalingServer.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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 + +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 ExternalSignalingServer( + @JsonField(name = ["externalSignalingServer"]) + var externalSignalingServer: String? = null, + @JsonField(name = ["externalSignalingTicket"]) + var externalSignalingTicket: String? = 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/LoginData.java b/app/src/main/java/com/nextcloud/talk/models/LoginData.java deleted file mode 100644 index ab4fa5863..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/LoginData.java +++ /dev/null @@ -1,101 +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; - -import org.parceler.Parcel; - -@Parcel -public class LoginData { - String serverUrl; - String username; - String token; - - public String getServerUrl() { - return this.serverUrl; - } - - public String getUsername() { - return this.username; - } - - public String getToken() { - return this.token; - } - - public void setServerUrl(String serverUrl) { - this.serverUrl = serverUrl; - } - - public void setUsername(String username) { - this.username = username; - } - - public void setToken(String token) { - this.token = token; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof LoginData)) { - return false; - } - final LoginData other = (LoginData) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$serverUrl = this.getServerUrl(); - final Object other$serverUrl = other.getServerUrl(); - if (this$serverUrl == null ? other$serverUrl != null : !this$serverUrl.equals(other$serverUrl)) { - return false; - } - final Object this$username = this.getUsername(); - final Object other$username = other.getUsername(); - if (this$username == null ? other$username != null : !this$username.equals(other$username)) { - return false; - } - final Object this$token = this.getToken(); - final Object other$token = other.getToken(); - - return this$token == null ? other$token == null : this$token.equals(other$token); - } - - protected boolean canEqual(final Object other) { - return other instanceof LoginData; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $serverUrl = this.getServerUrl(); - result = result * PRIME + ($serverUrl == null ? 43 : $serverUrl.hashCode()); - final Object $username = this.getUsername(); - result = result * PRIME + ($username == null ? 43 : $username.hashCode()); - final Object $token = this.getToken(); - result = result * PRIME + ($token == null ? 43 : $token.hashCode()); - return result; - } - - public String toString() { - return "LoginData(serverUrl=" + this.getServerUrl() + ", username=" + this.getUsername() + ", token=" + this.getToken() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/LoginData.kt b/app/src/main/java/com/nextcloud/talk/models/LoginData.kt new file mode 100644 index 000000000..42dd08555 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/LoginData.kt @@ -0,0 +1,32 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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 + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +@Parcelize +data class LoginData( + var serverUrl: String? = null, + var username: String? = null, + var token: String? = null +) : Parcelable diff --git a/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.java b/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.java deleted file mode 100644 index 32aeab070..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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; - -import org.parceler.Parcel; - -import java.util.Map; - -@Parcel -public class RetrofitBucket { - public String url; - public Map queryMap; - - public String getUrl() { - return this.url; - } - - public Map getQueryMap() { - return this.queryMap; - } - - public void setUrl(String url) { - this.url = url; - } - - public void setQueryMap(Map queryMap) { - this.queryMap = queryMap; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RetrofitBucket)) { - return false; - } - final RetrofitBucket other = (RetrofitBucket) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$url = this.getUrl(); - final Object other$url = other.getUrl(); - if (this$url == null ? other$url != null : !this$url.equals(other$url)) { - return false; - } - final Object this$queryMap = this.getQueryMap(); - final Object other$queryMap = other.getQueryMap(); - - return this$queryMap == null ? other$queryMap == null : this$queryMap.equals(other$queryMap); - } - - protected boolean canEqual(final Object other) { - return other instanceof RetrofitBucket; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $url = this.getUrl(); - result = result * PRIME + ($url == null ? 43 : $url.hashCode()); - final Object $queryMap = this.getQueryMap(); - result = result * PRIME + ($queryMap == null ? 43 : $queryMap.hashCode()); - return result; - } - - public String toString() { - return "RetrofitBucket(url=" + this.getUrl() + ", queryMap=" + this.getQueryMap() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.kt b/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.kt new file mode 100644 index 000000000..508e0d3ec --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/RetrofitBucket.kt @@ -0,0 +1,31 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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 + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +@Parcelize +data class RetrofitBucket( + var url: String? = null, + var queryMap: Map? = null +) : Parcelable diff --git a/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.java b/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.java deleted file mode 100644 index b7374858c..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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; - -import android.net.Uri; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.converters.UriTypeConverter; - -import org.parceler.Parcel; - -import androidx.annotation.Nullable; - -@Parcel -@JsonObject -public class RingtoneSettings { - @JsonField(name = "ringtoneUri", typeConverter = UriTypeConverter.class) - @Nullable - public Uri ringtoneUri; - @JsonField(name = "ringtoneName") - public String ringtoneName; - - @Nullable - public Uri getRingtoneUri() { - return this.ringtoneUri; - } - - public String getRingtoneName() { - return this.ringtoneName; - } - - public void setRingtoneUri(@Nullable Uri ringtoneUri) { - this.ringtoneUri = ringtoneUri; - } - - public void setRingtoneName(String ringtoneName) { - this.ringtoneName = ringtoneName; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RingtoneSettings)) { - return false; - } - final RingtoneSettings other = (RingtoneSettings) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$ringtoneUri = this.getRingtoneUri(); - final Object other$ringtoneUri = other.getRingtoneUri(); - if (this$ringtoneUri == null ? other$ringtoneUri != null : !this$ringtoneUri.equals(other$ringtoneUri)) { - return false; - } - final Object this$ringtoneName = this.getRingtoneName(); - final Object other$ringtoneName = other.getRingtoneName(); - - return this$ringtoneName == null ? other$ringtoneName == null : this$ringtoneName.equals(other$ringtoneName); - } - - protected boolean canEqual(final Object other) { - return other instanceof RingtoneSettings; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $ringtoneUri = this.getRingtoneUri(); - result = result * PRIME + ($ringtoneUri == null ? 43 : $ringtoneUri.hashCode()); - final Object $ringtoneName = this.getRingtoneName(); - result = result * PRIME + ($ringtoneName == null ? 43 : $ringtoneName.hashCode()); - return result; - } - - public String toString() { - return "RingtoneSettings(ringtoneUri=" + this.getRingtoneUri() + ", ringtoneName=" + this.getRingtoneName() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.kt b/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.kt new file mode 100644 index 000000000..a9c1c0700 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/RingtoneSettings.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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 + +import android.net.Uri +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.converters.UriTypeConverter +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class RingtoneSettings( + @JsonField(name = ["ringtoneUri"], typeConverter = UriTypeConverter::class) + var ringtoneUri: Uri? = null, + @JsonField(name = ["ringtoneName"]) + var ringtoneName: String? = 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/SignatureVerification.java b/app/src/main/java/com/nextcloud/talk/models/SignatureVerification.java deleted file mode 100644 index 169bf1637..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/SignatureVerification.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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; - - -import com.nextcloud.talk.models.database.UserEntity; - -import org.parceler.Parcel; - -@Parcel -public class SignatureVerification { - public boolean signatureValid; - public UserEntity userEntity; - - public boolean isSignatureValid() { - return this.signatureValid; - } - - public UserEntity getUserEntity() { - return this.userEntity; - } - - public void setSignatureValid(boolean signatureValid) { - this.signatureValid = signatureValid; - } - - public void setUserEntity(UserEntity userEntity) { - this.userEntity = userEntity; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignatureVerification)) { - return false; - } - final SignatureVerification other = (SignatureVerification) o; - if (!other.canEqual((Object) this)) { - return false; - } - if (this.isSignatureValid() != other.isSignatureValid()) { - return false; - } - final Object this$userEntity = this.getUserEntity(); - final Object other$userEntity = other.getUserEntity(); - - return this$userEntity == null ? other$userEntity == null : this$userEntity.equals(other$userEntity); - } - - protected boolean canEqual(final Object other) { - return other instanceof SignatureVerification; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - result = result * PRIME + (this.isSignatureValid() ? 79 : 97); - final Object $userEntity = this.getUserEntity(); - result = result * PRIME + ($userEntity == null ? 43 : $userEntity.hashCode()); - return result; - } - - public String toString() { - return "SignatureVerification(signatureValid=" + this.isSignatureValid() + ", userEntity=" + this.getUserEntity() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/SignatureVerification.kt b/app/src/main/java/com/nextcloud/talk/models/SignatureVerification.kt new file mode 100644 index 000000000..e07b89128 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/SignatureVerification.kt @@ -0,0 +1,32 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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 + +import android.os.Parcelable +import com.nextcloud.talk.models.database.UserEntity +import kotlinx.android.parcel.Parcelize + +@Parcelize +data class SignatureVerification( + var signatureValid: Boolean = false, + var userEntity: UserEntity? = null +) : Parcelable diff --git a/app/src/main/java/com/nextcloud/talk/models/json/AnyParceler.kt b/app/src/main/java/com/nextcloud/talk/models/json/AnyParceler.kt new file mode 100644 index 000000000..a419ad6bf --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/AnyParceler.kt @@ -0,0 +1,33 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * + * 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 + +import android.os.Parcel +import kotlinx.android.parcel.Parceler + +class AnyParceler : Parceler { + override fun create(parcel: Parcel): Any? { + return parcel.readValue(Any::class.java.getClassLoader()) + } + + override fun Any?.write(parcel: Parcel, flags: Int) { + parcel.writeValue(parcel) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java deleted file mode 100644 index 1a4996a8f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * @author Tim Krüger - * Copyright (C) 2021 Tim Krüger - * Copyright (C) 2017-2018 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.chat; - -import android.text.TextUtils; -import android.util.Log; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonIgnore; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.R; -import com.nextcloud.talk.application.NextcloudTalkApplication; -import com.nextcloud.talk.models.database.UserEntity; -import com.nextcloud.talk.models.json.converters.EnumSystemMessageTypeConverter; -import com.nextcloud.talk.utils.ApiUtils; -import com.stfalcon.chatkit.commons.models.IUser; -import com.stfalcon.chatkit.commons.models.MessageContentType; - -import org.parceler.Parcel; - -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import androidx.annotation.Nullable; -import kotlin.text.Charsets; - -@Parcel -@JsonObject -public class ChatMessage implements MessageContentType, MessageContentType.Image { - private static String TAG = "ChatMessage"; - - @JsonIgnore - public boolean isGrouped; - @JsonIgnore - public boolean isOneToOneConversation; - @JsonIgnore - public UserEntity activeUser; - @JsonIgnore - public Map selectedIndividualHashMap; - @JsonIgnore - public boolean isDeleted; - @JsonField(name = "id") - public int jsonMessageId; - @JsonIgnore - public int previousMessageId = -1; - @JsonField(name = "token") - public String token; - // guests or users - @JsonField(name = "actorType") - public String actorType; - @JsonField(name = "actorId") - public String actorId; - // send when crafting a message - @JsonField(name = "actorDisplayName") - public String actorDisplayName; - @JsonField(name = "timestamp") - public long timestamp; - // send when crafting a message, max 1000 lines - @JsonField(name = "message") - public String message; - @JsonField(name = "messageParameters") - public HashMap> messageParameters; - @JsonField(name = "systemMessage", typeConverter = EnumSystemMessageTypeConverter.class) - public SystemMessageType systemMessageType; - @JsonField(name = "isReplyable") - public boolean replyable; - @JsonField(name = "parent") - public ChatMessage parentMessage; - public Enum readStatus = ReadStatus.NONE; - @JsonField(name = "messageType") - public String messageType; - @JsonField(name = "reactions") - public LinkedHashMap reactions; - @JsonField(name = "reactionsSelf") - public ArrayList reactionsSelf; - - public boolean isDownloadingVoiceMessage; - public boolean resetVoiceMessage; - public boolean isPlayingVoiceMessage; - public int voiceMessageDuration; - public int voiceMessagePlayedSeconds; - public int voiceMessageDownloadProgress; - - @JsonIgnore - List messageTypesToIgnore = Arrays.asList( - MessageType.REGULAR_TEXT_MESSAGE, - MessageType.SYSTEM_MESSAGE, - MessageType.SINGLE_LINK_VIDEO_MESSAGE, - MessageType.SINGLE_LINK_AUDIO_MESSAGE, - MessageType.SINGLE_LINK_MESSAGE, - MessageType.SINGLE_NC_GEOLOCATION_MESSAGE, - MessageType.VOICE_MESSAGE); - - public boolean hasFileAttachment() { - if (messageParameters != null && messageParameters.size() > 0) { - for (HashMap.Entry> entry : messageParameters.entrySet()) { - Map individualHashMap = entry.getValue(); - if (MessageDigest.isEqual( - Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8), - ("file").getBytes(Charsets.UTF_8))) { - return true; - } - } - } - return false; - } - - public boolean hasGeoLocation() { - if (messageParameters != null && messageParameters.size() > 0) { - for (HashMap.Entry> entry : messageParameters.entrySet()) { - Map individualHashMap = entry.getValue(); - - if (MessageDigest.isEqual( - Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8), - ("geo-location").getBytes(Charsets.UTF_8))) { - return true; - } - } - } - - return false; - } - - @Nullable - @Override - public String getImageUrl() { - if (messageParameters != null && messageParameters.size() > 0) { - for (HashMap.Entry> entry : messageParameters.entrySet()) { - Map individualHashMap = entry.getValue(); - if (MessageDigest.isEqual( - Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8), - ("file").getBytes(Charsets.UTF_8))) { - - // TODO: this selectedIndividualHashMap stuff needs to be analyzed and most likely be refactored! - // it just feels wrong to fill this here inside getImageUrl() - selectedIndividualHashMap = individualHashMap; - if (!isVoiceMessage()) { - if (getActiveUser() != null && getActiveUser().getBaseUrl() != null) { - return (ApiUtils.getUrlForFilePreviewWithFileId( - getActiveUser().getBaseUrl(), - individualHashMap.get("id"), - NextcloudTalkApplication.Companion.getSharedApplication().getResources().getDimensionPixelSize(R.dimen.maximum_file_preview_size))); - } else { - Log.e(TAG, "getActiveUser() or getActiveUser().getBaseUrl() were null when trying to " + - "getImageUrl()"); - } - } - } - } - } - - if (!messageTypesToIgnore.contains(getMessageType())) { - return getMessage().trim(); - } - - return null; - } - - public MessageType getMessageType() { - if (!TextUtils.isEmpty(getSystemMessage())) { - return MessageType.SYSTEM_MESSAGE; - } - - if (isVoiceMessage()) { - return MessageType.VOICE_MESSAGE; - } - - if (hasFileAttachment()) { - return MessageType.SINGLE_NC_ATTACHMENT_MESSAGE; - } - - if (hasGeoLocation()) { - return MessageType.SINGLE_NC_GEOLOCATION_MESSAGE; - } - - - return MessageType.REGULAR_TEXT_MESSAGE; - } - - public Map getSelectedIndividualHashMap() { - return selectedIndividualHashMap; - } - - public void setSelectedIndividualHashMap(Map selectedIndividualHashMap) { - this.selectedIndividualHashMap = selectedIndividualHashMap; - } - - @Override - public String getId() { - return Integer.toString(jsonMessageId); - } - - @Override - public String getText() { - return ChatUtils.Companion.getParsedMessage(getMessage(), getMessageParameters()); - } - - public String getLastMessageDisplayText() { - if (getMessageType().equals(MessageType.REGULAR_TEXT_MESSAGE) || getMessageType().equals(MessageType.SYSTEM_MESSAGE) || getMessageType().equals(MessageType.SINGLE_LINK_MESSAGE)) { - return getText(); - } else { - if (MessageType.SINGLE_LINK_GIPHY_MESSAGE == getMessageType() - || MessageType.SINGLE_LINK_TENOR_MESSAGE == getMessageType() - || MessageType.SINGLE_LINK_GIF_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_gif_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_gif), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } else if (MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_attachment_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_attachment), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } else if (MessageType.SINGLE_NC_GEOLOCATION_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_location_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_location), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } else if (MessageType.VOICE_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_voice_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_voice), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - /*} else if (getMessageType().equals(MessageType.SINGLE_LINK_MESSAGE)) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_link_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_link), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - }*/ - } else if (MessageType.SINGLE_LINK_AUDIO_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_audio_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_audio), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } else if (MessageType.SINGLE_LINK_VIDEO_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_video_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_video), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } else if (MessageType.SINGLE_LINK_IMAGE_MESSAGE == getMessageType()) { - if (getActorId().equals(getActiveUser().getUserId())) { - return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_image_you)); - } else { - return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_image), - !TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest))); - } - } - } - - return ""; - } - - @Override - public IUser getUser() { - return new IUser() { - @Override - public String getId() { - return actorType + "/" + actorId; - } - - @Override - public String getName() { - if (!TextUtils.isEmpty(actorDisplayName)) { - return actorDisplayName; - } - - return NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest); - } - - @Override - public String getAvatar() { - if (getActiveUser() == null) { - return null; - } else if (getActorType().equals("users")) { - return ApiUtils.getUrlForAvatar(getActiveUser().getBaseUrl(), actorId, true); - } else if (getActorType().equals("bridged")) { - return ApiUtils.getUrlForAvatar(getActiveUser().getBaseUrl(), "bridge-bot", - true); - } else { - String apiId = - NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest); - - if (!TextUtils.isEmpty(getActorDisplayName())) { - apiId = getActorDisplayName(); - } - return ApiUtils.getUrlForGuestAvatar(getActiveUser().getBaseUrl(), apiId, true); - } - } - }; - } - - @Override - public Date getCreatedAt() { - return new Date(timestamp * 1000L); - } - - @Override - public String getSystemMessage() { - return new EnumSystemMessageTypeConverter().convertToString(getSystemMessageType()); - } - - public boolean isGrouped() { - return this.isGrouped; - } - - public boolean isOneToOneConversation() { - return this.isOneToOneConversation; - } - - public UserEntity getActiveUser() { - return this.activeUser; - } - - public boolean isDeleted() { - return this.isDeleted; - } - - public int getJsonMessageId() { - return this.jsonMessageId; - } - - public String getToken() { - return this.token; - } - - public String getActorType() { - return this.actorType; - } - - public String getActorId() { - return this.actorId; - } - - public String getActorDisplayName() { - return this.actorDisplayName; - } - - public long getTimestamp() { - return this.timestamp; - } - - public String getMessage() { - return this.message; - } - - public HashMap> getMessageParameters() { - return this.messageParameters; - } - - public SystemMessageType getSystemMessageType() { - return this.systemMessageType; - } - - public boolean isReplyable() { - return this.replyable; - } - - public ChatMessage getParentMessage() { - return this.parentMessage; - } - - public Enum getReadStatus() { - return this.readStatus; - } - - public List getMessageTypesToIgnore() { - return this.messageTypesToIgnore; - } - - public void setGrouped(boolean isGrouped) { - this.isGrouped = isGrouped; - } - - public void setOneToOneConversation(boolean isOneToOneConversation) { - this.isOneToOneConversation = isOneToOneConversation; - } - - public void setActiveUser(UserEntity activeUser) { - this.activeUser = activeUser; - } - - public void setDeleted(boolean isDeleted) { - this.isDeleted = isDeleted; - } - - public void setJsonMessageId(int jsonMessageId) { - this.jsonMessageId = jsonMessageId; - } - - public void setToken(String token) { - this.token = token; - } - - public void setActorType(String actorType) { - this.actorType = actorType; - } - - public void setActorId(String actorId) { - this.actorId = actorId; - } - - public void setActorDisplayName(String actorDisplayName) { - this.actorDisplayName = actorDisplayName; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setMessageParameters(HashMap> messageParameters) { - this.messageParameters = messageParameters; - } - - public void setSystemMessageType(SystemMessageType systemMessageType) { - this.systemMessageType = systemMessageType; - } - - public void setReplyable(boolean replyable) { - this.replyable = replyable; - } - - public void setParentMessage(ChatMessage parentMessage) { - this.parentMessage = parentMessage; - } - - public void setReadStatus(Enum readStatus) { - this.readStatus = readStatus; - } - - public void setMessageTypesToIgnore(List messageTypesToIgnore) { - this.messageTypesToIgnore = messageTypesToIgnore; - } - - public void setMessageType(String messageType) { - this.messageType = messageType; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatMessage)) { - return false; - } - final ChatMessage other = (ChatMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - if (this.isGrouped() != other.isGrouped()) { - return false; - } - if (this.isOneToOneConversation() != other.isOneToOneConversation()) { - return false; - } - final Object this$activeUser = this.getActiveUser(); - final Object other$activeUser = other.getActiveUser(); - if (this$activeUser == null ? other$activeUser != null : !this$activeUser.equals(other$activeUser)) { - return false; - } - final Object this$selectedIndividualHashMap = this.getSelectedIndividualHashMap(); - final Object other$selectedIndividualHashMap = other.getSelectedIndividualHashMap(); - if (this$selectedIndividualHashMap == null ? other$selectedIndividualHashMap != null : !this$selectedIndividualHashMap.equals(other$selectedIndividualHashMap)) { - return false; - } - if (this.isDeleted() != other.isDeleted()) { - return false; - } - if (this.getJsonMessageId() != other.getJsonMessageId()) { - return false; - } - final Object this$token = this.getToken(); - final Object other$token = other.getToken(); - if (this$token == null ? other$token != null : !this$token.equals(other$token)) { - return false; - } - final Object this$actorType = this.getActorType(); - final Object other$actorType = other.getActorType(); - if (this$actorType == null ? other$actorType != null : !this$actorType.equals(other$actorType)) { - return false; - } - final Object this$actorId = this.getActorId(); - final Object other$actorId = other.getActorId(); - if (this$actorId == null ? other$actorId != null : !this$actorId.equals(other$actorId)) { - return false; - } - final Object this$actorDisplayName = this.getActorDisplayName(); - final Object other$actorDisplayName = other.getActorDisplayName(); - if (this$actorDisplayName == null ? other$actorDisplayName != null : !this$actorDisplayName.equals(other$actorDisplayName)) { - return false; - } - if (this.getTimestamp() != other.getTimestamp()) { - return false; - } - final Object this$message = this.getMessage(); - final Object other$message = other.getMessage(); - if (this$message == null ? other$message != null : !this$message.equals(other$message)) { - return false; - } - final Object this$messageParameters = this.getMessageParameters(); - final Object other$messageParameters = other.getMessageParameters(); - if (this$messageParameters == null ? other$messageParameters != null : !this$messageParameters.equals(other$messageParameters)) { - return false; - } - final Object this$systemMessageType = this.getSystemMessageType(); - final Object other$systemMessageType = other.getSystemMessageType(); - if (this$systemMessageType == null ? other$systemMessageType != null : !this$systemMessageType.equals(other$systemMessageType)) { - return false; - } - if (this.isReplyable() != other.isReplyable()) { - return false; - } - final Object this$parentMessage = this.getParentMessage(); - final Object other$parentMessage = other.getParentMessage(); - if (this$parentMessage == null ? other$parentMessage != null : !this$parentMessage.equals(other$parentMessage)) { - return false; - } - final Object this$readStatus = this.getReadStatus(); - final Object other$readStatus = other.getReadStatus(); - if (this$readStatus == null ? other$readStatus != null : !this$readStatus.equals(other$readStatus)) { - return false; - } - final Object this$messageTypesToIgnore = this.getMessageTypesToIgnore(); - final Object other$messageTypesToIgnore = other.getMessageTypesToIgnore(); - - return this$messageTypesToIgnore == null ? other$messageTypesToIgnore == null : this$messageTypesToIgnore.equals(other$messageTypesToIgnore); - } - - protected boolean canEqual(final Object other) { - return other instanceof ChatMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - result = result * PRIME + (this.isGrouped() ? 79 : 97); - result = result * PRIME + (this.isOneToOneConversation() ? 79 : 97); - final Object $activeUser = this.getActiveUser(); - result = result * PRIME + ($activeUser == null ? 43 : $activeUser.hashCode()); - final Object $selectedIndividualHashMap = this.getSelectedIndividualHashMap(); - result = result * PRIME + ($selectedIndividualHashMap == null ? 43 : $selectedIndividualHashMap.hashCode()); - result = result * PRIME + (this.isDeleted() ? 79 : 97); - result = result * PRIME + this.getJsonMessageId(); - final Object $token = this.getToken(); - result = result * PRIME + ($token == null ? 43 : $token.hashCode()); - final Object $actorType = this.getActorType(); - result = result * PRIME + ($actorType == null ? 43 : $actorType.hashCode()); - final Object $actorId = this.getActorId(); - result = result * PRIME + ($actorId == null ? 43 : $actorId.hashCode()); - final Object $actorDisplayName = this.getActorDisplayName(); - result = result * PRIME + ($actorDisplayName == null ? 43 : $actorDisplayName.hashCode()); - final long $timestamp = this.getTimestamp(); - result = result * PRIME + (int) ($timestamp >>> 32 ^ $timestamp); - final Object $message = this.getMessage(); - result = result * PRIME + ($message == null ? 43 : $message.hashCode()); - final Object $messageParameters = this.getMessageParameters(); - result = result * PRIME + ($messageParameters == null ? 43 : $messageParameters.hashCode()); - final Object $systemMessageType = this.getSystemMessageType(); - result = result * PRIME + ($systemMessageType == null ? 43 : $systemMessageType.hashCode()); - result = result * PRIME + (this.isReplyable() ? 79 : 97); - final Object $parentMessage = this.getParentMessage(); - result = result * PRIME + ($parentMessage == null ? 43 : $parentMessage.hashCode()); - final Object $readStatus = this.getReadStatus(); - result = result * PRIME + ($readStatus == null ? 43 : $readStatus.hashCode()); - final Object $messageTypesToIgnore = this.getMessageTypesToIgnore(); - result = result * PRIME + ($messageTypesToIgnore == null ? 43 : $messageTypesToIgnore.hashCode()); - return result; - } - - public String toString() { - return "ChatMessage(isGrouped=" + this.isGrouped() + ", isOneToOneConversation=" + this.isOneToOneConversation() + ", activeUser=" + this.getActiveUser() + ", selectedIndividualHashMap=" + this.getSelectedIndividualHashMap() + ", isDeleted=" + this.isDeleted() + ", jsonMessageId=" + this.getJsonMessageId() + ", token=" + this.getToken() + ", actorType=" + this.getActorType() + ", actorId=" + this.getActorId() + ", actorDisplayName=" + this.getActorDisplayName() + ", timestamp=" + this.getTimestamp() + ", message=" + this.getMessage() + ", messageParameters=" + this.getMessageParameters() + ", systemMessageType=" + this.getSystemMessageType() + ", replyable=" + this.isReplyable() + ", parentMessage=" + this.getParentMessage() + ", readStatus=" + this.getReadStatus() + ", messageTypesToIgnore=" + this.getMessageTypesToIgnore() + ")"; - } - - public boolean isVoiceMessage() { - return "voice-message".equals(messageType); - } - - public boolean isCommandMessage() { - return "command".equals(messageType); - } - - public boolean isDeletedCommentMessage() { - return "comment_deleted".equals(messageType); - } - - public enum MessageType { - REGULAR_TEXT_MESSAGE, - SYSTEM_MESSAGE, - SINGLE_LINK_GIPHY_MESSAGE, - SINGLE_LINK_TENOR_MESSAGE, - SINGLE_LINK_GIF_MESSAGE, - SINGLE_LINK_MESSAGE, - SINGLE_LINK_VIDEO_MESSAGE, - SINGLE_LINK_IMAGE_MESSAGE, - SINGLE_LINK_AUDIO_MESSAGE, - SINGLE_NC_ATTACHMENT_MESSAGE, - SINGLE_NC_GEOLOCATION_MESSAGE, - VOICE_MESSAGE - } - - /** - * see https://nextcloud-talk.readthedocs.io/en/latest/chat/#system-messages - */ - public enum SystemMessageType { - DUMMY, - CONVERSATION_CREATED, - CONVERSATION_RENAMED, - DESCRIPTION_REMOVED, - DESCRIPTION_SET, - CALL_STARTED, - CALL_JOINED, - CALL_LEFT, - CALL_ENDED, - CALL_ENDED_EVERYONE, - CALL_MISSED, - CALL_TRIED, - READ_ONLY_OFF, - READ_ONLY, - LISTABLE_NONE, - LISTABLE_USERS, - LISTABLE_ALL, - LOBBY_NONE, - LOBBY_NON_MODERATORS, - LOBBY_OPEN_TO_EVERYONE, - GUESTS_ALLOWED, - GUESTS_DISALLOWED, - PASSWORD_SET, - PASSWORD_REMOVED, - USER_ADDED, - USER_REMOVED, - GROUP_ADDED, - GROUP_REMOVED, - CIRCLE_ADDED, - CIRCLE_REMOVED, - MODERATOR_PROMOTED, - MODERATOR_DEMOTED, - GUEST_MODERATOR_PROMOTED, - GUEST_MODERATOR_DEMOTED, - MESSAGE_DELETED, - FILE_SHARED, - OBJECT_SHARED, - MATTERBRIDGE_CONFIG_ADDED, - MATTERBRIDGE_CONFIG_EDITED, - MATTERBRIDGE_CONFIG_REMOVED, - MATTERBRIDGE_CONFIG_ENABLED, - MATTERBRIDGE_CONFIG_DISABLED, - CLEARED_CHAT, - REACTION, - REACTION_DELETED, - REACTION_REVOKED - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.kt new file mode 100644 index 000000000..04d23d056 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.kt @@ -0,0 +1,473 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Tim Krüger + * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Marcel Hibbe + * Copyright (C) 2021 Tim Krüger + * Copyright (C) 2017-2018 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.chat + +import android.os.Parcelable +import android.text.TextUtils +import android.util.Log +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonIgnore +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.R +import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication +import com.nextcloud.talk.models.database.UserEntity +import com.nextcloud.talk.models.json.chat.ChatUtils.Companion.getParsedMessage +import com.nextcloud.talk.models.json.converters.EnumSystemMessageTypeConverter +import com.nextcloud.talk.utils.ApiUtils +import com.stfalcon.chatkit.commons.models.IUser +import com.stfalcon.chatkit.commons.models.MessageContentType +import kotlinx.android.parcel.Parcelize +import java.security.MessageDigest +import java.util.ArrayList +import java.util.Arrays +import java.util.Date +import java.util.HashMap +import java.util.LinkedHashMap + +@Parcelize +@JsonObject +data class ChatMessage( + @JsonIgnore + var isGrouped: Boolean = false, + + @JsonIgnore + var isOneToOneConversation: Boolean = false, + + @JsonIgnore + var activeUser: UserEntity? = null, + + @JsonIgnore + var selectedIndividualHashMap: Map? = null, + + @JsonIgnore + var isDeleted: Boolean = false, + + @JsonField(name = ["id"]) + var jsonMessageId: Int = 0, + + @JsonIgnore + var previousMessageId: Int = -1, + + @JsonField(name = ["token"]) + var token: String? = null, + + // guests or users + @JsonField(name = ["actorType"]) + var actorType: String? = null, + + @JsonField(name = ["actorId"]) + var actorId: String? = null, + + // send when crafting a message + @JsonField(name = ["actorDisplayName"]) + var actorDisplayName: String? = null, + + @JsonField(name = ["timestamp"]) + var timestamp: Long = 0, + + // send when crafting a message, max 1000 lines + @JsonField(name = ["message"]) + var message: String? = null, + + @JsonField(name = ["messageParameters"]) + var messageParameters: HashMap>? = null, + + @JsonField(name = ["systemMessage"], typeConverter = EnumSystemMessageTypeConverter::class) + var systemMessageType: SystemMessageType? = null, + + @JsonField(name = ["isReplyable"]) + var replyable: Boolean = false, + + @JsonField(name = ["parent"]) + var parentMessage: ChatMessage? = null, + + var readStatus: Enum = ReadStatus.NONE, + + @JsonField(name = ["messageType"]) + var messageType: String? = null, + + @JsonField(name = ["reactions"]) + var reactions: LinkedHashMap? = null, + + @JsonField(name = ["reactionsSelf"]) + var reactionsSelf: ArrayList? = null, + + var isDownloadingVoiceMessage: Boolean = false, + + var resetVoiceMessage: Boolean = false, + + var isPlayingVoiceMessage: Boolean = false, + + var voiceMessageDuration: Int = 0, + + var voiceMessagePlayedSeconds: Int = 0, + + var voiceMessageDownloadProgress: Int = 0, +) : Parcelable, MessageContentType, MessageContentType.Image { + @JsonIgnore + var messageTypesToIgnore = Arrays.asList( + MessageType.REGULAR_TEXT_MESSAGE, + MessageType.SYSTEM_MESSAGE, + MessageType.SINGLE_LINK_VIDEO_MESSAGE, + MessageType.SINGLE_LINK_AUDIO_MESSAGE, + MessageType.SINGLE_LINK_MESSAGE, + MessageType.SINGLE_NC_GEOLOCATION_MESSAGE, + MessageType.VOICE_MESSAGE + ) + + fun hasFileAttachment(): Boolean { + if (messageParameters != null && messageParameters!!.size > 0) { + for ((_, individualHashMap) in messageParameters!!) { + if (MessageDigest.isEqual( + individualHashMap["type"]!!.toByteArray(), + "file".toByteArray() + ) + ) { + return true + } + } + } + return false + } + + fun hasGeoLocation(): Boolean { + if (messageParameters != null && messageParameters!!.size > 0) { + for ((_, individualHashMap) in messageParameters!!) { + if (MessageDigest.isEqual( + individualHashMap["type"]!!.toByteArray(), + "geo-location".toByteArray() + ) + ) { + return true + } + } + } + return false + } + + override fun getImageUrl(): String? { + if (messageParameters != null && messageParameters!!.size > 0) { + for ((_, individualHashMap) in messageParameters!!) { + if (MessageDigest.isEqual( + individualHashMap["type"]!!.toByteArray(), + "file".toByteArray() + ) + ) { + // FIX-ME: this selectedIndividualHashMap stuff needs to be analyzed and most likely be refactored! + // it just feels wrong to fill this here inside getImageUrl() + selectedIndividualHashMap = individualHashMap + if (!isVoiceMessage) { + if (activeUser != null && activeUser!!.baseUrl != null) { + return ApiUtils.getUrlForFilePreviewWithFileId( + activeUser!!.baseUrl, + individualHashMap["id"], + sharedApplication!!.resources.getDimensionPixelSize(R.dimen.maximum_file_preview_size) + ) + } else { + Log.e( + TAG, + "activeUser or activeUser.getBaseUrl() were null when trying to getImageUrl()" + ) + } + } + } + } + } + return if (!messageTypesToIgnore.contains(getCalculateMessageType())) { + message!!.trim { it <= ' ' } + } else null + } + + fun getCalculateMessageType(): MessageType { + return if (!TextUtils.isEmpty(systemMessage)) { + MessageType.SYSTEM_MESSAGE + } else if (isVoiceMessage) { + MessageType.VOICE_MESSAGE + } else if (hasFileAttachment()) { + MessageType.SINGLE_NC_ATTACHMENT_MESSAGE + } else if (hasGeoLocation()) { + MessageType.SINGLE_NC_GEOLOCATION_MESSAGE + } else { + MessageType.REGULAR_TEXT_MESSAGE + } + } + + override fun getId(): String { + return jsonMessageId.toString() + } + + override fun getText(): String { + return getParsedMessage(message, messageParameters)!! + } + + /*} else if (getCalculateMessageType().equals(MessageType.SINGLE_LINK_MESSAGE)) { + if (actorId.equals(activeUser.getUserId())) { + return ( + NextcloudTalkApplication + .Companion.getSharedApplication() + .getString(R.string.nc_sent_a_link_you) + ); + } else { + return (String.format(NextcloudTalkApplication. + Companion. + getSharedApplication(). + getResources(). + getString(R.string.nc_sent_a_link), + !TextUtils.isEmpty(actorDisplayName) ? actorDisplayName : NextcloudTalkApplication. + Companion. + getSharedApplication(). + getString(R.string.nc_guest)) + ); + }*/ + val lastMessageDisplayText: String + get() { + if (getCalculateMessageType() == MessageType.REGULAR_TEXT_MESSAGE || + getCalculateMessageType() == MessageType.SYSTEM_MESSAGE || + getCalculateMessageType() == MessageType.SINGLE_LINK_MESSAGE + ) { + return text + } else { + if (MessageType.SINGLE_LINK_GIPHY_MESSAGE == getCalculateMessageType() || + MessageType.SINGLE_LINK_TENOR_MESSAGE == getCalculateMessageType() || + MessageType.SINGLE_LINK_GIF_MESSAGE == getCalculateMessageType() + ) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_a_gif_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_a_gif), + getNullsafeActorDisplayName() + ) + } + } else if (MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_an_attachment_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_an_attachment), + getNullsafeActorDisplayName() + ) + } + } else if (MessageType.SINGLE_NC_GEOLOCATION_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_location_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_location), + getNullsafeActorDisplayName() + ) + } + } else if (MessageType.VOICE_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_voice_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_voice), + getNullsafeActorDisplayName() + ) + } + /*} else if (getCalculateMessageType().equals(MessageType.SINGLE_LINK_MESSAGE)) { + if (actorId.equals(activeUser.getUserId())) { + return ( + NextcloudTalkApplication + .Companion + .getSharedApplication() + .getString(R.string.nc_sent_a_link_you) + ); + } else { + return (String.format( + NextcloudTalkApplication + .Companion + .getSharedApplication() + .getResources() + .getString(R.string.nc_sent_a_link), + !TextUtils.isEmpty(actorDisplayName) ? actorDisplayName : NextcloudTalkApplication. + Companion. + getSharedApplication(). + getString(R.string.nc_guest)) + ); + }*/ + } else if (MessageType.SINGLE_LINK_AUDIO_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_an_audio_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_an_audio), + getNullsafeActorDisplayName() + ) + } + } else if (MessageType.SINGLE_LINK_VIDEO_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_a_video_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_a_video), + getNullsafeActorDisplayName() + ) + } + } else if (MessageType.SINGLE_LINK_IMAGE_MESSAGE == getCalculateMessageType()) { + return if (actorId == activeUser!!.userId) { + sharedApplication!!.getString(R.string.nc_sent_an_image_you) + } else { + String.format( + sharedApplication!!.resources.getString(R.string.nc_sent_an_image), + getNullsafeActorDisplayName() + ) + } + } + } + return "" + } + + private fun getNullsafeActorDisplayName() = if (!TextUtils.isEmpty(actorDisplayName)) { + actorDisplayName + } else { + sharedApplication!!.getString(R.string.nc_guest) + } + + override fun getUser(): IUser { + return object : IUser { + override fun getId(): String { + return "$actorType/$actorId" + } + + override fun getName(): String { + return if (!TextUtils.isEmpty(actorDisplayName)) { + actorDisplayName!! + } else sharedApplication!!.getString(R.string.nc_guest) + } + + override fun getAvatar(): String? { + return when { + activeUser == null -> { + null + } + actorType == "users" -> { + ApiUtils.getUrlForAvatar(activeUser!!.baseUrl, actorId, true) + } + actorType == "bridged" -> { + ApiUtils.getUrlForAvatar( + activeUser!!.baseUrl, "bridge-bot", + true + ) + } + else -> { + var apiId: String? = sharedApplication!!.getString(R.string.nc_guest) + if (!TextUtils.isEmpty(actorDisplayName)) { + apiId = actorDisplayName + } + ApiUtils.getUrlForGuestAvatar(activeUser!!.baseUrl, apiId, true) + } + } + } + } + } + + override fun getCreatedAt(): Date { + return Date(timestamp * MILLIES) + } + + override fun getSystemMessage(): String { + return EnumSystemMessageTypeConverter().convertToString(systemMessageType) + } + + val isVoiceMessage: Boolean + get() = "voice-message" == messageType + val isCommandMessage: Boolean + get() = "command" == messageType + val isDeletedCommentMessage: Boolean + get() = "comment_deleted" == messageType + + enum class MessageType { + REGULAR_TEXT_MESSAGE, + SYSTEM_MESSAGE, + SINGLE_LINK_GIPHY_MESSAGE, + SINGLE_LINK_TENOR_MESSAGE, + SINGLE_LINK_GIF_MESSAGE, + SINGLE_LINK_MESSAGE, + SINGLE_LINK_VIDEO_MESSAGE, + SINGLE_LINK_IMAGE_MESSAGE, + SINGLE_LINK_AUDIO_MESSAGE, + SINGLE_NC_ATTACHMENT_MESSAGE, + SINGLE_NC_GEOLOCATION_MESSAGE, + VOICE_MESSAGE + } + + /** + * see https://nextcloud-talk.readthedocs.io/en/latest/chat/#system-messages + */ + enum class SystemMessageType { + DUMMY, CONVERSATION_CREATED, + CONVERSATION_RENAMED, + DESCRIPTION_REMOVED, + DESCRIPTION_SET, + CALL_STARTED, + CALL_JOINED, + CALL_LEFT, + CALL_ENDED, + CALL_ENDED_EVERYONE, + CALL_MISSED, + CALL_TRIED, + READ_ONLY_OFF, + READ_ONLY, + LISTABLE_NONE, + LISTABLE_USERS, + LISTABLE_ALL, + LOBBY_NONE, + LOBBY_NON_MODERATORS, + LOBBY_OPEN_TO_EVERYONE, + GUESTS_ALLOWED, + GUESTS_DISALLOWED, + PASSWORD_SET, + PASSWORD_REMOVED, + USER_ADDED, + USER_REMOVED, + GROUP_ADDED, + GROUP_REMOVED, + CIRCLE_ADDED, + CIRCLE_REMOVED, + MODERATOR_PROMOTED, + MODERATOR_DEMOTED, + GUEST_MODERATOR_PROMOTED, + GUEST_MODERATOR_DEMOTED, + MESSAGE_DELETED, + FILE_SHARED, OBJECT_SHARED, + MATTERBRIDGE_CONFIG_ADDED, + MATTERBRIDGE_CONFIG_EDITED, + MATTERBRIDGE_CONFIG_REMOVED, + MATTERBRIDGE_CONFIG_ENABLED, + MATTERBRIDGE_CONFIG_DISABLED, + CLEARED_CHAT, + REACTION, + REACTION_DELETED, + REACTION_REVOKED + } + + companion object { + private const val TAG = "ChatMessage" + private const val MILLIES: Long = 1000L + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.java deleted file mode 100644 index 89d09ae89..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -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 ChatOCS 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 ChatOCS)) { - return false; - } - final ChatOCS other = (ChatOCS) 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 ChatOCS; - } - - 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 "ChatOCS(data=" + this.getData() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.kt new file mode 100644 index 000000000..5e36b98a7 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.chat + +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 ChatOCS( + @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/chat/ChatOCSSingleMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.java deleted file mode 100644 index 01efaa88f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Marcel Hibbe - * Copyright (C) 2021 Marcel Hibbe - * - * 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.generic.GenericOCS; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ChatOCSSingleMessage extends GenericOCS { - @JsonField(name = "data") - public ChatMessage data; - - public ChatMessage getData() { - return this.data; - } - - public void setData(ChatMessage data) { - this.data = data; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatOCSSingleMessage)) { - return false; - } - final ChatOCSSingleMessage other = (ChatOCSSingleMessage) 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 ChatOCSSingleMessage; - } - - 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 "ChatOCSSingleMessage(data=" + this.getData() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.kt new file mode 100644 index 000000000..49a6194f0 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021 Marcel Hibbe + * + * 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.chat + +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 ChatOCSSingleMessage( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, + @JsonField(name = ["data"]) + var data: ChatMessage? = 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/chat/ChatOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.java deleted file mode 100644 index ce1cdfd4f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ChatOverall { - @JsonField(name = "ocs") - public ChatOCS ocs; - - public ChatOCS getOcs() { - return this.ocs; - } - - public void setOcs(ChatOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatOverall)) { - return false; - } - final ChatOverall other = (ChatOverall) 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 ChatOverall; - } - - 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 "ChatOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.kt new file mode 100644 index 000000000..60820b444 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.chat + +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 ChatOverall( + @JsonField(name = ["ocs"]) + var ocs: ChatOCS? = 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/chat/ChatOverallSingleMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.java deleted file mode 100644 index ed2e04523..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Marcel Hibbe - * Copyright (C) 2021 Marcel Hibbe - * - * 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ChatOverallSingleMessage { - @JsonField(name = "ocs") - public ChatOCSSingleMessage ocs; - - public ChatOCSSingleMessage getOcs() { - return this.ocs; - } - - public void setOcs(ChatOCSSingleMessage ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatOverallSingleMessage)) { - return false; - } - final ChatOverallSingleMessage other = (ChatOverallSingleMessage) 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 ChatOverallSingleMessage; - } - - 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 "ChatOverallSingleMessage(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.kt new file mode 100644 index 000000000..e182adf5c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021 Marcel Hibbe + * + * 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.chat + +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 ChatOverallSingleMessage( + @JsonField(name = ["ocs"]) + var ocs: ChatOCSSingleMessage? = 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/chat/ChatShareOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.java deleted file mode 100644 index 6f0191037..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -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.HashMap; -import java.util.Objects; - -@Parcel -@JsonObject -public class ChatShareOCS { - @JsonField(name = "data") - public HashMap data; - - public HashMap getData() { - return this.data; - } - - public void setData(HashMap data) { - this.data = data; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatShareOCS)) { - return false; - } - final ChatShareOCS other = (ChatShareOCS) o; - if (!other.canEqual(this)) { - return false; - } - final Object this$data = this.getData(); - final Object other$data = other.getData(); - - return Objects.equals(this$data, other$data); - } - - protected boolean canEqual(final Object other) { - return other instanceof ChatShareOCS; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $data = this.getData(); - return result * PRIME + ($data == null ? 43 : $data.hashCode()); - } - - public String toString() { - return "ChatShareOCS(data=" + this.getData() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.kt new file mode 100644 index 000000000..d84b37f7c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.kt @@ -0,0 +1,38 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * @author Tim Krüger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Tim Krüger + * + * 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.chat + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import java.util.HashMap +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class ChatShareOCS( + @JsonField(name = ["data"]) + var data: HashMap? = 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/chat/ChatShareOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.java deleted file mode 100644 index ce97b53e6..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.Objects; - -@Parcel -@JsonObject -public class ChatShareOverall { - @JsonField(name = "ocs") - public ChatShareOCS ocs; - - public ChatShareOCS getOcs() { - return this.ocs; - } - - public void setOcs(ChatShareOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatShareOverall)) { - return false; - } - final ChatShareOverall other = (ChatShareOverall) o; - if (!other.canEqual(this)) { - return false; - } - final Object this$ocs = this.getOcs(); - final Object other$ocs = other.getOcs(); - - return Objects.equals(this$ocs, other$ocs); - } - - protected boolean canEqual(final Object other) { - return other instanceof ChatShareOverall; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $ocs = this.getOcs(); - return result * PRIME + ($ocs == null ? 43 : $ocs.hashCode()); - } - - public String toString() { - return "ChatShareOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.kt new file mode 100644 index 000000000..a5acce78a --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * @author Tim Krüger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Tim Krüger + * + * 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.chat + +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 ChatShareOverall( + @JsonField(name = ["ocs"]) + var ocs: ChatShareOCS? = 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/chat/ChatShareOverviewOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.java deleted file mode 100644 index c6ae81b62..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - -import androidx.annotation.NonNull; - -@Parcel -@JsonObject -public class ChatShareOverviewOCS { - @JsonField(name = "data") - public HashMap> data; - - public HashMap> getData() { - return this.data; - } - - public void setData(HashMap> data) { - this.data = data; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatShareOverviewOCS)) { - return false; - } - final ChatShareOverviewOCS other = (ChatShareOverviewOCS) o; - if (!other.canEqual(this)) { - return false; - } - final Object this$data = this.getData(); - final Object other$data = other.getData(); - - return Objects.equals(this$data, other$data); - } - - protected boolean canEqual(final Object other) { - return other instanceof ChatShareOverviewOCS; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $data = this.getData(); - return result * PRIME + ($data == null ? 43 : $data.hashCode()); - } - - public String toString() { - return "ChatShareOverviewOCS(data=" + this.getData() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.kt new file mode 100644 index 000000000..68d1da2a3 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * @author Tim Krüger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Tim Krüger + * + * 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.chat + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler +import java.util.HashMap + +@Parcelize +@JsonObject +@TypeParceler +data class ChatShareOverviewOCS( + @JsonField(name = ["data"]) + var data: HashMap>? = 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/chat/ChatShareOverviewOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.java deleted file mode 100644 index 086a765d7..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.chat; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.Objects; - -@Parcel -@JsonObject -public class ChatShareOverviewOverall { - @JsonField(name = "ocs") - public ChatShareOverviewOCS ocs; - - public ChatShareOverviewOCS getOcs() { - return this.ocs; - } - - public void setOcs(ChatShareOverviewOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ChatShareOverviewOverall)) { - return false; - } - final ChatShareOverviewOverall other = (ChatShareOverviewOverall) o; - if (!other.canEqual(this)) { - return false; - } - final Object this$ocs = this.getOcs(); - final Object other$ocs = other.getOcs(); - - return Objects.equals(this$ocs, other$ocs); - } - - protected boolean canEqual(final Object other) { - return other instanceof ChatShareOverviewOverall; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $ocs = this.getOcs(); - return result * PRIME + ($ocs == null ? 43 : $ocs.hashCode()); - } - - public String toString() { - return "ChatShareOverviewOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.kt new file mode 100644 index 000000000..7cfe04d82 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * @author Tim Krüger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Tim Krüger + * + * 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.chat + +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 ChatShareOverviewOverall( + @JsonField(name = ["ocs"]) + var ocs: ChatShareOverviewOCS? = 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/chat/ReadStatus.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.kt similarity index 91% rename from app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.java rename to app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.kt index 03442f3d1..eca46fd47 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.kt @@ -17,9 +17,8 @@ * 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.chat -package com.nextcloud.talk.models.json.chat; - -public enum ReadStatus { +enum class ReadStatus { NONE, SENT, READ } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java deleted file mode 100644 index 13bd0f41c..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java +++ /dev/null @@ -1,624 +0,0 @@ -/* - * - * Nextcloud Talk application - * - * @author Mario Danic - * @author Tim Krüger - * Copyright (C) 2021 Tim Krüger - * 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.database.CapabilitiesUtil; -import com.nextcloud.talk.models.database.UserEntity; -import com.nextcloud.talk.models.json.chat.ChatMessage; -import com.nextcloud.talk.models.json.converters.EnumLobbyStateConverter; -import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter; -import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter; -import com.nextcloud.talk.models.json.converters.EnumReadOnlyConversationConverter; -import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter; -import com.nextcloud.talk.models.json.participants.Participant; - -import org.parceler.Parcel; - -import java.util.HashMap; -import java.util.Objects; - -@Parcel -@JsonObject -public class Conversation { - @JsonField(name = "id") - public String roomId; - @JsonField(name = "token") - public String token; - @JsonField(name = "name") - public String name; - @JsonField(name = "displayName") - public String displayName; - @JsonField(name = "description") - public String description; - @JsonField(name = "type", typeConverter = EnumRoomTypeConverter.class) - public ConversationType type; - @JsonField(name = "lastPing") - public long lastPing; - @Deprecated - @JsonField(name = "participants") - public HashMap> participants; - @JsonField(name = "participantType", typeConverter = EnumParticipantTypeConverter.class) - public Participant.ParticipantType participantType; - @JsonField(name = "hasPassword") - public boolean hasPassword; - @JsonField(name = "sessionId") - public String sessionId; - @JsonField(name = "actorId") - public String actorId; - @JsonField(name = "actorType") - public String actorType; - public String password; - @JsonField(name = "isFavorite") - public boolean isFavorite; - @JsonField(name = "lastActivity") - public long lastActivity; - @JsonField(name = "unreadMessages") - public int unreadMessages; - @JsonField(name = "unreadMention") - public boolean unreadMention; - @JsonField(name = "lastMessage") - public ChatMessage lastMessage; - @JsonField(name = "objectType") - public String objectType; - @JsonField(name = "notificationLevel", typeConverter = EnumNotificationLevelConverter.class) - public NotificationLevel notificationLevel; - @JsonField(name = "readOnly", typeConverter = EnumReadOnlyConversationConverter.class) - public ConversationReadOnlyState conversationReadOnlyState; - @JsonField(name = "lobbyState", typeConverter = EnumLobbyStateConverter.class) - public LobbyState lobbyState; - @JsonField(name = "lobbyTimer") - public Long lobbyTimer; - @JsonField(name = "lastReadMessage") - public int lastReadMessage; - @JsonField(name = "hasCall") - public boolean hasCall; - @JsonField(name = "callFlag") - public int callFlag; - @JsonField(name = "canStartCall") - public boolean canStartCall; - - @JsonField(name = "canLeaveConversation") - public Boolean canLeaveConversation; - - @JsonField(name = "canDeleteConversation") - public Boolean canDeleteConversation; - - @JsonField(name = "unreadMentionDirect") - public Boolean unreadMentionDirect; - - @JsonField(name = "notificationCalls") - public Integer notificationCalls; - - @JsonField(name = "permissions") - public int permissions; - - public boolean isPublic() { - return (ConversationType.ROOM_PUBLIC_CALL.equals(type)); - } - - public boolean isGuest() { - return (Participant.ParticipantType.GUEST.equals(participantType) || - Participant.ParticipantType.GUEST_MODERATOR.equals(participantType) || - Participant.ParticipantType.USER_FOLLOWING_LINK.equals(participantType)); - } - - private boolean isLockedOneToOne(UserEntity conversationUser) { - return (getType() == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL && - CapabilitiesUtil.hasSpreedFeatureCapability(conversationUser, "locked-one-to-one-rooms")); - } - - public boolean canModerate(UserEntity conversationUser) { - return (isParticipantOwnerOrModerator() && !isLockedOneToOne(conversationUser)); - } - - public boolean isParticipantOwnerOrModerator() { - return (Participant.ParticipantType.OWNER.equals(participantType) || - Participant.ParticipantType.GUEST_MODERATOR.equals(participantType) || - Participant.ParticipantType.MODERATOR.equals(participantType)); - } - - public boolean shouldShowLobby(UserEntity conversationUser) { - return LobbyState.LOBBY_STATE_MODERATORS_ONLY.equals(getLobbyState()) && !canModerate(conversationUser); - } - - public boolean isLobbyViewApplicable(UserEntity conversationUser) { - return !canModerate(conversationUser) && (getType() == ConversationType.ROOM_GROUP_CALL || getType() == ConversationType.ROOM_PUBLIC_CALL); - } - - public boolean isNameEditable(UserEntity conversationUser) { - return (canModerate(conversationUser) && !ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL.equals(type)); - } - - public boolean canLeave(UserEntity conversationUser) { - if (canLeaveConversation != null) { - // Available since APIv2 - return canLeaveConversation; - } - // Fallback for APIv1 - return !canModerate(conversationUser) || - (getType() != ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL && this.participants.size() > 1); - } - - public boolean canDelete(UserEntity conversationUser) { - if (canDeleteConversation != null) { - // Available since APIv2 - return canDeleteConversation; - } - // Fallback for APIv1 - return canModerate(conversationUser); - } - - public String getRoomId() { - return this.roomId; - } - - public String getToken() { - return this.token; - } - - public String getName() { - return this.name; - } - - public String getDescription() { - return this.description; - } - - public String getDisplayName() { - return this.displayName; - } - - public ConversationType getType() { - return this.type; - } - - public long getLastPing() { - return this.lastPing; - } - - public Participant.ParticipantType getParticipantType() { - return this.participantType; - } - - public String getActorId() { - return actorId; - } - - public String getActorType() { - return actorType; - } - - public boolean isHasPassword() { - return this.hasPassword; - } - - public String getSessionId() { - return this.sessionId; - } - - public String getPassword() { - return this.password; - } - - public boolean isFavorite() { - return this.isFavorite; - } - - public long getLastActivity() { - return this.lastActivity; - } - - public int getUnreadMessages() { - return this.unreadMessages; - } - - public boolean isUnreadMention() { - return this.unreadMention; - } - - public ChatMessage getLastMessage() { - return this.lastMessage; - } - - public String getObjectType() { - return this.objectType; - } - - public NotificationLevel getNotificationLevel() { - return this.notificationLevel; - } - - public ConversationReadOnlyState getConversationReadOnlyState() { - return this.conversationReadOnlyState; - } - - public LobbyState getLobbyState() { - return this.lobbyState; - } - - public Long getLobbyTimer() { - return this.lobbyTimer; - } - - public int getLastReadMessage() { - return this.lastReadMessage; - } - - public boolean getHasCall() { - return hasCall; - } - - public int getCallFlag() { - return this.callFlag; - } - - public boolean getCanStartCall() { - return canStartCall; - } - - public Boolean getUnreadMentionDirect() { - return unreadMentionDirect; - } - - public Integer getNotificationCalls() { return notificationCalls; } - - public int getPermissions() { - return permissions; - } - - public void setRoomId(String roomId) { - this.roomId = roomId; - } - - public void setToken(String token) { - this.token = token; - } - - public void setName(String name) { - this.name = name; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public void setType(ConversationType type) { - this.type = type; - } - - public void setLastPing(long lastPing) { - this.lastPing = lastPing; - } - - @Deprecated - public void setParticipants(HashMap> participants) { - this.participants = participants; - } - - public void setParticipantType(Participant.ParticipantType participantType) { - this.participantType = participantType; - } - - public void setActorId(String actorId) { - this.actorId = actorId; - } - - public void setActorType(String actorType) { - this.actorType = actorType; - } - - public void setHasPassword(boolean hasPassword) { - this.hasPassword = hasPassword; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - public void setPassword(String password) { - this.password = password; - } - - public void setFavorite(boolean isFavorite) { - this.isFavorite = isFavorite; - } - - public void setLastActivity(long lastActivity) { - this.lastActivity = lastActivity; - } - - public void setUnreadMessages(int unreadMessages) { - this.unreadMessages = unreadMessages; - } - - public void setUnreadMention(boolean unreadMention) { - this.unreadMention = unreadMention; - } - - public void setLastMessage(ChatMessage lastMessage) { - this.lastMessage = lastMessage; - } - - public void setObjectType(String objectType) { - this.objectType = objectType; - } - - public void setNotificationLevel(NotificationLevel notificationLevel) { - this.notificationLevel = notificationLevel; - } - - public void setConversationReadOnlyState(ConversationReadOnlyState conversationReadOnlyState) { - this.conversationReadOnlyState = conversationReadOnlyState; - } - - public void setLobbyState(LobbyState lobbyState) { - this.lobbyState = lobbyState; - } - - public void setLobbyTimer(Long lobbyTimer) { - this.lobbyTimer = lobbyTimer; - } - - public void setLastReadMessage(int lastReadMessage) { - this.lastReadMessage = lastReadMessage; - } - - public void setHasCall(boolean hasCall) { - this.hasCall = hasCall; - } - - public void setCallFlag(int callFlag) { - this.callFlag = callFlag; - } - - public void setCanStartCall(boolean canStartCall) { - this.canStartCall = canStartCall; - } - - public void setUnreadMentionDirect(Boolean unreadMentionDirect) { - this.unreadMentionDirect = unreadMentionDirect; - } - - public void setPermissions(int permissions) { - this.permissions = permissions; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Conversation that = (Conversation) o; - - if (lastPing != that.lastPing) { - return false; - } - if (hasPassword != that.hasPassword) { - return false; - } - if (isFavorite != that.isFavorite) { - return false; - } - if (lastActivity != that.lastActivity) { - return false; - } - if (unreadMessages != that.unreadMessages) { - return false; - } - if (unreadMention != that.unreadMention) { - return false; - } - if (lastReadMessage != that.lastReadMessage) { - return false; - } - if (hasCall != that.hasCall) { - return false; - } - if (callFlag != that.callFlag) { - return false; - } - if (canStartCall != that.canStartCall) { - return false; - } - if (!Objects.equals(roomId, that.roomId)) { - return false; - } - if (!token.equals(that.token)) { - return false; - } - if (!Objects.equals(name, that.name)) { - return false; - } - if (!Objects.equals(displayName, that.displayName)) { - return false; - } - if (!Objects.equals(description, that.description)) { - return false; - } - if (type != that.type) { - return false; - } - if (!Objects.equals(participants, that.participants)) { - return false; - } - if (participantType != that.participantType) { - return false; - } - if (!Objects.equals(sessionId, that.sessionId)) { - return false; - } - if (!Objects.equals(actorId, that.actorId)) { - return false; - } - if (!Objects.equals(actorType, that.actorType)) { - return false; - } - if (!Objects.equals(password, that.password)) { - return false; - } - if (!Objects.equals(lastMessage, that.lastMessage)) { - return false; - } - if (!Objects.equals(objectType, that.objectType)) { - return false; - } - if (notificationLevel != that.notificationLevel) { - return false; - } - if (conversationReadOnlyState != that.conversationReadOnlyState) { - return false; - } - if (lobbyState != that.lobbyState) { - return false; - } - if (!Objects.equals(lobbyTimer, that.lobbyTimer)) { - return false; - } - if (!Objects.equals(canLeaveConversation, that.canLeaveConversation)) { - return false; - } - if (!Objects.equals(notificationCalls, that.notificationCalls)) { - return false; - } - if (permissions != that.permissions) { - return false; - } - return Objects.equals(canDeleteConversation, that.canDeleteConversation); - } - - protected boolean canEqual(final Object other) { - return other instanceof Conversation; - } - - @Override - public int hashCode() { - int result = roomId != null ? roomId.hashCode() : 0; - result = 31 * result + token.hashCode(); - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (displayName != null ? displayName.hashCode() : 0); - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + type.hashCode(); - result = 31 * result + (int) (lastPing ^ (lastPing >>> 32)); - result = 31 * result + (participants != null ? participants.hashCode() : 0); - result = 31 * result + (participantType != null ? participantType.hashCode() : 0); - result = 31 * result + (actorId != null ? actorId.hashCode() : 0); - result = 31 * result + (actorType != null ? actorType.hashCode() : 0); - result = 31 * result + (hasPassword ? 1 : 0); - result = 31 * result + (sessionId != null ? sessionId.hashCode() : 0); - result = 31 * result + (password != null ? password.hashCode() : 0); - result = 31 * result + (isFavorite ? 1 : 0); - result = 31 * result + (int) (lastActivity ^ (lastActivity >>> 32)); - result = 31 * result + unreadMessages; - result = 31 * result + (unreadMention ? 1 : 0); - result = 31 * result + (lastMessage != null ? lastMessage.hashCode() : 0); - result = 31 * result + (objectType != null ? objectType.hashCode() : 0); - result = 31 * result + (notificationLevel != null ? notificationLevel.hashCode() : 0); - result = 31 * result + (conversationReadOnlyState != null ? conversationReadOnlyState.hashCode() : 0); - result = 31 * result + (lobbyState != null ? lobbyState.hashCode() : 0); - result = 31 * result + (lobbyTimer != null ? lobbyTimer.hashCode() : 0); - result = 31 * result + lastReadMessage; - result = 31 * result + (hasCall ? 1 : 0); - result = 31 * result + callFlag; - result = 31 * result + (canStartCall ? 1 : 0); - result = 31 * result + (canLeaveConversation != null ? canLeaveConversation.hashCode() : 0); - result = 31 * result + (canDeleteConversation != null ? canDeleteConversation.hashCode() : 0); - result = 31 * result + (notificationCalls != null ? notificationCalls.hashCode() : 0); - result = 31 * result + permissions; - return result; - } - - @Override - public String toString() { - return "Conversation{" + - "roomId='" + roomId + '\'' + - ", token='" + token + '\'' + - ", name='" + name + '\'' + - ", displayName='" + displayName + '\'' + - ", description='" + description + '\'' + - ", type=" + type + - ", lastPing=" + lastPing + - ", participants=" + participants + - ", participantType=" + participantType + - ", actorId=" + actorId + - ", actorType=" + actorType + - ", hasPassword=" + hasPassword + - ", sessionId='" + sessionId + '\'' + - ", password='" + password + '\'' + - ", isFavorite=" + isFavorite + - ", lastActivity=" + lastActivity + - ", unreadMessages=" + unreadMessages + - ", unreadMention=" + unreadMention + - ", lastMessage=" + lastMessage + - ", objectType='" + objectType + '\'' + - ", notificationLevel=" + notificationLevel + - ", conversationReadOnlyState=" + conversationReadOnlyState + - ", lobbyState=" + lobbyState + - ", lobbyTimer=" + lobbyTimer + - ", lastReadMessage=" + lastReadMessage + - ", hasCall=" + hasCall + - ", callFlag=" + callFlag + - ", canStartCall=" + canStartCall + - ", canLeaveConversation=" + canLeaveConversation + - ", canDeleteConversation=" + canDeleteConversation + - ", notificationCalls=" + notificationCalls + - ", permissions=" + permissions + - '}'; - } - - public enum NotificationLevel { - DEFAULT, - ALWAYS, - MENTION, - NEVER - } - - public enum LobbyState { - LOBBY_STATE_ALL_PARTICIPANTS, - LOBBY_STATE_MODERATORS_ONLY - } - - public enum ConversationReadOnlyState { - CONVERSATION_READ_WRITE, - CONVERSATION_READ_ONLY - } - - @Parcel - public enum ConversationType { - DUMMY, - ROOM_TYPE_ONE_TO_ONE_CALL, - ROOM_GROUP_CALL, - ROOM_PUBLIC_CALL, - ROOM_SYSTEM - } - -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt new file mode 100644 index 000000000..b7718584d --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt @@ -0,0 +1,198 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021 Tim Krüger + * 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 android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.database.CapabilitiesUtil +import com.nextcloud.talk.models.database.UserEntity +import com.nextcloud.talk.models.json.chat.ChatMessage +import com.nextcloud.talk.models.json.converters.EnumLobbyStateConverter +import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter +import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter +import com.nextcloud.talk.models.json.converters.EnumReadOnlyConversationConverter +import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter +import com.nextcloud.talk.models.json.participants.Participant.ParticipantType +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class Conversation( + @JsonField(name = ["id"]) + var roomId: String? = null, + @JsonField(name = ["token"]) + var token: String? = null, + @JsonField(name = ["name"]) + var name: String? = null, + @JsonField(name = ["displayName"]) + var displayName: String? = null, + @JsonField(name = ["description"]) + var description: String? = null, + @JsonField(name = ["type"], typeConverter = EnumRoomTypeConverter::class) + var type: ConversationType? = null, + @JsonField(name = ["lastPing"]) + var lastPing: Long = 0, + @JsonField(name = ["participantType"], typeConverter = EnumParticipantTypeConverter::class) + var participantType: ParticipantType? = null, + @JsonField(name = ["hasPassword"]) + var hasPassword: Boolean = false, + @JsonField(name = ["sessionId"]) + var sessionId: String? = null, + @JsonField(name = ["actorId"]) + var actorId: String? = null, + @JsonField(name = ["actorType"]) + var actorType: String? = null, + + var password: String? = null, + + @JsonField(name = ["isFavorite"]) + var favorite: Boolean = false, + + @JsonField(name = ["lastActivity"]) + var lastActivity: Long = 0, + + @JsonField(name = ["unreadMessages"]) + var unreadMessages: Int = 0, + + @JsonField(name = ["unreadMention"]) + var unreadMention: Boolean = false, + + @JsonField(name = ["lastMessage"]) + var lastMessage: ChatMessage? = null, + + @JsonField(name = ["objectType"]) + var objectType: String? = null, + + @JsonField(name = ["notificationLevel"], typeConverter = EnumNotificationLevelConverter::class) + var notificationLevel: NotificationLevel? = null, + + @JsonField(name = ["readOnly"], typeConverter = EnumReadOnlyConversationConverter::class) + var conversationReadOnlyState: ConversationReadOnlyState? = null, + + @JsonField(name = ["lobbyState"], typeConverter = EnumLobbyStateConverter::class) + var lobbyState: LobbyState? = null, + + @JsonField(name = ["lobbyTimer"]) + var lobbyTimer: Long? = null, + + @JsonField(name = ["lastReadMessage"]) + var lastReadMessage: Int = 0, + + @JsonField(name = ["hasCall"]) + var hasCall: Boolean = false, + + @JsonField(name = ["callFlag"]) + var callFlag: Int = 0, + + @JsonField(name = ["canStartCall"]) + var canStartCall: Boolean = false, + + @JsonField(name = ["canLeaveConversation"]) + var canLeaveConversation: Boolean? = null, + + @JsonField(name = ["canDeleteConversation"]) + var canDeleteConversation: Boolean? = null, + + @JsonField(name = ["unreadMentionDirect"]) + var unreadMentionDirect: Boolean? = null, + + @JsonField(name = ["notificationCalls"]) + var notificationCalls: Int? = null, + + @JsonField(name = ["permissions"]) + var permissions: Int = 0 +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) + + val isPublic: Boolean + get() = ConversationType.ROOM_PUBLIC_CALL == type + + val isGuest: Boolean + get() = ParticipantType.GUEST == participantType || + ParticipantType.GUEST_MODERATOR == participantType || + ParticipantType.USER_FOLLOWING_LINK == participantType + + val isParticipantOwnerOrModerator: Boolean + get() = ParticipantType.OWNER == participantType || + ParticipantType.GUEST_MODERATOR == participantType || + ParticipantType.MODERATOR == participantType + + private fun isLockedOneToOne(conversationUser: UserEntity): Boolean { + return type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL && + CapabilitiesUtil.hasSpreedFeatureCapability(conversationUser, "locked-one-to-one-rooms") + } + + fun canModerate(conversationUser: UserEntity): Boolean { + return isParticipantOwnerOrModerator && !isLockedOneToOne(conversationUser) + } + + fun shouldShowLobby(conversationUser: UserEntity): Boolean { + return LobbyState.LOBBY_STATE_MODERATORS_ONLY == lobbyState && !canModerate(conversationUser) + } + + fun isLobbyViewApplicable(conversationUser: UserEntity): Boolean { + return !canModerate(conversationUser) && + (type == ConversationType.ROOM_GROUP_CALL || type == ConversationType.ROOM_PUBLIC_CALL) + } + + fun isNameEditable(conversationUser: UserEntity): Boolean { + return canModerate(conversationUser) && ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL != type + } + + fun canLeave(): Boolean { + return if (canLeaveConversation != null) { + // Available since APIv2 + canLeaveConversation!! + } else { + true + } + } + + fun canDelete(conversationUser: UserEntity): Boolean { + return if (canDeleteConversation != null) { + // Available since APIv2 + canDeleteConversation!! + } else canModerate(conversationUser) + // Fallback for APIv1 + } + + enum class NotificationLevel { + DEFAULT, ALWAYS, MENTION, NEVER + } + + enum class LobbyState { + LOBBY_STATE_ALL_PARTICIPANTS, LOBBY_STATE_MODERATORS_ONLY + } + + enum class ConversationReadOnlyState { + CONVERSATION_READ_WRITE, CONVERSATION_READ_ONLY + } + + @Parcelize + enum class ConversationType : Parcelable { + DUMMY, ROOM_TYPE_ONE_TO_ONE_CALL, ROOM_GROUP_CALL, ROOM_PUBLIC_CALL, ROOM_SYSTEM + } +} 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/models/json/converters/EnumSystemMessageTypeConverter.kt b/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumSystemMessageTypeConverter.kt index c20d09046..caa75ec2b 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumSystemMessageTypeConverter.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumSystemMessageTypeConverter.kt @@ -171,6 +171,7 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter - * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com) + * 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 diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java deleted file mode 100644 index ea55f20d5..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java +++ /dev/null @@ -1,38 +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.generic; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -/** - * Legacy class for the remaining java parceler classes - * that haven't yet been migrated to kotlin data classes - */ -@Parcel -@JsonObject -@Deprecated -public class GenericOCS { - @JsonField(name = "meta") - public GenericMeta meta; -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt index 9b1111f59..a257638ca 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt @@ -1,22 +1,23 @@ /* + * Nextcloud Talk application * - * Nextcloud Talk application + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com) * - * @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 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. * - * 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 . + * 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.generic diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.java deleted file mode 100644 index 443abdc0d..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.java +++ /dev/null @@ -1,35 +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.participants; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.generic.GenericOCS; -import com.nextcloud.talk.models.json.conversations.Conversation; - -@JsonObject -public class AddParticipantOCS extends GenericOCS { - /* - Returned room will have only type set, and sometimes even that will be null - */ - @JsonField(name = "data") - Conversation data; -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.kt new file mode 100644 index 000000000..852aac0c4 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOCS.kt @@ -0,0 +1,42 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.participants + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.conversations.Conversation +import com.nextcloud.talk.models.json.generic.GenericMeta +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class AddParticipantOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, + /* Returned room will have only type set, and sometimes even that will be null */ + @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/participants/AddParticipantOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOverall.java deleted file mode 100644 index 0fd69701e..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOverall.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.participants; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.conversations.RoomsOCS; - -@JsonObject -public class AddParticipantOverall { - @JsonField(name = "ocs") - 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 AddParticipantOverall)) { - return false; - } - final AddParticipantOverall other = (AddParticipantOverall) 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 AddParticipantOverall; - } - - 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 "AddParticipantOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOverall.kt new file mode 100644 index 000000000..58dbf39a6 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/AddParticipantOverall.kt @@ -0,0 +1,38 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.participants + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.conversations.RoomsOCS +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class AddParticipantOverall( + @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/models/json/participants/ParticipantsOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/participants/ParticipantsOverall.kt index ed3d0b768..b26af9932 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/ParticipantsOverall.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/ParticipantsOverall.kt @@ -18,9 +18,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * Parts related to account import were either copied from or inspired by the great work done by David Luhmer at: - * https://github.com/nextcloud/ownCloud-Account-Importer */ package com.nextcloud.talk.models.json.participants diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.java deleted file mode 100644 index 8315105bd..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.converters.ObjectParcelConverter; - -import org.parceler.ParcelPropertyConverter; - -@JsonObject -public class DataChannelMessage { - @JsonField(name = "type") - String type; - - @ParcelPropertyConverter(ObjectParcelConverter.class) - @JsonField(name = "payload") - Object payload; - - public DataChannelMessage(String type) { - this.type = type; - } - - public DataChannelMessage() { - } - - public String getType() { - return this.type; - } - - public Object getPayload() { - return this.payload; - } - - public void setType(String type) { - this.type = type; - } - - public void setPayload(Object payload) { - this.payload = payload; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof DataChannelMessage)) { - return false; - } - final DataChannelMessage other = (DataChannelMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$payload = this.getPayload(); - final Object other$payload = other.getPayload(); - - return this$payload == null ? other$payload == null : this$payload.equals(other$payload); - } - - protected boolean canEqual(final Object other) { - return other instanceof DataChannelMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $payload = this.getPayload(); - result = result * PRIME + ($payload == null ? 43 : $payload.hashCode()); - return result; - } - - public String toString() { - return "DataChannelMessage(type=" + this.getType() + ", payload=" + this.getPayload() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.kt new file mode 100644 index 000000000..1024afc0f --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessage.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler + +@Parcelize +@JsonObject +@TypeParceler +data class DataChannelMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["payload"]) + var payload: Any? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) + constructor(type: String) : this(type, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.java deleted file mode 100644 index c9038868c..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.converters.ObjectParcelConverter; - -import org.parceler.ParcelPropertyConverter; - -import java.util.HashMap; - -@JsonObject -public class DataChannelMessageNick { - @JsonField(name = "type") - String type; - - @ParcelPropertyConverter(ObjectParcelConverter.class) - @JsonField(name = "payload") - HashMap payload; - - public DataChannelMessageNick(String type) { - this.type = type; - } - - public DataChannelMessageNick() { - } - - public String getType() { - return this.type; - } - - public HashMap getPayload() { - return this.payload; - } - - public void setType(String type) { - this.type = type; - } - - public void setPayload(HashMap payload) { - this.payload = payload; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof DataChannelMessageNick)) { - return false; - } - final DataChannelMessageNick other = (DataChannelMessageNick) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$payload = this.getPayload(); - final Object other$payload = other.getPayload(); - - return this$payload == null ? other$payload == null : this$payload.equals(other$payload); - } - - protected boolean canEqual(final Object other) { - return other instanceof DataChannelMessageNick; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $payload = this.getPayload(); - result = result * PRIME + ($payload == null ? 43 : $payload.hashCode()); - return result; - } - - public String toString() { - return "DataChannelMessageNick(type=" + this.getType() + ", payload=" + this.getPayload() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.kt new file mode 100644 index 000000000..652106fa0 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/DataChannelMessageNick.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import java.util.HashMap +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class DataChannelMessageNick( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["payload"]) + var payload: HashMap? = 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/signaling/NCIceCandidate.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCIceCandidate.java deleted file mode 100644 index 72662c581..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCIceCandidate.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class NCIceCandidate { - @JsonField(name = "sdpMLineIndex") - int sdpMLineIndex; - - @JsonField(name = "sdpMid") - String sdpMid; - - @JsonField(name = "candidate") - String candidate; - - public int getSdpMLineIndex() { - return this.sdpMLineIndex; - } - - public String getSdpMid() { - return this.sdpMid; - } - - public String getCandidate() { - return this.candidate; - } - - public void setSdpMLineIndex(int sdpMLineIndex) { - this.sdpMLineIndex = sdpMLineIndex; - } - - public void setSdpMid(String sdpMid) { - this.sdpMid = sdpMid; - } - - public void setCandidate(String candidate) { - this.candidate = candidate; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof NCIceCandidate)) { - return false; - } - final NCIceCandidate other = (NCIceCandidate) o; - if (!other.canEqual((Object) this)) { - return false; - } - if (this.getSdpMLineIndex() != other.getSdpMLineIndex()) { - return false; - } - final Object this$sdpMid = this.getSdpMid(); - final Object other$sdpMid = other.getSdpMid(); - if (this$sdpMid == null ? other$sdpMid != null : !this$sdpMid.equals(other$sdpMid)) { - return false; - } - final Object this$candidate = this.getCandidate(); - final Object other$candidate = other.getCandidate(); - - return this$candidate == null ? other$candidate == null : this$candidate.equals(other$candidate); - } - - protected boolean canEqual(final Object other) { - return other instanceof NCIceCandidate; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - result = result * PRIME + this.getSdpMLineIndex(); - final Object $sdpMid = this.getSdpMid(); - result = result * PRIME + ($sdpMid == null ? 43 : $sdpMid.hashCode()); - final Object $candidate = this.getCandidate(); - result = result * PRIME + ($candidate == null ? 43 : $candidate.hashCode()); - return result; - } - - public String toString() { - return "NCIceCandidate(sdpMLineIndex=" + this.getSdpMLineIndex() + ", sdpMid=" + this.getSdpMid() + ", candidate=" + this.getCandidate() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCIceCandidate.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCIceCandidate.kt new file mode 100644 index 000000000..d63d58b08 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCIceCandidate.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +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 NCIceCandidate( + @JsonField(name = ["sdpMLineIndex"]) + var sdpMLineIndex: Int = 0, + @JsonField(name = ["sdpMid"]) + var sdpMid: String? = null, + @JsonField(name = ["candidate"]) + var candidate: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(0, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.java deleted file mode 100644 index dfb9c2897..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class NCMessagePayload { - @JsonField(name = "type") - String type; - - @JsonField(name = "sdp") - String sdp; - - @JsonField(name = "nick") - String nick; - - @JsonField(name = "candidate") - NCIceCandidate iceCandidate; - - @JsonField(name = "name") - String name; - - public String getType() { - return this.type; - } - - public String getSdp() { - return this.sdp; - } - - public String getNick() { - return this.nick; - } - - public NCIceCandidate getIceCandidate() { - return this.iceCandidate; - } - - public String getName() { - return this.name; - } - - public void setType(String type) { - this.type = type; - } - - public void setSdp(String sdp) { - this.sdp = sdp; - } - - public void setNick(String nick) { - this.nick = nick; - } - - public void setIceCandidate(NCIceCandidate iceCandidate) { - this.iceCandidate = iceCandidate; - } - - public void setName(String name) { - this.name = name; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof NCMessagePayload)) { - return false; - } - final NCMessagePayload other = (NCMessagePayload) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$sdp = this.getSdp(); - final Object other$sdp = other.getSdp(); - if (this$sdp == null ? other$sdp != null : !this$sdp.equals(other$sdp)) { - return false; - } - final Object this$nick = this.getNick(); - final Object other$nick = other.getNick(); - if (this$nick == null ? other$nick != null : !this$nick.equals(other$nick)) { - return false; - } - final Object this$iceCandidate = this.getIceCandidate(); - final Object other$iceCandidate = other.getIceCandidate(); - if (this$iceCandidate == null ? other$iceCandidate != null : !this$iceCandidate.equals(other$iceCandidate)) { - return false; - } - final Object this$name = this.getName(); - final Object other$name = other.getName(); - - return this$name == null ? other$name == null : this$name.equals(other$name); - } - - protected boolean canEqual(final Object other) { - return other instanceof NCMessagePayload; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $sdp = this.getSdp(); - result = result * PRIME + ($sdp == null ? 43 : $sdp.hashCode()); - final Object $nick = this.getNick(); - result = result * PRIME + ($nick == null ? 43 : $nick.hashCode()); - final Object $iceCandidate = this.getIceCandidate(); - result = result * PRIME + ($iceCandidate == null ? 43 : $iceCandidate.hashCode()); - final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 43 : $name.hashCode()); - return result; - } - - public String toString() { - return "NCMessagePayload(type=" + this.getType() + ", sdp=" + this.getSdp() + ", nick=" + this.getNick() + ", iceCandidate=" + this.getIceCandidate() + ", name=" + this.getName() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.kt new file mode 100644 index 000000000..79b0b4b6e --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessagePayload.kt @@ -0,0 +1,45 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +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 NCMessagePayload( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["sdp"]) + var sdp: String? = null, + @JsonField(name = ["nick"]) + var nick: String? = null, + @JsonField(name = ["candidate"]) + var iceCandidate: NCIceCandidate? = null, + @JsonField(name = ["name"]) + var name: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.java deleted file mode 100644 index 8beb8a32f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class NCMessageWrapper { - @JsonField(name = "fn") - NCSignalingMessage signalingMessage; - - // always a "message" - @JsonField(name = "ev") - String ev; - - @JsonField(name = "sessionId") - String sessionId; - - public NCSignalingMessage getSignalingMessage() { - return this.signalingMessage; - } - - public String getEv() { - return this.ev; - } - - public String getSessionId() { - return this.sessionId; - } - - public void setSignalingMessage(NCSignalingMessage signalingMessage) { - this.signalingMessage = signalingMessage; - } - - public void setEv(String ev) { - this.ev = ev; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof NCMessageWrapper)) { - return false; - } - final NCMessageWrapper other = (NCMessageWrapper) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$signalingMessage = this.getSignalingMessage(); - final Object other$signalingMessage = other.getSignalingMessage(); - if (this$signalingMessage == null ? other$signalingMessage != null : !this$signalingMessage.equals(other$signalingMessage)) { - return false; - } - final Object this$ev = this.getEv(); - final Object other$ev = other.getEv(); - if (this$ev == null ? other$ev != null : !this$ev.equals(other$ev)) { - return false; - } - final Object this$sessionId = this.getSessionId(); - final Object other$sessionId = other.getSessionId(); - - return this$sessionId == null ? other$sessionId == null : this$sessionId.equals(other$sessionId); - } - - protected boolean canEqual(final Object other) { - return other instanceof NCMessageWrapper; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $signalingMessage = this.getSignalingMessage(); - result = result * PRIME + ($signalingMessage == null ? 43 : $signalingMessage.hashCode()); - final Object $ev = this.getEv(); - result = result * PRIME + ($ev == null ? 43 : $ev.hashCode()); - final Object $sessionId = this.getSessionId(); - result = result * PRIME + ($sessionId == null ? 43 : $sessionId.hashCode()); - return result; - } - - public String toString() { - return "NCMessageWrapper(signalingMessage=" + this.getSignalingMessage() + ", ev=" + this.getEv() + ", sessionId=" + this.getSessionId() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.kt new file mode 100644 index 000000000..b8100bb07 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCMessageWrapper.kt @@ -0,0 +1,42 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +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 NCMessageWrapper( + @JsonField(name = ["fn"]) + var signalingMessage: NCSignalingMessage? = null, + /** always a "message" */ + @JsonField(name = ["ev"]) + var ev: String? = null, + @JsonField(name = ["sessionId"]) + var sessionId: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.java deleted file mode 100644 index 610533476..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class NCSignalingMessage { - @JsonField(name = "from") - String from; - @JsonField(name = "to") - String to; - @JsonField(name = "type") - String type; - @JsonField(name = "payload") - NCMessagePayload payload; - @JsonField(name = "roomType") - String roomType; - @JsonField(name = "sid") - String sid; - @JsonField(name = "prefix") - String prefix; - - public String getFrom() { - return this.from; - } - - public String getTo() { - return this.to; - } - - public String getType() { - return this.type; - } - - public NCMessagePayload getPayload() { - return this.payload; - } - - public String getRoomType() { - return this.roomType; - } - - public String getSid() { - return this.sid; - } - - public String getPrefix() { - return this.prefix; - } - - public void setFrom(String from) { - this.from = from; - } - - public void setTo(String to) { - this.to = to; - } - - public void setType(String type) { - this.type = type; - } - - public void setPayload(NCMessagePayload payload) { - this.payload = payload; - } - - public void setRoomType(String roomType) { - this.roomType = roomType; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof NCSignalingMessage)) { - return false; - } - final NCSignalingMessage other = (NCSignalingMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$from = this.getFrom(); - final Object other$from = other.getFrom(); - if (this$from == null ? other$from != null : !this$from.equals(other$from)) { - return false; - } - final Object this$to = this.getTo(); - final Object other$to = other.getTo(); - if (this$to == null ? other$to != null : !this$to.equals(other$to)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$payload = this.getPayload(); - final Object other$payload = other.getPayload(); - if (this$payload == null ? other$payload != null : !this$payload.equals(other$payload)) { - return false; - } - final Object this$roomType = this.getRoomType(); - final Object other$roomType = other.getRoomType(); - if (this$roomType == null ? other$roomType != null : !this$roomType.equals(other$roomType)) { - return false; - } - final Object this$sid = this.getSid(); - final Object other$sid = other.getSid(); - if (this$sid == null ? other$sid != null : !this$sid.equals(other$sid)) { - return false; - } - final Object this$prefix = this.getPrefix(); - final Object other$prefix = other.getPrefix(); - - return this$prefix == null ? other$prefix == null : this$prefix.equals(other$prefix); - } - - protected boolean canEqual(final Object other) { - return other instanceof NCSignalingMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $from = this.getFrom(); - result = result * PRIME + ($from == null ? 43 : $from.hashCode()); - final Object $to = this.getTo(); - result = result * PRIME + ($to == null ? 43 : $to.hashCode()); - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $payload = this.getPayload(); - result = result * PRIME + ($payload == null ? 43 : $payload.hashCode()); - final Object $roomType = this.getRoomType(); - result = result * PRIME + ($roomType == null ? 43 : $roomType.hashCode()); - final Object $sid = this.getSid(); - result = result * PRIME + ($sid == null ? 43 : $sid.hashCode()); - final Object $prefix = this.getPrefix(); - result = result * PRIME + ($prefix == null ? 43 : $prefix.hashCode()); - return result; - } - - public String toString() { - return "NCSignalingMessage(from=" + this.getFrom() + ", to=" + this.getTo() + ", type=" + this.getType() + ", payload=" + this.getPayload() + ", roomType=" + this.getRoomType() + ", sid=" + this.getSid() + ", prefix=" + this.getPrefix() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.kt new file mode 100644 index 000000000..2af0b97da --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/NCSignalingMessage.kt @@ -0,0 +1,49 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +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 NCSignalingMessage( + @JsonField(name = ["from"]) + var from: String? = null, + @JsonField(name = ["to"]) + var to: String? = null, + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["payload"]) + var payload: NCMessagePayload? = null, + @JsonField(name = ["roomType"]) + var roomType: String? = null, + @JsonField(name = ["sid"]) + var sid: String? = null, + @JsonField(name = ["prefix"]) + var prefix: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null, null, null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.java deleted file mode 100644 index adfb55e12..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -/** - * Created by mdjanic on 30/10/2017. - */ - -@JsonObject -public class Signaling { - @JsonField(name = "type") - String type; - //can be NCMessageWrapper or List> - @JsonField(name = "data") - Object messageWrapper; - - public String getType() { - return this.type; - } - - public Object getMessageWrapper() { - return this.messageWrapper; - } - - public void setType(String type) { - this.type = type; - } - - public void setMessageWrapper(Object messageWrapper) { - this.messageWrapper = messageWrapper; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Signaling)) { - return false; - } - final Signaling other = (Signaling) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$messageWrapper = this.getMessageWrapper(); - final Object other$messageWrapper = other.getMessageWrapper(); - - return this$messageWrapper == null ? other$messageWrapper == null : this$messageWrapper.equals(other$messageWrapper); - } - - protected boolean canEqual(final Object other) { - return other instanceof Signaling; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $messageWrapper = this.getMessageWrapper(); - result = result * PRIME + ($messageWrapper == null ? 43 : $messageWrapper.hashCode()); - return result; - } - - public String toString() { - return "Signaling(type=" + this.getType() + ", messageWrapper=" + this.getMessageWrapper() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.kt new file mode 100644 index 000000000..38c17648c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/Signaling.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler + +@Parcelize +@JsonObject +@TypeParceler +data class Signaling( + @JsonField(name = ["type"]) + var type: String? = null, + /** can be NCMessageWrapper or List> */ + @JsonField(name = ["data"]) + var messageWrapper: Any? = 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/signaling/SignalingOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOCS.java deleted file mode 100644 index c060e4bf1..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOCS.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.generic.GenericOCS; - -import java.util.List; - -@JsonObject -public class SignalingOCS extends GenericOCS { - @JsonField(name = "data") - List signalings; - - public List getSignalings() { - return this.signalings; - } - - public void setSignalings(List signalings) { - this.signalings = signalings; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignalingOCS)) { - return false; - } - final SignalingOCS other = (SignalingOCS) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$signalings = this.getSignalings(); - final Object other$signalings = other.getSignalings(); - - return this$signalings == null ? other$signalings == null : this$signalings.equals(other$signalings); - } - - protected boolean canEqual(final Object other) { - return other instanceof SignalingOCS; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $signalings = this.getSignalings(); - result = result * PRIME + ($signalings == null ? 43 : $signalings.hashCode()); - return result; - } - - public String toString() { - return "SignalingOCS(signalings=" + this.getSignalings() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOCS.kt new file mode 100644 index 000000000..bfbec9166 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOCS.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +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 +class SignalingOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, + @JsonField(name = ["data"]) + var signalings: 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/signaling/SignalingOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOverall.java deleted file mode 100644 index 83a1df6c3..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOverall.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -@JsonObject -public class SignalingOverall { - @JsonField(name = "ocs") - SignalingOCS ocs; - - public SignalingOCS getOcs() { - return this.ocs; - } - - public void setOcs(SignalingOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignalingOverall)) { - return false; - } - final SignalingOverall other = (SignalingOverall) 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 SignalingOverall; - } - - 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 "SignalingOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOverall.kt new file mode 100644 index 000000000..4d19942bc --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/SignalingOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class SignalingOverall( + @JsonField(name = ["ocs"]) + var ocs: SignalingOCS? = 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/signaling/settings/IceServer.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/IceServer.java deleted file mode 100644 index 1df8eaa40..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/IceServer.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling.settings; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import java.util.List; - -@JsonObject -public class IceServer { - @Deprecated - @JsonField(name = "url") - String url; - - @JsonField(name = "urls") - List urls; - - @JsonField(name = "username") - String username; - - @JsonField(name = "credential") - String credential; - - @Deprecated - public String getUrl() { - return this.url; - } - - public List getUrls() { - return this.urls; - } - - public String getUsername() { - return this.username; - } - - public String getCredential() { - return this.credential; - } - - public void setUrl(String url) { - this.url = url; - } - - public void setUrls(List urls) { - this.urls = urls; - } - - public void setUsername(String username) { - this.username = username; - } - - public void setCredential(String credential) { - this.credential = credential; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof IceServer)) { - return false; - } - final IceServer other = (IceServer) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$url = this.getUrl(); - final Object other$url = other.getUrl(); - if (this$url == null ? other$url != null : !this$url.equals(other$url)) { - return false; - } - final Object this$urls = this.getUrls(); - final Object other$urls = other.getUrls(); - if (this$urls == null ? other$urls != null : !this$urls.equals(other$urls)) { - return false; - } - final Object this$username = this.getUsername(); - final Object other$username = other.getUsername(); - if (this$username == null ? other$username != null : !this$username.equals(other$username)) { - return false; - } - final Object this$credential = this.getCredential(); - final Object other$credential = other.getCredential(); - - return this$credential == null ? other$credential == null : this$credential.equals(other$credential); - } - - protected boolean canEqual(final Object other) { - return other instanceof IceServer; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $url = this.getUrl(); - result = result * PRIME + ($url == null ? 43 : $url.hashCode()); - final Object $urls = this.getUrls(); - result = result * PRIME + ($urls == null ? 43 : $urls.hashCode()); - final Object $username = this.getUsername(); - result = result * PRIME + ($username == null ? 43 : $username.hashCode()); - final Object $credential = this.getCredential(); - result = result * PRIME + ($credential == null ? 43 : $credential.hashCode()); - return result; - } - - public String toString() { - return "IceServer(url=" + this.getUrl() + ", urls=" + this.getUrls() + ", username=" + this.getUsername() + ", credential=" + this.getCredential() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/IceServer.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/IceServer.kt new file mode 100644 index 000000000..85a4efbc9 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/IceServer.kt @@ -0,0 +1,44 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling.settings + +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 IceServer( + @Deprecated("") + @JsonField(name = ["url"]) + var url: String? = null, + @JsonField(name = ["urls"]) + var urls: List? = null, + @JsonField(name = ["username"]) + var username: String? = null, + @JsonField(name = ["credential"]) + var credential: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.java deleted file mode 100644 index 985217601..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling.settings; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import java.util.List; - -@JsonObject -public class Settings { - @JsonField(name = "stunservers") - List stunServers; - - @JsonField(name = "turnservers") - List turnServers; - - @JsonField(name = "server") - String externalSignalingServer; - - @JsonField(name = "ticket") - String externalSignalingTicket; - - public List getStunServers() { - return this.stunServers; - } - - public List getTurnServers() { - return this.turnServers; - } - - public String getExternalSignalingServer() { - return this.externalSignalingServer; - } - - public String getExternalSignalingTicket() { - return this.externalSignalingTicket; - } - - public void setStunServers(List stunServers) { - this.stunServers = stunServers; - } - - public void setTurnServers(List turnServers) { - this.turnServers = turnServers; - } - - public void setExternalSignalingServer(String externalSignalingServer) { - this.externalSignalingServer = externalSignalingServer; - } - - public void setExternalSignalingTicket(String externalSignalingTicket) { - this.externalSignalingTicket = externalSignalingTicket; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Settings)) { - return false; - } - final Settings other = (Settings) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$stunServers = this.getStunServers(); - final Object other$stunServers = other.getStunServers(); - if (this$stunServers == null ? other$stunServers != null : !this$stunServers.equals(other$stunServers)) { - return false; - } - final Object this$turnServers = this.getTurnServers(); - final Object other$turnServers = other.getTurnServers(); - if (this$turnServers == null ? other$turnServers != null : !this$turnServers.equals(other$turnServers)) { - return false; - } - final Object this$externalSignalingServer = this.getExternalSignalingServer(); - final Object other$externalSignalingServer = other.getExternalSignalingServer(); - if (this$externalSignalingServer == null ? other$externalSignalingServer != null : !this$externalSignalingServer.equals(other$externalSignalingServer)) { - return false; - } - final Object this$externalSignalingTicket = this.getExternalSignalingTicket(); - final Object other$externalSignalingTicket = other.getExternalSignalingTicket(); - - return this$externalSignalingTicket == null ? other$externalSignalingTicket == null : this$externalSignalingTicket.equals(other$externalSignalingTicket); - } - - protected boolean canEqual(final Object other) { - return other instanceof Settings; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $stunServers = this.getStunServers(); - result = result * PRIME + ($stunServers == null ? 43 : $stunServers.hashCode()); - final Object $turnServers = this.getTurnServers(); - result = result * PRIME + ($turnServers == null ? 43 : $turnServers.hashCode()); - final Object $externalSignalingServer = this.getExternalSignalingServer(); - result = result * PRIME + ($externalSignalingServer == null ? 43 : $externalSignalingServer.hashCode()); - final Object $externalSignalingTicket = this.getExternalSignalingTicket(); - result = result * PRIME + ($externalSignalingTicket == null ? 43 : $externalSignalingTicket.hashCode()); - return result; - } - - public String toString() { - return "Settings(stunServers=" + this.getStunServers() + ", turnServers=" + this.getTurnServers() + ", externalSignalingServer=" + this.getExternalSignalingServer() + ", externalSignalingTicket=" + this.getExternalSignalingTicket() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.kt new file mode 100644 index 000000000..f04b3095c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/Settings.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling.settings + +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 Settings( + @JsonField(name = ["stunservers"]) + var stunServers: List? = null, + @JsonField(name = ["turnservers"]) + var turnServers: List? = null, + @JsonField(name = ["server"]) + var externalSignalingServer: String? = null, + @JsonField(name = ["ticket"]) + var externalSignalingTicket: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.java deleted file mode 100644 index 477438485..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling.settings; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.generic.GenericOCS; - -@JsonObject -public class SignalingSettingsOcs extends GenericOCS { - @JsonField(name = "data") - Settings settings; - - public Settings getSettings() { - return this.settings; - } - - public void setSettings(Settings settings) { - this.settings = settings; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignalingSettingsOcs)) { - return false; - } - final SignalingSettingsOcs other = (SignalingSettingsOcs) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$settings = this.getSettings(); - final Object other$settings = other.getSettings(); - - return this$settings == null ? other$settings == null : this$settings.equals(other$settings); - } - - protected boolean canEqual(final Object other) { - return other instanceof SignalingSettingsOcs; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $settings = this.getSettings(); - result = result * PRIME + ($settings == null ? 43 : $settings.hashCode()); - return result; - } - - public String toString() { - return "SignalingSettingsOcs(settings=" + this.getSettings() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.kt new file mode 100644 index 000000000..473b8a57c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOcs.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling.settings + +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 SignalingSettingsOcs( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, + @JsonField(name = ["data"]) + var settings: Settings? = 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/signaling/settings/SignalingSettingsOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOverall.java deleted file mode 100644 index 17420876b..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOverall.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * 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.signaling.settings; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -@JsonObject -public class SignalingSettingsOverall { - @JsonField(name = "ocs") - SignalingSettingsOcs ocs; - - public SignalingSettingsOcs getOcs() { - return this.ocs; - } - - public void setOcs(SignalingSettingsOcs ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignalingSettingsOverall)) { - return false; - } - final SignalingSettingsOverall other = (SignalingSettingsOverall) 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 SignalingSettingsOverall; - } - - 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 "SignalingSettingsOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOverall.kt new file mode 100644 index 000000000..3fc736aaf --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/signaling/settings/SignalingSettingsOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * 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.signaling.settings + +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 SignalingSettingsOverall( + @JsonField(name = ["ocs"]) + var ocs: SignalingSettingsOcs? = 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/websocket/ActorWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ActorWebSocketMessage.java deleted file mode 100644 index 1cc2e0678..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ActorWebSocketMessage.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class ActorWebSocketMessage { - @JsonField(name = "type") - String type; - - @JsonField(name = "sessionid") - String sessionId; - - @JsonField(name = "userid") - String userid; - - public String getType() { - return this.type; - } - - public String getSessionId() { - return this.sessionId; - } - - public String getUserid() { - return this.userid; - } - - public void setType(String type) { - this.type = type; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - public void setUserid(String userid) { - this.userid = userid; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ActorWebSocketMessage)) { - return false; - } - final ActorWebSocketMessage other = (ActorWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$sessionId = this.getSessionId(); - final Object other$sessionId = other.getSessionId(); - if (this$sessionId == null ? other$sessionId != null : !this$sessionId.equals(other$sessionId)) { - return false; - } - final Object this$userid = this.getUserid(); - final Object other$userid = other.getUserid(); - - return this$userid == null ? other$userid == null : this$userid.equals(other$userid); - } - - protected boolean canEqual(final Object other) { - return other instanceof ActorWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $sessionId = this.getSessionId(); - result = result * PRIME + ($sessionId == null ? 43 : $sessionId.hashCode()); - final Object $userid = this.getUserid(); - result = result * PRIME + ($userid == null ? 43 : $userid.hashCode()); - return result; - } - - public String toString() { - return "ActorWebSocketMessage(type=" + this.getType() + ", sessionId=" + this.getSessionId() + ", userid=" + this.getUserid() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ActorWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ActorWebSocketMessage.kt new file mode 100644 index 000000000..0542ed9f5 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ActorWebSocketMessage.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 ActorWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["sessionid"]) + var sessionId: String? = null, + @JsonField(name = ["userid"]) + var userid: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.java deleted file mode 100644 index b4366ce48..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class AuthParametersWebSocketMessage { - @JsonField(name = "userid") - String userid; - - @JsonField(name = "ticket") - String ticket; - - public String getUserid() { - return this.userid; - } - - public String getTicket() { - return this.ticket; - } - - public void setUserid(String userid) { - this.userid = userid; - } - - public void setTicket(String ticket) { - this.ticket = ticket; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof AuthParametersWebSocketMessage)) { - return false; - } - final AuthParametersWebSocketMessage other = (AuthParametersWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$userid = this.getUserid(); - final Object other$userid = other.getUserid(); - if (this$userid == null ? other$userid != null : !this$userid.equals(other$userid)) { - return false; - } - final Object this$ticket = this.getTicket(); - final Object other$ticket = other.getTicket(); - - return this$ticket == null ? other$ticket == null : this$ticket.equals(other$ticket); - } - - protected boolean canEqual(final Object other) { - return other instanceof AuthParametersWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $userid = this.getUserid(); - result = result * PRIME + ($userid == null ? 43 : $userid.hashCode()); - final Object $ticket = this.getTicket(); - result = result * PRIME + ($ticket == null ? 43 : $ticket.hashCode()); - return result; - } - - public String toString() { - return "AuthParametersWebSocketMessage(userid=" + this.getUserid() + ", ticket=" + this.getTicket() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.kt new file mode 100644 index 000000000..7afa0b6a6 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthParametersWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class AuthParametersWebSocketMessage( + @JsonField(name = ["userid"]) + var userid: String? = null, + @JsonField(name = ["ticket"]) + var ticket: String? = 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/websocket/AuthWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthWebSocketMessage.java deleted file mode 100644 index 2c08101fd..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthWebSocketMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class AuthWebSocketMessage { - @JsonField(name = "url") - String url; - - @JsonField(name = "params") - AuthParametersWebSocketMessage authParametersWebSocketMessage; - - public String getUrl() { - return this.url; - } - - public AuthParametersWebSocketMessage getAuthParametersWebSocketMessage() { - return this.authParametersWebSocketMessage; - } - - public void setUrl(String url) { - this.url = url; - } - - public void setAuthParametersWebSocketMessage(AuthParametersWebSocketMessage authParametersWebSocketMessage) { - this.authParametersWebSocketMessage = authParametersWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof AuthWebSocketMessage)) { - return false; - } - final AuthWebSocketMessage other = (AuthWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$url = this.getUrl(); - final Object other$url = other.getUrl(); - if (this$url == null ? other$url != null : !this$url.equals(other$url)) { - return false; - } - final Object this$authParametersWebSocketMessage = this.getAuthParametersWebSocketMessage(); - final Object other$authParametersWebSocketMessage = other.getAuthParametersWebSocketMessage(); - - return this$authParametersWebSocketMessage == null ? other$authParametersWebSocketMessage == null : this$authParametersWebSocketMessage.equals(other$authParametersWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof AuthWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $url = this.getUrl(); - result = result * PRIME + ($url == null ? 43 : $url.hashCode()); - final Object $authParametersWebSocketMessage = this.getAuthParametersWebSocketMessage(); - result = result * PRIME + ($authParametersWebSocketMessage == null ? 43 : $authParametersWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "AuthWebSocketMessage(url=" + this.getUrl() + ", authParametersWebSocketMessage=" + this.getAuthParametersWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthWebSocketMessage.kt new file mode 100644 index 000000000..a9fe8e2be --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/AuthWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 AuthWebSocketMessage( + @JsonField(name = ["url"]) + var url: String? = null, + @JsonField(name = ["params"]) + var authParametersWebSocketMessage: AuthParametersWebSocketMessage? = 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/websocket/BaseWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/BaseWebSocketMessage.java deleted file mode 100644 index 66ba83a9e..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/BaseWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class BaseWebSocketMessage { - @JsonField(name = "type") - String type; - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof BaseWebSocketMessage)) { - return false; - } - final BaseWebSocketMessage other = (BaseWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - - return this$type == null ? other$type == null : this$type.equals(other$type); - } - - protected boolean canEqual(final Object other) { - return other instanceof BaseWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - return result; - } - - public String toString() { - return "BaseWebSocketMessage(type=" + this.getType() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/BaseWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/BaseWebSocketMessage.kt new file mode 100644 index 000000000..9bef196e8 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/BaseWebSocketMessage.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 BaseWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = 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/websocket/ByeWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ByeWebSocketMessage.java deleted file mode 100644 index a1b6c2e59..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ByeWebSocketMessage.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.HashMap; - -@JsonObject -@Parcel -public class ByeWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "bye") - HashMap bye; - - public HashMap getBye() { - return this.bye; - } - - public void setBye(HashMap bye) { - this.bye = bye; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ByeWebSocketMessage)) { - return false; - } - final ByeWebSocketMessage other = (ByeWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$bye = this.getBye(); - final Object other$bye = other.getBye(); - - return this$bye == null ? other$bye == null : this$bye.equals(other$bye); - } - - protected boolean canEqual(final Object other) { - return other instanceof ByeWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $bye = this.getBye(); - result = result * PRIME + ($bye == null ? 43 : $bye.hashCode()); - return result; - } - - public String toString() { - return "ByeWebSocketMessage(bye=" + this.getBye() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ByeWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ByeWebSocketMessage.kt new file mode 100644 index 000000000..b450700e2 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ByeWebSocketMessage.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler +import java.util.HashMap + +@Parcelize +@JsonObject +@TypeParceler +data class ByeWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["bye"]) + var bye: HashMap? = 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/websocket/CallOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallOverallWebSocketMessage.java deleted file mode 100644 index 064daa45a..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class CallOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "message") - CallWebSocketMessage callWebSocketMessage; - - public CallWebSocketMessage getCallWebSocketMessage() { - return this.callWebSocketMessage; - } - - public void setCallWebSocketMessage(CallWebSocketMessage callWebSocketMessage) { - this.callWebSocketMessage = callWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof CallOverallWebSocketMessage)) { - return false; - } - final CallOverallWebSocketMessage other = (CallOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$callWebSocketMessage = this.getCallWebSocketMessage(); - final Object other$callWebSocketMessage = other.getCallWebSocketMessage(); - - return this$callWebSocketMessage == null ? other$callWebSocketMessage == null : this$callWebSocketMessage.equals(other$callWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof CallOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $callWebSocketMessage = this.getCallWebSocketMessage(); - result = result * PRIME + ($callWebSocketMessage == null ? 43 : $callWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "CallOverallWebSocketMessage(callWebSocketMessage=" + this.getCallWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallOverallWebSocketMessage.kt new file mode 100644 index 000000000..4137b6d2c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 CallOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["message"]) + var callWebSocketMessage: CallWebSocketMessage? = 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/websocket/CallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallWebSocketMessage.java deleted file mode 100644 index 6b3b59099..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallWebSocketMessage.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.signaling.NCSignalingMessage; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class CallWebSocketMessage { - @JsonField(name = "recipient") - ActorWebSocketMessage recipientWebSocketMessage; - - @JsonField(name = "sender") - ActorWebSocketMessage senderWebSocketMessage; - - @JsonField(name = "data") - NCSignalingMessage ncSignalingMessage; - - public ActorWebSocketMessage getRecipientWebSocketMessage() { - return this.recipientWebSocketMessage; - } - - public ActorWebSocketMessage getSenderWebSocketMessage() { - return this.senderWebSocketMessage; - } - - public NCSignalingMessage getNcSignalingMessage() { - return this.ncSignalingMessage; - } - - public void setRecipientWebSocketMessage(ActorWebSocketMessage recipientWebSocketMessage) { - this.recipientWebSocketMessage = recipientWebSocketMessage; - } - - public void setSenderWebSocketMessage(ActorWebSocketMessage senderWebSocketMessage) { - this.senderWebSocketMessage = senderWebSocketMessage; - } - - public void setNcSignalingMessage(NCSignalingMessage ncSignalingMessage) { - this.ncSignalingMessage = ncSignalingMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof CallWebSocketMessage)) { - return false; - } - final CallWebSocketMessage other = (CallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$recipientWebSocketMessage = this.getRecipientWebSocketMessage(); - final Object other$recipientWebSocketMessage = other.getRecipientWebSocketMessage(); - if (this$recipientWebSocketMessage == null ? other$recipientWebSocketMessage != null : !this$recipientWebSocketMessage.equals(other$recipientWebSocketMessage)) { - return false; - } - final Object this$senderWebSocketMessage = this.getSenderWebSocketMessage(); - final Object other$senderWebSocketMessage = other.getSenderWebSocketMessage(); - if (this$senderWebSocketMessage == null ? other$senderWebSocketMessage != null : !this$senderWebSocketMessage.equals(other$senderWebSocketMessage)) { - return false; - } - final Object this$ncSignalingMessage = this.getNcSignalingMessage(); - final Object other$ncSignalingMessage = other.getNcSignalingMessage(); - - return this$ncSignalingMessage == null ? other$ncSignalingMessage == null : this$ncSignalingMessage.equals(other$ncSignalingMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof CallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $recipientWebSocketMessage = this.getRecipientWebSocketMessage(); - result = result * PRIME + ($recipientWebSocketMessage == null ? 43 : $recipientWebSocketMessage.hashCode()); - final Object $senderWebSocketMessage = this.getSenderWebSocketMessage(); - result = result * PRIME + ($senderWebSocketMessage == null ? 43 : $senderWebSocketMessage.hashCode()); - final Object $ncSignalingMessage = this.getNcSignalingMessage(); - result = result * PRIME + ($ncSignalingMessage == null ? 43 : $ncSignalingMessage.hashCode()); - return result; - } - - public String toString() { - return "CallWebSocketMessage(recipientWebSocketMessage=" + this.getRecipientWebSocketMessage() + ", senderWebSocketMessage=" + this.getSenderWebSocketMessage() + ", ncSignalingMessage=" + this.getNcSignalingMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallWebSocketMessage.kt new file mode 100644 index 000000000..1bd855c43 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/CallWebSocketMessage.kt @@ -0,0 +1,42 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.signaling.NCSignalingMessage +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class CallWebSocketMessage( + @JsonField(name = ["recipient"]) + var recipientWebSocketMessage: ActorWebSocketMessage? = null, + @JsonField(name = ["sender"]) + var senderWebSocketMessage: ActorWebSocketMessage? = null, + @JsonField(name = ["data"]) + var ncSignalingMessage: NCSignalingMessage? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.java deleted file mode 100644 index 94b37056c..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ErrorOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "error") - ErrorWebSocketMessage errorWebSocketMessage; - - public ErrorWebSocketMessage getErrorWebSocketMessage() { - return this.errorWebSocketMessage; - } - - public void setErrorWebSocketMessage(ErrorWebSocketMessage errorWebSocketMessage) { - this.errorWebSocketMessage = errorWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ErrorOverallWebSocketMessage)) { - return false; - } - final ErrorOverallWebSocketMessage other = (ErrorOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$errorWebSocketMessage = this.getErrorWebSocketMessage(); - final Object other$errorWebSocketMessage = other.getErrorWebSocketMessage(); - - return this$errorWebSocketMessage == null ? other$errorWebSocketMessage == null : this$errorWebSocketMessage.equals(other$errorWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof ErrorOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $errorWebSocketMessage = this.getErrorWebSocketMessage(); - result = result * PRIME + ($errorWebSocketMessage == null ? 43 : $errorWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "ErrorOverallWebSocketMessage(errorWebSocketMessage=" + this.getErrorWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.kt new file mode 100644 index 000000000..a3110d8ca --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 ErrorOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["error"]) + var errorWebSocketMessage: ErrorWebSocketMessage? = 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/websocket/ErrorWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorWebSocketMessage.java deleted file mode 100644 index 3b1c829aa..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorWebSocketMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ErrorWebSocketMessage { - @JsonField(name = "code") - String code; - - @JsonField(name = "message") - String message; - - public String getCode() { - return this.code; - } - - public String getMessage() { - return this.message; - } - - public void setCode(String code) { - this.code = code; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ErrorWebSocketMessage)) { - return false; - } - final ErrorWebSocketMessage other = (ErrorWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$code = this.getCode(); - final Object other$code = other.getCode(); - if (this$code == null ? other$code != null : !this$code.equals(other$code)) { - return false; - } - final Object this$message = this.getMessage(); - final Object other$message = other.getMessage(); - - return this$message == null ? other$message == null : this$message.equals(other$message); - } - - protected boolean canEqual(final Object other) { - return other instanceof ErrorWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $code = this.getCode(); - result = result * PRIME + ($code == null ? 43 : $code.hashCode()); - final Object $message = this.getMessage(); - result = result * PRIME + ($message == null ? 43 : $message.hashCode()); - return result; - } - - public String toString() { - return "ErrorWebSocketMessage(code=" + this.getCode() + ", message=" + this.getMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorWebSocketMessage.kt new file mode 100644 index 000000000..3d2a33c5b --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ErrorWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 ErrorWebSocketMessage( + @JsonField(name = ["code"]) + var code: String? = null, + @JsonField(name = ["message"]) + var message: String? = 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/websocket/EventOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java deleted file mode 100644 index d9424ee43..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.HashMap; - -@Parcel -@JsonObject -public class EventOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "type") - String type; - @JsonField(name = "event") - HashMap eventMap; - - public String getType() { - return this.type; - } - - public HashMap getEventMap() { - return this.eventMap; - } - - public void setType(String type) { - this.type = type; - } - - public void setEventMap(HashMap eventMap) { - this.eventMap = eventMap; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof EventOverallWebSocketMessage)) { - return false; - } - final EventOverallWebSocketMessage other = (EventOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$eventMap = this.getEventMap(); - final Object other$eventMap = other.getEventMap(); - - return this$eventMap == null ? other$eventMap == null : this$eventMap.equals(other$eventMap); - } - - protected boolean canEqual(final Object other) { - return other instanceof EventOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $eventMap = this.getEventMap(); - result = result * PRIME + ($eventMap == null ? 43 : $eventMap.hashCode()); - return result; - } - - public String toString() { - return "EventOverallWebSocketMessage(type=" + this.getType() + ", eventMap=" + this.getEventMap() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt new file mode 100644 index 000000000..dc06c0329 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler +import java.util.HashMap + +@Parcelize +@JsonObject +@TypeParceler +class EventOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["event"]) + var eventMap: HashMap? = 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/websocket/HelloOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloOverallWebSocketMessage.java deleted file mode 100644 index 51d56e856..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class HelloOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "hello") - HelloWebSocketMessage helloWebSocketMessage; - - public HelloWebSocketMessage getHelloWebSocketMessage() { - return this.helloWebSocketMessage; - } - - public void setHelloWebSocketMessage(HelloWebSocketMessage helloWebSocketMessage) { - this.helloWebSocketMessage = helloWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof HelloOverallWebSocketMessage)) { - return false; - } - final HelloOverallWebSocketMessage other = (HelloOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$helloWebSocketMessage = this.getHelloWebSocketMessage(); - final Object other$helloWebSocketMessage = other.getHelloWebSocketMessage(); - - return this$helloWebSocketMessage == null ? other$helloWebSocketMessage == null : this$helloWebSocketMessage.equals(other$helloWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof HelloOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $helloWebSocketMessage = this.getHelloWebSocketMessage(); - result = result * PRIME + ($helloWebSocketMessage == null ? 43 : $helloWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "HelloOverallWebSocketMessage(helloWebSocketMessage=" + this.getHelloWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloOverallWebSocketMessage.kt new file mode 100644 index 000000000..0da623ceb --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 HelloOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["hello"]) + var helloWebSocketMessage: HelloWebSocketMessage? = 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/websocket/HelloResponseOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseOverallWebSocketMessage.java deleted file mode 100644 index 589e7d432..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class HelloResponseOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "hello") - HelloResponseWebSocketMessage helloResponseWebSocketMessage; - - public HelloResponseWebSocketMessage getHelloResponseWebSocketMessage() { - return this.helloResponseWebSocketMessage; - } - - public void setHelloResponseWebSocketMessage(HelloResponseWebSocketMessage helloResponseWebSocketMessage) { - this.helloResponseWebSocketMessage = helloResponseWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof HelloResponseOverallWebSocketMessage)) { - return false; - } - final HelloResponseOverallWebSocketMessage other = (HelloResponseOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$helloResponseWebSocketMessage = this.getHelloResponseWebSocketMessage(); - final Object other$helloResponseWebSocketMessage = other.getHelloResponseWebSocketMessage(); - - return this$helloResponseWebSocketMessage == null ? other$helloResponseWebSocketMessage == null : this$helloResponseWebSocketMessage.equals(other$helloResponseWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof HelloResponseOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $helloResponseWebSocketMessage = this.getHelloResponseWebSocketMessage(); - result = result * PRIME + ($helloResponseWebSocketMessage == null ? 43 : $helloResponseWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "HelloResponseOverallWebSocketMessage(helloResponseWebSocketMessage=" + this.getHelloResponseWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseOverallWebSocketMessage.kt new file mode 100644 index 000000000..c213190c1 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 HelloResponseOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["hello"]) + var helloResponseWebSocketMessage: HelloResponseWebSocketMessage? = 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/websocket/HelloResponseWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseWebSocketMessage.java deleted file mode 100644 index f31c7f1e5..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseWebSocketMessage.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class HelloResponseWebSocketMessage { - @JsonField(name = "resumeid") - String resumeId; - - @JsonField(name = "sessionid") - String sessionId; - - @JsonField(name = "server") - ServerHelloResponseFeaturesWebSocketMessage serverHelloResponseFeaturesWebSocketMessage; - - public boolean serverHasMCUSupport() { - return serverHelloResponseFeaturesWebSocketMessage != null && serverHelloResponseFeaturesWebSocketMessage.getFeatures() != null - && serverHelloResponseFeaturesWebSocketMessage.getFeatures().contains("mcu"); - } - - public String getResumeId() { - return this.resumeId; - } - - public String getSessionId() { - return this.sessionId; - } - - public ServerHelloResponseFeaturesWebSocketMessage getServerHelloResponseFeaturesWebSocketMessage() { - return this.serverHelloResponseFeaturesWebSocketMessage; - } - - public void setResumeId(String resumeId) { - this.resumeId = resumeId; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - public void setServerHelloResponseFeaturesWebSocketMessage(ServerHelloResponseFeaturesWebSocketMessage serverHelloResponseFeaturesWebSocketMessage) { - this.serverHelloResponseFeaturesWebSocketMessage = serverHelloResponseFeaturesWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof HelloResponseWebSocketMessage)) { - return false; - } - final HelloResponseWebSocketMessage other = (HelloResponseWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$resumeId = this.getResumeId(); - final Object other$resumeId = other.getResumeId(); - if (this$resumeId == null ? other$resumeId != null : !this$resumeId.equals(other$resumeId)) { - return false; - } - final Object this$sessionId = this.getSessionId(); - final Object other$sessionId = other.getSessionId(); - if (this$sessionId == null ? other$sessionId != null : !this$sessionId.equals(other$sessionId)) { - return false; - } - final Object this$serverHelloResponseFeaturesWebSocketMessage = this.getServerHelloResponseFeaturesWebSocketMessage(); - final Object other$serverHelloResponseFeaturesWebSocketMessage = other.getServerHelloResponseFeaturesWebSocketMessage(); - - return this$serverHelloResponseFeaturesWebSocketMessage == null ? other$serverHelloResponseFeaturesWebSocketMessage == null : this$serverHelloResponseFeaturesWebSocketMessage.equals(other$serverHelloResponseFeaturesWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof HelloResponseWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $resumeId = this.getResumeId(); - result = result * PRIME + ($resumeId == null ? 43 : $resumeId.hashCode()); - final Object $sessionId = this.getSessionId(); - result = result * PRIME + ($sessionId == null ? 43 : $sessionId.hashCode()); - final Object $serverHelloResponseFeaturesWebSocketMessage = this.getServerHelloResponseFeaturesWebSocketMessage(); - result = result * PRIME + ($serverHelloResponseFeaturesWebSocketMessage == null ? 43 : $serverHelloResponseFeaturesWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "HelloResponseWebSocketMessage(resumeId=" + this.getResumeId() + ", sessionId=" + this.getSessionId() + ", serverHelloResponseFeaturesWebSocketMessage=" + this.getServerHelloResponseFeaturesWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseWebSocketMessage.kt new file mode 100644 index 000000000..8e0e1a1a1 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloResponseWebSocketMessage.kt @@ -0,0 +1,47 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 HelloResponseWebSocketMessage( + @JsonField(name = ["resumeid"]) + var resumeId: String? = null, + @JsonField(name = ["sessionid"]) + var sessionId: String? = null, + @JsonField(name = ["server"]) + var serverHelloResponseFeaturesWebSocketMessage: ServerHelloResponseFeaturesWebSocketMessage? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) + + fun serverHasMCUSupport(): Boolean { + return serverHelloResponseFeaturesWebSocketMessage != null && + serverHelloResponseFeaturesWebSocketMessage!!.features != null && + serverHelloResponseFeaturesWebSocketMessage!!.features!!.contains("mcu") + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.java deleted file mode 100644 index 2aed8f798..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class HelloWebSocketMessage { - @JsonField(name = "version") - String version; - - @JsonField(name = "resumeid") - String resumeid; - - @JsonField(name = "auth") - AuthWebSocketMessage authWebSocketMessage; - - public String getVersion() { - return this.version; - } - - public String getResumeid() { - return this.resumeid; - } - - public AuthWebSocketMessage getAuthWebSocketMessage() { - return this.authWebSocketMessage; - } - - public void setVersion(String version) { - this.version = version; - } - - public void setResumeid(String resumeid) { - this.resumeid = resumeid; - } - - public void setAuthWebSocketMessage(AuthWebSocketMessage authWebSocketMessage) { - this.authWebSocketMessage = authWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof HelloWebSocketMessage)) { - return false; - } - final HelloWebSocketMessage other = (HelloWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$version = this.getVersion(); - final Object other$version = other.getVersion(); - if (this$version == null ? other$version != null : !this$version.equals(other$version)) { - return false; - } - final Object this$resumeid = this.getResumeid(); - final Object other$resumeid = other.getResumeid(); - if (this$resumeid == null ? other$resumeid != null : !this$resumeid.equals(other$resumeid)) { - return false; - } - final Object this$authWebSocketMessage = this.getAuthWebSocketMessage(); - final Object other$authWebSocketMessage = other.getAuthWebSocketMessage(); - - return this$authWebSocketMessage == null ? other$authWebSocketMessage == null : this$authWebSocketMessage.equals(other$authWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof HelloWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $version = this.getVersion(); - result = result * PRIME + ($version == null ? 43 : $version.hashCode()); - final Object $resumeid = this.getResumeid(); - result = result * PRIME + ($resumeid == null ? 43 : $resumeid.hashCode()); - final Object $authWebSocketMessage = this.getAuthWebSocketMessage(); - result = result * PRIME + ($authWebSocketMessage == null ? 43 : $authWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "HelloWebSocketMessage(version=" + this.getVersion() + ", resumeid=" + this.getResumeid() + ", authWebSocketMessage=" + this.getAuthWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.kt new file mode 100644 index 000000000..6aa62f9d6 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/HelloWebSocketMessage.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 HelloWebSocketMessage( + @JsonField(name = ["version"]) + var version: String? = null, + @JsonField(name = ["resumeid"]) + var resumeid: String? = null, + @JsonField(name = ["auth"]) + var authWebSocketMessage: AuthWebSocketMessage? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.java deleted file mode 100644 index c6523b13f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class JoinedRoomOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "room") - RoomWebSocketMessage roomWebSocketMessage; - - public RoomWebSocketMessage getRoomWebSocketMessage() { - return this.roomWebSocketMessage; - } - - public void setRoomWebSocketMessage(RoomWebSocketMessage roomWebSocketMessage) { - this.roomWebSocketMessage = roomWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof JoinedRoomOverallWebSocketMessage)) { - return false; - } - final JoinedRoomOverallWebSocketMessage other = (JoinedRoomOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$roomWebSocketMessage = this.getRoomWebSocketMessage(); - final Object other$roomWebSocketMessage = other.getRoomWebSocketMessage(); - - return this$roomWebSocketMessage == null ? other$roomWebSocketMessage == null : this$roomWebSocketMessage.equals(other$roomWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof JoinedRoomOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $roomWebSocketMessage = this.getRoomWebSocketMessage(); - result = result * PRIME + ($roomWebSocketMessage == null ? 43 : $roomWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "JoinedRoomOverallWebSocketMessage(roomWebSocketMessage=" + this.getRoomWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.kt new file mode 100644 index 000000000..69a977371 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/JoinedRoomOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 JoinedRoomOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["room"]) + var roomWebSocketMessage: RoomWebSocketMessage? = 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/websocket/RequestOfferOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.java deleted file mode 100644 index 7994ac56f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class RequestOfferOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "message") - RequestOfferSignalingMessage requestOfferOverallWebSocketMessage; - - public RequestOfferSignalingMessage getRequestOfferOverallWebSocketMessage() { - return this.requestOfferOverallWebSocketMessage; - } - - public void setRequestOfferOverallWebSocketMessage(RequestOfferSignalingMessage requestOfferOverallWebSocketMessage) { - this.requestOfferOverallWebSocketMessage = requestOfferOverallWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RequestOfferOverallWebSocketMessage)) { - return false; - } - final RequestOfferOverallWebSocketMessage other = (RequestOfferOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$requestOfferOverallWebSocketMessage = this.getRequestOfferOverallWebSocketMessage(); - final Object other$requestOfferOverallWebSocketMessage = other.getRequestOfferOverallWebSocketMessage(); - - return this$requestOfferOverallWebSocketMessage == null ? other$requestOfferOverallWebSocketMessage == null : this$requestOfferOverallWebSocketMessage.equals(other$requestOfferOverallWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof RequestOfferOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $requestOfferOverallWebSocketMessage = this.getRequestOfferOverallWebSocketMessage(); - result = result * PRIME + ($requestOfferOverallWebSocketMessage == null ? 43 : $requestOfferOverallWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "RequestOfferOverallWebSocketMessage(requestOfferOverallWebSocketMessage=" + this.getRequestOfferOverallWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.kt new file mode 100644 index 000000000..deb11af47 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 RequestOfferOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["message"]) + var requestOfferOverallWebSocketMessage: RequestOfferSignalingMessage? = 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/websocket/RequestOfferSignalingMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.java deleted file mode 100644 index b79a705d1..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class RequestOfferSignalingMessage { - @JsonField(name = "recipient") - ActorWebSocketMessage actorWebSocketMessage; - - @JsonField(name = "data") - SignalingDataWebSocketMessageForOffer signalingDataWebSocketMessageForOffer; - - public ActorWebSocketMessage getActorWebSocketMessage() { - return this.actorWebSocketMessage; - } - - public SignalingDataWebSocketMessageForOffer getSignalingDataWebSocketMessageForOffer() { - return this.signalingDataWebSocketMessageForOffer; - } - - public void setActorWebSocketMessage(ActorWebSocketMessage actorWebSocketMessage) { - this.actorWebSocketMessage = actorWebSocketMessage; - } - - public void setSignalingDataWebSocketMessageForOffer(SignalingDataWebSocketMessageForOffer signalingDataWebSocketMessageForOffer) { - this.signalingDataWebSocketMessageForOffer = signalingDataWebSocketMessageForOffer; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RequestOfferSignalingMessage)) { - return false; - } - final RequestOfferSignalingMessage other = (RequestOfferSignalingMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$actorWebSocketMessage = this.getActorWebSocketMessage(); - final Object other$actorWebSocketMessage = other.getActorWebSocketMessage(); - if (this$actorWebSocketMessage == null ? other$actorWebSocketMessage != null : !this$actorWebSocketMessage.equals(other$actorWebSocketMessage)) { - return false; - } - final Object this$signalingDataWebSocketMessageForOffer = this.getSignalingDataWebSocketMessageForOffer(); - final Object other$signalingDataWebSocketMessageForOffer = other.getSignalingDataWebSocketMessageForOffer(); - - return this$signalingDataWebSocketMessageForOffer == null ? other$signalingDataWebSocketMessageForOffer == null : this$signalingDataWebSocketMessageForOffer.equals(other$signalingDataWebSocketMessageForOffer); - } - - protected boolean canEqual(final Object other) { - return other instanceof RequestOfferSignalingMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $actorWebSocketMessage = this.getActorWebSocketMessage(); - result = result * PRIME + ($actorWebSocketMessage == null ? 43 : $actorWebSocketMessage.hashCode()); - final Object $signalingDataWebSocketMessageForOffer = this.getSignalingDataWebSocketMessageForOffer(); - result = result * PRIME + ($signalingDataWebSocketMessageForOffer == null ? 43 : $signalingDataWebSocketMessageForOffer.hashCode()); - return result; - } - - public String toString() { - return "RequestOfferSignalingMessage(actorWebSocketMessage=" + this.getActorWebSocketMessage() + ", signalingDataWebSocketMessageForOffer=" + this.getSignalingDataWebSocketMessageForOffer() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.kt new file mode 100644 index 000000000..d791cf7bd --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class RequestOfferSignalingMessage( + @JsonField(name = ["recipient"]) + var actorWebSocketMessage: ActorWebSocketMessage? = null, + @JsonField(name = ["data"]) + var signalingDataWebSocketMessageForOffer: SignalingDataWebSocketMessageForOffer? = 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/websocket/RoomOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomOverallWebSocketMessage.java deleted file mode 100644 index 80f1b0d22..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomOverallWebSocketMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class RoomOverallWebSocketMessage extends BaseWebSocketMessage { - @JsonField(name = "room") - RoomWebSocketMessage roomWebSocketMessage; - - public RoomWebSocketMessage getRoomWebSocketMessage() { - return this.roomWebSocketMessage; - } - - public void setRoomWebSocketMessage(RoomWebSocketMessage roomWebSocketMessage) { - this.roomWebSocketMessage = roomWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RoomOverallWebSocketMessage)) { - return false; - } - final RoomOverallWebSocketMessage other = (RoomOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$roomWebSocketMessage = this.getRoomWebSocketMessage(); - final Object other$roomWebSocketMessage = other.getRoomWebSocketMessage(); - - return this$roomWebSocketMessage == null ? other$roomWebSocketMessage == null : this$roomWebSocketMessage.equals(other$roomWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof RoomOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $roomWebSocketMessage = this.getRoomWebSocketMessage(); - result = result * PRIME + ($roomWebSocketMessage == null ? 43 : $roomWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "RoomOverallWebSocketMessage(roomWebSocketMessage=" + this.getRoomWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomOverallWebSocketMessage.kt new file mode 100644 index 000000000..ecf77c134 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomOverallWebSocketMessage.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class RoomOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["room"]) + var roomWebSocketMessage: RoomWebSocketMessage? = 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/websocket/RoomPropertiesWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomPropertiesWebSocketMessage.java deleted file mode 100644 index 726404eb9..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomPropertiesWebSocketMessage.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; -import com.nextcloud.talk.models.json.conversations.Conversation; -import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class RoomPropertiesWebSocketMessage { - @JsonField(name = "name") - String name; - - @JsonField(name = "type", typeConverter = EnumRoomTypeConverter.class) - Conversation.ConversationType roomType; - - public String getName() { - return this.name; - } - - public Conversation.ConversationType getRoomType() { - return this.roomType; - } - - public void setName(String name) { - this.name = name; - } - - public void setRoomType(Conversation.ConversationType roomType) { - this.roomType = roomType; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RoomPropertiesWebSocketMessage)) { - return false; - } - final RoomPropertiesWebSocketMessage other = (RoomPropertiesWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$name = this.getName(); - final Object other$name = other.getName(); - if (this$name == null ? other$name != null : !this$name.equals(other$name)) { - return false; - } - final Object this$roomType = this.getRoomType(); - final Object other$roomType = other.getRoomType(); - - return this$roomType == null ? other$roomType == null : this$roomType.equals(other$roomType); - } - - protected boolean canEqual(final Object other) { - return other instanceof RoomPropertiesWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 43 : $name.hashCode()); - final Object $roomType = this.getRoomType(); - result = result * PRIME + ($roomType == null ? 43 : $roomType.hashCode()); - return result; - } - - public String toString() { - return "RoomPropertiesWebSocketMessage(name=" + this.getName() + ", roomType=" + this.getRoomType() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomPropertiesWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomPropertiesWebSocketMessage.kt new file mode 100644 index 000000000..74bd8b2fc --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomPropertiesWebSocketMessage.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.conversations.Conversation.ConversationType +import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class RoomPropertiesWebSocketMessage( + @JsonField(name = ["name"]) + var name: String? = null, + @JsonField(name = ["type"], typeConverter = EnumRoomTypeConverter::class) + var roomType: ConversationType? = 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/websocket/RoomWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomWebSocketMessage.java deleted file mode 100644 index 16168c6d8..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomWebSocketMessage.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class RoomWebSocketMessage { - @JsonField(name = "roomid") - String roomId; - - @JsonField(name = "sessionid") - String sessiondId; - - @JsonField(name = "properties") - RoomPropertiesWebSocketMessage roomPropertiesWebSocketMessage; - - public String getRoomId() { - return this.roomId; - } - - public String getSessiondId() { - return this.sessiondId; - } - - public RoomPropertiesWebSocketMessage getRoomPropertiesWebSocketMessage() { - return this.roomPropertiesWebSocketMessage; - } - - public void setRoomId(String roomId) { - this.roomId = roomId; - } - - public void setSessiondId(String sessiondId) { - this.sessiondId = sessiondId; - } - - public void setRoomPropertiesWebSocketMessage(RoomPropertiesWebSocketMessage roomPropertiesWebSocketMessage) { - this.roomPropertiesWebSocketMessage = roomPropertiesWebSocketMessage; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof RoomWebSocketMessage)) { - return false; - } - final RoomWebSocketMessage other = (RoomWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$roomId = this.getRoomId(); - final Object other$roomId = other.getRoomId(); - if (this$roomId == null ? other$roomId != null : !this$roomId.equals(other$roomId)) { - return false; - } - final Object this$sessiondId = this.getSessiondId(); - final Object other$sessiondId = other.getSessiondId(); - if (this$sessiondId == null ? other$sessiondId != null : !this$sessiondId.equals(other$sessiondId)) { - return false; - } - final Object this$roomPropertiesWebSocketMessage = this.getRoomPropertiesWebSocketMessage(); - final Object other$roomPropertiesWebSocketMessage = other.getRoomPropertiesWebSocketMessage(); - - return this$roomPropertiesWebSocketMessage == null ? other$roomPropertiesWebSocketMessage == null : this$roomPropertiesWebSocketMessage.equals(other$roomPropertiesWebSocketMessage); - } - - protected boolean canEqual(final Object other) { - return other instanceof RoomWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $roomId = this.getRoomId(); - result = result * PRIME + ($roomId == null ? 43 : $roomId.hashCode()); - final Object $sessiondId = this.getSessiondId(); - result = result * PRIME + ($sessiondId == null ? 43 : $sessiondId.hashCode()); - final Object $roomPropertiesWebSocketMessage = this.getRoomPropertiesWebSocketMessage(); - result = result * PRIME + ($roomPropertiesWebSocketMessage == null ? 43 : $roomPropertiesWebSocketMessage.hashCode()); - return result; - } - - public String toString() { - return "RoomWebSocketMessage(roomId=" + this.getRoomId() + ", sessiondId=" + this.getSessiondId() + ", roomPropertiesWebSocketMessage=" + this.getRoomPropertiesWebSocketMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomWebSocketMessage.kt new file mode 100644 index 000000000..5096d33f1 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/RoomWebSocketMessage.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class RoomWebSocketMessage( + @JsonField(name = ["roomid"]) + var roomId: String? = null, + @JsonField(name = ["sessionid"]) + var sessiondId: String? = null, + @JsonField(name = ["properties"]) + var roomPropertiesWebSocketMessage: RoomPropertiesWebSocketMessage? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.java deleted file mode 100644 index 0ee622864..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.List; - -@JsonObject -@Parcel -public class ServerHelloResponseFeaturesWebSocketMessage { - @JsonField(name = "features") - List features; - - public List getFeatures() { - return this.features; - } - - public void setFeatures(List features) { - this.features = features; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ServerHelloResponseFeaturesWebSocketMessage)) { - return false; - } - final ServerHelloResponseFeaturesWebSocketMessage other = (ServerHelloResponseFeaturesWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$features = this.getFeatures(); - final Object other$features = other.getFeatures(); - - return this$features == null ? other$features == null : this$features.equals(other$features); - } - - protected boolean canEqual(final Object other) { - return other instanceof ServerHelloResponseFeaturesWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $features = this.getFeatures(); - result = result * PRIME + ($features == null ? 43 : $features.hashCode()); - return result; - } - - public String toString() { - return "ServerHelloResponseFeaturesWebSocketMessage(features=" + this.getFeatures() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.kt new file mode 100644 index 000000000..5d8ac619d --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/ServerHelloResponseFeaturesWebSocketMessage.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +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 ServerHelloResponseFeaturesWebSocketMessage( + @JsonField(name = ["features"]) + var features: List? = 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/websocket/SignalingDataWebSocketMessageForOffer.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.java deleted file mode 100644 index 714aae569..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 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.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@JsonObject -@Parcel -public class SignalingDataWebSocketMessageForOffer { - @JsonField(name = "type") - String type; - - @JsonField(name = "roomType") - String roomType; - - public String getType() { - return this.type; - } - - public String getRoomType() { - return this.roomType; - } - - public void setType(String type) { - this.type = type; - } - - public void setRoomType(String roomType) { - this.roomType = roomType; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SignalingDataWebSocketMessageForOffer)) { - return false; - } - final SignalingDataWebSocketMessageForOffer other = (SignalingDataWebSocketMessageForOffer) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$roomType = this.getRoomType(); - final Object other$roomType = other.getRoomType(); - - return this$roomType == null ? other$roomType == null : this$roomType.equals(other$roomType); - } - - protected boolean canEqual(final Object other) { - return other instanceof SignalingDataWebSocketMessageForOffer; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $roomType = this.getRoomType(); - result = result * PRIME + ($roomType == null ? 43 : $roomType.hashCode()); - return result; - } - - public String toString() { - return "SignalingDataWebSocketMessageForOffer(type=" + this.getType() + ", roomType=" + this.getRoomType() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.kt new file mode 100644 index 000000000..dbf2327fc --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 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.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +class SignalingDataWebSocketMessageForOffer( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["roomType"]) + var roomType: String? = 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/ui/bottom/sheet/ProfileBottomSheet.kt b/app/src/main/java/com/nextcloud/talk/ui/bottom/sheet/ProfileBottomSheet.kt index 7a51cae3c..975b5e3f7 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 @@ -137,7 +137,7 @@ class ProfileBottomSheet(val ncApi: NcApi, val userEntity: UserEntity, val route val credentials = ApiUtils.getCredentials(userEntity.username, userEntity.token) ncApi.createRoom( credentials, - retrofitBucket.getUrl(), retrofitBucket.getQueryMap() + retrofitBucket.url, retrofitBucket.queryMap ) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -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().getToken()) - bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId()) + 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().getToken() + 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().getToken(), bundle, true + roomOverall.ocs!!.data!!.token!!, bundle, true ) } diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt index 5dc5a04d3..937ed28c3 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt @@ -102,10 +102,10 @@ class ConversationsListBottomDialog( } private fun initHeaderDescription() { - if (!TextUtils.isEmpty(conversation.getDisplayName())) { - binding.conversationOperationHeader.text = conversation.getDisplayName() - } else if (!TextUtils.isEmpty(conversation.getName())) { - binding.conversationOperationHeader.text = conversation.getName() + if (!TextUtils.isEmpty(conversation.displayName)) { + binding.conversationOperationHeader.text = conversation.displayName + } else if (!TextUtils.isEmpty(conversation.name)) { + binding.conversationOperationHeader.text = conversation.name } } @@ -114,10 +114,10 @@ class ConversationsListBottomDialog( val canModerate = conversation.canModerate(currentUser) binding.conversationOperationRemoveFavorite.visibility = setVisibleIf( - hasFavoritesCapability && conversation.isFavorite() + hasFavoritesCapability && conversation.favorite ) binding.conversationOperationAddFavorite.visibility = setVisibleIf( - hasFavoritesCapability && !conversation.isFavorite() + hasFavoritesCapability && !conversation.favorite ) binding.conversationOperationMarkAsRead.visibility = setVisibleIf( @@ -133,15 +133,15 @@ class ConversationsListBottomDialog( ) binding.conversationOperationChangePassword.visibility = setVisibleIf( - canModerate && conversation.isHasPassword && conversation.isPublic + canModerate && conversation.hasPassword && conversation.isPublic ) binding.conversationOperationClearPassword.visibility = setVisibleIf( - canModerate && conversation.isHasPassword && conversation.isPublic + canModerate && conversation.hasPassword && conversation.isPublic ) binding.conversationOperationSetPassword.visibility = setVisibleIf( - canModerate && !conversation.isHasPassword && conversation.isPublic + canModerate && !conversation.hasPassword && conversation.isPublic ) binding.conversationOperationDelete.visibility = setVisibleIf( @@ -157,7 +157,7 @@ class ConversationsListBottomDialog( ) binding.conversationOperationLeave.visibility = setVisibleIf( - conversation.canLeave(currentUser) && + conversation.canLeave() && // leaving is by api not possible for the last user with moderator permissions. // for now, hide this option for all moderators. !conversation.canModerate(currentUser) @@ -183,7 +183,7 @@ class ConversationsListBottomDialog( binding.conversationOperationLeave.setOnClickListener { val dataBuilder = Data.Builder() - dataBuilder.putString(KEY_ROOM_TOKEN, conversation.getToken()) + dataBuilder.putString(KEY_ROOM_TOKEN, conversation.token) dataBuilder.putLong(KEY_INTERNAL_USER_ID, currentUser.id) val data = dataBuilder.build() @@ -197,7 +197,7 @@ class ConversationsListBottomDialog( } binding.conversationOperationDelete.setOnClickListener { - if (!TextUtils.isEmpty(conversation.getToken())) { + if (!TextUtils.isEmpty(conversation.token)) { val bundle = Bundle() bundle.putLong(KEY_INTERNAL_USER_ID, currentUser.id) bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation)) diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt index e3edd0e4e..9a3ad996d 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt @@ -83,12 +83,12 @@ class MessageActionsDialog( ) initMenuDeleteMessage(showMessageDeletionButton) initMenuForwardMessage( - ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getMessageType() && + ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() && !(message.isDeletedCommentMessage || message.isDeleted) ) initMenuMarkAsUnread( message.previousMessageId > NO_PREVIOUS_MESSAGE_ID && - ChatMessage.MessageType.SYSTEM_MESSAGE != message.getMessageType() && + ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType() && BuildConfig.DEBUG ) } diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt index 50c443dd3..5eb330388 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt @@ -95,9 +95,9 @@ class ShowReactionsDialog( private fun initEmojiReactions() { adapter?.list?.clear() - if (chatMessage.reactions != null && chatMessage.reactions.isNotEmpty()) { + if (chatMessage.reactions != null && chatMessage.reactions!!.isNotEmpty()) { var reactionsTotal = 0 - for ((emoji, amount) in chatMessage.reactions) { + for ((emoji, amount) in chatMessage.reactions!!) { reactionsTotal = reactionsTotal.plus(amount as Int) val tab: TabLayout.Tab = binding.emojiReactionsTabs.newTab() // Create a new Tab names "First Tab" diff --git a/app/src/main/java/com/nextcloud/talk/utils/FileViewerUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/FileViewerUtils.kt index 7e9a31a50..f3eaf5b34 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/FileViewerUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/FileViewerUtils.kt @@ -58,14 +58,14 @@ class FileViewerUtils(private val context: Context, private val userEntity: User message: ChatMessage, progressUi: ProgressUi ) { - val fileName = message.getSelectedIndividualHashMap()[MagicPreviewMessageViewHolder.KEY_NAME]!! - val mimetype = message.getSelectedIndividualHashMap()[MagicPreviewMessageViewHolder.KEY_MIMETYPE]!! - val link = message.getSelectedIndividualHashMap()["link"]!! + val fileName = message.selectedIndividualHashMap!![MagicPreviewMessageViewHolder.KEY_NAME]!! + val mimetype = message.selectedIndividualHashMap!![MagicPreviewMessageViewHolder.KEY_MIMETYPE]!! + val link = message.selectedIndividualHashMap!!["link"]!! - val fileId = message.getSelectedIndividualHashMap()[MagicPreviewMessageViewHolder.KEY_ID]!! - val path = message.getSelectedIndividualHashMap()[MagicPreviewMessageViewHolder.KEY_PATH]!! + val fileId = message.selectedIndividualHashMap!![MagicPreviewMessageViewHolder.KEY_ID]!! + val path = message.selectedIndividualHashMap!![MagicPreviewMessageViewHolder.KEY_PATH]!! - var size = message.getSelectedIndividualHashMap()["size"] + var size = message.selectedIndividualHashMap!!["size"] if (size == null) { size = "-1" } diff --git a/app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt b/app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt index e9ff5d158..03210d6cf 100644 --- a/app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt @@ -72,8 +72,8 @@ class SharedItemsViewModel(private val repository: SharedItemsRepository, privat val mediaItems = response.body()!!.ocs!!.data if (mediaItems != null) { for (it in mediaItems) { - if (it.value.messageParameters.containsKey("file")) { - val fileParameters = it.value.messageParameters["file"]!! + if (it.value.messageParameters!!.containsKey("file")) { + val fileParameters = it.value.messageParameters!!["file"]!! val previewAvailable = "yes".equals(fileParameters["preview-available"], ignoreCase = true) @@ -140,7 +140,7 @@ class SharedItemsViewModel(private val repository: SharedItemsRepository, privat override fun onSubscribe(d: Disposable) = Unit override fun onNext(response: Response) { - val typeMap = response.body()!!.ocs!!.data + val typeMap = response.body()!!.ocs!!.data!! for (it in typeMap) { if (it.value.size > 0) { try { diff --git a/app/src/main/java/third_parties/daveKoeller/AlphanumComparator.java b/app/src/main/java/third_parties/daveKoeller/AlphanumComparator.java index 07f117776..af25c47b2 100644 --- a/app/src/main/java/third_parties/daveKoeller/AlphanumComparator.java +++ b/app/src/main/java/third_parties/daveKoeller/AlphanumComparator.java @@ -88,8 +88,8 @@ public class AlphanumComparator implements Comparator, Serializable { } public int compare(BrowserFileItem f1, BrowserFileItem f2) { - String s1 = f1.getModel().path; - String s2 = f2.getModel().path; + String s1 = f1.getModel().getPath(); + String s2 = f2.getModel().getPath(); return compare(s1, s2); } diff --git a/app/src/test/java/com/nextcloud/talk/utils/ShareUtilsTest.kt b/app/src/test/java/com/nextcloud/talk/utils/ShareUtilsTest.kt index 33ede2a91..985826a17 100644 --- a/app/src/test/java/com/nextcloud/talk/utils/ShareUtilsTest.kt +++ b/app/src/test/java/com/nextcloud/talk/utils/ShareUtilsTest.kt @@ -69,7 +69,7 @@ class ShareUtilsTest { PowerMockito.mockStatic(TextUtils::class.java) Mockito.`when`(userUtils!!.currentUser).thenReturn(userEntity) Mockito.`when`(userEntity!!.baseUrl).thenReturn(baseUrl) - Mockito.`when`(conversation!!.getToken()).thenReturn(token) + Mockito.`when`(conversation!!.token).thenReturn(token) Mockito.`when`(context!!.resources).thenReturn(resources) Mockito.`when`(resources!!.getString(R.string.nc_share_text)) .thenReturn("Join the conversation at %1\$s/index.php/call/%2\$s") diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index ef491079a..a14c1ee5a 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -337 \ No newline at end of file +180 \ No newline at end of file