Update avatar editor emoji categories

This commit is contained in:
Ilya Laktyushin 2023-01-29 17:26:37 +04:00
parent 5800d72d2e
commit 8748ca5706
4 changed files with 17 additions and 4 deletions

View File

@ -8724,6 +8724,7 @@ Sorry for the inconvenience.";
"AvatarEditor.SetGroupPhoto" = "Set as Group Photo";
"AvatarEditor.SetChannelPhoto" = "Set as Channel Photo";
"AvatarEditor.Set" = "Set";
"AvatarEditor.Suggest" = "Suggest";
"Premium.UpgradeDescription" = "Your current **Telegram Premium** plan can be upgraded at a **discount**.";
"Premium.CurrentPlan" = "your current plan";

View File

@ -7,6 +7,7 @@ public final class EmojiSearchCategories: Equatable, Codable {
public enum Kind: Int64 {
case emoji = 0
case status = 1
case avatar = 2
}
public struct Group: Codable, Equatable {
@ -122,6 +123,11 @@ func managedSynchronizeEmojiSearchCategories(postbox: Postbox, network: Network,
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
return .single(.emojiGroupsNotModified)
}
case .avatar:
signal = network.request(Api.functions.messages.getEmojiProfilePhotoGroups(hash: current?.hash ?? 0))
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
return .single(.emojiGroupsNotModified)
}
}
return signal

View File

@ -867,7 +867,7 @@ final class AvatarEditorScreenComponent: Component {
let navigationDoneButtonSize = self.navigationDoneButton.update(
transition: transition,
component: AnyComponent(Button(
content: AnyComponent(Text(text: strings.AvatarEditor_Set, font: Font.semibold(17.0), color: state.expanded && !backgroundIsBright ? .white : environment.theme.rootController.navigationBar.accentTextColor)),
content: AnyComponent(Text(text: component.peerType == .suggest ? strings.AvatarEditor_Suggest : strings.AvatarEditor_Set, font: Font.semibold(17.0), color: state.expanded && !backgroundIsBright ? .white : environment.theme.rootController.navigationBar.accentTextColor)),
action: { [weak self] in
guard let self else {
return

View File

@ -6878,10 +6878,12 @@ public final class EmojiPagerContentComponent: Component {
}
let searchCategories: Signal<EmojiSearchCategories?, NoError>
if isEmojiSelection || isReactionSelection || isProfilePhotoEmojiSelection || isGroupPhotoEmojiSelection {
if isEmojiSelection || isReactionSelection {
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .emoji)
} else if isStatusSelection {
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .status)
} else if isProfilePhotoEmojiSelection || isGroupPhotoEmojiSelection {
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .avatar)
} else {
searchCategories = .single(nil)
}
@ -7802,8 +7804,12 @@ public final class EmojiPagerContentComponent: Component {
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
let searchCategories: Signal<EmojiSearchCategories?, NoError> = context.engine.stickers.emojiSearchCategories(kind: .emoji)
let searchCategories: Signal<EmojiSearchCategories?, NoError>
if isProfilePhotoEmojiSelection || isGroupPhotoEmojiSelection {
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .avatar)
} else {
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .emoji)
}
return combineLatest(
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: stickerOrderedItemListCollectionIds, namespaces: stickerNamespaces, aroundIndex: nil, count: 10000000),
hasPremium(context: context, chatPeerId: chatPeerId, premiumIfSavedMessages: false),