mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 10:47:32 +00:00
android: report network info without an error alert, remove comments that restate the code
This commit is contained in:
1 parent
dcc48284be
commit
9e6047989e
3 files changed
+1
-4
No files matched your search
@@ -52,7 +52,6 @@ class NetworkObserver {
|
||||
// the interface is compared too - a VPN that reconnected as another one can have the same
|
||||
// address, and an interface being configured has none yet
|
||||
let pathChanged = interface != prevInterface || lost(prevGateways, gateways) || lost(prevAddresses, addresses)
|
||||
// the report that was not accepted is repeated when the next path update is received
|
||||
if prevInfo != info || (info.online && pathChanged) {
|
||||
prevInfo = setNetworkInfo(info) ? info : nil
|
||||
}
|
||||
|
||||
-2
@@ -160,11 +160,9 @@ class NetworkObserver {
|
||||
|
||||
private suspend fun sendNetworkInfo(info: UserNetworkInfo, network: Network?, removals: Int, ctrlGen: Int): Boolean {
|
||||
if (ctrlGen != ctrlGeneration) return false
|
||||
// the controller is passed, so that replacing it while the report is sent does not fail the command
|
||||
val ctrl = controller.currentCtrl() ?: return false.also { reportFailed(ctrlGen) }
|
||||
// a failed command must not be recorded as sent, and it throws when the response cannot be parsed
|
||||
val sent = try { controller.apiSetNetworkInfo(info, ctrl) } catch (e: Throwable) { Log.e(TAG, "Error reporting network info: ${e.stackTraceToString()}"); false }
|
||||
// when it was not sent the network info is reported again when the next event is received
|
||||
if (sent) setSentInfo(info, network, removals, ctrlGen) else reportFailed(ctrlGen)
|
||||
return sent
|
||||
}
|
||||
|
||||
+1
-1
@@ -1534,7 +1534,7 @@ object ChatController {
|
||||
}
|
||||
|
||||
suspend fun apiSetNetworkInfo(networkInfo: UserNetworkInfo, ctrl: ChatCtrl): Boolean =
|
||||
sendCommandOkResp(null, CC.APISetNetworkInfo(networkInfo), ctrl)
|
||||
sendCmd(null, CC.APISetNetworkInfo(networkInfo), ctrl).result is CR.CmdOk
|
||||
|
||||
suspend fun apiSetMemberSettings(rh: Long?, groupId: Long, groupMemberId: Long, memberSettings: GroupMemberSettings): Boolean =
|
||||
sendCommandOkResp(rh, CC.ApiSetMemberSettings(groupId, groupMemberId, memberSettings))
|
||||
|
||||
Reference in new issue
Block a user