mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 15:03:16 +00:00
Merge branch 'master' into badge-in-app-checkout
This commit is contained in:
commit
57ab333a2b
94 files changed
+2255
-405
No files matched your search
@@ -1972,10 +1972,13 @@ enum UserServersError: Decodable {
|
||||
case storageMissing(protocol: ServerProtocol, user: UserRef?)
|
||||
case proxyMissing(protocol: ServerProtocol, user: UserRef?)
|
||||
case duplicateServer(protocol: ServerProtocol, duplicateServer: String, duplicateHost: String)
|
||||
case tooManyHosts(protocol: ServerProtocol, tooManyHostsServer: String)
|
||||
case duplicateChatRelayAddress(duplicateChatRelay: String, duplicateAddress: String)
|
||||
|
||||
var globalError: String? {
|
||||
switch self {
|
||||
case .tooManyHosts:
|
||||
return globalSMPError
|
||||
case let .noServers(`protocol`, _):
|
||||
switch `protocol` {
|
||||
case .smp: return globalSMPError
|
||||
@@ -2018,6 +2021,8 @@ enum UserServersError: Decodable {
|
||||
} else {
|
||||
return text
|
||||
}
|
||||
case let .tooManyHosts(.smp, server):
|
||||
return String.localizedStringWithFormat(NSLocalizedString("Server %@ has more than two host names.", comment: "servers error"), serverHostname(server))
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -935,6 +935,8 @@ final class ChatModel: ObservableObject {
|
||||
func updateCurrentUser(_ newProfile: Profile, _ preferences: FullPreferences? = nil) {
|
||||
if let current = currentUser {
|
||||
currentUser?.profile = toLocalProfile(current.profile.profileId, newProfile, "")
|
||||
currentUser?.profile.localBadge = current.profile.localBadge
|
||||
currentUser?.profile.contactDomainVerified = current.profile.contactDomainVerified
|
||||
if let preferences = preferences {
|
||||
currentUser?.fullPreferences = preferences
|
||||
}
|
||||
|
||||
@@ -1359,8 +1359,12 @@ func apiUpdateProfile(profile: Profile) async throws -> (Profile, [Contact])? {
|
||||
switch r {
|
||||
case .result(.userProfileNoChange): return (profile, [])
|
||||
case let .result(.userProfileUpdated(_, _, toProfile, updateSummary)): return (toProfile, updateSummary.changedContacts)
|
||||
case .error(.errorStore(.duplicateName)): return nil;
|
||||
default: throw r.unexpected
|
||||
case .error(.errorStore(.duplicateName)), .error(.error(.userExists)): return nil;
|
||||
default:
|
||||
await MainActor.run {
|
||||
showErrorAlert(r.unexpected, NSLocalizedString("Error saving profile", comment: "alert title"))
|
||||
}
|
||||
throw r.unexpected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user