From 79502b3d6fcb4ad38be4ad6a04a53026c44972bd Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Tue, 9 Apr 2024 17:54:11 +0400 Subject: [PATCH] Profile posts improvements --- .../TelegramEngine/Messages/Stories.swift | 4 +- .../Sources/MediaEditorScreen.swift | 5 +++ .../Sources/PeerInfoStoryPaneNode.swift | 36 +++++++++++++++--- .../StoryItemSetContainerComponent.swift | 2 +- .../Resources/Animations/anim_toastpin.tgs | Bin 0 -> 2531 bytes .../Resources/Animations/anim_toastunpin.tgs | Bin 0 -> 3259 bytes 6 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs create mode 100644 submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs 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 0000000000000000000000000000000000000000..469a8ac12598f5c961888b7253f0e7139dc354d5 GIT binary patch literal 2531 zcmV<92^{txiwFpRmK|gO17%-uX>KwuYIARH0M%OCZX>x7{S~91*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Wt>001DN@mK%= literal 0 HcmV?d00001 diff --git a/submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs b/submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs new file mode 100644 index 0000000000000000000000000000000000000000..e8decc25d3f2e3a977516b622c16cda4b000c44d GIT binary patch literal 3259 zcmV;s3`FxEiwFpRmK|gO17%-uX>KlRb8l_{?Oa)JBgYZ`D*~T~jjq01Z*dMIKoA75 zkrzQQXe~EVbWosZJH}%Fd%mjfp@!s8BqeGk%EYcXWKZ=~)pgg*m%*=t(}7o{6%Crf z=jq@y=w@(rKRCr@f(sdZ`E79O$uxt@dcC_vukla!S9j?2>C-2H9z8saXAgtZvoC`y zvomm6qm>fia-y0TDL z#ygmlt#`d(iXJXU_v3O3dG~|=OtI^$S)u1$L66*cxE#!D~~w917hdS$f5&!NdGYtsykQ6_N%1|UETO;X+% zZV6cho;ILGJ8q$@e8&1BU?cakSy6sm7#4gnIGs&@8GjY#*?~f251K?Nsce8fGC?`- zgd&hK8YD@;dCc7wpg3FCPbBY~=#-Y*L*rFseB)|Tp^{PBfozsQrCh0GY!WI(3jI_v z$|rhU+%lOuGVVapzb6i{IyJzWwq9_p@r~z7Dv+-{ViGeAX7Q0*A}JdL`7WBBS)>)d zU#tB8*JySrdiVAYzy9=>@BVu7@A1WKGClc$Mdr!yAIr+m zHv<`ZK^Qkh2bO7E%YCal#1|DpRZrFB{Ozim0V~V-emc6pyt=@G7^ZhUGZyMg%I8s| z_h_1qx?ihSDu7+5@xuBoMjrIKuM^|tVbpiWw}km|I=XxKJel4Om}b%>lo0IP-HZOb zsCu+wu&S*d)Gbr+e67)NF?*!RitS(*ZHMnBv)SafV?NL`%!fX+Dn!>BR7=KGYK^ER z18PC`18!Y^yVRepTpj@OZh45f?GROt4aq%s2;8x+fn13X%~#E9-AcfXuQd-$7%GSTk7uwMG+gPOcro>gEl}NffROGU1E%YJE&cz@=SwjZK zQec38a};1 ziz_VwhPIQIRQyI_f&tq^=;ccj>|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