Modern Apps git

← Modern-Apps.git

share: keep ShareNative at JNI package (runtime linkage)

Commit
68c9f48362b149b2da9bd8408c8030be1d96498f
Author
vayun-mathur <[email protected]>
When
2026-08-15 20:25 UTC (3 months ago)
Parents
65de0be

Diff

share/src/main/java/com/vayunmathur/share/domain/protocol/ShareSession.kt
diff --git a/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareSession.kt b/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareSession.ktindex f1b8ff9fd6..0022532c81 100644--- a/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareSession.kt+++ b/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareSession.kt@@ -1,5 +1,6 @@ package com.vayunmathur.share.domain.protocol +import com.vayunmathur.share.protocol.ShareNative import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json 
share/src/main/java/com/vayunmathur/share/platform/discovery/BleDiscoveryManager.kt
diff --git a/share/src/main/java/com/vayunmathur/share/platform/discovery/BleDiscoveryManager.kt b/share/src/main/java/com/vayunmathur/share/platform/discovery/BleDiscoveryManager.ktindex c55e8a4146..4cca1f9a67 100644--- a/share/src/main/java/com/vayunmathur/share/platform/discovery/BleDiscoveryManager.kt+++ b/share/src/main/java/com/vayunmathur/share/platform/discovery/BleDiscoveryManager.kt@@ -82,7 +82,7 @@ class BleDiscoveryManager(private val context: Context) {     private fun tryBuildPresenceViaRust(deviceName: String): ByteArray? {         return try {             @Suppress("DEPRECATION")-            com.vayunmathur.share.domain.protocol.ShareNative.nativeBuildPresenceAdvert(deviceName)+            com.vayunmathur.share.protocol.ShareNative.nativeBuildPresenceAdvert(deviceName)         } catch (_: UnsatisfiedLinkError) { null         } catch (_: NoSuchMethodError) { null         } catch (_: ClassNotFoundException) { null }@@ -131,7 +131,7 @@ class BleDiscoveryManager(private val context: Context) {     private fun tryParsePresenceViaRust(advertBytes: ByteArray): String? {         return try {             // Primary: JSON byte[] {"deviceName":"...","deviceType":1,...} — extract deviceName.-            val jsonBytes = try { com.vayunmathur.share.domain.protocol.ShareNative.nativeParsePresenceAdvert(advertBytes) } catch (_: NoSuchMethodError) { null }+            val jsonBytes = try { com.vayunmathur.share.protocol.ShareNative.nativeParsePresenceAdvert(advertBytes) } catch (_: NoSuchMethodError) { null }             if (jsonBytes != null && jsonBytes.isNotEmpty()) {                 val json = String(jsonBytes, Charsets.UTF_8)                 Regex(""""deviceName"\s*:\s*"([^"]+)"""").find(json)?.groupValues?.getOrNull(1)?.let { if (it.isNotBlank()) return it }@@ -141,7 +141,7 @@ class BleDiscoveryManager(private val context: Context) {             }             // Alias: String return for older builds             @Suppress("DEPRECATION")-            com.vayunmathur.share.domain.protocol.ShareNative.nativeParsePresenceAdvertName(advertBytes)+            com.vayunmathur.share.protocol.ShareNative.nativeParsePresenceAdvertName(advertBytes)         } catch (_: UnsatisfiedLinkError) { null         } catch (_: NoSuchMethodError) { null }     }
share/src/main/java/com/vayunmathur/share/protocol/ShareNative.kt
diff --git a/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareNative.kt b/share/src/main/java/com/vayunmathur/share/protocol/ShareNative.ktsimilarity index 95%rename from share/src/main/java/com/vayunmathur/share/domain/protocol/ShareNative.ktrename to share/src/main/java/com/vayunmathur/share/protocol/ShareNative.ktindex d46f8fb143..ffba0aeb3a 100644--- a/share/src/main/java/com/vayunmathur/share/domain/protocol/ShareNative.kt+++ b/share/src/main/java/com/vayunmathur/share/protocol/ShareNative.kt@@ -1,4 +1,5 @@-package com.vayunmathur.share.domain.protocol+// PACKAGE STRUCTURE EXCEPTION (JNI): FQN frozen for native RegisterNatives/symbol mangling+package com.vayunmathur.share.protocol  /**  * JNI surface for the native Nearby Share / Quick Share protocol crate