finalize renames, ui alerts

This commit is contained in:
Evgeny @ SimpleX Chat committed 2026-06-30 16:06:45 +00:00
1 parent 657f050305
commit 569de5cd06
16 files changed
+90 -72

No files matched your search

+24 -6
View File
@@ -1087,19 +1087,19 @@ private func apiConnectResponseAlert<R>(_ r: APIResult<R>) -> Alert {
switch err {
case .noValidLink:
mkAlert(
title: "Cannot reconnect via name",
message: "This SimpleX name is known but has no saved link to reconnect via."
title: "No valid link",
message: "The SimpleX name \(name.shortName) is registered, but it has no valid link."
)
case .unknownName:
mkAlert(
title: name.nameType == .contact ? "Contact name not found" : "Channel name not found",
message: "There is no contact or group registered with this SimpleX name."
title: "Unconfirmed name",
message: "The SimpleX name \(name.shortName) is registered, but not added to profile. Please add it to your address or channel profile, if you are the owner."
)
}
case .errorAgent(.NO_NAME_SERVERS):
mkAlert(
title: "Name resolution unavailable",
message: "None of your SMP servers support resolving SimpleX names. Add a server that does, or use a connection link."
title: "SimpleX name error",
message: "None of your servers are set to resolve SimpleX names. Configure servers, or use a connection link."
)
case .errorAgent(.SMP(_, .AUTH)):
mkAlert(
@@ -1131,6 +1131,24 @@ private func apiConnectResponseAlert<R>(_ r: APIResult<R>) -> Alert {
} else {
connectionErrorAlert(r)
}
case let .errorAgent(.SMP(serverAddress, .NAME(nameErr))):
switch nameErr {
case .NOT_FOUND:
mkAlert(
title: "Name not found",
message: "This SimpleX name is not registered. Please check the name."
)
case .NO_RESOLVER:
mkAlert(
title: "SimpleX name error",
message: "Server \(serverAddress) does not support name resolution. Configure servers, or use a connection link."
)
case let .RESOLVER(resolverErr):
mkAlert(
title: "SimpleX name error",
message: "Resolver error: \(resolverErr)"
)
}
default: connectionErrorAlert(r)
}
}
@@ -395,7 +395,7 @@ struct ChatInfoView: View {
if let claim = contact.profile.simplexName, claim.proof != nil {
SimplexNameView(
name: claim.shortName,
verification: contact.profile.contactDomainVerification,
verification: contact.profile.contactNameVerification,
autoVerify: UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_VERIFY_SIMPLEX_NAMES),
verify: {
do {
@@ -404,7 +404,7 @@ struct ChatInfoView: View {
chatModel.updateContact(ct)
contact = ct
}
return (ct.profile.contactDomainVerification, reason)
return (ct.profile.contactNameVerification, reason)
} catch {
logger.error("apiVerifyContactName: \(responseError(error))")
return nil
@@ -362,7 +362,7 @@ struct GroupChatInfoView: View {
access.simplexName?.proof != nil {
SimplexNameView(
name: groupName,
verification: groupInfo.groupDomainVerification,
verification: groupInfo.groupNameVerification,
autoVerify: UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_VERIFY_SIMPLEX_NAMES),
verify: {
do {
@@ -371,7 +371,7 @@ struct GroupChatInfoView: View {
chatModel.updateGroup(gInfo)
groupInfo = gInfo
}
return (gInfo.groupDomainVerification, reason)
return (gInfo.groupNameVerification, reason)
} catch {
logger.error("apiVerifyPublicGroupName: \(responseError(error))")
return nil
+4 -4
View File
@@ -163,7 +163,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
localBadge: LocalBadge? = nil,
localAlias: String,
simplexName: SimplexNameClaim? = nil,
contactDomainVerification: Bool? = nil
contactNameVerification: Bool? = nil
) {
self.profileId = profileId
self.displayName = displayName
@@ -176,7 +176,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
self.localBadge = localBadge
self.localAlias = localAlias
self.simplexName = simplexName
self.contactDomainVerification = contactDomainVerification
self.contactNameVerification = contactNameVerification
}
public var profileId: Int64
@@ -190,7 +190,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
public var localBadge: LocalBadge?
public var localAlias: String
public var simplexName: SimplexNameClaim?
public var contactDomainVerification: Bool?
public var contactNameVerification: Bool?
var profileViewName: String {
localAlias == ""
@@ -2540,7 +2540,7 @@ public struct GroupInfo: Identifiable, Decodable, NamedChat, Hashable {
public var chatTags: [Int64]
public var chatItemTTL: Int64?
public var localAlias: String
public var groupDomainVerification: Bool?
public var groupNameVerification: Bool?
public var isOwner: Bool {
return membership.memberRole == .owner && membership.memberCurrent
@@ -2070,7 +2070,7 @@ data class LocalProfile(
val peerType: ChatPeerType? = null,
val localBadge: LocalBadge? = null,
val simplexName: SimplexNameClaim? = null,
val contactDomainVerification: Boolean? = null
val contactNameVerification: Boolean? = null
): NamedChat {
val profileViewName: String = localAlias.ifEmpty { if (fullName == "" || displayName == fullName) displayName else "$displayName ($fullName)" }
@@ -2200,7 +2200,7 @@ data class GroupInfo (
val chatTags: List<Long>,
val chatItemTTL: Long?,
override val localAlias: String,
val groupDomainVerification: Boolean? = null,
val groupNameVerification: Boolean? = null,
): SomeChat, NamedChat {
override val chatType get() = ChatType.Group
override val id get() = "#$groupId"
@@ -761,13 +761,13 @@ fun ChatInfoHeader(cInfo: ChatInfo, contact: Contact) {
if (contactDomain != null && contact.profile.simplexName?.proof != null) {
SimplexNameView(
name = contactDomain,
verification = contact.profile.contactDomainVerification,
verification = contact.profile.contactNameVerification,
autoVerify = chatModel.controller.appPrefs.privacyVerifySimplexNames.get(),
verify = {
val rhId = chatModel.remoteHostId()
chatModel.controller.apiVerifyContactName(rhId, contact.contactId)?.let { (ct, reason) ->
chatModel.chatsContext.updateContact(rhId, ct)
ct.profile.contactDomainVerification to reason
ct.profile.contactNameVerification to reason
}
}
)
@@ -979,13 +979,13 @@ private fun GroupChatInfoHeader(cInfo: ChatInfo, groupInfo: GroupInfo) {
if (groupName != null && access.simplexName?.proof != null) {
SimplexNameView(
name = groupName,
verification = groupInfo.groupDomainVerification,
verification = groupInfo.groupNameVerification,
autoVerify = chatModel.controller.appPrefs.privacyVerifySimplexNames.get(),
verify = {
val rhId = chatModel.remoteHostId()
chatModel.controller.apiVerifyPublicGroupName(rhId, groupInfo.groupId)?.let { (gInfo, reason) ->
chatModel.chatsContext.updateGroup(rhId, gInfo)
gInfo.groupDomainVerification to reason
gInfo.groupNameVerification to reason
}
}
)