diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift index 16b52484aa..a3020311f1 100644 --- a/Telegram/NotificationService/Sources/NotificationService.swift +++ b/Telegram/NotificationService/Sources/NotificationService.swift @@ -785,10 +785,6 @@ private final class NotificationServiceHandler { var recordId: AccountRecordId? var isCurrentAccount: Bool = false - let loggingSettings = sharedData.entries[SharedDataKeys.loggingSettings]?.get(LoggingSettings.self) ?? LoggingSettings.defaultSettings - Logger.shared.logToFile = loggingSettings.logToFile - Logger.shared.logToConsole = loggingSettings.logToConsole - var automaticMediaDownloadSettings: MediaAutoDownloadSettings if let value = sharedData.entries[ApplicationSpecificSharedDataKeys.automaticMediaDownloadSettings]?.get(MediaAutoDownloadSettings.self) { automaticMediaDownloadSettings = value diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 015052f58a..4d7e2e1cad 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -2851,50 +2851,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController }) }))) - let isMuted = resolvedAreStoriesMuted(globalSettings: globalSettings._asGlobalNotificationSettings(), peer: peer._asPeer(), peerSettings: notificationSettings._asNotificationSettings(), topSearchPeers: topSearchPeers) - items.append(.action(ContextMenuActionItem(text: isMuted ? self.presentationData.strings.StoryFeed_ContextNotifyOn : self.presentationData.strings.StoryFeed_ContextNotifyOff, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: isMuted ? "Chat/Context Menu/Unmute" : "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor) - }, action: { [weak self] _, f in - f(.default) - - guard let self else { - return - } - let _ = self.context.engine.peers.togglePeerStoriesMuted(peerId: peer.id).start() - - let iconColor = UIColor.white - let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } - if isMuted { - self.present(UndoOverlayController( - presentationData: presentationData, - content: .universal(animation: "anim_profileunmute", scale: 0.075, colors: [ - "Middle.Group 1.Fill 1": iconColor, - "Top.Group 1.Fill 1": iconColor, - "Bottom.Group 1.Fill 1": iconColor, - "EXAMPLE.Group 1.Fill 1": iconColor, - "Line.Group 1.Stroke 1": iconColor - ], title: nil, text: presentationData.strings.StoryFeed_TooltipNotifyOn(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string, customUndoText: nil, timeout: nil), - elevatedLayout: false, - animateInAsReplacement: false, - action: { _ in return false } - ), in: .current) - } else { - self.present(UndoOverlayController( - presentationData: presentationData, - content: .universal(animation: "anim_profilemute", scale: 0.075, colors: [ - "Middle.Group 1.Fill 1": iconColor, - "Top.Group 1.Fill 1": iconColor, - "Bottom.Group 1.Fill 1": iconColor, - "EXAMPLE.Group 1.Fill 1": iconColor, - "Line.Group 1.Stroke 1": iconColor - ], title: nil, text: presentationData.strings.StoryFeed_TooltipNotifyOff(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string, customUndoText: nil, timeout: nil), - elevatedLayout: false, - animateInAsReplacement: false, - action: { _ in return false } - ), in: .current) - } - }))) - let hideText: String if self.location == .chatList(groupId: .archive) { hideText = self.presentationData.strings.StoryFeed_ContextUnarchive diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index 898f0aee37..526c7f66a4 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -431,6 +431,7 @@ public final class MessageInputPanelComponent: Component { let blurEffect = UIBlurEffect(style: style) let vibrancyEffect = UIVibrancyEffect(blurEffect: blurEffect) let vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect) + vibrancyEffectView.alpha = 0.0 self.vibrancyEffectView = vibrancyEffectView self.mediaRecordingVibrancyContainer = UIView() @@ -791,6 +792,9 @@ public final class MessageInputPanelComponent: Component { transition.setFrame(view: self.vibrancyEffectView, frame: CGRect(origin: CGPoint(), size: fieldBackgroundFrame.size)) self.vibrancyEffectView.isHidden = component.style == .media + if isEditing { + self.vibrancyEffectView.alpha = 1.0 + } transition.setFrame(view: self.fieldBackgroundView, frame: fieldBackgroundFrame) self.fieldBackgroundView.update(size: fieldBackgroundFrame.size, cornerRadius: baseFieldHeight * 0.5, transition: transition.containedViewLayoutTransition) diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift index d05405eaf5..4c7e60ee2e 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift @@ -1550,7 +1550,8 @@ private final class StoryContainerScreenComponent: Component { closeFriends: self.closeFriendsPromise, blockedPeers: self.blockedPeers, sharedViewListsContext: self.sharedViewListsContext, - stealthModeTimeout: stealthModeTimeout + stealthModeTimeout: stealthModeTimeout, + isDismissed: self.isDismissedExlusively )), environment: {}, containerSize: itemSetContainerSize @@ -1697,6 +1698,7 @@ private final class StoryContainerScreenComponent: Component { itemSetView.removeFromSuperview() if let view = itemSetView.view.view as? StoryItemSetContainerComponent.View { + view.saveDraft() view.transitionCloneContainerView.removeFromSuperview() } } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index 7d7c86c05c..0666ced830 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -124,6 +124,7 @@ public final class StoryItemSetContainerComponent: Component { public let blockedPeers: BlockedPeersContext? let sharedViewListsContext: StoryItemSetViewListComponent.SharedListsContext let stealthModeTimeout: Int32? + public let isDismissed: Bool init( context: AccountContext, @@ -158,7 +159,8 @@ public final class StoryItemSetContainerComponent: Component { closeFriends: Promise<[EnginePeer]>, blockedPeers: BlockedPeersContext?, sharedViewListsContext: StoryItemSetViewListComponent.SharedListsContext, - stealthModeTimeout: Int32? + stealthModeTimeout: Int32?, + isDismissed: Bool ) { self.context = context self.externalState = externalState @@ -193,6 +195,7 @@ public final class StoryItemSetContainerComponent: Component { self.blockedPeers = blockedPeers self.sharedViewListsContext = sharedViewListsContext self.stealthModeTimeout = stealthModeTimeout + self.isDismissed = isDismissed } public static func ==(lhs: StoryItemSetContainerComponent, rhs: StoryItemSetContainerComponent) -> Bool { @@ -253,6 +256,9 @@ public final class StoryItemSetContainerComponent: Component { if lhs.stealthModeTimeout != rhs.stealthModeTimeout { return false } + if lhs.isDismissed != rhs.isDismissed { + return false + } return true } @@ -476,10 +482,13 @@ public final class StoryItemSetContainerComponent: Component { private var isAnimatingOut: Bool = false + private var scheduledStoryUnpinnedUndoOverlay: ViewController? + override init(frame: CGRect) { self.sendMessageContext = StoryItemSetContainerSendMessage() self.componentContainerView = UIView() + self.overlayContainerView = SparseContainerView() self.itemsContainerView = UIView() @@ -2017,6 +2026,14 @@ public final class StoryItemSetContainerComponent: Component { } func animateOut(transitionOut: StoryContainerScreen.TransitionOut, transitionCloneMasterView: UIView, completion: @escaping () -> Void) { + func fixScale(layer: CALayer) { + layer.rasterizationScale = UIScreenScale + + for sublayer in layer.sublayers ?? [] { + fixScale(layer: sublayer) + } + } + var cleanups: [() -> Void] = [] self.isAnimatingOut = true @@ -2142,6 +2159,7 @@ public final class StoryItemSetContainerComponent: Component { var transitionViewsImpl: [UIView] = [] if let transitionViewImpl = transitionView?.makeView() { + fixScale(layer: transitionViewImpl.layer) transitionViewsImpl.append(transitionViewImpl) let transitionSourceContainerView = UIView(frame: self.bounds) @@ -2152,6 +2170,7 @@ public final class StoryItemSetContainerComponent: Component { if let insertCloneTransitionView = transitionView?.insertCloneTransitionView { if let transitionCloneViewImpl = transitionView?.makeView() { + fixScale(layer: transitionCloneViewImpl.layer) transitionViewsImpl.append(transitionCloneViewImpl) transitionCloneMasterView.isUserInteractionEnabled = false @@ -2262,6 +2281,7 @@ public final class StoryItemSetContainerComponent: Component { var transitionViewsImpl: [UIView] = [] if let transitionViewImpl = transitionView?.makeView() { + fixScale(layer: transitionViewImpl.layer) transitionViewsImpl.append(transitionViewImpl) let transitionSourceContainerView = UIView(frame: self.bounds) @@ -2272,6 +2292,7 @@ public final class StoryItemSetContainerComponent: Component { if let insertCloneTransitionView = transitionView?.insertCloneTransitionView { if let transitionCloneViewImpl = transitionView?.makeView() { + fixScale(layer: transitionCloneViewImpl.layer) transitionViewsImpl.append(transitionCloneViewImpl) transitionCloneMasterView.isUserInteractionEnabled = false @@ -2413,6 +2434,19 @@ public final class StoryItemSetContainerComponent: Component { let _ = ApplicationSpecificNotice.setDisplayStoryReactionTooltip(accountManager: component.context.sharedContext.accountManager).start() } + func saveDraft() { + guard let component = self.component else { + return + } + if let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View { + let previousInput = inputPanelView.getSendMessageInput() + switch previousInput { + case let .text(value): + component.storyItemSharedState.replyDrafts[StoryId(peerId: component.slice.peer.id, id: component.slice.item.storyItem.id)] = value + } + } + } + func update(component: StoryItemSetContainerComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { let isFirstTime = self.component == nil @@ -2448,15 +2482,7 @@ public final class StoryItemSetContainerComponent: Component { resetInputContents = .text(NSAttributedString()) - if let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View { - if let previousComponent = self.component { - let previousInput = inputPanelView.getSendMessageInput() - switch previousInput { - case let .text(value): - component.storyItemSharedState.replyDrafts[StoryId(peerId: previousComponent.slice.peer.id, id: previousComponent.slice.item.storyItem.id)] = value - } - } - } + self.saveDraft() if let draft = component.storyItemSharedState.replyDrafts[StoryId(peerId: component.slice.peer.id, id: component.slice.item.storyItem.id)] { resetInputContents = .text(draft) } @@ -4590,6 +4616,13 @@ public final class StoryItemSetContainerComponent: Component { ) } + if let scheduledStoryUnpinnedUndoOverlay = self.scheduledStoryUnpinnedUndoOverlay { + self.scheduledStoryUnpinnedUndoOverlay = nil + if !self.isAnimatingOut && !component.isDismissed { + component.presentController(scheduledStoryUnpinnedUndoOverlay, nil) + } + } + return contentSize } @@ -5265,9 +5298,13 @@ public final class StoryItemSetContainerComponent: Component { } var likeButtonView: UIView? + var addTracingOffset: ((UIView) -> Void)? if let visibleItem = self.visibleItems[component.slice.item.storyItem.id], let footerPanelView = visibleItem.footerPanel?.view as? StoryFooterPanelComponent.View { likeButtonView = footerPanelView.likeButtonView + addTracingOffset = { [weak footerPanelView] view in + footerPanelView?.setLikeButtonTracingOffset(view: view) + } } else { guard let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View else { return @@ -5338,6 +5375,8 @@ public final class StoryItemSetContainerComponent: Component { standaloneReactionAnimation?.view.removeFromSuperview() } ) + + addTracingOffset?(standaloneReactionAnimation.view) } if component.slice.item.storyItem.myReaction != nil { @@ -5721,14 +5760,14 @@ public final class StoryItemSetContainerComponent: Component { let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme) //TODO:localize if component.slice.item.storyItem.isPinned { - self.component?.presentController(UndoOverlayController( + self.scheduledStoryUnpinnedUndoOverlay = UndoOverlayController( presentationData: presentationData, content: .info(title: nil, text: "Story removed from the channel's profile", timeout: nil), elevatedLayout: false, animateInAsReplacement: false, blurred: true, action: { _ in return false } - ), nil) + ) } else { self.component?.presentController(UndoOverlayController( presentationData: presentationData, diff --git a/submodules/TelegramUI/Components/Stories/StoryFooterPanelComponent/Sources/StoryFooterPanelComponent.swift b/submodules/TelegramUI/Components/Stories/StoryFooterPanelComponent/Sources/StoryFooterPanelComponent.swift index 8b334c9356..0c5cf7e035 100644 --- a/submodules/TelegramUI/Components/Stories/StoryFooterPanelComponent/Sources/StoryFooterPanelComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryFooterPanelComponent/Sources/StoryFooterPanelComponent.swift @@ -137,6 +137,8 @@ public final class StoryFooterPanelComponent: Component { public let externalContainerView: UIView + private weak var likeButtonTracingOffsetView: UIView? + public var likeButtonView: UIView? { return self.likeButton?.view } @@ -197,6 +199,10 @@ public final class StoryFooterPanelComponent: Component { self.uploadProgressDisposable?.dispose() } + public func setLikeButtonTracingOffset(view: UIView) { + self.likeButtonTracingOffsetView = view + } + @objc private func viewStatsPressed() { guard let component = self.component else { return @@ -457,6 +463,13 @@ public final class StoryFooterPanelComponent: Component { var likeButtonFrame = CGRect(origin: CGPoint(x: rightContentOffset - likeButtonSize.width, y: floor((size.height - likeButtonSize.height) * 0.5)), size: likeButtonSize) likeButtonFrame.origin.y += component.expandFraction * 45.0 + if let likeButtonTracingOffsetView = self.likeButtonTracingOffsetView { + let difference = CGPoint(x: likeButtonFrame.midX - likeButtonView.layer.position.x, y: likeButtonFrame.midY - likeButtonView.layer.position.y) + if difference != CGPoint() { + likeStatsTransition.setPosition(view: likeButtonTracingOffsetView, position: likeButtonTracingOffsetView.layer.position.offsetBy(dx: difference.x, dy: difference.y)) + } + } + likeStatsTransition.setPosition(view: likeButtonView, position: likeButtonFrame.center) likeStatsTransition.setBounds(view: likeButtonView, bounds: CGRect(origin: CGPoint(), size: likeButtonFrame.size)) likeStatsTransition.setAlpha(view: likeButtonView, alpha: 1.0 - component.expandFraction) diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift index b98a76a8ef..49a445e671 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift @@ -321,6 +321,7 @@ public final class StoryPeerListItemComponent: Component { if let itemView { if let portalView = PortalView(matchPosition: false) { + portalView.view.layer.rasterizationScale = UIScreenScale itemView.avatarContent.addPortal(view: portalView) self.portalView = portalView self.addSubview(portalView.view) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift index 87b6378e2d..8cc57a80e7 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift @@ -698,6 +698,10 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat let previousCurrentPaneKey = self.currentPaneKey var updateCurrentPaneStatus = false + if let previousAvailablePanes, !previousAvailablePanes.contains(.stories), availablePanes.contains(.stories) { + self.pendingSwitchToPaneKey = .stories + } + if let currentPaneKey = self.currentPaneKey, !availablePanes.contains(currentPaneKey) { var nextCandidatePaneKey: PeerInfoPaneKey? if let previousAvailablePanes = previousAvailablePanes, let index = previousAvailablePanes.firstIndex(of: currentPaneKey), index != 0 {