mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Profile posts improvements
This commit is contained in:
parent
982311de7b
commit
79502b3d6f
@ -1686,9 +1686,7 @@ func _internal_updatePinnedToTopStories(account: Account, peerId: PeerId, ids: [
|
|||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
account.stateManager.injectStoryUpdates(updates: ids.map { id in
|
account.stateManager.injectStoryUpdates(updates: [.updatePinnedToTopList(peerId: peerId, ids: ids)])
|
||||||
return .updatePinnedToTopList(peerId: peerId, ids: ids)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return inputPeer
|
return inputPeer
|
||||||
|
@ -2404,6 +2404,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
|
|
||||||
case camera
|
case camera
|
||||||
case gallery(GalleryTransitionIn)
|
case gallery(GalleryTransitionIn)
|
||||||
|
case noAnimation
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class TransitionOut {
|
public final class TransitionOut {
|
||||||
@ -3603,6 +3604,10 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
|
|
||||||
if let transitionIn = self.controller?.transitionIn {
|
if let transitionIn = self.controller?.transitionIn {
|
||||||
switch transitionIn {
|
switch transitionIn {
|
||||||
|
case .noAnimation:
|
||||||
|
self.layer.allowsGroupOpacity = true
|
||||||
|
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
|
completion()
|
||||||
case .camera:
|
case .camera:
|
||||||
if let view = self.componentHost.view as? MediaEditorScreenComponent.View {
|
if let view = self.componentHost.view as? MediaEditorScreenComponent.View {
|
||||||
view.animateIn(from: .camera, completion: completion)
|
view.animateIn(from: .camera, completion: completion)
|
||||||
|
@ -1847,7 +1847,17 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||||||
|
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
let presentationData = self.presentationData
|
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 {
|
if updatedPinnedIds.count > 3 {
|
||||||
let presentationData = self.presentationData
|
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 {
|
} else {
|
||||||
let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone()
|
let _ = self.context.engine.messages.updatePinnedToTopStories(peerId: self.peerId, ids: Array(updatedPinnedIds)).startStandalone()
|
||||||
|
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
let presentationData = self.presentationData
|
let presentationData = self.presentationData
|
||||||
|
|
||||||
|
let toastTitle: String
|
||||||
|
let toastText: String
|
||||||
if selectedIds.count == 1 {
|
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 {
|
} 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 {
|
if let parentController = self.parentController as? PeerInfoScreen {
|
||||||
parentController.cancelItemSelection()
|
parentController.cancelItemSelection()
|
||||||
@ -2493,11 +2511,17 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||||||
|
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
let presentationData = self.presentationData
|
let presentationData = self.presentationData
|
||||||
|
|
||||||
|
let toastTitle: String?
|
||||||
|
let toastText: String
|
||||||
if selectedIds.count == 1 {
|
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 {
|
} 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 {
|
if let parentController = self.parentController as? PeerInfoScreen {
|
||||||
parentController.cancelItemSelection()
|
parentController.cancelItemSelection()
|
||||||
|
@ -5430,7 +5430,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
initialPrivacy: initialPrivacy,
|
initialPrivacy: initialPrivacy,
|
||||||
initialMediaAreas: initialMediaAreas,
|
initialMediaAreas: initialMediaAreas,
|
||||||
initialVideoPosition: videoPlaybackPosition,
|
initialVideoPosition: videoPlaybackPosition,
|
||||||
transitionIn: nil,
|
transitionIn: .noAnimation,
|
||||||
transitionOut: { finished, isNew in
|
transitionOut: { finished, isNew in
|
||||||
if repost && finished {
|
if repost && finished {
|
||||||
if let transitionOut = externalState.transitionOut?(externalState.storyTarget, externalState.isPeerArchived), let destinationView = transitionOut.destinationView {
|
if let transitionOut = externalState.transitionOut?(externalState.storyTarget, externalState.isPeerArchived), let destinationView = transitionOut.destinationView {
|
||||||
|
BIN
submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs
Normal file
BIN
submodules/TelegramUI/Resources/Animations/anim_toastpin.tgs
Normal file
Binary file not shown.
BIN
submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs
Normal file
BIN
submodules/TelegramUI/Resources/Animations/anim_toastunpin.tgs
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user