Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.0 #44

Merged
merged 8 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ allprojects {
### project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:socket-io:0.5.0")
commonMainApi("dev.icerock.moko:socket-io:0.6.0")
}
```

Expand All @@ -59,15 +59,15 @@ kotlin {
// add native dependency
pod(name = "mokoSocketIo") {
source = git(url = "https://github.com/icerockdev/moko-socket-io.git") {
tag = "release/0.5.0"
tag = "release/0.6.0"
}
}
}
}
```
Podfile
```
pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.5.0'
pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.6.0'
```

(!) Check sample - https://github.com/Alex009/moko-socket-io-sample ([integration changes](https://github.com/Alex009/moko-socket-io-sample/commit/7439093217f9c041369540011d84d7109b2c1606))
Expand All @@ -91,7 +91,7 @@ cocoaPods {

Podfile
```ruby
pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.5.0'
pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.6.0'
```

## Usage
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[versions]
detektVersion = "1.15.0"
detektVersion = "1.18.0"
androidAppCompatVersion = "1.6.1"
androidSocketIoVersion = "1.0.0"
androidSocketIoVersion = "2.1.1"
gradleVersion = "8.2.2"
kotlinGradlePluginVersion = "1.9.10"
kotlinxSerializationVersion = "1.3.3"
kotlinGradlePluginVersion = "1.9.25"
kotlinxSerializationVersion = "1.7.0"
mobileMultiplatformVersion = "0.14.2"
mokoSocketIoVersion = "0.5.0"
mokoSocketIoVersion = "0.6.0"
compileSdk = "34"
targetSdk = "34"
minSdk = "16"
Expand Down
2 changes: 1 addition & 1 deletion mokoSocketIo.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'mokoSocketIo'
spec.version = '0.5.0'
spec.version = '0.6.0'
spec.homepage = 'https://github.com/icerockdev/moko-socket-io'
spec.source = { :git => "https://github.com/icerockdev/moko-socket-io.git", :tag => "release/#{spec.version}" }
spec.authors = 'IceRock Development'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import dev.icerock.moko.socket.SocketOptions

class Testing {
val socket = Socket(
endpoint = "https://socketio-chat-h9jt.herokuapp.com",
endpoint = "https://socket-io-demo-hrnu.onrender.com",
config = SocketOptions(
queryParams = mapOf("param1" to "1", "param2" to "2"),
transport = SocketOptions.Transport.WEBSOCKET
Expand Down
8 changes: 2 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

rootProject.name = "moko-socket-io"

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
repositories {
mavenCentral()
google()

jcenter {
content {
includeGroup("org.jetbrains.kotlinx")
}
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions socket-io/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import java.util.Base64

plugins {
Expand Down Expand Up @@ -46,6 +47,14 @@ kotlin {
dependsOn(iosMain)
}
}

targets.withType<KotlinNativeTarget>().configureEach {
compilations.configureEach {
cinterops.configureEach {
extraOpts("-compiler-option", "-fmodules")
}
}
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.socket

object Constants {
const val EVENT_PING = "ping"
const val EVENT_PONG = "pong"
const val EVENT_ERROR = "error"
const val EVENT_MESSAGE = "message"
const val EVENT_CONNECTING = "connecting"
const val EVENT_RECONNECT = "reconnect"
const val EVENT_RECONNECT_ATTEMPT = "reconnect_attempt"
const val EVENT_RECONNECT_ERROR = "reconnect_error"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ actual sealed class SocketEvent<T> : Mapper<T> {
}

actual object Connecting : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_CONNECTING)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_CONNECTING)
}

actual object Disconnect : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
Expand All @@ -21,9 +21,9 @@ actual sealed class SocketEvent<T> : Mapper<T> {

actual object Error : SocketEvent<Throwable>() {
override val socketIoEvents: List<String> = listOf(
Socket.EVENT_ERROR,
Constants.EVENT_ERROR,
Socket.EVENT_CONNECT_ERROR,
Socket.EVENT_RECONNECT_ERROR
Constants.EVENT_RECONNECT_ERROR
)

override fun mapper(array: Array<out Any>): Throwable {
Expand All @@ -32,29 +32,29 @@ actual sealed class SocketEvent<T> : Mapper<T> {
}

actual object Message : SocketEvent<Any>() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_MESSAGE)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_MESSAGE)
override fun mapper(array: Array<out Any>): Any {
return array
}
}

actual object Reconnect : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_RECONNECT)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_RECONNECT)
}

actual object ReconnectAttempt : SocketEvent<Int>() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_RECONNECT_ATTEMPT)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_RECONNECT_ATTEMPT)
override fun mapper(array: Array<out Any>): Int {
return array[0] as Int
}
}

actual object Ping : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_PING)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_PING)
}

actual object Pong : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
override val socketIoEvents: List<String> = listOf(Socket.EVENT_PONG)
override val socketIoEvents: List<String> = listOf(Constants.EVENT_PONG)
}

abstract val socketIoEvents: List<String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import cocoapods.mokoSocketIo.SocketIo
import cocoapods.mokoSocketIo.SocketIoTransportPolling
import cocoapods.mokoSocketIo.SocketIoTransportUndefined
import cocoapods.mokoSocketIo.SocketIoTransportWebsocket
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject

@OptIn(ExperimentalForeignApi::class)
actual class Socket actual constructor(
endpoint: String,
config: SocketOptions?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import cocoapods.mokoSocketIo.SocketEventPing
import cocoapods.mokoSocketIo.SocketEventPong
import cocoapods.mokoSocketIo.SocketEventReconnect
import cocoapods.mokoSocketIo.SocketEventReconnectAttempt
import kotlinx.cinterop.ExperimentalForeignApi
import cocoapods.mokoSocketIo.SocketEvent as SocketIoEvent

@OptIn(ExperimentalForeignApi::class)
actual sealed class SocketEvent<T> : Mapper<T> {
actual object Connect : SocketEvent<Unit>(), Mapper<Unit> by UnitMapper() {
override val platformEvent: SocketIoEvent = SocketEventConnect
Expand Down
Loading