android: fix QR join flow + cleanup log levels + remove log artifacts
- MainActivity: call NativeLib.joinChannel directly (bypass ViewModel null repo) - LogManager: add Log.d for Kotlin logs visibility in logcat - ChatViewModel/NativeLib: add diagnostic logs for join path - chat_sync: JNI-safe logs via __android_log_print, add error on !g_cs - etcp_debug: DUMP INFO→DEBUG (remove 99.8% packet spam) - secure_channel/etcp_connections/topo_node: keepalive PING/PONG spam INFO→DEBUG - .gitignore: logreceiver output + build artifacts - Remove tracked log files and build dir from repo
This commit is contained in:
1 parent
0216b0bf50
commit
03b34e9580
40 files changed
+42
-3954
No files matched your search
@@ -100,7 +100,7 @@ class MainActivity : ComponentActivity() {
|
||||
},
|
||||
onConnect = { data: InviteData ->
|
||||
val addrs = data.serializeAddrs()
|
||||
vm.joinChannel(data.channelId, data.nodeId, data.pubkey, addrs, data.addrs.size)
|
||||
NativeLib.joinChannel(data.channelId, data.nodeId, data.pubkey, addrs, data.addrs.size)
|
||||
showJoinDialog = false
|
||||
},
|
||||
onDismiss = { showJoinDialog = false }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.utun.chat.data
|
||||
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
@@ -19,6 +20,7 @@ object LogManager {
|
||||
|
||||
@Synchronized
|
||||
fun addLog(level: String, category: String, message: String) {
|
||||
Log.d("utun-gui", "[$level] [$category] $message")
|
||||
val entry = LogEntry(level = level, category = category, message = message)
|
||||
if (_buffer.size >= MAX_BUFFER) _buffer.removeFirst()
|
||||
_buffer.add(entry)
|
||||
|
||||
@@ -59,7 +59,9 @@ object NativeLib {
|
||||
fun createChannel(name: String, channelId: String) { nativeCreateChannel(name, channelId) }
|
||||
fun connectNode(address: String, port: Int, pubkeyHex: String) { nativeConnectNode(address, port, pubkeyHex) }
|
||||
fun joinChannel(channelId: Long, nodeId: Long, pubkey: ByteArray, addrs: ByteArray, addrCount: Int) {
|
||||
LogManager.addLog("INFO", "JNI", "joinChannel: calling native")
|
||||
nativeJoinChannel(channelId, nodeId, pubkey, addrs, addrCount)
|
||||
LogManager.addLog("INFO", "JNI", "joinChannel: native returned")
|
||||
}
|
||||
fun connectChannel(channelId: String) { nativeConnectChannel(channelId) }
|
||||
fun getChannels(): String = nativeGetChannels() ?: "[]"
|
||||
|
||||
@@ -136,7 +136,9 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
fun joinChannel(channelId: Long, nodeId: Long, pubkey: ByteArray, addrs: ByteArray, addrCount: Int) {
|
||||
val r = repo ?: return
|
||||
val r = repo
|
||||
if (r == null) { LogManager.addLog("ERROR", "VM", "joinChannel: repo is NULL"); return }
|
||||
LogManager.addLog("INFO", "VM", "joinChannel: ch=0x%016x node=0x%016x".format(channelId, nodeId))
|
||||
r.joinChannel(channelId, nodeId, pubkey, addrs, addrCount)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user