mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 23:00:09 +00:00
core, ui: resolve untyped domains (#7198)
* core: resolve untyped domains * CPError * only add domain when it has link of correct type * resolve first * handle errors * remove CPError * update UI types * remove unused name Co-authored-by: Evgeny <evgeny@poberezkin.com> * refactor connection plan * kotlin: show domain and alternative chat, haskell tests for dual domains * view/tests * update kotlin * dual domains accounting for business chats * refactor, fix * fix kotlin * remove comment * search * add resolve mode * local resolution * refactor, bot types * search both contact and channel by name * fix * fix searching business chats by name * fix ui * ios * fix ios * fix icon --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
co-authored by
Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
parent
ff58dbd6df
commit
6150b35a2f
@@ -1026,13 +1026,17 @@ func apiChangeConnectionUser(connId: Int64, userId: Int64) async throws -> Pendi
|
||||
if let r { throw r.unexpected } else { return nil }
|
||||
}
|
||||
|
||||
func apiConnectPlan(connLink: String, linkOwnerSig: LinkOwnerSig? = nil, inProgress: BoxedValue<Bool>) async -> (CreatedConnLink, ConnectionPlan)? {
|
||||
func apiConnectPlan(connLink: String, resolveMode: PlanResolveMode = .unknown, linkOwnerSig: LinkOwnerSig? = nil, inProgress: BoxedValue<Bool>) async -> ConnectionPlanResult? {
|
||||
guard let userId = ChatModel.shared.currentUser?.userId else {
|
||||
logger.error("apiConnectPlan: no current user")
|
||||
return nil
|
||||
}
|
||||
let r: APIResult<ChatResponse1>? = await chatApiSendCmdWithRetry(.apiConnectPlan(userId: userId, connLink: connLink, linkOwnerSig: linkOwnerSig), inProgress: inProgress)
|
||||
if case let .result(.connectionPlan(_, connLink, connPlan)) = r { return (connLink, connPlan) }
|
||||
let r: APIResult<ChatResponse1>? = await chatApiSendCmdWithRetry(.apiConnectPlan(userId: userId, connLink: connLink, resolveMode: resolveMode, linkOwnerSig: linkOwnerSig), inProgress: inProgress)
|
||||
if case let .result(.connectionPlan(_, connLink, planSimplexName, otherSimplexName, connPlan)) = r {
|
||||
return ConnectionPlanResult(connLink: connLink, planSimplexName: planSimplexName, otherSimplexName: otherSimplexName, connectionPlan: connPlan)
|
||||
}
|
||||
// a .never (typing) search that matches nothing locally is not an error to surface
|
||||
if case .error(.error(.notResolvedLocally)) = r { return nil }
|
||||
if let r { await apiConnectResponseAlert(r) }
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user