mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
e938cecd37
commit
e2a3decea3
@ -212,6 +212,8 @@ final class ComposePollScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
let usedCustomEmojiFiles: [Int64: TelegramMediaFile] = [:]
|
||||
|
||||
return ComposedPoll(
|
||||
publicity: self.isAnonymous ? .anonymous : .public,
|
||||
kind: mappedKind,
|
||||
@ -226,7 +228,8 @@ final class ComposePollScreenComponent: Component {
|
||||
return TelegramMediaPollResults.Solution(text: mappedSolution, entities: [])
|
||||
}
|
||||
),
|
||||
deadlineTimeout: nil
|
||||
deadlineTimeout: nil,
|
||||
usedCustomEmojiFiles: usedCustomEmojiFiles
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -506,6 +506,7 @@ public final class ComposedPoll {
|
||||
public let correctAnswers: [Data]?
|
||||
public let results: TelegramMediaPollResults
|
||||
public let deadlineTimeout: Int32?
|
||||
public let usedCustomEmojiFiles: [Int64: TelegramMediaFile]
|
||||
|
||||
public init(
|
||||
publicity: TelegramMediaPollPublicity,
|
||||
@ -514,7 +515,8 @@ public final class ComposedPoll {
|
||||
options: [TelegramMediaPollOption],
|
||||
correctAnswers: [Data]?,
|
||||
results: TelegramMediaPollResults,
|
||||
deadlineTimeout: Int32?
|
||||
deadlineTimeout: Int32?,
|
||||
usedCustomEmojiFiles: [Int64: TelegramMediaFile]
|
||||
) {
|
||||
self.publicity = publicity
|
||||
self.kind = kind
|
||||
@ -523,6 +525,7 @@ public final class ComposedPoll {
|
||||
self.correctAnswers = correctAnswers
|
||||
self.results = results
|
||||
self.deadlineTimeout = deadlineTimeout
|
||||
self.usedCustomEmojiFiles = usedCustomEmojiFiles
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,7 +977,8 @@ public func createPollController(context: AccountContext, updatedPresentationDat
|
||||
options: options,
|
||||
correctAnswers: correctAnswers,
|
||||
results: TelegramMediaPollResults(voters: nil, totalVoters: nil, recentVoters: [], solution: resolvedSolution),
|
||||
deadlineTimeout: deadlineTimeout
|
||||
deadlineTimeout: deadlineTimeout,
|
||||
usedCustomEmojiFiles: [:]
|
||||
))
|
||||
})
|
||||
|
||||
|
@ -93,6 +93,8 @@ final class AccountTaskManager {
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .emoji).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .status).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .avatar).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .chatStickers).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .greetingStickers).start())
|
||||
tasks.add(managedSynchronizeAttachMenuBots(accountPeerId: self.accountPeerId, postbox: self.stateManager.postbox, network: self.stateManager.network, force: true).start())
|
||||
tasks.add(managedSynchronizeNotificationSoundList(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
|
||||
tasks.add(managedChatListFilters(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
|
||||
|
@ -8,6 +8,8 @@ public final class EmojiSearchCategories: Equatable, Codable {
|
||||
case emoji = 0
|
||||
case status = 1
|
||||
case avatar = 2
|
||||
case chatStickers = 3
|
||||
case greetingStickers = 4
|
||||
}
|
||||
|
||||
public struct Group: Codable, Equatable {
|
||||
@ -128,6 +130,12 @@ func managedSynchronizeEmojiSearchCategories(postbox: Postbox, network: Network,
|
||||
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
|
||||
return .single(.emojiGroupsNotModified)
|
||||
}
|
||||
//TODO:localize
|
||||
case .chatStickers, .greetingStickers:
|
||||
signal = network.request(Api.functions.messages.getEmojiGroups(hash: current?.hash ?? 0))
|
||||
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
|
||||
return .single(.emojiGroupsNotModified)
|
||||
}
|
||||
}
|
||||
|
||||
return signal
|
||||
|
@ -966,7 +966,7 @@ private final class AdminUserActionsSheetComponent: Component {
|
||||
component: AnyComponent(PlainButtonComponent(
|
||||
content: AnyComponent(OptionsSectionFooterComponent(
|
||||
theme: environment.theme,
|
||||
text: self.isConfigurationExpanded ? partiallyRestrictTitle : fullyBanTitle,
|
||||
text: self.isConfigurationExpanded ? fullyBanTitle : partiallyRestrictTitle,
|
||||
fontSize: presentationData.listsFontSize.itemListBaseHeaderFontSize,
|
||||
isExpanded: self.isConfigurationExpanded
|
||||
)),
|
||||
|
@ -1542,8 +1542,7 @@ public final class AvatarEditorScreen: ViewControllerComponentContainer {
|
||||
hasTrending: false,
|
||||
forceHasPremium: true,
|
||||
searchIsPlaceholderOnly: false,
|
||||
isProfilePhotoEmojiSelection: !isGroup,
|
||||
isGroupPhotoEmojiSelection: isGroup
|
||||
subject: isGroup ? .groupPhotoEmojiSelection : .profilePhotoEmojiSelection
|
||||
)
|
||||
|
||||
let signal = combineLatest(queue: .mainQueue(),
|
||||
|
@ -197,7 +197,20 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
|
||||
let stickerItems: Signal<EmojiPagerContentComponent?, NoError>
|
||||
if hasStickers {
|
||||
stickerItems = EmojiPagerContentComponent.stickerInputData(context: context, animationCache: animationCache, animationRenderer: animationRenderer, stickerNamespaces: stickerNamespaces, stickerOrderedItemListCollectionIds: stickerOrderedItemListCollectionIds, chatPeerId: chatPeerId, hasSearch: hasSearch, hasTrending: hasTrending, forceHasPremium: false, hasEdit: hasEdit, hideBackground: hideBackground)
|
||||
stickerItems = EmojiPagerContentComponent.stickerInputData(
|
||||
context: context,
|
||||
animationCache: animationCache,
|
||||
animationRenderer: animationRenderer,
|
||||
stickerNamespaces: stickerNamespaces,
|
||||
stickerOrderedItemListCollectionIds: stickerOrderedItemListCollectionIds,
|
||||
chatPeerId: chatPeerId,
|
||||
hasSearch: hasSearch,
|
||||
hasTrending: hasTrending,
|
||||
forceHasPremium: false,
|
||||
hasEdit: hasEdit,
|
||||
subject: .chatStickers,
|
||||
hideBackground: hideBackground
|
||||
)
|
||||
|> map(Optional.init)
|
||||
} else {
|
||||
stickerItems = .single(nil)
|
||||
|
@ -1589,6 +1589,13 @@ public extension EmojiPagerContentComponent {
|
||||
return emojiItems
|
||||
}
|
||||
|
||||
enum StickersSubject {
|
||||
case profilePhotoEmojiSelection
|
||||
case groupPhotoEmojiSelection
|
||||
case chatStickers
|
||||
case greetingStickers
|
||||
}
|
||||
|
||||
static func stickerInputData(
|
||||
context: AccountContext,
|
||||
animationCache: AnimationCache,
|
||||
@ -1601,8 +1608,7 @@ public extension EmojiPagerContentComponent {
|
||||
forceHasPremium: Bool,
|
||||
hasEdit: Bool = false,
|
||||
searchIsPlaceholderOnly: Bool = true,
|
||||
isProfilePhotoEmojiSelection: Bool = false,
|
||||
isGroupPhotoEmojiSelection: Bool = false,
|
||||
subject: StickersSubject = .chatStickers,
|
||||
hideBackground: Bool = false
|
||||
) -> Signal<EmojiPagerContentComponent, NoError> {
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||
@ -1652,12 +1658,17 @@ public extension EmojiPagerContentComponent {
|
||||
|
||||
let strings = context.sharedContext.currentPresentationData.with({ $0 }).strings
|
||||
|
||||
//TODO:localize
|
||||
let searchCategories: Signal<EmojiSearchCategories?, NoError>
|
||||
if isProfilePhotoEmojiSelection || isGroupPhotoEmojiSelection {
|
||||
switch subject {
|
||||
case .groupPhotoEmojiSelection, .profilePhotoEmojiSelection:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .avatar)
|
||||
} else {
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .emoji)
|
||||
case .chatStickers:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .chatStickers)
|
||||
case .greetingStickers:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .greetingStickers)
|
||||
}
|
||||
|
||||
return combineLatest(
|
||||
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: stickerOrderedItemListCollectionIds, namespaces: stickerNamespaces, aroundIndex: nil, count: 10000000),
|
||||
hasPremium(context: context, chatPeerId: chatPeerId, premiumIfSavedMessages: false),
|
||||
@ -2091,6 +2102,14 @@ public extension EmojiPagerContentComponent {
|
||||
)
|
||||
}
|
||||
|
||||
let warpContentsOnEdges: Bool
|
||||
switch subject {
|
||||
case .profilePhotoEmojiSelection, .groupPhotoEmojiSelection:
|
||||
warpContentsOnEdges = true
|
||||
default:
|
||||
warpContentsOnEdges = false
|
||||
}
|
||||
|
||||
return EmojiPagerContentComponent(
|
||||
id: isMasks ? "masks" : "stickers",
|
||||
context: context,
|
||||
@ -2103,7 +2122,7 @@ public extension EmojiPagerContentComponent {
|
||||
itemLayoutType: .detailed,
|
||||
itemContentUniqueId: nil,
|
||||
searchState: .empty(hasResults: false),
|
||||
warpContentsOnEdges: isProfilePhotoEmojiSelection || isGroupPhotoEmojiSelection,
|
||||
warpContentsOnEdges: warpContentsOnEdges,
|
||||
hideBackground: hideBackground,
|
||||
displaySearchWithPlaceholder: hasSearch ? strings.StickersSearch_SearchStickersPlaceholder : nil,
|
||||
searchCategories: searchCategories,
|
||||
|
@ -229,7 +229,8 @@ final class BusinessIntroSetupScreenComponent: Component {
|
||||
hasSearch: true,
|
||||
hasTrending: false,
|
||||
forceHasPremium: true,
|
||||
searchIsPlaceholderOnly: false
|
||||
searchIsPlaceholderOnly: false,
|
||||
subject: .greetingStickers
|
||||
)
|
||||
self.stickerContentDisposable = (stickerContent
|
||||
|> deliverOnMainQueue).start(next: { [weak self] stickerContent in
|
||||
|
@ -14,6 +14,7 @@ import TelegramStringFormatting
|
||||
import StorageUsageScreen
|
||||
import SettingsUI
|
||||
import DeleteChatPeerActionSheetItem
|
||||
import OverlayStatusController
|
||||
|
||||
fileprivate struct InitialBannedRights {
|
||||
var value: TelegramChatBannedRights?
|
||||
@ -131,9 +132,40 @@ extension ChatControllerImpl {
|
||||
return
|
||||
}
|
||||
|
||||
self.navigationActionDisposable.set((combineLatest(authors.map { author in
|
||||
var signal = combineLatest(authors.map { author in
|
||||
self.context.engine.peers.fetchChannelParticipant(peerId: peerId, participantId: author.id)
|
||||
})
|
||||
let disposables = MetaDisposable()
|
||||
self.navigationActionDisposable.set(disposables)
|
||||
|
||||
var cancelImpl: (() -> Void)?
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let progressSignal = Signal<Never, NoError> { [weak self] subscriber in
|
||||
let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: {
|
||||
cancelImpl?()
|
||||
}))
|
||||
self?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
return ActionDisposable { [weak controller] in
|
||||
Queue.mainQueue().async() {
|
||||
controller?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|> runOn(Queue.mainQueue())
|
||||
|> delay(0.3, queue: Queue.mainQueue())
|
||||
let progressDisposable = progressSignal.startStrict()
|
||||
|
||||
signal = signal
|
||||
|> afterDisposed {
|
||||
Queue.mainQueue().async {
|
||||
progressDisposable.dispose()
|
||||
}
|
||||
}
|
||||
cancelImpl = {
|
||||
disposables.set(nil)
|
||||
}
|
||||
|
||||
disposables.set((signal
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] participants in
|
||||
guard let self else {
|
||||
return
|
||||
@ -190,52 +222,88 @@ extension ChatControllerImpl {
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
self.navigationActionDisposable.set((self.context.engine.peers.fetchChannelParticipant(peerId: peerId, participantId: author.id)
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] participant in
|
||||
if let strongSelf = self {
|
||||
if "".isEmpty {
|
||||
guard let participant else {
|
||||
var signal = self.context.engine.peers.fetchChannelParticipant(peerId: peerId, participantId: author.id)
|
||||
let disposables = MetaDisposable()
|
||||
self.navigationActionDisposable.set(disposables)
|
||||
|
||||
var cancelImpl: (() -> Void)?
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let progressSignal = Signal<Never, NoError> { [weak self] subscriber in
|
||||
let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: {
|
||||
cancelImpl?()
|
||||
}))
|
||||
self?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
return ActionDisposable { [weak controller] in
|
||||
Queue.mainQueue().async() {
|
||||
controller?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|> runOn(Queue.mainQueue())
|
||||
|> delay(0.3, queue: Queue.mainQueue())
|
||||
let progressDisposable = progressSignal.startStrict()
|
||||
|
||||
signal = signal
|
||||
|> afterDisposed {
|
||||
Queue.mainQueue().async {
|
||||
progressDisposable.dispose()
|
||||
}
|
||||
}
|
||||
cancelImpl = {
|
||||
disposables.set(nil)
|
||||
}
|
||||
|
||||
disposables.set((signal
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] participant in
|
||||
guard let self, let participant else {
|
||||
return
|
||||
}
|
||||
let _ = (self.context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId),
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: author.id)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] chatPeer, authorPeer in
|
||||
guard let self, let chatPeer else {
|
||||
return
|
||||
}
|
||||
guard let authorPeer else {
|
||||
return
|
||||
}
|
||||
var initialUserBannedRights: [EnginePeer.Id: InitialBannedRights] = [:]
|
||||
switch participant {
|
||||
case .creator:
|
||||
break
|
||||
case let .member(_, _, _, banInfo, _):
|
||||
if let banInfo {
|
||||
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: banInfo.rights)
|
||||
} else {
|
||||
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: nil)
|
||||
}
|
||||
}
|
||||
self.push(AdminUserActionsSheet(
|
||||
context: self.context,
|
||||
chatPeer: chatPeer,
|
||||
peers: [RenderedChannelParticipant(
|
||||
participant: participant,
|
||||
peer: authorPeer._asPeer()
|
||||
)],
|
||||
messageCount: messageIds.count,
|
||||
completion: { [weak self] result in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId),
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: author.id)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { chatPeer, authorPeer in
|
||||
guard let self, let chatPeer else {
|
||||
return
|
||||
}
|
||||
guard let authorPeer else {
|
||||
return
|
||||
}
|
||||
var initialUserBannedRights: [EnginePeer.Id: InitialBannedRights] = [:]
|
||||
switch participant {
|
||||
case .creator:
|
||||
break
|
||||
case let .member(_, _, _, banInfo, _):
|
||||
if let banInfo {
|
||||
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: banInfo.rights)
|
||||
} else {
|
||||
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: nil)
|
||||
}
|
||||
}
|
||||
self.push(AdminUserActionsSheet(
|
||||
context: self.context,
|
||||
chatPeer: chatPeer,
|
||||
peers: [RenderedChannelParticipant(
|
||||
participant: participant,
|
||||
peer: authorPeer._asPeer()
|
||||
)],
|
||||
messageCount: messageIds.count,
|
||||
completion: { [weak self] result in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.applyAdminUserActionsResult(messageIds: messageIds, result: result, initialUserBannedRights: initialUserBannedRights)
|
||||
}
|
||||
))
|
||||
})
|
||||
self.applyAdminUserActionsResult(messageIds: messageIds, result: result, initialUserBannedRights: initialUserBannedRights)
|
||||
}
|
||||
))
|
||||
})
|
||||
}))
|
||||
|
||||
/*do {
|
||||
self.navigationActionDisposable.set((self.context.engine.peers.fetchChannelParticipant(peerId: peerId, participantId: author.id)
|
||||
|> deliverOnMainQueue).startStrict(next: {
|
||||
if let strongSelf = self {
|
||||
if "".isEmpty {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -310,7 +378,7 @@ extension ChatControllerImpl {
|
||||
strongSelf.present(actionSheet, in: .window(.root))
|
||||
}
|
||||
}))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
func presentDeleteMessageOptions(messageIds: Set<MessageId>, options: ChatAvailableMessageActionOptions, contextController: ContextControllerProtocol?, completion: @escaping (ContextMenuActionResult) -> Void) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user