fix: Fix pairing same devices (#10856)

This commit is contained in:
Igor Sirotin 2023-05-30 17:22:09 +03:00 committed by GitHub
parent 91bdb5824b
commit b565b56aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import json, tables
import json, tables, chronicles
import base
import ../../../../app_service/service/accounts/dto/accounts
import ../../../../app_service/service/devices/dto/installation
@ -21,6 +21,7 @@ proc fromEvent*(T: type LocalPairingSignal, event: JsonNode): LocalPairingSignal
result.action = e["action"].getInt().parse()
if e.contains("error"):
result.error = e["error"].getStr()
debug "local pairing event", `type` = result.eventType, action = result.action, error = result.error, event = $event
if not e.contains("data"):
return
case result.eventType:

View File

@ -1,4 +1,4 @@
import NimQml, Tables, sequtils
import NimQml, Tables, sequtils, chronicles
import item
import ../../../../../app_service/service/devices/dto/[installation]
@ -113,7 +113,15 @@ QtObject:
defer: index.delete
self.items[i].installation = installation
self.dataChanged(index, index, @[])
self.dataChanged(index, index, @[
ModelRole.Identity.int,
ModelRole.Version.int,
ModelRole.Enabled.int,
ModelRole.Timestamp.int,
ModelRole.Name.int,
ModelRole.DeviceType.int,
ModelRole.FcmToken.int,
])
proc updateItemName*(self: Model, installationId: string, name: string) =
var i = self.findIndexByInstallationId(installationId)

View File

@ -188,6 +188,7 @@ QtObject:
"timeout": 5 * 60 * 1000,
}
}
self.localPairingStatus.reset()
self.localPairingStatus.mode = LocalPairingMode.Sender
return status_go.getConnectionStringForBootstrappingAnotherDevice($configJSON)
@ -204,6 +205,7 @@ QtObject:
},
"clientConfig": %* {}
}
self.localPairingStatus.reset()
self.localPairingStatus.mode = LocalPairingMode.Receiver
let arg = AsyncInputConnectionStringArg(