no message

This commit is contained in:
overtake
2018-09-17 19:05:02 +01:00
parent e2fc5ace75
commit c2ec64d813
2 changed files with 21 additions and 19 deletions

View File

@@ -1733,11 +1733,14 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
} }
} }
}) })
secondaryRightNavigationButton = ItemListNavigationButton(content: .icon(.search), style: .regular, enabled: true, action: { if peer is TelegramChannel {
updateState { state in secondaryRightNavigationButton = ItemListNavigationButton(content: .icon(.search), style: .regular, enabled: true, action: {
return state.withUpdatedSearchingMembers(true) updateState { state in
} return state.withUpdatedSearchingMembers(true)
}) }
})
}
} }
var searchItem: ItemListControllerSearch? var searchItem: ItemListControllerSearch?

View File

@@ -9,14 +9,14 @@ private final class InstalledStickerPacksControllerArguments {
let openStickerPack: (StickerPackCollectionInfo) -> Void let openStickerPack: (StickerPackCollectionInfo) -> Void
let setPackIdWithRevealedOptions: (ItemCollectionId?, ItemCollectionId?) -> Void let setPackIdWithRevealedOptions: (ItemCollectionId?, ItemCollectionId?) -> Void
let removePack: (ItemCollectionId) -> Void let removePack: (ArchivedStickerPackItem) -> Void
let openStickersBot: () -> Void let openStickersBot: () -> Void
let openMasks: () -> Void let openMasks: () -> Void
let openFeatured: () -> Void let openFeatured: () -> Void
let openArchived: ([ArchivedStickerPackItem]?) -> Void let openArchived: ([ArchivedStickerPackItem]?) -> Void
let openSuggestOptions: () -> Void let openSuggestOptions: () -> Void
init(account: Account, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, removePack: @escaping (ItemCollectionId) -> Void, openStickersBot: @escaping () -> Void, openMasks: @escaping () -> Void, openFeatured: @escaping () -> Void, openArchived: @escaping ([ArchivedStickerPackItem]?) -> Void, openSuggestOptions: @escaping () -> Void) { init(account: Account, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, removePack: @escaping (ArchivedStickerPackItem) -> Void, openStickersBot: @escaping () -> Void, openMasks: @escaping () -> Void, openFeatured: @escaping () -> Void, openArchived: @escaping ([ArchivedStickerPackItem]?) -> Void, openSuggestOptions: @escaping () -> Void) {
self.account = account self.account = account
self.openStickerPack = openStickerPack self.openStickerPack = openStickerPack
self.setPackIdWithRevealedOptions = setPackIdWithRevealedOptions self.setPackIdWithRevealedOptions = setPackIdWithRevealedOptions
@@ -256,7 +256,7 @@ private enum InstalledStickerPacksEntry: ItemListNodeEntry {
arguments.setPackIdWithRevealedOptions(current, previous) arguments.setPackIdWithRevealedOptions(current, previous)
}, addPack: { }, addPack: {
}, removePack: { }, removePack: {
arguments.removePack(info.id) arguments.removePack(ArchivedStickerPackItem(info: info, topItems: topItem != nil ? [topItem!] : []))
}) })
case let .packsInfo(theme, text): case let .packsInfo(theme, text):
return ItemListTextItem(theme: theme, text: .markdown(text), sectionId: self.section, linkAction: { _ in return ItemListTextItem(theme: theme, text: .markdown(text), sectionId: self.section, linkAction: { _ in
@@ -411,7 +411,7 @@ public func installedStickerPacksController(account: Account, mode: InstalledSti
return state return state
} }
} }
}, removePack: { id in }, removePack: { archivedItem in
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
let controller = ActionSheetController(presentationTheme: presentationData.theme) let controller = ActionSheetController(presentationTheme: presentationData.theme)
let dismissAction: () -> Void = { [weak controller] in let dismissAction: () -> Void = { [weak controller] in
@@ -422,23 +422,22 @@ public func installedStickerPacksController(account: Account, mode: InstalledSti
ActionSheetTextItem(title: presentationData.strings.StickerSettings_ContextInfo), ActionSheetTextItem(title: presentationData.strings.StickerSettings_ContextInfo),
ActionSheetButtonItem(title: presentationData.strings.StickerSettings_ContextHide, color: .accent, action: { ActionSheetButtonItem(title: presentationData.strings.StickerSettings_ContextHide, color: .accent, action: {
dismissAction() dismissAction()
archivedPromise.set(archivedStickerPacks(account: account) |> map {Optional($0)} |> afterNext { packs in
let archivedSignal = archivedPromise.get() |> take(1) |> map { packs -> [ArchivedStickerPackItem]? in
return (packs ?? []) + [archivedItem]
}
_ = archivedSignal.start(next: { packs in
archivedPromise.set(.single(packs))
updatedPacks(packs) updatedPacks(packs)
}) })
// let archivedSignal = archivedPromise.get() |> take(1) |> map { packs -> [ArchivedStickerPackItem]? in //
// return packs?.filter({$0.info.id != id}) let _ = removeStickerPackInteractively(postbox: account.postbox, id: archivedItem.info.id, option: .archive)
// }
// _ = archivedSignal.start(next: { packs in
// archivedPromise.set(.single(packs))
// updatedPacks(packs)
// })
let _ = removeStickerPackInteractively(postbox: account.postbox, id: id, option: .archive).start()
}), }),
ActionSheetButtonItem(title: presentationData.strings.Common_Delete, color: .destructive, action: { ActionSheetButtonItem(title: presentationData.strings.Common_Delete, color: .destructive, action: {
dismissAction() dismissAction()
let _ = removeStickerPackInteractively(postbox: account.postbox, id: id, option: .delete).start() let _ = removeStickerPackInteractively(postbox: account.postbox, id: archivedItem.info.id, option: .delete).start()
}) })
]), ]),
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })]) ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])