Skip to content
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
3 changes: 2 additions & 1 deletion lib/src/commonMain/kotlin/im/tox/tox4j/ToxEventListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import im.tox.tox4j.av.callbacks.ToxAvEventListener
import im.tox.tox4j.core.callbacks.ToxCoreEventListener

interface ToxEventListener<ToxCoreState> :
ToxCoreEventListener<ToxCoreState>, ToxAvEventListener<ToxCoreState>
ToxCoreEventListener<ToxCoreState>,
ToxAvEventListener<ToxCoreState>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package im.tox.tox4j.av.data

enum class AudioChannels(val value: Int) {
enum class AudioChannels(
val value: Int,
) {
Mono(1),
Stereo(2),
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package im.tox.tox4j.av.data

/** Length in microseconds. */
@Suppress("ktlint:standard:enum-entry-name-case")
enum class AudioLength(val value: Int) {
enum class AudioLength(
val value: Int,
) {
Length2_5(2500),
Length5(5000),
Length10(10000),
Expand Down
4 changes: 3 additions & 1 deletion lib/src/commonMain/kotlin/im/tox/tox4j/av/data/BitRate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package im.tox.tox4j.av.data
import kotlin.jvm.JvmInline

@JvmInline
value class BitRate(val value: Int) {
value class BitRate(
val value: Int,
) {
companion object {
val Unchanged: BitRate = BitRate(-1)
val Disabled: BitRate = BitRate(0)
Expand Down
4 changes: 3 additions & 1 deletion lib/src/commonMain/kotlin/im/tox/tox4j/av/data/Height.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.av.data

import kotlin.jvm.JvmInline

@JvmInline value class Height(val value: Int)
@JvmInline value class Height(
val value: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package im.tox.tox4j.av.data
import kotlin.jvm.JvmInline

@JvmInline
value class SampleCount(val value: Int) {
value class SampleCount(
val value: Int,
) {
constructor(
audioLength: AudioLength,
samplingRate: SamplingRate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package im.tox.tox4j.av.data

enum class SamplingRate(val value: Int) {
enum class SamplingRate(
val value: Int,
) {
Rate8k(8000),
Rate12k(12000),
Rate16k(16000),
Expand Down
4 changes: 3 additions & 1 deletion lib/src/commonMain/kotlin/im/tox/tox4j/av/data/Width.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.av.data

import kotlin.jvm.JvmInline

@JvmInline value class Width(val value: Int)
@JvmInline value class Width(
val value: Int,
)
4 changes: 3 additions & 1 deletion lib/src/commonMain/kotlin/im/tox/tox4j/core/data/Port.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ package im.tox.tox4j.core.data
import kotlin.jvm.JvmInline

/** IP_Port stores an IP datastructure with a port. */
@JvmInline value class Port constructor(val value: UShort)
@JvmInline value class Port constructor(
val value: UShort,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFileId(val value: ByteArray)
@JvmInline value class ToxFileId(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFilename(val value: ByteArray)
@JvmInline value class ToxFilename(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFriendAddress(val value: ByteArray)
@JvmInline value class ToxFriendAddress(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFriendMessage(val value: ByteArray)
@JvmInline value class ToxFriendMessage(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFriendNumber(val value: Int)
@JvmInline value class ToxFriendNumber(
val value: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxFriendRequestMessage(val value: ByteArray)
@JvmInline value class ToxFriendRequestMessage(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxLosslessPacket(val value: ByteArray)
@JvmInline value class ToxLosslessPacket(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxLossyPacket(val value: ByteArray)
@JvmInline value class ToxLossyPacket(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxNickname(val value: ByteArray)
@JvmInline value class ToxNickname(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxPublicKey(val value: ByteArray)
@JvmInline value class ToxPublicKey(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxSecretKey(val value: ByteArray)
@JvmInline value class ToxSecretKey(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package im.tox.tox4j.core.data

import kotlin.jvm.JvmInline

@JvmInline value class ToxStatusMessage(val value: ByteArray)
@JvmInline value class ToxStatusMessage(
val value: ByteArray,
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ object SaveDataOptions {
* Full save data containing friend list, last seen DHT nodes, name, and all other information
* contained within a Tox instance.
*/
final data class ToxSave(override val data: ByteArray) : Type {
final data class ToxSave(
override val data: ByteArray,
) : Type {
override val kind: ToxSavedataType = ToxSavedataType.TOX_SAVE
}

Expand All @@ -35,7 +37,9 @@ object SaveDataOptions {
* secret key, the friend list, name, and noSpam value is sufficient to restore the observable
* behaviour of a Tox instance without the full save data in [[ToxSave]].
*/
final data class SecretKey(private val key: ToxSecretKey) : Type {
final data class SecretKey(
private val key: ToxSecretKey,
) : Type {
override val kind: ToxSavedataType = ToxSavedataType.SECRET_KEY
override val data: ByteArray = key.value
}
Expand Down
4 changes: 3 additions & 1 deletion lib/src/jvmMain/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import im.tox.tox4j.core.data.ToxFriendNumber
* @throws ToxavNewException If there was already an A/V session.
*/
@kotlin.ExperimentalStdlibApi
final class ToxAvImpl(private val tox: ToxCoreImpl) : ToxAv {
final class ToxAvImpl(
private val tox: ToxCoreImpl,
) : ToxAv {
internal val instanceNumber = ToxAvJni.toxavNew(tox.instanceNumber)

override fun create(tox: ToxCore): ToxAv =
Expand Down
8 changes: 4 additions & 4 deletions lib/src/jvmMain/java/im/tox/tox4j/impl/jni/ToxCoreImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import im.tox.tox4j.core.options.ToxOptions
* @param options Connection options object with optional save-data.
*/
@kotlin.ExperimentalStdlibApi
final class ToxCoreImpl(val options: ToxOptions) : ToxCore {
final class ToxCoreImpl(
val options: ToxOptions,
) : ToxCore {
/** This field has package visibility for [[ToxAvImpl]]. */
internal val instanceNumber =
ToxCoreJni.toxNew(
Expand Down Expand Up @@ -232,9 +234,7 @@ final class ToxCoreImpl(val options: ToxOptions) : ToxCore {
name: String,
message: String,
expectedSize: Int,
) {
throw IllegalArgumentException("$name too $message, must be $expectedSize bytes")
}
): Unit = throw IllegalArgumentException("$name too $message, must be $expectedSize bytes")

fun checkLength(
name: String,
Expand Down
Loading