ios: update contacts on profile update (#2970)

* ios: update contacts on profile update

* change

* remove init

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Stanislav Dmitrenko
2023-08-23 20:43:06 +03:00
committed by GitHub
parent 9639fd26b8
commit 16792de67a
6 changed files with 16 additions and 8 deletions
+3 -3
View File
@@ -691,12 +691,12 @@ func apiListContacts() throws -> [Contact] {
throw r
}
func apiUpdateProfile(profile: Profile) async throws -> Profile? {
func apiUpdateProfile(profile: Profile) async throws -> (Profile, [Contact])? {
let userId = try currentUserId("apiUpdateProfile")
let r = await chatSendCmd(.apiUpdateProfile(userId: userId, profile: profile))
switch r {
case .userProfileNoChange: return nil
case let .userProfileUpdated(_, _, toProfile): return toProfile
case let .userProfileUpdated(_, _, toProfile, updateSummary): return (toProfile, updateSummary.changedContacts)
default: throw r
}
}
@@ -706,7 +706,7 @@ func apiSetProfileAddress(on: Bool) async throws -> User? {
let r = await chatSendCmd(.apiSetProfileAddress(userId: userId, on: on))
switch r {
case .userProfileNoChange: return nil
case let .userProfileUpdated(user, _, _): return user
case let .userProfileUpdated(user, _, _, _): return user
default: throw r
}
}