diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift index f7bc3f634c..601f6d15d7 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift @@ -1686,9 +1686,7 @@ func _internal_updatePinnedToTopStories(account: Account, peerId: PeerId, ids: [ } DispatchQueue.main.async { - account.stateManager.injectStoryUpdates(updates: ids.map { id in - return .updatePinnedToTopList(peerId: peerId, ids: ids) - }) + account.stateManager.injectStoryUpdates(updates: [.updatePinnedToTopList(peerId: peerId, ids: ids)]) } return inputPeer diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index af23bc10cb..290f289931 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -2404,6 +2404,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate case camera case gallery(GalleryTransitionIn) + case noAnimation } public final class TransitionOut { @@ -3603,6 +3604,10 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate if let transitionIn = self.controller?.transitionIn { switch transitionIn { + case .noAnimation: + self.layer.allowsGroupOpacity = true + self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) + completion() case .camera: if let view = self.componentHost.view as? MediaEditorScreenComponent.View { view.animateIn(from: .camera, completion: completion) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift index 1cfb2d9641..f5ddb1cdd9 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift @@ -1847,7 +1847,17 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr //TODO:localize let presentationData = self.presentationData - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: isPinned ? nil : "Story Pinned", text: isPinned ? "Story Unpinned." : "Now it will always be shown on the top.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + + let toastTitle: String? + let toastText: String + if isPinned { + toastTitle = nil + toastText = "Story unpinned." + } else { + toastTitle = "Story pinned" + toastText = "Now it will always be shown on the top." + } + self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: isPinned ? "anim_toastunpin" : "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) }))) } @@ -2468,17 +2478,25 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr } if updatedPinnedIds.count > 3 { let presentationData = self.presentationData - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "You can't pin more than 3 posts.", timeout: nil, customUndoText: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + let animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor + let toastText = "You can't pin more than 3 posts." + self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_infotip", scale: 1.0, colors: ["info1.info1.stroke": animationBackgroundColor, "info2.info2.Fill": animationBackgroundColor], title: nil, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) } else { let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone() //TODO:localize let presentationData = self.presentationData + + let toastTitle: String + let toastText: String if selectedIds.count == 1 { - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: "Story Pinned", text: "Now it will always be shown on the top.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + toastTitle = "Story Pinned" + toastText = "Now it will always be shown on the top." } else { - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: "Stories Pinned", text: "Now they will always be shown on the top.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + toastTitle = "Stories Pinned" + toastText = "Now they will always be shown on the top." } + self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) if let parentController = self.parentController as? PeerInfoScreen { parentController.cancelItemSelection() @@ -2493,11 +2511,17 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr //TODO:localize let presentationData = self.presentationData + + let toastTitle: String? + let toastText: String if selectedIds.count == 1 { - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: "Story unpinned.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + toastTitle = nil + toastText = "Story unpinned." } else { - self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: nil, text: "Stories unpinned.", cancel: nil, destructive: false), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) + toastTitle = nil + toastText = "Stories unpinned." } + self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_toastunpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) if let parentController = self.parentController as? PeerInfoScreen { parentController.cancelItemSelection() diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index e2ef65ae7e..1a59d41eb5 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -5430,7 +5430,7 @@ public final class StoryItemSetContainerComponent: Component { initialPrivacy: initialPrivacy, initialMediaAreas: initialMediaAreas, initialVideoPosition: videoPlaybackPosition, - transitionIn: nil, + transitionIn: .noAnimation, transitionOut: { finished, isNew in if repost && finished { if let transitionOut = externalState.transitionOut?(externalState.storyTarget, externalState.isPeerArchived), let destinationView = transitionOut.destinationView { diff --git a/submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs b/submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs new file mode 100644 index 0000000000..469a8ac125 Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs differ diff --git a/submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs b/submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs new file mode 100644 index 0000000000..e8decc25d3 Binary files /dev/null and b/submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs differ