fix(web): make source a listenable state, fixes the view

This commit is contained in:
2026-07-31 19:43:49 +02:00
parent d2ca76b4a9
commit 0c7c2b3848
21 changed files with 323 additions and 54 deletions
@@ -0,0 +1,80 @@
///
/// Func_void_std__optional_Source_.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(value: optional) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_std__optional_Source_: (Source?) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(value: Source?): Unit
}
/**
* Represents the JavaScript callback `(value: optional) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_std__optional_Source__cxx: Func_void_std__optional_Source_ {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(value: Source?): Unit
= invoke_cxx(value)
@FastNative
private external fun invoke_cxx(value: Source?): Unit
}
/**
* Represents the JavaScript callback `(value: optional) => void`.
* This is implemented in Java/Kotlin, via a `(Source?) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_std__optional_Source__java(private val function: (Source?) -> Unit): Func_void_std__optional_Source_ {
@DoNotStrip
@Keep
override fun invoke(value: Source?): Unit {
return this.function(value)
}
}
@@ -100,6 +100,24 @@ abstract class HybridOmniEventMapSpec: HybridObject() {
return __result
}
abstract fun addSourceListener(cb: (value: Source?) -> Unit): Unit
@DoNotStrip
@Keep
private fun addSourceListener_cxx(cb: Func_void_std__optional_Source_): Unit {
val __result = addSourceListener(cb)
return __result
}
abstract fun removeSourceListener(cb: (value: Source?) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeSourceListener_cxx(cb: Func_void_std__optional_Source_): Unit {
val __result = removeSourceListener(cb)
return __result
}
abstract fun addOnEndListener(cb: () -> Unit): Unit
@DoNotStrip
@@ -35,12 +35,6 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
@set:Keep
abstract var showNotification: Boolean?
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var source: Source?
@get:DoNotStrip
@get:Keep
abstract val hasPrev: Boolean
@@ -65,6 +59,12 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
@get:Keep
abstract val rendition: Array<Rendition>
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var source: Source?
@get:DoNotStrip
@get:Keep
abstract val status: PlayerStatus