Fix colors

This commit is contained in:
Isaac
2023-11-23 18:30:02 +04:00
parent b1fba62426
commit f47a710fb9
6 changed files with 113 additions and 198 deletions

View File

@@ -64,11 +64,16 @@ func _internal_updateNameColorAndEmoji(account: Account, nameColor: PeerNameColo
|> switchToLatest
|> castError(UpdateNameColorAndEmojiError.self)
|> mapToSignal { _ -> Signal<Void, UpdateNameColorAndEmojiError> in
let flagsReplies: Int32 = 1 << 0
let flagsProfile: Int32 = (1 << 0) | (1 << 1)
let flagsReplies: Int32 = (1 << 0) | (1 << 2)
var flagsProfile: Int32 = (1 << 0) | (1 << 1)
if profileColor != nil {
flagsProfile |= (1 << 2)
}
return combineLatest(
account.network.request(Api.functions.account.updateColor(flags: flagsReplies, color: nameColor.rawValue, backgroundEmojiId: backgroundEmojiId ?? 0)),
account.network.request(Api.functions.account.updateColor(flags: flagsProfile, color: profileColor?.rawValue ?? 0, backgroundEmojiId: profileBackgroundEmojiId ?? 0))
account.network.request(Api.functions.account.updateColor(flags: flagsProfile, color: profileColor?.rawValue, backgroundEmojiId: profileBackgroundEmojiId ?? 0))
)
|> mapError { _ -> UpdateNameColorAndEmojiError in
return .generic