mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Group boosts
This commit is contained in:
@@ -11302,3 +11302,5 @@ Sorry for the inconvenience.";
|
||||
|
||||
"Channel.AdminLog.MessageChangedGroupEmojiPack" = "%@ changed group emoji pack";
|
||||
"Channel.AdminLog.MessageRemovedGroupEmojiPack" = "%@ removed group emoji pack";
|
||||
|
||||
"Group.Appearance.EmojiPackUpdated" = "Group emoji pack updated.";
|
||||
|
||||
@@ -23,6 +23,7 @@ swift_library(
|
||||
"//submodules/SearchBarNode:SearchBarNode",
|
||||
"//submodules/SearchUI:SearchUI",
|
||||
"//submodules/MergeLists:MergeLists",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
||||
@@ -344,6 +344,7 @@ class GroupStickerPackCurrentItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
if case .searching = item.content {
|
||||
strongSelf.activityIndicator.isHidden = false
|
||||
strongSelf.imageNode.isHidden = true
|
||||
} else {
|
||||
strongSelf.activityIndicator.isHidden = true
|
||||
}
|
||||
@@ -351,6 +352,7 @@ class GroupStickerPackCurrentItemNode: ItemListRevealOptionsItemNode {
|
||||
if case .found = item.content {
|
||||
strongSelf.removeButtonIcon.isHidden = false
|
||||
strongSelf.removeButton.isHidden = false
|
||||
strongSelf.imageNode.isHidden = false
|
||||
} else {
|
||||
strongSelf.removeButtonIcon.isHidden = true
|
||||
strongSelf.removeButton.isHidden = true
|
||||
|
||||
@@ -11,6 +11,7 @@ import PresentationDataUtils
|
||||
import AccountContext
|
||||
import StickerPackPreviewUI
|
||||
import ItemListStickerPackItem
|
||||
import UndoUI
|
||||
|
||||
private final class GroupStickerPackSetupControllerArguments {
|
||||
let context: AccountContext
|
||||
@@ -343,6 +344,20 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
initialData.set(.single(.noData))
|
||||
}
|
||||
|
||||
var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)?
|
||||
|
||||
var completionImpl: ((StickerPackCollectionInfo?) -> Void)?
|
||||
if let completion {
|
||||
completionImpl = { value in
|
||||
completion(value)
|
||||
if let _ = value {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let controller = UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: presentationData.strings.Group_Appearance_EmojiPackUpdated, cancel: nil, destructive: false), elevatedLayout: false, action: { _ in return true })
|
||||
presentControllerImpl?(controller, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let stickerPacks = Promise<CombinedView>()
|
||||
stickerPacks.set(context.account.postbox.combinedView(keys: [.itemCollectionInfos(namespaces: [isEmoji ? Namespaces.ItemCollection.CloudEmojiPacks : Namespaces.ItemCollection.CloudStickerPacks])]))
|
||||
|
||||
@@ -353,6 +368,9 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
if searchText.isEmpty {
|
||||
return .single((searchText, .none))
|
||||
} else if case let .data(data) = initialData, searchText.lowercased() == data.info.shortName {
|
||||
Queue.mainQueue().async {
|
||||
completionImpl?(data.info)
|
||||
}
|
||||
return .single((searchText, .found(StickerPackData(info: data.info, item: data.item))))
|
||||
} else {
|
||||
let namespace = isEmoji ? Namespaces.ItemCollection.CloudEmojiPacks : Namespaces.ItemCollection.CloudStickerPacks
|
||||
@@ -378,6 +396,13 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
case let .result(info, items, _):
|
||||
return .single((searchText, .found(StickerPackData(info: info, item: items.first))))
|
||||
}
|
||||
}
|
||||
|> afterNext { value in
|
||||
if case let .found(data) = value.1 {
|
||||
Queue.mainQueue().async {
|
||||
completionImpl?(data.info)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
@@ -385,7 +410,6 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
}
|
||||
})
|
||||
|
||||
var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)?
|
||||
var navigateToChatControllerImpl: ((PeerId) -> Void)?
|
||||
var dismissInputImpl: (() -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
@@ -402,15 +426,13 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
|
||||
let arguments = GroupStickerPackSetupControllerArguments(context: context, selectStickerPack: { info in
|
||||
searchText.set(info.shortName)
|
||||
if let completion {
|
||||
completion(info)
|
||||
}
|
||||
completionImpl?(info)
|
||||
}, openStickerPack: { info in
|
||||
presentStickerPackController?(info)
|
||||
}, updateSearchText: { text in
|
||||
searchText.set(text)
|
||||
if text == "", let completion {
|
||||
completion(nil)
|
||||
if text == "" {
|
||||
completionImpl?(nil)
|
||||
}
|
||||
}, openStickersBot: {
|
||||
resolveDisposable.set((context.engine.peers.resolvePeerByName(name: "stickers")
|
||||
@@ -473,10 +495,6 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
info = data.info
|
||||
}
|
||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: enabled, action: {
|
||||
if let completion {
|
||||
completion(info)
|
||||
dismissImpl?()
|
||||
} else {
|
||||
if info?.id == currentPackInfo?.id {
|
||||
dismissImpl?()
|
||||
} else {
|
||||
@@ -496,7 +514,6 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
dismissImpl?()
|
||||
}))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -537,6 +554,14 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
||||
|
||||
presentControllerImpl = { [weak controller] c, p in
|
||||
if let controller = controller {
|
||||
if c is UndoOverlayController {
|
||||
controller.window?.forEachController { c in
|
||||
if let controller = c as? UndoOverlayController {
|
||||
controller.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
controller.present(c, in: .window(.root), with: p)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +291,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
|
||||
private var paymentDisposable: Disposable?
|
||||
|
||||
private var lastExpansionTimestamp: Double?
|
||||
|
||||
private var didTransitionIn = false
|
||||
private var dismissed = false
|
||||
|
||||
@@ -739,7 +741,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
guard let eventName = body["eventName"] as? String else {
|
||||
return
|
||||
}
|
||||
|
||||
let currentTimestamp = CACurrentMediaTime()
|
||||
let eventData = (body["eventData"] as? String)?.data(using: .utf8)
|
||||
let json = try? JSONSerialization.jsonObject(with: eventData ?? Data(), options: []) as? [String: Any]
|
||||
|
||||
@@ -804,7 +806,12 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
case "web_app_request_theme":
|
||||
self.sendThemeChangedEvent()
|
||||
case "web_app_expand":
|
||||
if let lastExpansionTimestamp = self.lastExpansionTimestamp, currentTimestamp < lastExpansionTimestamp + 1.0 {
|
||||
|
||||
} else {
|
||||
self.lastExpansionTimestamp = currentTimestamp
|
||||
controller.requestAttachmentMenuExpansion()
|
||||
}
|
||||
case "web_app_close":
|
||||
controller.dismiss()
|
||||
case "web_app_open_tg_link":
|
||||
@@ -846,7 +853,6 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
case "web_app_open_link":
|
||||
if let json = json, let url = json["url"] as? String {
|
||||
let tryInstantView = json["try_instant_view"] as? Bool ?? false
|
||||
let currentTimestamp = CACurrentMediaTime()
|
||||
if let lastTouchTimestamp = self.webView?.lastTouchTimestamp, currentTimestamp < lastTouchTimestamp + 10.0 {
|
||||
self.webView?.lastTouchTimestamp = nil
|
||||
if tryInstantView {
|
||||
|
||||
Reference in New Issue
Block a user