Skip to content

Commit

Permalink
fix: 实际类未同步预期类更改
Browse files Browse the repository at this point in the history
  • Loading branch information
xfqwdsj committed May 5, 2024
1 parent b6163e4 commit 6e6c474
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions compose-app/src/androidMain/kotlin/platform/Camera.android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package xyz.xfqlittlefan.fhraise.platform

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.SharedFlow

actual class Camera {
actual companion object {
Expand All @@ -43,7 +43,7 @@ actual class Camera {
actual var streamingJob: Job?
get() = TODO("Not yet implemented")
set(value) {}
actual val frameFlow: StateFlow<CameraImage?>
actual val frameFlow: SharedFlow<CameraImage?>
get() = TODO("Not yet implemented")

actual suspend fun open() {
Expand Down
24 changes: 23 additions & 1 deletion compose-app/src/commonMain/kotlin/platform/Camera.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,29 @@ data class CameraImage(
val width: Int,
val height: Int,
val content: ByteArray,
)
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as CameraImage

if (format != other.format) return false
if (width != other.width) return false
if (height != other.height) return false
if (!content.contentEquals(other.content)) return false

return true
}

override fun hashCode(): Int {
var result = format.hashCode()
result = 31 * result + width
result = 31 * result + height
result = 31 * result + content.contentHashCode()
return result
}
}

enum class FrameFormat {
AndroidRgba8888, Rgb, Bgr, RgbInt, ArgbInt
Expand Down
4 changes: 2 additions & 2 deletions compose-app/src/wasmJsMain/kotlin/platform/Camera.wasmJs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package xyz.xfqlittlefan.fhraise.platform

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.SharedFlow

actual class Camera {
actual companion object {
Expand All @@ -43,7 +43,7 @@ actual class Camera {
actual var streamingJob: Job?
get() = TODO("Not yet implemented")
set(value) {}
actual val frameFlow: StateFlow<CameraImage?>
actual val frameFlow: SharedFlow<CameraImage?>
get() = TODO("Not yet implemented")

actual suspend fun open() {
Expand Down

0 comments on commit 6e6c474

Please sign in to comment.