From 515ef8cfc52917ccc7d4298ae9368887ea76ec8f Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 4 Apr 2023 16:19:22 +0400 Subject: [PATCH] Folder improvements --- .../Sources/ChatFolderLinkPreviewScreen.swift | 34 +++++++++++++++-- .../Animations/anim_add_to_folder.json | 1 + .../Sources/UndoOverlayControllerNode.swift | 37 ++++++++++++------- 3 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 submodules/TelegramUI/Resources/Animations/anim_add_to_folder.json diff --git a/submodules/TelegramUI/Components/ChatFolderLinkPreviewScreen/Sources/ChatFolderLinkPreviewScreen.swift b/submodules/TelegramUI/Components/ChatFolderLinkPreviewScreen/Sources/ChatFolderLinkPreviewScreen.swift index a3bbd80f3b..12f07d8485 100644 --- a/submodules/TelegramUI/Components/ChatFolderLinkPreviewScreen/Sources/ChatFolderLinkPreviewScreen.swift +++ b/submodules/TelegramUI/Components/ChatFolderLinkPreviewScreen/Sources/ChatFolderLinkPreviewScreen.swift @@ -896,7 +896,7 @@ private final class ChatFolderLinkPreviewScreenComponent: Component { contentTransition.setFrame(view: self.itemContainerView, frame: CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: CGSize(width: availableSize.width - sideInset * 2.0, height: itemsHeight))) var initialContentHeight = contentHeight - initialContentHeight += min(itemsHeight, floor(singleItemHeight * 2.5)) + initialContentHeight += min(itemsHeight, floor(singleItemHeight * 3.5)) contentHeight += itemsHeight contentHeight += 24.0 @@ -980,6 +980,10 @@ private final class ChatFolderLinkPreviewScreenComponent: Component { var chatListController: ChatListController? if let navigationController = controller.navigationController as? NavigationController { for viewController in navigationController.viewControllers.reversed() { + if viewController is ChatFolderLinkPreviewScreen { + continue + } + if let rootController = viewController as? TabBarController { for c in rootController.controllers { if let c = c as? ChatListController { @@ -1083,7 +1087,17 @@ private final class ChatFolderLinkPreviewScreenComponent: Component { //TODO:localize let presentationData = context.sharedContext.currentPresentationData.with({ $0 }) + + var isUpdates = false if case .updates = component.subject { + isUpdates = true + } else { + if component.linkContents?.localFilterId != nil { + isUpdates = true + } + } + + if isUpdates { let chatCountString: String if result.newChatCount == 1 { chatCountString = "1 new chat" @@ -1091,7 +1105,7 @@ private final class ChatFolderLinkPreviewScreenComponent: Component { chatCountString = "\(result.newChatCount) new chats" } - chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Updated", text: "You have joined \(chatCountString)", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current) + chatListController.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_add_to_folder", scale: 0.1, colors: ["__allcolors__": UIColor.white], title: "Folder \(result.title) Updated", text: "You have joined \(chatCountString)", customUndoText: nil, timeout: 5), elevatedLayout: false, action: { _ in true }), in: .current) } else if result.newChatCount != 0 { let chatCountString: String if result.newChatCount == 1 { @@ -1100,9 +1114,21 @@ private final class ChatFolderLinkPreviewScreenComponent: Component { chatCountString = "\(result.newChatCount) chats" } - chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Added", text: "You also joined \(chatCountString)", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current) + let animationBackgroundColor: UIColor + if presentationData.theme.overallDarkAppearance { + animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor + } else { + animationBackgroundColor = UIColor(rgb: 0x474747) + } + chatListController.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_success", scale: 1.0, colors: ["info1.info1.stroke": animationBackgroundColor, "info2.info2.Fill": animationBackgroundColor], title: "Folder \(result.title) Added", text: "You also joined \(chatCountString)", customUndoText: nil, timeout: 5), elevatedLayout: false, action: { _ in true }), in: .current) } else { - chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "Folder \(result.title) Added", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current) + let animationBackgroundColor: UIColor + if presentationData.theme.overallDarkAppearance { + animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor + } else { + animationBackgroundColor = UIColor(rgb: 0x474747) + } + chatListController.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_success", scale: 1.0, colors: ["info1.info1.stroke": animationBackgroundColor, "info2.info2.Fill": animationBackgroundColor], title: "Folder \(result.title) Added", text: "", customUndoText: nil, timeout: 5), elevatedLayout: false, action: { _ in true }), in: .current) } }) } diff --git a/submodules/TelegramUI/Resources/Animations/anim_add_to_folder.json b/submodules/TelegramUI/Resources/Animations/anim_add_to_folder.json new file mode 100644 index 0000000000..d6a6f34a0c --- /dev/null +++ b/submodules/TelegramUI/Resources/Animations/anim_add_to_folder.json @@ -0,0 +1 @@ +{"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.20","a":"","k":"","d":"","tc":""},"fr":60,"ip":0,"op":57,"w":400,"h":350,"nm":"Folder New 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Folder Front","parent":3,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[57.78,31.05,0],"ix":2},"a":{"a":0,"k":[57.78,31.05,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.3,"y":1},"o":{"x":0.3,"y":0},"t":14,"s":[{"i":[[0,0],[2.227,-6.498],[0,0],[0,-1.195],[-11.046,0],[0,0],[-2.227,6.498],[0,0],[0,1.195],[11.046,0]],"o":[[-9.176,0],[0,0],[-0.397,1.159],[0,8.063],[0,0],[9.176,0],[0,0],[0.397,-1.159],[0,-8.063],[0,0]],"v":[[-12.096,6.216],[-31.498,17.271],[-48.512,66.908],[-49.11,70.451],[-29.11,85.05],[127.657,85.05],[147.059,73.994],[163.661,26.719],[164.259,23.176],[144.259,8.577]],"c":true}]},{"i":{"x":0.5,"y":1},"o":{"x":0.4,"y":0},"t":27,"s":[{"i":[[0,0],[5.516,-7.616],[0,0],[0,-1.636],[-11.046,0],[0,0],[-3.702,4.718],[0,0],[-0.287,1.611],[17.899,0.533]],"o":[[-13.886,0.099],[0,0],[-0.397,1.588],[0,11.046],[0,0],[9.176,0],[0,0],[1.817,-2.298],[2.019,-11.354],[0,0]],"v":[[15.169,-0.792],[-12.083,14.287],[-46.038,57.422],[-49.11,65.05],[-29.11,85.05],[127.657,85.05],[147.059,69.904],[179.824,27.398],[186.808,16.342],[164.086,-0.858]],"c":true}]},{"i":{"x":0.4,"y":1},"o":{"x":0.167,"y":0},"t":41,"s":[{"i":[[0,0],[2.227,-8.902],[0,0],[0,-1.636],[-11.046,0],[0,0],[-2.227,8.902],[0,0],[0,1.636],[11.046,0]],"o":[[-9.176,0],[0,0],[-0.397,1.588],[0,11.046],[0,0],[9.176,0],[0,0],[0.397,-1.588],[0,-11.046],[0,0]],"v":[[-19.91,-30.122],[-39.312,-14.977],[-48.512,60.196],[-49.11,65.05],[-29.11,85.05],[127.657,85.05],[147.059,69.904],[156.259,-5.268],[156.857,-10.122],[136.857,-30.122]],"c":true}]},{"t":57,"s":[{"i":[[0,0],[2.227,-8.902],[0,0],[0,-1.636],[-11.046,0],[0,0],[-2.227,8.902],[0,0],[0,1.636],[11.046,0]],"o":[[-9.176,0],[0,0],[-0.397,1.588],[0,11.046],[0,0],[9.176,0],[0,0],[0.397,-1.588],[0,-11.046],[0,0]],"v":[[-12.096,-22.95],[-31.498,-7.804],[-48.512,60.196],[-49.11,65.05],[-29.11,85.05],[127.657,85.05],[147.059,69.904],[164.072,1.904],[164.671,-2.95],[144.671,-22.95]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Paper","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.3],"y":[0]},"t":0,"s":[-140]},{"t":41,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.4,"y":1},"o":{"x":0.3,"y":0},"t":5,"s":[63,140,0],"to":[60,-107,0],"ti":[21.5,-66,0]},{"t":41,"s":[196.5,190.5,0]}],"ix":2},"a":{"a":0,"k":[5,-14.5,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.2,0.2,0.2],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":3,"s":[0,0,100]},{"t":25,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.817},"o":{"x":0.167,"y":0.183},"t":7,"s":[{"i":[[-0.65,-1.421],[0,0],[0.482,-2.258],[0,0],[0,1.563],[0,0],[-4.198,0.087],[-14.973,55.488]],"o":[[0,0],[0.908,1.763],[-11.843,55.532],[-3.639,0],[0,0],[0.536,-1.393],[0,0],[0.406,-1.503]],"v":[[16.939,-25.089],[21.552,-11.162],[22.384,-3.927],[-54.983,22.264],[-59.414,16.933],[-42.822,-9.049],[-38.427,-5.397],[12.23,-25.189]],"c":true}]},{"i":{"x":0.833,"y":0.817},"o":{"x":0.167,"y":0.183},"t":17,"s":[{"i":[[-0.228,-2.877],[0,0],[1.839,-2.538],[0,0],[0.228,2.877],[0,0],[-4.069,0.484],[-29.183,53.209]],"o":[[0,0],[0.379,3.64],[-24.239,33.437],[-3.538,0.28],[0,0],[0.318,-2.605],[0,0],[1.116,-2.034]],"v":[[35.765,-62.31],[46.729,-6.432],[43.267,-0.275],[-48.859,12.248],[-55.678,7.547],[-43.336,-41.567],[-38.388,-45.142],[31.343,-65.757]],"c":true}]},{"i":{"x":0.833,"y":0.817},"o":{"x":0.167,"y":0.183},"t":27,"s":[{"i":[[-0.659,-4.349],[16.896,-32.916],[4.752,-2.294],[0,0],[-0.022,5.209],[1.273,23.429],[-4.286,0.455],[-17.457,21.461]],"o":[[0,0],[-1.699,3.31],[-9.471,15.247],[-6.85,1.014],[0,0],[-0.24,-4.418],[0,0],[3.617,-1.401]],"v":[[97.835,-46.729],[88.2,16.307],[79.81,26.213],[-55.106,58.355],[-66.276,49.585],[-46.927,-9.122],[-44.085,-19.527],[91.651,-50.567]],"c":true}]},{"i":{"x":0.4,"y":1},"o":{"x":0.167,"y":0.183},"t":34,"s":[{"i":[[1.564,-9.117],[0,0],[6.889,-0.844],[0,0],[-1.33,6.325],[0,0],[-7.219,0.656],[0,0]],"o":[[0,0],[-1.623,3.404],[0,0],[-8.918,-0.04],[0,0],[1.783,-3.832],[0,0],[5.358,0]],"v":[[161.863,-8.438],[128.764,51.308],[115.565,62.55],[-44.616,78.002],[-58.265,63.015],[-27.343,5.488],[-11.35,-6.154],[149.641,-22.078]],"c":true}]},{"t":41,"s":[{"i":[[0,-5.355],[0,0],[7.172,-0.931],[0,0],[0,5.355],[0,0],[-7.528,0.723],[0,0]],"o":[[0,0],[-1.755,3.475],[0,0],[-5.515,0],[0,0],[1.928,-3.947],[0,0],[5.515,0]],"v":[[156,-12.514],[140.83,61.269],[126.876,71.495],[-26.81,70.997],[-36.796,61.3],[-23.93,-13.814],[-8.917,-24.04],[146.014,-22.211]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[5,-14.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":20,"op":33,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Folder Far","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.4],"y":[1]},"o":{"x":[0.3],"y":[0]},"t":8,"s":[10]},{"i":{"x":[0.7],"y":[1]},"o":{"x":[0.6],"y":[0]},"t":27,"s":[-10]},{"i":{"x":[0.4],"y":[1]},"o":{"x":[0.3],"y":[0]},"t":43,"s":[5]},{"t":54,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.4,"y":1},"o":{"x":0.3,"y":0},"t":3,"s":[147.274,211.361,0],"to":[62.976,-21.111,0],"ti":[0,0,0]},{"i":{"x":0.647,"y":1},"o":{"x":0.6,"y":0},"t":24,"s":[197.774,139.611,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.347,"y":1},"o":{"x":0.281,"y":0},"t":40,"s":[249.274,169.361,0],"to":[0,0,0],"ti":[0,0,0]},{"t":52,"s":[234.274,153.861,0]}],"ix":2},"a":{"a":0,"k":[34.274,-21.139,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.2,0.2,0.2],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":2,"s":[40,0,100]},{"t":18,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.3,"y":1},"o":{"x":0.3,"y":0},"t":13,"s":[{"i":[[0,0],[-11.641,-0.603],[0,0],[-3.346,-2.144],[0,0],[-4.559,-0.236],[0,0],[0.179,-3.451],[0,0],[5.246,0],[0,0],[3.437,-10.77],[0,0]],"o":[[0.4,-7.669],[0,0],[4.559,0.236],[0,0],[3.346,2.144],[0,0],[5.239,0.272],[0,0],[-1.081,2.903],[0,0],[-14.946,0],[0,0],[0,0]],"v":[[-31.343,-23.38],[-9.543,-36.173],[52.203,-34.019],[64.458,-30.329],[77.186,-22.173],[89.441,-18.482],[151.238,-14.104],[159.509,-7.163],[158.328,-2.715],[147.415,-0.44],[-7.364,-2.697],[-36.675,13.091],[-53.574,55.488]],"c":true}]},{"i":{"x":0.5,"y":1},"o":{"x":0.4,"y":0},"t":30,"s":[{"i":[[0,0],[-11.045,0.001],[0,0],[-3.271,-2.83],[0,0],[-4.326,0],[0,0],[0,-4.971],[0,0],[4.971,0],[0,0],[2.948,-13.852],[0,0]],"o":[[0.002,-11.045],[0,0],[4.326,0],[0,0],[3.271,2.83],[0,0],[4.971,0],[0,0],[0,4.971],[0,0],[-14.162,0],[0,0],[0,0]],"v":[[-64.694,-61.634],[-44.692,-81.634],[23.101,-81.634],[34.879,-77.246],[46.309,-70.961],[58.086,-66.573],[123.293,-66.573],[133.279,-57.406],[132.954,-51.02],[121.043,-44.289],[-25.669,-44.289],[-54.929,-21.027],[-65.353,60.809]],"c":true}]},{"t":42,"s":[{"i":[[0,0],[-11.045,0.001],[0,0],[-3.271,-2.83],[0,0],[-4.326,0],[0,0],[0,-4.971],[0,0],[4.971,0],[0,0],[2.948,-13.852],[0,0]],"o":[[0.002,-11.045],[0,0],[4.326,0],[0,0],[3.271,2.83],[0,0],[4.971,0],[0,0],[0,4.971],[0,0],[-14.162,0],[0,0],[0,0]],"v":[[-64.723,-65.95],[-44.721,-85.95],[23.072,-85.95],[34.85,-81.562],[47.295,-70.794],[59.072,-66.406],[124.279,-66.406],[133.279,-57.406],[133.279,-49.95],[124.279,-40.95],[-22.434,-40.95],[-51.777,-17.195],[-64.73,43.672]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Arrow 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.554],"y":[0.744]},"o":{"x":[0.3],"y":[0]},"t":0,"s":[-76]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.3],"y":[0.114]},"t":14,"s":[-28]},{"t":30,"s":[55]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.4,"y":0.499},"o":{"x":0.3,"y":0},"t":0,"s":[41.503,199.029,0],"to":[-0.503,-44.029,0],"ti":[-45.497,2.029,0]},{"i":{"x":0.3,"y":1},"o":{"x":0.3,"y":0.252},"t":15,"s":[119.503,79.029,0],"to":[101.497,-6.029,0],"ti":[0,0,0]},{"t":36,"s":[278.503,205.029,0]}],"ix":2},"a":{"a":0,"k":[-125.497,4.029,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.3,"y":1},"o":{"x":0.3,"y":0},"t":0,"s":[{"i":[[0,0],[0,0],[0,-0.041],[0,0],[-0.041,0],[0,0],[0,0],[-0.023,-0.023],[-0.048,0.048],[0,0],[0,0],[0.043,0.043],[0,0],[0.033,0],[0,-0.068]],"o":[[0,0],[-0.041,0],[0,0],[0,0.041],[0,0],[0,0],[0,0.033],[0.048,0.048],[0,0],[0,0],[0.033,-0.048],[0,0],[-0.023,-0.023],[-0.068,0],[0,0]],"v":[[-131.34,3.057],[-132.056,3.057],[-132.13,3.131],[-132.13,3.96],[-132.056,4.034],[-131.34,4.034],[-131.339,4.606],[-131.303,4.694],[-131.128,4.694],[-129.947,3.623],[-129.932,3.605],[-129.947,3.448],[-131.128,2.34],[-131.215,2.304],[-131.339,2.428]],"c":true}]},{"i":{"x":0.3,"y":1},"o":{"x":0.3,"y":0},"t":4,"s":[{"i":[[0,0],[0,0],[0,-1.32],[0,0],[-1.175,0],[0,0],[0,0],[-0.665,-0.747],[-1.386,1.555],[0,0],[0,0],[1.234,1.38],[0,0],[0.94,0],[0,-2.199]],"o":[[0,0],[-1.175,0],[0,0],[0,1.32],[0,0],[0,0],[0,1.056],[1.385,1.556],[0,0],[0,0],[0.957,-1.552],[0,0],[-0.665,-0.746],[-1.959,0],[0,0]],"v":[[-144.335,-11.532],[-161.017,-13.498],[-163.145,-11.108],[-163.145,15.681],[-161.017,18.071],[-144.335,20.036],[-144.292,38.503],[-143.254,41.318],[-138.238,41.32],[-104.263,6.735],[-103.848,6.183],[-104.263,1.105],[-138.239,-34.663],[-140.746,-35.828],[-144.292,-31.846]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.3,"y":0},"t":8,"s":[{"i":[[0,0],[0,0],[0,-1.265],[0,0],[-1.46,0],[0,0],[0,0],[-0.826,-0.716],[-1.721,1.49],[0,0],[0,0],[1.532,1.322],[0,0],[1.168,0],[0,-2.108]],"o":[[0,0],[-1.46,0],[0,0],[0,1.265],[0,0],[0,0],[0,1.012],[1.72,1.491],[0,0],[0,0],[1.189,-1.488],[0,0],[-0.826,-0.715],[-2.433,0],[0,0]],"v":[[-145.887,-10.908],[-179.424,-13.016],[-182.067,-10.726],[-182.067,14.953],[-179.424,17.243],[-145.887,19.351],[-145.834,37.052],[-144.544,39.75],[-138.314,39.752],[-96.114,6.602],[-95.6,6.073],[-96.115,1.206],[-138.315,-33.08],[-141.429,-34.196],[-145.834,-30.379]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":11,"s":[{"i":[[0,0],[0,0],[0,-1.483],[0,0],[-1.559,0],[0,0],[0,0],[-0.882,-0.839],[-1.838,1.747],[0,0],[0,0],[1.636,1.55],[0,0],[1.247,0],[0,-2.471]],"o":[[0,0],[-1.559,0],[0,0],[0,1.483],[0,0],[0,0],[0,1.186],[1.837,1.748],[0,0],[0,0],[1.269,-1.744],[0,0],[-0.882,-0.838],[-2.598,0],[0,0]],"v":[[-144.997,-13.394],[-186.36,-13.8],[-189.183,-11.115],[-189.183,18.988],[-186.36,21.673],[-144.997,22.078],[-144.94,42.829],[-143.563,45.992],[-136.91,45.994],[-91.843,7.132],[-91.294,6.512],[-91.844,0.806],[-136.911,-39.386],[-140.236,-40.695],[-144.94,-36.22]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":15,"s":[{"i":[[0,0],[0,0],[0.27,-1.827],[0,0],[-1.635,-0.301],[0,0],[0,0],[-0.772,-1.204],[-2.245,1.797],[0,0],[0,0],[1.434,2.227],[0,0],[1.308,0.241],[0.45,-3.045]],"o":[[0,0],[-1.635,-0.301],[0,0],[-0.27,1.827],[0,0],[0,0],[-0.216,1.462],[1.608,2.509],[0,0],[0,0],[1.648,-1.904],[0,0],[-0.773,-1.203],[-2.725,-0.502],[0,0]],"v":[[-139.957,-19.364],[-153.524,-22.444],[-156.972,-19.681],[-164.805,17.145],[-162.334,20.999],[-147.423,24.15],[-151.138,49.73],[-150.269,53.894],[-143.293,55.183],[-88.965,16.013],[-88.276,15.355],[-87.815,8.218],[-125.526,-50.094],[-128.775,-52.35],[-134.522,-47.746]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":17,"s":[{"i":[[0,0],[0,0],[1.08,-4.086],[0,0],[-2.412,-0.853],[0,0],[0,0],[-0.789,-1.192],[-2.786,3.065],[-8.056,15.524],[0,0],[1.493,2.181],[0,0],[1.31,0.222],[0.404,-3.05]],"o":[[0,0],[-1.892,4.665],[0,0],[-0.536,2.031],[0,0],[0,0],[0.601,1.66],[1.644,2.484],[21.698,-24.351],[1.126,-2.17],[0.694,-2.227],[-3.546,-4.57],[-0.79,-1.191],[-2.73,-0.462],[0,0]],"v":[[-145.719,-28.204],[-149.077,-20.175],[-154.116,-8.412],[-169.847,24.113],[-166.767,29.218],[-158.568,40.162],[-148.254,58.487],[-146.224,63.024],[-138.24,63.078],[-89.869,3.151],[-88.626,-0.617],[-91.143,-6.841],[-132.219,-50.996],[-136.144,-52.926],[-141.174,-48.516]],"c":true}]},{"t":20,"s":[{"i":[[0,0],[0,0],[2.181,-7.503],[0,0],[-3.602,-1.613],[0,0],[0,0],[-0.848,-1.152],[-3.513,5.044],[0.317,3.77],[0,0],[1.643,2.07],[0,0],[1.32,0.156],[0.251,-3.068]],"o":[[0,0],[-2.147,12.166],[0,0],[-0.879,2.352],[0,0],[0,0],[1.873,1.942],[1.767,2.399],[45.207,-64.911],[-0.18,-2.145],[-0.799,-2.731],[-8.99,-11.325],[-0.849,-1.151],[-2.751,-0.325],[0,0]],"v":[[-173.195,-36.843],[-172.839,-24.281],[-181.275,1.521],[-204.178,31.859],[-200.045,38.754],[-187.652,50.276],[-169.748,68.311],[-165.849,73.352],[-156.354,71.333],[-118.587,-21.06],[-120.379,-27.967],[-123.774,-34.313],[-171.113,-56.088],[-176.106,-57.42],[-179.938,-53.161]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path-5","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":1,"op":20,"st":5,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Arrow","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.3,"y":0},"t":35,"s":[21.503,179.029,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":45,"s":[98.503,179.029,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.471,"y":1},"o":{"x":0.3,"y":0},"t":51,"s":[70.503,179.029,0],"to":[0,0,0],"ti":[0,0,0]},{"t":57.087890625,"s":[74.503,179.029,0]}],"ix":2},"a":{"a":0,"k":[-125.497,4.029,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.4,0.4,0.4],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":35,"s":[0,60,100]},{"t":45,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.3,"y":0},"t":36.105,"s":[{"i":[[0,0],[0,0],[0,-1.657],[0,0],[-1.657,0],[0,0],[0,0],[-0.937,-0.938],[-1.953,1.952],[0,0],[0,0],[1.739,1.732],[0,0],[1.325,0],[0,-2.761]],"o":[[0,0],[-1.657,0],[0,0],[0,1.657],[0,0],[0,0],[0,1.326],[1.952,1.953],[0,0],[0,0],[1.349,-1.949],[0,0],[-0.938,-0.937],[-2.761,0],[0,0]],"v":[[-144.223,-15.381],[-173.23,-15.381],[-176.23,-12.381],[-176.23,21.257],[-173.23,24.257],[-144.223,24.257],[-144.162,47.445],[-142.699,50.979],[-135.628,50.981],[-87.731,7.556],[-87.147,6.863],[-87.732,0.487],[-135.629,-44.424],[-139.163,-45.887],[-144.163,-40.887]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":46,"s":[{"i":[[0,0],[0,0],[0,-1.657],[0,0],[-1.484,0],[0,0],[0,0],[-0.839,-0.938],[-1.75,1.952],[0,0],[0,0],[1.558,1.732],[0,0],[1.187,0],[0,-2.761]],"o":[[0,0],[-1.484,0],[0,0],[0,1.657],[0,0],[0,0],[0,1.326],[1.748,1.953],[0,0],[0,0],[1.208,-1.949],[0,0],[-0.84,-0.937],[-2.473,0],[0,0]],"v":[[-138.012,-16.631],[-153.694,-16.631],[-156.381,-13.631],[-156.381,23.507],[-153.694,26.507],[-138.012,26.507],[-138.118,54.195],[-136.807,57.729],[-130.473,57.731],[-90.03,7.669],[-89.507,6.976],[-90.03,0.6],[-130.474,-48.924],[-133.64,-50.387],[-138.118,-45.387]],"c":true}]},{"t":53,"s":[{"i":[[0,0],[0,0],[0,-1.657],[0,0],[-1.657,0],[0,0],[0,0],[-0.937,-0.938],[-1.953,1.952],[0,0],[0,0],[1.739,1.732],[0,0],[1.325,0],[0,-2.761]],"o":[[0,0],[-1.657,0],[0,0],[0,1.657],[0,0],[0,0],[0,1.326],[1.952,1.953],[0,0],[0,0],[1.349,-1.949],[0,0],[-0.938,-0.937],[-2.761,0],[0,0]],"v":[[-144.223,-15.381],[-161.73,-15.381],[-164.73,-12.381],[-164.73,21.257],[-161.73,24.257],[-144.223,24.257],[-144.223,51.945],[-142.76,55.479],[-135.689,55.481],[-87.731,7.556],[-87.147,6.863],[-87.732,0.487],[-135.689,-47.424],[-139.223,-48.887],[-144.223,-43.887]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path-5","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":125,"st":5,"bm":0}],"markers":[{"tm":60,"cm":"1","dr":0}]} \ No newline at end of file diff --git a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift index 94bdb4ae57..0d79b33c52 100644 --- a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift +++ b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift @@ -861,20 +861,31 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode { self.animationNode = AnimationNode(animation: animation, colors: colors, scale: scale) self.animatedStickerNode = nil - if let title = title { - self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(14.0), textColor: .white) - } else { - self.titleNode.attributedText = nil - } - - let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white) - let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white) - let link = MarkdownAttributeSet(font: Font.regular(14.0), textColor: undoTextColor) - let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { contents in - return ("URL", contents) - }), textAlignment: .natural) - self.textNode.attributedText = attributedText + if let title = title, text.isEmpty { + self.titleNode.attributedText = nil + let body = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white) + let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white) + let link = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: undoTextColor) + let attributedText = parseMarkdownIntoAttributedString(title, attributes: MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { contents in + return ("URL", contents) + }), textAlignment: .natural) + self.textNode.attributedText = attributedText + } else { + if let title = title { + self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(14.0), textColor: .white) + } else { + self.titleNode.attributedText = nil + } + + let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white) + let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white) + let link = MarkdownAttributeSet(font: Font.regular(14.0), textColor: undoTextColor) + let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { contents in + return ("URL", contents) + }), textAlignment: .natural) + self.textNode.attributedText = attributedText + } if text.contains("](") { isUserInteractionEnabled = true