From 115533cd628cd22bdccbb03e1fcde932950da061 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Sat, 3 Oct 2026 10:44:30 +0800 Subject: [PATCH] [fix] report mobile client info after identity login --- apps/android/native/rtc_bridge.cpp | 10 ++++++++-- .../CrossDeskMobile/Bridge/CrossDeskRTCBridge.mm | 14 +++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/android/native/rtc_bridge.cpp b/apps/android/native/rtc_bridge.cpp index 12946b19..3f9a6c65 100644 --- a/apps/android/native/rtc_bridge.cpp +++ b/apps/android/native/rtc_bridge.cpp @@ -136,6 +136,14 @@ struct Session { void Signal(SignalStatus status, const char*, size_t, void* user) { auto* ctx = static_cast(user); + if (!ctx->controller && status == SignalStatus::SignalConnected && + !ctx->owner->stopping && ctx->owner->identity) { + // Report after every identity login, including reconnects. The server + // ignores client_info sent through the temporary C- controller peer. + constexpr char info[] = + R"({"type":"client_info","version":"android-native","platform":"android"})"; + SendSignalMessage(ctx->owner->identity, info, sizeof(info) - 1); + } if (!ctx->controller && ctx->owner->signal_status.exchange(status) != status) ++ctx->owner->signal_generation; const auto generation = ctx->owner->signal_generation.load(); @@ -339,8 +347,6 @@ extern "C" JNIEXPORT jboolean JNICALL JNI_METHOD(nConnect)( } extern "C" JNIEXPORT void JNICALL JNI_METHOD(nReady)(JNIEnv*, jclass, jlong handle) { auto* s = From(handle); if (!s || !s->controller) return; - const std::string info = R"({"type":"client_info","version":"android-native","platform":"android"})"; - SendSignalMessage(s->controller, info.data(), info.size()); auto action = MakeHostInformation("CrossDesk Android", {}, false, "1.6.0", HostPlatform::Android); s->Send(kControlStream, action.to_json()); FreeRemoteAction(action); } diff --git a/apps/ios/CrossDeskMobile/Bridge/CrossDeskRTCBridge.mm b/apps/ios/CrossDeskMobile/Bridge/CrossDeskRTCBridge.mm index b080aa5a..f020fcee 100644 --- a/apps/ios/CrossDeskMobile/Bridge/CrossDeskRTCBridge.mm +++ b/apps/ios/CrossDeskMobile/Bridge/CrossDeskRTCBridge.mm @@ -1195,6 +1195,15 @@ Params MakeParams(const RTCState &state, const std::string &user_id, self->_state->presence_requests.clear(); if (role == PeerRole::Identity) { self->_state->identity_ready = state == CrossDeskSignalStateConnected; + if (self->_state->identity_ready && self->_state->identity_peer) { + // The server records client_info on the persistent identity peer, + // before any remote session starts and again after reconnecting. + constexpr char client_info[] = + "{\"type\":\"client_info\",\"version\":\"ios-native\"," + "\"platform\":\"ios\"}"; + SendSignalMessage(self->_state->identity_peer, client_info, + sizeof(client_info) - 1); + } if (state == CrossDeskSignalStateFailed && !self->_state->identity_with_password.empty() && !self->_state->identity_recovery_attempted) { @@ -1377,11 +1386,6 @@ Params MakeParams(const RTCState &state, const std::string &user_id, !self->_state->controller_peer) { return; } - constexpr char client_info[] = - "{\"type\":\"client_info\",\"version\":\"ios-native\"," - "\"platform\":\"ios\"}"; - SendSignalMessage(self->_state->controller_peer, client_info, - sizeof(client_info) - 1); const std::string controller_name = self->_state->identity_base.empty() ? "iPhone"