Skip to content

Commit

Permalink
ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
wkal-pubnub committed Jul 31, 2024
1 parent fa890ef commit 71c497e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
3 changes: 0 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import com.pubnub.gradle.tasks.GenerateVersionTask
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn

plugins {
kotlin("multiplatform") version "2.0.0"
Expand Down
3 changes: 0 additions & 3 deletions pubnub-chat-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn

plugins {
kotlin("multiplatform") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,19 @@ sealed class EventContent {
val files: List<File>? = null,
) : EventContent() {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is TextMessageContent) return false

if (text != other.text) return false
if (files != other.files) return false
if (this === other) {
return true
}
if (other !is TextMessageContent) {
return false
}

if (text != other.text) {
return false
}
if (files != other.files) {
return false
}

return true
}
Expand Down
4 changes: 0 additions & 4 deletions pubnub-chat-impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn

plugins {
kotlin("multiplatform") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ class ChatImpl(
callback: (event: Event<T>) -> Unit
): AutoCloseable {
val handler = fun(_: PubNub, pnEvent: PNEvent) {
if (pnEvent.channel != channelId) return
if (pnEvent.channel != channelId) {
return
}
val message = (pnEvent as? MessageResult)?.message ?: return
val eventContent: EventContent = PNDataEncoder.decode<EventContent>(message)

Expand All @@ -593,8 +595,16 @@ class ChatImpl(
val method = type.getEmitMethod() ?: customMethod
val listener = createEventListener(
pubNub,
onMessage = if (method == EmitEventMethod.PUBLISH) handler else { _, _ -> },
onSignal = if (method == EmitEventMethod.SIGNAL) handler else { _, _ -> },
onMessage = if (method == EmitEventMethod.PUBLISH) {
handler
} else {
{ _, _ -> }
},
onSignal = if (method == EmitEventMethod.SIGNAL) {
handler
} else {
{ _, _ -> }
},
)
val channelEntity = pubNub.channel(channelId)
val subscription = channelEntity.subscription()
Expand Down Expand Up @@ -637,7 +647,11 @@ class ChatImpl(
channelId = userId,
payload = EventContent.Moderation(
channelId = channel,
restriction = if (restriction.ban) RestrictionType.BAN else RestrictionType.MUTE,
restriction = if (restriction.ban) {
RestrictionType.BAN
} else {
RestrictionType.MUTE
},
reason = restriction.reason
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ abstract class BaseMessage<T : Message>(
val listener = createEventListener(chat.pubNub, onMessageAction = { _, event ->
val message =
latestMessages.find { it.timetoken == event.messageAction.messageTimetoken } ?: return@createEventListener
if (message.channelId != event.channel) return@createEventListener
if (message.channelId != event.channel) {
return@createEventListener
}
val actions = if (event.event == "added") {
assignAction(
message.actions,
Expand Down

0 comments on commit 71c497e

Please sign in to comment.