mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +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.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.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";
|
"WebApp.AddToAttachmentAllowMessages" = "Allow **%@** to send me messages";
|
||||||
|
|
||||||
"Common.Paste" = "Paste";
|
"Common.Paste" = "Paste";
|
||||||
|
@ -12,6 +12,7 @@ swift_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/ComponentFlow:ComponentFlow",
|
"//submodules/ComponentFlow:ComponentFlow",
|
||||||
|
"//submodules/DirectionalPanGesture:DirectionalPanGesture",
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
@ -2,6 +2,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Display
|
import Display
|
||||||
import ComponentFlow
|
import ComponentFlow
|
||||||
|
import DirectionalPanGesture
|
||||||
|
|
||||||
public protocol PagerExpandableScrollView: UIScrollView {
|
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 {
|
private struct PaneTransitionGestureState {
|
||||||
@ -311,6 +312,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
|||||||
self.disablesInteractiveTransitionGestureRecognizer = true
|
self.disablesInteractiveTransitionGestureRecognizer = true
|
||||||
|
|
||||||
let panRecognizer = PagerPanGestureRecognizerImpl(target: self, action: #selector(self.panGesture(_:)))
|
let panRecognizer = PagerPanGestureRecognizerImpl(target: self, action: #selector(self.panGesture(_:)))
|
||||||
|
panRecognizer.direction = .horizontal
|
||||||
self.panRecognizer = panRecognizer
|
self.panRecognizer = panRecognizer
|
||||||
self.addGestureRecognizer(panRecognizer)
|
self.addGestureRecognizer(panRecognizer)
|
||||||
}
|
}
|
||||||
@ -681,7 +683,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
|||||||
} else {
|
} else {
|
||||||
wasAdded = true
|
wasAdded = true
|
||||||
contentView = ContentView(view: ComponentHostView<(ChildEnvironmentType, PagerComponentChildEnvironment)>())
|
contentView = ContentView(view: ComponentHostView<(ChildEnvironmentType, PagerComponentChildEnvironment)>())
|
||||||
contentTransition = .immediate
|
contentTransition = transition.withAnimation(.none)
|
||||||
self.contentViews[content.id] = contentView
|
self.contentViews[content.id] = contentView
|
||||||
if let contentBackgroundView = self.contentBackgroundView {
|
if let contentBackgroundView = self.contentBackgroundView {
|
||||||
self.insertSubview(contentView.view, aboveSubview: contentBackgroundView)
|
self.insertSubview(contentView.view, aboveSubview: contentBackgroundView)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class DirectionalPanGestureRecognizer: UIPanGestureRecognizer {
|
open class DirectionalPanGestureRecognizer: UIPanGestureRecognizer {
|
||||||
public enum Direction {
|
public enum Direction {
|
||||||
case horizontal
|
case horizontal
|
||||||
case vertical
|
case vertical
|
||||||
|
@ -90,6 +90,7 @@ swift_library(
|
|||||||
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
||||||
"//submodules/TelegramUI/Components/ChatEntityKeyboardInputNode:ChatEntityKeyboardInputNode",
|
"//submodules/TelegramUI/Components/ChatEntityKeyboardInputNode:ChatEntityKeyboardInputNode",
|
||||||
"//submodules/FeaturedStickersScreen:FeaturedStickersScreen",
|
"//submodules/FeaturedStickersScreen:FeaturedStickersScreen",
|
||||||
|
"//submodules/TelegramNotices:TelegramNotices",
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
@ -12,6 +12,7 @@ import ViewControllerComponent
|
|||||||
import EntityKeyboard
|
import EntityKeyboard
|
||||||
import PagerComponent
|
import PagerComponent
|
||||||
import FeaturedStickersScreen
|
import FeaturedStickersScreen
|
||||||
|
import TelegramNotices
|
||||||
|
|
||||||
struct InputData: Equatable {
|
struct InputData: Equatable {
|
||||||
var emoji: EmojiPagerContentComponent
|
var emoji: EmojiPagerContentComponent
|
||||||
@ -127,7 +128,7 @@ private final class StickerSelectionComponent: Component {
|
|||||||
let topPanelHeight: CGFloat = 42.0
|
let topPanelHeight: CGFloat = 42.0
|
||||||
|
|
||||||
let keyboardSize = self.keyboardView.update(
|
let keyboardSize = self.keyboardView.update(
|
||||||
transition: transition,//.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
transition: transition.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
||||||
component: AnyComponent(EntityKeyboardComponent(
|
component: AnyComponent(EntityKeyboardComponent(
|
||||||
theme: component.theme,
|
theme: component.theme,
|
||||||
strings: component.strings,
|
strings: component.strings,
|
||||||
@ -214,7 +215,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
|
|
||||||
private(set) var isExpanded = false
|
private(set) var isExpanded = false
|
||||||
private var panGestureRecognizer: UIPanGestureRecognizer?
|
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 currentIsVisible: Bool = false
|
||||||
private var currentLayout: (layout: ContainerViewLayout, navigationHeight: CGFloat)?
|
private var currentLayout: (layout: ContainerViewLayout, navigationHeight: CGFloat)?
|
||||||
@ -316,8 +317,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
},
|
},
|
||||||
deleteBackwards: nil,
|
deleteBackwards: nil,
|
||||||
openStickerSettings: nil,
|
openStickerSettings: nil,
|
||||||
openFeatured: {
|
openFeatured: nil,
|
||||||
},
|
|
||||||
openSearch: {},
|
openSearch: {},
|
||||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
||||||
@ -370,7 +370,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if groupId == AnyHashable("popular") {
|
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))
|
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
let context = controller.context
|
let context = controller.context
|
||||||
@ -418,8 +418,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
},
|
},
|
||||||
deleteBackwards: nil,
|
deleteBackwards: nil,
|
||||||
openStickerSettings: nil,
|
openStickerSettings: nil,
|
||||||
openFeatured: {
|
openFeatured: nil,
|
||||||
},
|
|
||||||
openSearch: {},
|
openSearch: {},
|
||||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
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 {
|
if isPremiumLocked {
|
||||||
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
||||||
// controllerInteraction.navigationController()?.pushViewController(controller)
|
// controllerInteraction.navigationController()?.pushViewController(controller)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,32 +465,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
clearGroup: { [weak self] groupId in
|
clearGroup: { _ 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)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
pushController: { c in },
|
pushController: { c in },
|
||||||
presentController: { c in },
|
presentController: { c in },
|
||||||
@ -520,24 +493,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
},
|
},
|
||||||
deleteBackwards: nil,
|
deleteBackwards: nil,
|
||||||
openStickerSettings: nil,
|
openStickerSettings: nil,
|
||||||
openFeatured: { [weak self] in
|
openFeatured: nil,
|
||||||
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, [])
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
openSearch: {},
|
openSearch: {},
|
||||||
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
addGroupAction: { [weak self] groupId, isPremiumLocked in
|
||||||
guard let strongSelf = self, let controller = strongSelf.controller, let collectionId = groupId.base as? ItemCollectionId else {
|
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 {
|
if isPremiumLocked {
|
||||||
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
// let controller = PremiumIntroScreen(context: context, source: .stickers)
|
||||||
// controllerInteraction.navigationController()?.pushViewController(controller)
|
// controllerInteraction.navigationController()?.pushViewController(controller)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,20 +544,14 @@ public class StickerPickerScreen: ViewController {
|
|||||||
guard let strongSelf = self, let controller = strongSelf.controller else {
|
guard let strongSelf = self, let controller = strongSelf.controller else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if groupId == AnyHashable("popular") {
|
let context = controller.context
|
||||||
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
|
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))
|
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
let context = controller.context
|
items.append(ActionSheetButtonItem(title: presentationData.strings.Stickers_ClearRecent, color: .destructive, action: { [weak actionSheet] in
|
||||||
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()
|
actionSheet?.dismissAnimated()
|
||||||
guard let strongSelf = self else {
|
let _ = context.engine.stickers.clearRecentlyUsedStickers().start()
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
strongSelf.scheduledEmojiContentAnimationHint = EmojiPagerContentComponent.ContentAnimation(type: .groupRemoved(id: "popular"))
|
|
||||||
let _ = context.engine.stickers.clearRecentlyUsedReactions().start()
|
|
||||||
}))
|
}))
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
||||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
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)
|
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 },
|
pushController: { c in },
|
||||||
@ -671,6 +635,9 @@ public class StickerPickerScreen: ViewController {
|
|||||||
|
|
||||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||||
if gestureRecognizer is UIPanGestureRecognizer && otherGestureRecognizer is UIPanGestureRecognizer {
|
if gestureRecognizer is UIPanGestureRecognizer && otherGestureRecognizer is UIPanGestureRecognizer {
|
||||||
|
if otherGestureRecognizer is PagerPanGestureRecognizer {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -719,7 +686,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
let isLandscape = layout.orientation == .landscape
|
let isLandscape = layout.orientation == .landscape
|
||||||
let edgeTopInset = isLandscape ? 0.0 : self.defaultTopInset
|
let edgeTopInset = isLandscape ? 0.0 : self.defaultTopInset
|
||||||
let topInset: CGFloat
|
let topInset: CGFloat
|
||||||
if let (panInitialTopInset, panOffset, _, _) = self.panGestureArguments {
|
if let (panInitialTopInset, panOffset, _) = self.panGestureArguments {
|
||||||
if effectiveExpanded {
|
if effectiveExpanded {
|
||||||
topInset = min(edgeTopInset, panInitialTopInset + max(0.0, panOffset))
|
topInset = min(edgeTopInset, panInitialTopInset + max(0.0, panOffset))
|
||||||
} else {
|
} 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 {
|
||||||
if let view = view as? UIScrollView, view.contentSize.width < view.contentSize.height {
|
if let view = view as? PagerExpandableScrollView {
|
||||||
return (view, nil)
|
return view
|
||||||
}
|
|
||||||
if let node = view.asyncdisplaykit_node as? ListView {
|
|
||||||
return (node.scroller, node)
|
|
||||||
}
|
}
|
||||||
return findScrollView(view: view.superview)
|
return findScrollView(view: view.superview)
|
||||||
} else {
|
} else {
|
||||||
@ -879,11 +843,10 @@ public class StickerPickerScreen: ViewController {
|
|||||||
let currentHitView = self.hitTest(point, with: nil)
|
let currentHitView = self.hitTest(point, with: nil)
|
||||||
|
|
||||||
var scrollViewAndListNode = self.findScrollView(view: currentHitView)
|
var scrollViewAndListNode = self.findScrollView(view: currentHitView)
|
||||||
if scrollViewAndListNode?.0.frame.height == self.frame.width {
|
if scrollViewAndListNode?.frame.height == self.frame.width {
|
||||||
scrollViewAndListNode = nil
|
scrollViewAndListNode = nil
|
||||||
}
|
}
|
||||||
let scrollView = scrollViewAndListNode?.0
|
let scrollView = scrollViewAndListNode
|
||||||
let listNode = scrollViewAndListNode?.1
|
|
||||||
|
|
||||||
let topInset: CGFloat
|
let topInset: CGFloat
|
||||||
if self.isExpanded {
|
if self.isExpanded {
|
||||||
@ -892,12 +855,11 @@ public class StickerPickerScreen: ViewController {
|
|||||||
topInset = edgeTopInset
|
topInset = edgeTopInset
|
||||||
}
|
}
|
||||||
|
|
||||||
self.panGestureArguments = (topInset, 0.0, scrollView, listNode)
|
self.panGestureArguments = (topInset, 0.0, scrollView)
|
||||||
case .changed:
|
case .changed:
|
||||||
guard let (topInset, panOffset, scrollView, listNode) = self.panGestureArguments else {
|
guard let (topInset, panOffset, scrollView) = self.panGestureArguments else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let visibleContentOffset = listNode?.visibleContentOffset()
|
|
||||||
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
||||||
|
|
||||||
var translation = recognizer.translation(in: self.view).y
|
var translation = recognizer.translation(in: self.view).y
|
||||||
@ -905,12 +867,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
var currentOffset = topInset + translation
|
var currentOffset = topInset + translation
|
||||||
|
|
||||||
let epsilon = 1.0
|
let epsilon = 1.0
|
||||||
if case let .known(value) = visibleContentOffset, value <= epsilon {
|
if let scrollView = scrollView, contentOffset <= -scrollView.contentInset.top + 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 {
|
|
||||||
scrollView.bounces = false
|
scrollView.bounces = false
|
||||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
||||||
} else if let scrollView = scrollView {
|
} 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 !self.isExpanded {
|
||||||
if currentOffset > 0.0, let scrollView = scrollView {
|
if currentOffset > 0.0, let scrollView = scrollView {
|
||||||
@ -942,23 +899,18 @@ public class StickerPickerScreen: ViewController {
|
|||||||
|
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate)
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate)
|
||||||
case .ended:
|
case .ended:
|
||||||
guard let (currentTopInset, panOffset, scrollView, listNode) = self.panGestureArguments else {
|
guard let (currentTopInset, panOffset, scrollView) = self.panGestureArguments else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.panGestureArguments = nil
|
self.panGestureArguments = nil
|
||||||
|
|
||||||
let visibleContentOffset = listNode?.visibleContentOffset()
|
|
||||||
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
let contentOffset = scrollView?.contentOffset.y ?? 0.0
|
||||||
|
|
||||||
let translation = recognizer.translation(in: self.view).y
|
let translation = recognizer.translation(in: self.view).y
|
||||||
var velocity = recognizer.velocity(in: self.view)
|
var velocity = recognizer.velocity(in: self.view)
|
||||||
|
|
||||||
if self.isExpanded {
|
if self.isExpanded {
|
||||||
if case let .known(value) = visibleContentOffset, value > 0.1 {
|
if contentOffset > 0.1 {
|
||||||
velocity = CGPoint()
|
|
||||||
} else if case .unknown = visibleContentOffset {
|
|
||||||
velocity = CGPoint()
|
|
||||||
} else if contentOffset > 0.1 {
|
|
||||||
velocity = CGPoint()
|
velocity = CGPoint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -984,9 +936,7 @@ public class StickerPickerScreen: ViewController {
|
|||||||
} else if self.isExpanded {
|
} else if self.isExpanded {
|
||||||
if velocity.y > 300.0 || offset > topInset / 2.0 {
|
if velocity.y > 300.0 || offset > topInset / 2.0 {
|
||||||
self.isExpanded = false
|
self.isExpanded = false
|
||||||
if let listNode = listNode {
|
if let scrollView = scrollView {
|
||||||
listNode.scroller.setContentOffset(CGPoint(), animated: false)
|
|
||||||
} else if let scrollView = scrollView {
|
|
||||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
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)))
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: Transition(.animated(duration: 0.3, curve: .easeInOut)))
|
||||||
}
|
}
|
||||||
} else if (velocity.y < -300.0 || offset < topInset / 2.0) {
|
} 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 initialVelocity: CGFloat = offset.isZero ? 0.0 : abs(velocity.y / offset)
|
||||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.45, curve: .customSpring(damping: 124.0, initialVelocity: initialVelocity))
|
let transition = ContainedViewLayoutTransition.animated(duration: 0.45, curve: .customSpring(damping: 124.0, initialVelocity: initialVelocity))
|
||||||
self.isExpanded = true
|
self.isExpanded = true
|
||||||
|
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: Transition(transition))
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: Transition(transition))
|
||||||
} else {
|
} else {
|
||||||
if let listNode = listNode {
|
if let scrollView = scrollView {
|
||||||
listNode.scroller.setContentOffset(CGPoint(), animated: false)
|
|
||||||
} else if let scrollView = scrollView {
|
|
||||||
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
scrollView.setContentOffset(CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +698,17 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
|
|||||||
case .nobody:
|
case .nobody:
|
||||||
entries.append(.enableFor(presentationData.theme, enableForText, stringForUserCount(state.enableFor, strings: presentationData.strings)))
|
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 {
|
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()))
|
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))
|
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 performItemAction: (AnyHashable, Item, UIView, CGRect, CALayer, Bool) -> Void
|
||||||
public let deleteBackwards: (() -> Void)?
|
public let deleteBackwards: (() -> Void)?
|
||||||
public let openStickerSettings: (() -> Void)?
|
public let openStickerSettings: (() -> Void)?
|
||||||
public let openFeatured: () -> Void
|
public let openFeatured: (() -> Void)?
|
||||||
public let openSearch: () -> Void
|
public let openSearch: () -> Void
|
||||||
public let addGroupAction: (AnyHashable, Bool) -> Void
|
public let addGroupAction: (AnyHashable, Bool) -> Void
|
||||||
public let clearGroup: (AnyHashable) -> Void
|
public let clearGroup: (AnyHashable) -> Void
|
||||||
@ -2124,7 +2124,7 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
performItemAction: @escaping (AnyHashable, Item, UIView, CGRect, CALayer, Bool) -> Void,
|
performItemAction: @escaping (AnyHashable, Item, UIView, CGRect, CALayer, Bool) -> Void,
|
||||||
deleteBackwards: (() -> Void)?,
|
deleteBackwards: (() -> Void)?,
|
||||||
openStickerSettings: (() -> Void)?,
|
openStickerSettings: (() -> Void)?,
|
||||||
openFeatured: @escaping () -> Void,
|
openFeatured: (() -> Void)?,
|
||||||
openSearch: @escaping () -> Void,
|
openSearch: @escaping () -> Void,
|
||||||
addGroupAction: @escaping (AnyHashable, Bool) -> Void,
|
addGroupAction: @escaping (AnyHashable, Bool) -> Void,
|
||||||
clearGroup: @escaping (AnyHashable) -> Void,
|
clearGroup: @escaping (AnyHashable) -> Void,
|
||||||
|
@ -451,19 +451,21 @@ public final class EntityKeyboardComponent: Component {
|
|||||||
if let stickerContent = component.stickerContent {
|
if let stickerContent = component.stickerContent {
|
||||||
var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = []
|
var topStickerItems: [EntityKeyboardTopPanelComponent.Item] = []
|
||||||
|
|
||||||
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
if let _ = stickerContent.inputInteractionHolder.inputInteraction?.openFeatured {
|
||||||
id: "featuredTop",
|
topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
|
||||||
isReorderable: false,
|
id: "featuredTop",
|
||||||
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
isReorderable: false,
|
||||||
icon: .featured,
|
content: AnyComponent(EntityKeyboardIconTopPanelComponent(
|
||||||
theme: component.theme,
|
icon: .featured,
|
||||||
useAccentColor: false,
|
theme: component.theme,
|
||||||
title: component.strings.Stickers_Trending,
|
useAccentColor: false,
|
||||||
pressed: { [weak self] in
|
title: component.strings.Stickers_Trending,
|
||||||
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured()
|
pressed: { [weak self] in
|
||||||
}
|
self?.component?.stickerContent?.inputInteractionHolder.inputInteraction?.openFeatured?()
|
||||||
|
}
|
||||||
|
))
|
||||||
))
|
))
|
||||||
))
|
}
|
||||||
|
|
||||||
for itemGroup in stickerContent.itemGroups {
|
for itemGroup in stickerContent.itemGroups {
|
||||||
if let id = itemGroup.supergroupId.base as? String {
|
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))
|
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 {
|
if let searchComponent = self.searchComponent, let accountContext = accountContext {
|
||||||
var animateIn = false
|
var animateIn = false
|
||||||
let searchView: ComponentHostView<EntitySearchContentEnvironment>
|
let searchView: ComponentHostView<EntitySearchContentEnvironment>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user