mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Various fixes
This commit is contained in:
parent
c6a3e1a932
commit
8985192fa1
@ -8510,6 +8510,9 @@ Sorry for the inconvenience.";
|
||||
"Privacy.ProfilePhoto.PublicPhotoSuccess" = "This photo is now set for those who are restricted from viewing your main photo.";
|
||||
"Privacy.ProfilePhoto.PublicVideoSuccess" = "This video is now set for those who are restricted from viewing your main photo.";
|
||||
|
||||
"Privacy.ProfilePhoto.CustomOverrideInfo" = "You can add users or entire groups which will not see your profile photo.";
|
||||
"Privacy.ProfilePhoto.CustomOverrideAddInfo" = "Add users or entire groups which will still see your profile photo.";
|
||||
|
||||
"WebApp.AddToAttachmentAllowMessages" = "Allow **%@** to send me messages";
|
||||
|
||||
"Common.Paste" = "Paste";
|
||||
|
@ -12,6 +12,7 @@ swift_library(
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/ComponentFlow:ComponentFlow",
|
||||
"//submodules/DirectionalPanGesture:DirectionalPanGesture",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -2,6 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import ComponentFlow
|
||||
import DirectionalPanGesture
|
||||
|
||||
public protocol PagerExpandableScrollView: UIScrollView {
|
||||
}
|
||||
@ -274,7 +275,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
}
|
||||
}
|
||||
|
||||
private final class PagerPanGestureRecognizerImpl: UIPanGestureRecognizer, PagerPanGestureRecognizer {
|
||||
private final class PagerPanGestureRecognizerImpl: DirectionalPanGestureRecognizer, PagerPanGestureRecognizer {
|
||||
}
|
||||
|
||||
private struct PaneTransitionGestureState {
|
||||
@ -311,6 +312,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
self.disablesInteractiveTransitionGestureRecognizer = true
|
||||
|
||||
let panRecognizer = PagerPanGestureRecognizerImpl(target: self, action: #selector(self.panGesture(_:)))
|
||||
panRecognizer.direction = .horizontal
|
||||
self.panRecognizer = panRecognizer
|
||||
self.addGestureRecognizer(panRecognizer)
|
||||
}
|
||||
@ -681,7 +683,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
} else {
|
||||
wasAdded = true
|
||||
contentView = ContentView(view: ComponentHostView<(ChildEnvironmentType, PagerComponentChildEnvironment)>())
|
||||
contentTransition = .immediate
|
||||
contentTransition = transition.withAnimation(.none)
|
||||
self.contentViews[content.id] = contentView
|
||||
if let contentBackgroundView = self.contentBackgroundView {
|
||||
self.insertSubview(contentView.view, aboveSubview: contentBackgroundView)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
public class DirectionalPanGestureRecognizer: UIPanGestureRecognizer {
|
||||
open class DirectionalPanGestureRecognizer: UIPanGestureRecognizer {
|
||||
public enum Direction {
|
||||
case horizontal
|
||||
case vertical
|
||||
|
@ -90,6 +90,7 @@ swift_library(
|
||||
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
||||
"//submodules/TelegramUI/Components/ChatEntityKeyboardInputNode:ChatEntityKeyboardInputNode",
|
||||
"//submodules/FeaturedStickersScreen:FeaturedStickersScreen",
|
||||
"//submodules/TelegramNotices:TelegramNotices",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -12,6 +12,7 @@ import ViewControllerComponent
|
||||
import EntityKeyboard
|
||||
import PagerComponent
|
||||
import FeaturedStickersScreen
|
||||
import TelegramNotices
|
||||
|
||||
struct InputData: Equatable {
|
||||
var emoji: EmojiPagerContentComponent
|
||||
@ -127,7 +128,7 @@ private final class StickerSelectionComponent: Component {
|
||||
let topPanelHeight: CGFloat = 42.0
|
||||
|
||||
let keyboardSize = self.keyboardView.update(
|
||||
transition: transition,//.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
||||
transition: transition.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
||||
component: AnyComponent(EntityKeyboardComponent(
|
||||
theme: component.theme,
|
||||
strings: component.strings,
|
||||
@ -214,7 +215,7 @@ public class StickerPickerScreen: ViewController {
|
||||
|
||||
private(set) var isExpanded = false
|
||||
private var panGestureRecognizer: UIPanGestureRecognizer?
|
||||
private var panGestureArguments: (topInset: CGFloat, offset: CGFloat, scrollView: UIScrollView?, listNode: ListView?)?
|
||||
private var panGestureArguments: (topInset: CGFloat, offset: CGFloat, scrollView: UIScrollView?)?
|
||||
|
||||
private var currentIsVisible: Bool = false
|
||||
private var currentLayout: (layout: ContainerViewLayout, navigationHeight: CGFloat)?
|
||||
@ -316,8 +317,7 @@ public class StickerPickerScreen: ViewController {
|
||||
},
|
||||
deleteBackwards: nil,
|
||||
openStickerSettings: nil,
|
||||
openFeatured: {
|
||||
},
|
||||
openFeatured: nil,
|
||||
openSearch: {},
|
||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
||||
@ -370,7 +370,7 @@ public class StickerPickerScreen: ViewController {
|
||||
return
|
||||
}
|
||||
if groupId == AnyHashable("popular") {
|
||||
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
|
||||
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
|
||||
var items: [ActionSheetItem] = []
|
||||
let context = controller.context
|
||||
@ -418,8 +418,7 @@ public class StickerPickerScreen: ViewController {
|
||||
},
|
||||
deleteBackwards: nil,
|
||||
openStickerSettings: nil,
|
||||
openFeatured: {
|
||||
},
|
||||
openFeatured: nil,
|
||||
openSearch: {},
|
||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
||||
@ -430,7 +429,6 @@ public class StickerPickerScreen: ViewController {
|
||||
if isPremiumLocked {
|
||||
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
||||
// controllerInteraction.navigationController()?.pushViewController(controller)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -467,32 +465,7 @@ public class StickerPickerScreen: ViewController {
|
||||
}
|
||||
})
|
||||
},
|
||||
clearGroup: { [weak self] groupId in
|
||||
guard let strongSelf = self, let controller = strongSelf.controller else {
|
||||
return
|
||||
}
|
||||
if groupId == AnyHashable("popular") {
|
||||
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
|
||||
var items: [ActionSheetItem] = []
|
||||
let context = controller.context
|
||||
items.append(ActionSheetTextItem(title: presentationData.strings.Chat_ClearReactionsAlertText, parseMarkdown: true))
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.Chat_ClearReactionsAlertAction, color: .destructive, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.scheduledEmojiContentAnimationHint = EmojiPagerContentComponent.ContentAnimation(type: .groupRemoved(id: "popular"))
|
||||
let _ = context.engine.stickers.clearRecentlyUsedReactions().start()
|
||||
}))
|
||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
})
|
||||
])])
|
||||
context.sharedContext.mainWindow?.presentInGlobalOverlay(actionSheet)
|
||||
}
|
||||
clearGroup: { _ in
|
||||
},
|
||||
pushController: { c in },
|
||||
presentController: { c in },
|
||||
@ -520,24 +493,7 @@ public class StickerPickerScreen: ViewController {
|
||||
},
|
||||
deleteBackwards: nil,
|
||||
openStickerSettings: nil,
|
||||
openFeatured: { [weak self] in
|
||||
guard let strongSelf = self, let controller = strongSelf.controller else {
|
||||
return
|
||||
}
|
||||
strongSelf.controller?.push(
|
||||
FeaturedStickersScreen(
|
||||
context: controller.context,
|
||||
highlightedPackId: nil,
|
||||
sendSticker: { _, _, _ in
|
||||
// guard let controllerInteraction = controllerInteraction else {
|
||||
// return false
|
||||
// }
|
||||
return false
|
||||
// return controllerInteraction.sendSticker(fileReference, false, false, nil, false, sourceNode, sourceRect, nil, [])
|
||||
}
|
||||
)
|
||||
)
|
||||
},
|
||||
openFeatured: nil,
|
||||
openSearch: {},
|
||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
||||
@ -548,7 +504,6 @@ public class StickerPickerScreen: ViewController {
|
||||
if isPremiumLocked {
|
||||
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
||||
// controllerInteraction.navigationController()?.pushViewController(controller)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -589,20 +544,14 @@ public class StickerPickerScreen: ViewController {
|
||||
guard let strongSelf = self, let controller = strongSelf.controller else {
|
||||
return
|
||||
}
|
||||
if groupId == AnyHashable("popular") {
|
||||
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let context = controller.context
|
||||
if groupId == AnyHashable("recent") {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
|
||||
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
|
||||
var items: [ActionSheetItem] = []
|
||||
let context = controller.context
|
||||
items.append(ActionSheetTextItem(title: presentationData.strings.Chat_ClearReactionsAlertText, parseMarkdown: true))
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.Chat_ClearReactionsAlertAction, color: .destructive, action: { [weak actionSheet] in
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.Stickers_ClearRecent, color: .destructive, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.scheduledEmojiContentAnimationHint = EmojiPagerContentComponent.ContentAnimation(type: .groupRemoved(id: "popular"))
|
||||
let _ = context.engine.stickers.clearRecentlyUsedReactions().start()
|
||||
let _ = context.engine.stickers.clearRecentlyUsedStickers().start()
|
||||
}))
|
||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
||||
@ -610,6 +559,21 @@ public class StickerPickerScreen: ViewController {
|
||||
})
|
||||
])])
|
||||
context.sharedContext.mainWindow?.presentInGlobalOverlay(actionSheet)
|
||||
} else if groupId == AnyHashable("featuredTop") {
|
||||
let viewKey = PostboxViewKey.orderedItemList(id: Namespaces.OrderedItemList.CloudFeaturedStickerPacks)
|
||||
let _ = (context.account.postbox.combinedView(keys: [viewKey])
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { views in
|
||||
guard let view = views.views[viewKey] as? OrderedItemListView else {
|
||||
return
|
||||
}
|
||||
var stickerPackIds: [Int64] = []
|
||||
for featuredStickerPack in view.items.lazy.map({ $0.contents.get(FeaturedStickerPackItem.self)! }) {
|
||||
stickerPackIds.append(featuredStickerPack.info.id.id)
|
||||
}
|
||||
let _ = ApplicationSpecificNotice.setDismissedTrendingStickerPacks(accountManager: context.sharedContext.accountManager, values: stickerPackIds).start()
|
||||
})
|
||||
} else if groupId == AnyHashable("peerSpecific") {
|
||||
}
|
||||
},
|
||||
pushController: { c in },
|
||||
@ -671,6 +635,9 @@ public class StickerPickerScreen: ViewController {
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if gestureRecognizer is UIPanGestureRecognizer && otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
if otherGestureRecognizer is PagerPanGestureRecognizer {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -719,7 +686,7 @@ public class StickerPickerScreen: ViewController {
|
||||
let isLandscape = layout.orientation == .landscape
|
||||
let edgeTopInset = isLandscape ? 0.0 : self.defaultTopInset
|
||||
let topInset: CGFloat
|
||||
if let (panInitialTopInset, panOffset, _, _) = self.panGestureArguments {
|
||||
if let (panInitialTopInset, panOffset, _) = self.panGestureArguments {
|
||||
if effectiveExpanded {
|
||||
topInset = min(edgeTopInset, panInitialTopInset + max(0.0, panOffset))
|
||||
} else {
|
||||
@ -851,13 +818,10 @@ public class StickerPickerScreen: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private func findScrollView(view: UIView?) -> (UIScrollView, ListView?)? {
|
||||
private func findScrollView(view: UIView?) -> UIScrollView? {
|
||||
if let view = view {
|
||||
if let view = view as? UIScrollView, view.contentSize.width < view.contentSize.height {
|
||||
return (view, nil)
|
||||
}
|
||||
if let node = view.asyncdisplaykit_node as? ListView {
|
||||
return (node.scroller, node)
|
||||
if let view = view as? PagerExpandableScrollView {
|
||||
return view
|
||||
}
|
||||
return findScrollView(view: view.superview)
|
||||
} else {
|
||||
@ -879,11 +843,10 @@ public class StickerPickerScreen: ViewController {
|
||||
let currentHitView = self.hitTest(point, with: nil)
|
||||
|
||||
var scrollViewAndListNode = self.findScrollView(view: currentHitView)
|
||||
if scrollViewAndListNode?.0.frame.height == self.frame.width {
|
||||
if scrollViewAndListNode?.frame.height == self.frame.width {
|
||||
scrollViewAndListNode = nil
|
||||
}
|
||||
let scrollView = scrollViewAndListNode?.0
|
||||
let listNode = scrollViewAndListNode?.1
|
||||
let scrollView = scrollViewAndListNode
|
||||
|
||||
let topInset: CGFloat
|
||||
if self.isExpanded {
|
||||
@ -892,12 +855,11 @@ public class StickerPickerScreen: ViewController {
|
||||
topInset = edgeTopInset
|
||||
}
|
||||
|
||||
self.panGestureArguments = (topInset, 0.0, scrollView, listNode)
|
||||
self.panGestureArguments = (topInset, 0.0, scrollView)
|
||||
case .changed:
|
||||
guard let (topInset, panOffset, scrollView, listNode) = self.panGestureArguments else {
|
||||
guard let (topInset, panOffset, scrollView) = self.panGestureArguments else {
|
||||
return
|
||||
}
|
||||
let visibleContentOffset = listNode?.visibleContentOffset()
|
||||
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
||||
|
||||
var translation = recognizer.translation(in: self.view).y
|
||||
@ -905,12 +867,7 @@ public class StickerPickerScreen: ViewController {
|
||||
var currentOffset = topInset + translation
|
||||
|
||||
let epsilon = 1.0
|
||||
if case let .known(value) = visibleContentOffset, value <= epsilon {
|
||||
if let scrollView = scrollView {
|
||||
scrollView.bounces = false
|
||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: 0.0), animated: false)
|
||||
}
|
||||
} else if let scrollView = scrollView, contentOffset <= -scrollView.contentInset.top + epsilon {
|
||||
if let scrollView = scrollView, contentOffset <= -scrollView.contentInset.top + epsilon {
|
||||
scrollView.bounces = false
|
||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
||||
} else if let scrollView = scrollView {
|
||||
@ -923,7 +880,7 @@ public class StickerPickerScreen: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
self.panGestureArguments = (topInset, translation, scrollView, listNode)
|
||||
self.panGestureArguments = (topInset, translation, scrollView)
|
||||
|
||||
if !self.isExpanded {
|
||||
if currentOffset > 0.0, let scrollView = scrollView {
|
||||
@ -942,23 +899,18 @@ public class StickerPickerScreen: ViewController {
|
||||
|
||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate)
|
||||
case .ended:
|
||||
guard let (currentTopInset, panOffset, scrollView, listNode) = self.panGestureArguments else {
|
||||
guard let (currentTopInset, panOffset, scrollView) = self.panGestureArguments else {
|
||||
return
|
||||
}
|
||||
self.panGestureArguments = nil
|
||||
|
||||
let visibleContentOffset = listNode?.visibleContentOffset()
|
||||
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
||||
|
||||
let translation = recognizer.translation(in: self.view).y
|
||||
var velocity = recognizer.velocity(in: self.view)
|
||||
|
||||
if self.isExpanded {
|
||||
if case let .known(value) = visibleContentOffset, value > 0.1 {
|
||||
velocity = CGPoint()
|
||||
} else if case .unknown = visibleContentOffset {
|
||||
velocity = CGPoint()
|
||||
} else if contentOffset > 0.1 {
|
||||
if contentOffset > 0.1 {
|
||||
velocity = CGPoint()
|
||||
}
|
||||
}
|
||||
@ -984,9 +936,7 @@ public class StickerPickerScreen: ViewController {
|
||||
} else if self.isExpanded {
|
||||
if velocity.y > 300.0 || offset > topInset / 2.0 {
|
||||
self.isExpanded = false
|
||||
if let listNode = listNode {
|
||||
listNode.scroller.setContentOffset(CGPoint(), animated: false)
|
||||
} else if let scrollView = scrollView {
|
||||
if let scrollView = scrollView {
|
||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
||||
}
|
||||
|
||||
@ -1001,21 +951,13 @@ public class StickerPickerScreen: ViewController {
|
||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: Transition(.animated(duration: 0.3, curve: .easeInOut)))
|
||||
}
|
||||
} else if (velocity.y < -300.0 || offset < topInset / 2.0) {
|
||||
if velocity.y > -2200.0 && velocity.y < -300.0, let listNode = listNode {
|
||||
DispatchQueue.main.async {
|
||||
listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous, .LowLatency], scrollToItem: ListViewScrollToItem(index: 0, position: .top(0.0), animated: true, curve: .Default(duration: nil), directionHint: .Up), updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
}
|
||||
}
|
||||
|
||||
let initialVelocity: CGFloat = offset.isZero ? 0.0 : abs(velocity.y / offset)
|
||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.45, curve: .customSpring(damping: 124.0, initialVelocity: initialVelocity))
|
||||
self.isExpanded = true
|
||||
|
||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: Transition(transition))
|
||||
} else {
|
||||
if let listNode = listNode {
|
||||
listNode.scroller.setContentOffset(CGPoint(), animated: false)
|
||||
} else if let scrollView = scrollView {
|
||||
if let scrollView = scrollView {
|
||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,17 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
|
||||
case .nobody:
|
||||
entries.append(.enableFor(presentationData.theme, enableForText, stringForUserCount(state.enableFor, strings: presentationData.strings)))
|
||||
}
|
||||
entries.append(.peersInfo(presentationData.theme, presentationData.strings.PrivacyLastSeenSettings_CustomShareSettingsHelp))
|
||||
let exceptionsInfo: String
|
||||
if case .profilePhoto = kind {
|
||||
if case .nobody = state.setting {
|
||||
exceptionsInfo = presentationData.strings.Privacy_ProfilePhoto_CustomOverrideAddInfo
|
||||
} else {
|
||||
exceptionsInfo = presentationData.strings.Privacy_ProfilePhoto_CustomOverrideInfo
|
||||
}
|
||||
} else {
|
||||
exceptionsInfo = presentationData.strings.PrivacyLastSeenSettings_CustomShareSettingsHelp
|
||||
}
|
||||
entries.append(.peersInfo(presentationData.theme, exceptionsInfo))
|
||||
|
||||
if case .voiceCalls = kind, let p2pMode = state.callP2PMode, let integrationAvailable = state.callIntegrationAvailable, let integrationEnabled = state.callIntegrationEnabled {
|
||||
entries.append(.callsP2PHeader(presentationData.theme, presentationData.strings.Privacy_Calls_P2P.uppercased()))
|
||||
@ -945,43 +955,6 @@ func selectivePrivacySettingsController(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// let controller = selectivePrivacyPeersController(context: context, title: title, initialPeers: updatedPeerIds, updated: { updatedPeerIds in
|
||||
// updateState { state in
|
||||
// if enable {
|
||||
// switch target {
|
||||
// case .main:
|
||||
// var disableFor = state.disableFor
|
||||
// for (key, _) in updatedPeerIds {
|
||||
// disableFor.removeValue(forKey: key)
|
||||
// }
|
||||
// return state.withUpdatedEnableFor(updatedPeerIds).withUpdatedDisableFor(disableFor)
|
||||
// case .callP2P:
|
||||
// var callP2PDisableFor = state.callP2PDisableFor ?? [:]
|
||||
// for (key, _) in updatedPeerIds {
|
||||
// callP2PDisableFor.removeValue(forKey: key)
|
||||
// }
|
||||
// return state.withUpdatedCallP2PEnableFor(updatedPeerIds).withUpdatedCallP2PDisableFor(callP2PDisableFor)
|
||||
// }
|
||||
// } else {
|
||||
// switch target {
|
||||
// case .main:
|
||||
// var enableFor = state.enableFor
|
||||
// for (key, _) in updatedPeerIds {
|
||||
// enableFor.removeValue(forKey: key)
|
||||
// }
|
||||
// return state.withUpdatedDisableFor(updatedPeerIds).withUpdatedEnableFor(enableFor)
|
||||
// case .callP2P:
|
||||
// var callP2PEnableFor = state.callP2PEnableFor ?? [:]
|
||||
// for (key, _) in updatedPeerIds {
|
||||
// callP2PEnableFor.removeValue(forKey: key)
|
||||
// }
|
||||
// return state.withUpdatedCallP2PDisableFor(updatedPeerIds).withUpdatedCallP2PEnableFor(callP2PEnableFor)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// pushControllerImpl?(controller, false)
|
||||
})
|
||||
}))
|
||||
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
|
@ -2103,7 +2103,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
public let performItemAction: (AnyHashable, Item, UIView, CGRect, CALayer, Bool) -> Void
|
||||
public let deleteBackwards: (() -> Void)?
|
||||
public let openStickerSettings: (() -> Void)?
|
||||
public let openFeatured: () -> Void
|
||||
public let openFeatured: (() -> Void)?
|
||||
public let openSearch: () -> Void
|
||||
public let addGroupAction: (AnyHashable, Bool) -> Void
|
||||
public let clearGroup: (AnyHashable) -> Void
|
||||
@ -2124,7 +2124,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
performItemAction: @escaping (AnyHashable, Item, UIView, CGRect, CALayer, Bool) -> Void,
|
||||
deleteBackwards: (() -> Void)?,
|
||||
openStickerSettings: (() -> Void)?,
|
||||
openFeatured: @escaping () -> Void,
|
||||
openFeatured: (() -> Void)?,
|
||||
openSearch: @escaping () -> Void,
|
||||
addGroupAction: @escaping (AnyHashable, Bool) -> Void,
|
||||
clearGroup: @escaping (AnyHashable) -> Void,
|
||||
|
@ -451,19 +451,21 @@ public final class EntityKeyboardComponent: Component {
|
||||
if let stickerContent = component.stickerContent {
|
||||
var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = []
|
||||
|
||||
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
id: "featuredTop",
|
||||
isReorderable: false,
|
||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||
icon: .featured,
|
||||
theme: component.theme,
|
||||
useAccentColor: false,
|
||||
title: component.strings.Stickers_Trending,
|
||||
pressed: { [weak self] in
|
||||
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured()
|
||||
}
|
||||
if let _ = stickerContent.inputInteractionHolder.inputInteraction?.openFeatured {
|
||||
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||
id: "featuredTop",
|
||||
isReorderable: false,
|
||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||
icon: .featured,
|
||||
theme: component.theme,
|
||||
useAccentColor: false,
|
||||
title: component.strings.Stickers_Trending,
|
||||
pressed: { [weak self] in
|
||||
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured?()
|
||||
}
|
||||
))
|
||||
))
|
||||
))
|
||||
}
|
||||
|
||||
for itemGroup in stickerContent.itemGroups {
|
||||
if let id = itemGroup.supergroupId.base as? String {
|
||||
@ -761,7 +763,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
)
|
||||
transition.setFrame(view: self.pagerView, frame: CGRect(origin: CGPoint(), size: pagerSize))
|
||||
|
||||
let accountContext = component.emojiContent?.context ?? component.maskContent?.context
|
||||
let accountContext = component.emojiContent?.context ?? component.stickerContent?.context
|
||||
if let searchComponent = self.searchComponent, let accountContext = accountContext {
|
||||
var animateIn = false
|
||||
let searchView: ComponentHostView<EntitySearchContentEnvironment>
|
||||
|
Loading…
x
Reference in New Issue
Block a user