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
9c95be3766
commit
5f44db6b7b
@ -502,6 +502,7 @@ public final class NavigateToChatControllerParams {
|
||||
public let peerNearbyData: ChatPeerNearbyData?
|
||||
public let reportReason: NavigateToChatControllerParams.ReportReason?
|
||||
public let animated: Bool
|
||||
public let forceAnimatedScroll: Bool
|
||||
public let options: NavigationAnimationOptions
|
||||
public let parentGroupId: PeerGroupId?
|
||||
public let chatListFilter: Int32?
|
||||
@ -514,7 +515,7 @@ public final class NavigateToChatControllerParams {
|
||||
public let forceOpenChat: Bool
|
||||
public let customChatNavigationStack: [EnginePeer.Id]?
|
||||
|
||||
public init(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContext, chatLocation: Location, chatLocationContextHolder: Atomic<ChatLocationContextHolder?> = Atomic<ChatLocationContextHolder?>(value: nil), subject: ChatControllerSubject? = nil, botStart: ChatControllerInitialBotStart? = nil, attachBotStart: ChatControllerInitialAttachBotStart? = nil, botAppStart: ChatControllerInitialBotAppStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: ChatControllerActivateInput? = nil, keepStack: NavigateToChatKeepStack = .default, useExisting: Bool = true, useBackAnimation: Bool = false, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, activateMessageSearch: (ChatSearchDomain, String)? = nil, peekData: ChatPeekTimeout? = nil, peerNearbyData: ChatPeerNearbyData? = nil, reportReason: NavigateToChatControllerParams.ReportReason? = nil, animated: Bool = true, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, chatListFilter: Int32? = nil, chatNavigationStack: [ChatNavigationStackItem] = [], changeColors: Bool = false, setupController: @escaping (ChatController) -> Void = { _ in }, pushController: ((ChatController, Bool, @escaping () -> Void) -> Void)? = nil, completion: @escaping (ChatController) -> Void = { _ in }, chatListCompletion: @escaping (ChatListController) -> Void = { _ in }, forceOpenChat: Bool = false, customChatNavigationStack: [EnginePeer.Id]? = nil) {
|
||||
public init(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContext, chatLocation: Location, chatLocationContextHolder: Atomic<ChatLocationContextHolder?> = Atomic<ChatLocationContextHolder?>(value: nil), subject: ChatControllerSubject? = nil, botStart: ChatControllerInitialBotStart? = nil, attachBotStart: ChatControllerInitialAttachBotStart? = nil, botAppStart: ChatControllerInitialBotAppStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: ChatControllerActivateInput? = nil, keepStack: NavigateToChatKeepStack = .default, useExisting: Bool = true, useBackAnimation: Bool = false, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, activateMessageSearch: (ChatSearchDomain, String)? = nil, peekData: ChatPeekTimeout? = nil, peerNearbyData: ChatPeerNearbyData? = nil, reportReason: NavigateToChatControllerParams.ReportReason? = nil, animated: Bool = true, forceAnimatedScroll: Bool = false, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, chatListFilter: Int32? = nil, chatNavigationStack: [ChatNavigationStackItem] = [], changeColors: Bool = false, setupController: @escaping (ChatController) -> Void = { _ in }, pushController: ((ChatController, Bool, @escaping () -> Void) -> Void)? = nil, completion: @escaping (ChatController) -> Void = { _ in }, chatListCompletion: @escaping (ChatListController) -> Void = { _ in }, forceOpenChat: Bool = false, customChatNavigationStack: [EnginePeer.Id]? = nil) {
|
||||
self.navigationController = navigationController
|
||||
self.chatController = chatController
|
||||
self.chatLocationContextHolder = chatLocationContextHolder
|
||||
@ -536,6 +537,7 @@ public final class NavigateToChatControllerParams {
|
||||
self.peerNearbyData = peerNearbyData
|
||||
self.reportReason = reportReason
|
||||
self.animated = animated
|
||||
self.forceAnimatedScroll = forceAnimatedScroll
|
||||
self.options = options
|
||||
self.parentGroupId = parentGroupId
|
||||
self.chatListFilter = chatListFilter
|
||||
|
@ -559,7 +559,7 @@ public final class ButtonComponent: Component {
|
||||
shimmeringView = ButtonShimmeringView(frame: .zero)
|
||||
self.insertSubview(shimmeringView, at: 0)
|
||||
}
|
||||
shimmeringView.update(size: availableSize, color: component.background.color, cornerRadius: component.background.cornerRadius, transition: shimmeringTransition)
|
||||
shimmeringView.update(size: availableSize, background: component.background, cornerRadius: component.background.cornerRadius, transition: shimmeringTransition)
|
||||
shimmeringTransition.setFrame(view: shimmeringView, frame: CGRect(origin: .zero, size: availableSize))
|
||||
} else if let shimmeringView = self.shimmeringView {
|
||||
self.shimmeringView = nil
|
||||
@ -598,6 +598,8 @@ private class ButtonShimmeringView: UIView {
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.isUserInteractionEnabled = false
|
||||
|
||||
self.addSubview(self.shimmerView)
|
||||
self.addSubview(self.borderView)
|
||||
}
|
||||
@ -606,7 +608,9 @@ private class ButtonShimmeringView: UIView {
|
||||
preconditionFailure()
|
||||
}
|
||||
|
||||
func update(size: CGSize, color: UIColor, cornerRadius: CGFloat, transition: ComponentTransition) {
|
||||
func update(size: CGSize, background: ButtonComponent.Background, cornerRadius: CGFloat, transition: ComponentTransition) {
|
||||
let color = background.foreground
|
||||
|
||||
let alpha: CGFloat
|
||||
let borderAlpha: CGFloat
|
||||
let compositingFilter: String?
|
||||
@ -620,14 +624,16 @@ private class ButtonShimmeringView: UIView {
|
||||
compositingFilter = nil
|
||||
}
|
||||
|
||||
self.backgroundColor = background.color
|
||||
self.layer.cornerRadius = cornerRadius
|
||||
self.borderMaskView.layer.cornerRadius = cornerRadius
|
||||
|
||||
self.shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: false, duration: 4.0, horizontal: true)
|
||||
self.shimmerView.layer.compositingFilter = compositingFilter
|
||||
|
||||
self.borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), gradientSize: 70.0, globalTimeOffset: false, duration: 4.0, horizontal: true)
|
||||
self.borderShimmerView.layer.compositingFilter = compositingFilter
|
||||
|
||||
self.borderMaskView.layer.cornerRadius = cornerRadius
|
||||
|
||||
let bounds = CGRect(origin: .zero, size: size)
|
||||
transition.setFrame(view: self.shimmerView, frame: bounds)
|
||||
transition.setFrame(view: self.borderView, frame: bounds)
|
||||
|
@ -191,24 +191,26 @@ public final class GiftCompositionComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
if case let .model(_, file, _) = self.previewModels[Int(self.previewModelIndex)] {
|
||||
animationFile = file
|
||||
}
|
||||
|
||||
if case let .pattern(_, file, _) = self.previewPatterns[Int(self.previewPatternIndex)] {
|
||||
patternFile = file
|
||||
files[file.fileId.id] = file
|
||||
}
|
||||
|
||||
if case let .backdrop(_, innerColorValue, outerColorValue, patternColorValue, _, _) = self.previewBackdrops[Int(self.previewBackdropIndex)] {
|
||||
backgroundColor = UIColor(rgb: UInt32(bitPattern: outerColorValue))
|
||||
secondBackgroundColor = UIColor(rgb: UInt32(bitPattern: innerColorValue))
|
||||
patternColor = UIColor(rgb: UInt32(bitPattern: patternColorValue))
|
||||
if !self.previewModels.isEmpty {
|
||||
if case let .model(_, file, _) = self.previewModels[Int(self.previewModelIndex)] {
|
||||
animationFile = file
|
||||
}
|
||||
|
||||
if case let .pattern(_, file, _) = self.previewPatterns[Int(self.previewPatternIndex)] {
|
||||
patternFile = file
|
||||
files[file.fileId.id] = file
|
||||
}
|
||||
|
||||
if case let .backdrop(_, innerColorValue, outerColorValue, patternColorValue, _, _) = self.previewBackdrops[Int(self.previewBackdropIndex)] {
|
||||
backgroundColor = UIColor(rgb: UInt32(bitPattern: outerColorValue))
|
||||
secondBackgroundColor = UIColor(rgb: UInt32(bitPattern: innerColorValue))
|
||||
patternColor = UIColor(rgb: UInt32(bitPattern: patternColorValue))
|
||||
}
|
||||
}
|
||||
|
||||
if self.previewTimer == nil {
|
||||
self.previewTimer = SwiftSignalKit.Timer(timeout: 2.0, repeat: true, completion: { [weak self] in
|
||||
guard let self else {
|
||||
guard let self, !self.previewModels.isEmpty else {
|
||||
return
|
||||
}
|
||||
self.previewModelIndex = (self.previewModelIndex + 1) % Int32(self.previewModels.count)
|
||||
|
@ -1450,6 +1450,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
isEnabled: true,
|
||||
displaysProgress: false,
|
||||
action: {
|
||||
component.cancel(true)
|
||||
component.viewUpgraded(upgradeMessageId)
|
||||
}),
|
||||
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: 50.0),
|
||||
@ -2064,17 +2065,17 @@ public class GiftViewScreen: ViewControllerComponentContainer {
|
||||
}
|
||||
|
||||
viewUpgradedImpl = { [weak self] messageId in
|
||||
guard let self else {
|
||||
guard let self, let navigationController = self.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
let _ = (context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: messageId.peerId)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { peer in
|
||||
guard let peer, let navigationController = self.navigationController as? NavigationController else {
|
||||
|> deliverOnMainQueue).start(next: { [weak navigationController] peer in
|
||||
guard let peer, let navigationController else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), subject: .message(id: .id(messageId), highlight: ChatControllerSubject.MessageHighlight(quote: nil), timecode: nil, setupReply: false), keepStack: .always, useExisting: false, purposefulAction: {}, peekData: nil))
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), subject: .message(id: .id(messageId), highlight: ChatControllerSubject.MessageHighlight(quote: nil), timecode: nil, setupReply: false), keepStack: .always, useExisting: true, purposefulAction: {}, peekData: nil, forceAnimatedScroll: true))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
|
||||
if case let .id(messageId) = messageSubject {
|
||||
let navigationController = params.navigationController
|
||||
let animated = params.animated
|
||||
controller.navigateToMessage(messageLocation: .id(messageId, NavigateToMessageParams(timestamp: timecode, quote: (highlight?.quote).flatMap { quote in NavigateToMessageParams.Quote(string: quote.string, offset: quote.offset) }, setupReply: setupReply)), animated: isFirst, completion: { [weak navigationController, weak controller] in
|
||||
controller.navigateToMessage(messageLocation: .id(messageId, NavigateToMessageParams(timestamp: timecode, quote: (highlight?.quote).flatMap { quote in NavigateToMessageParams.Quote(string: quote.string, offset: quote.offset) }, setupReply: setupReply)), animated: isFirst || params.forceAnimatedScroll, completion: { [weak navigationController, weak controller] in
|
||||
if let navigationController = navigationController, let controller = controller {
|
||||
let _ = navigationController.popToViewController(controller, animated: animated)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user