dispaly gecko version in about dialog

This commit is contained in:
Fabian Freund
2025-09-22 13:54:13 +02:00
parent 4661386024
commit 8e5e858c9a
10 changed files with 117 additions and 31 deletions
@@ -52,6 +52,7 @@ import mozilla.components.support.base.log.Log
import mozilla.components.support.base.log.sink.AndroidLogSink
import mozilla.components.support.base.log.sink.LogSink
import org.mozilla.gecko.util.ThreadUtils.runOnUiThread
import org.mozilla.geckoview.BuildConfig as GeckoViewBuildConfig
class PriorityAwareLogSink(
private val minLogPriority: Log.Priority,
@@ -135,6 +136,10 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
isPlatformViewRegistered = false
}
override fun getGeckoVersion(): String {
return GeckoViewBuildConfig.MOZ_APP_VERSION + "-" + GeckoViewBuildConfig.MOZ_APP_BUILDID
}
override fun initialize(logLevel: LogLevel, contentBlocking: ContentBlocking) {
synchronized(this) {
if(!isGeckoInitialized) {
@@ -2648,6 +2648,7 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface GeckoBrowserApi {
fun getGeckoVersion(): String
fun initialize(logLevel: LogLevel, contentBlocking: ContentBlocking)
fun showNativeFragment(): Boolean
fun onTrimMemory(level: Long)
@@ -2661,6 +2662,21 @@ interface GeckoBrowserApi {
@JvmOverloads
fun setUp(binaryMessenger: BinaryMessenger, api: GeckoBrowserApi?, messageChannelSuffix: String = "") {
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_mozilla_components.GeckoBrowserApi.getGeckoVersion$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
val wrapped: List<Any?> = try {
listOf(api.getGeckoVersion())
} catch (exception: Throwable) {
GeckoPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_mozilla_components.GeckoBrowserApi.initialize$separatedMessageChannelSuffix", codec)
if (api != null) {