diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Contents.json new file mode 100644 index 0000000000..e779fe6aa0 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Size=24px, Form=Crossed Out.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Size=24px, Form=Crossed Out.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Size=24px, Form=Crossed Out.pdf new file mode 100644 index 0000000000..e9b835155e --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOff.imageset/Size=24px, Form=Crossed Out.pdf @@ -0,0 +1,154 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 3.334961 3.205200 cm +0.000000 0.000000 0.000000 scn +1.135226 17.265064 m +0.875527 17.524763 0.454473 17.524763 0.194774 17.265064 c +-0.064925 17.005365 -0.064925 16.584312 0.194774 16.324614 c +16.194775 0.324612 l +16.454473 0.064913 16.875528 0.064913 17.135227 0.324612 c +17.394926 0.584311 17.394926 1.005365 17.135227 1.265064 c +12.830019 5.570272 l +12.830019 13.983986 l +12.830019 14.015613 l +12.830019 14.015624 l +12.830019 14.015635 l +12.830032 14.503068 12.830044 14.912857 12.802612 15.227474 c +12.776955 15.521744 12.718998 15.904229 12.465319 16.192802 c +12.149200 16.552406 11.677307 16.734844 11.201504 16.681402 c +10.819681 16.638517 10.519508 16.394487 10.302576 16.194004 c +10.070641 15.979656 9.794991 15.676425 9.467113 15.315740 c +9.467100 15.315726 l +9.445833 15.292332 l +6.911015 12.504032 l +6.870810 12.459918 l +6.811123 12.459843 l +6.165019 12.459843 l +6.142232 12.459843 l +6.073141 12.459844 6.005919 12.459845 5.940522 12.459769 c +1.135226 17.265064 l +h +7.233788 11.166502 m +11.500019 6.900272 l +11.500019 13.983986 l +11.500019 14.511434 11.499405 14.862314 11.477638 15.111951 c +11.466372 15.241177 11.451292 15.307449 11.443966 15.335070 c +11.425201 15.348596 11.403254 15.357081 11.380270 15.359694 c +11.356270 15.344185 11.300531 15.305291 11.205269 15.217251 c +11.021238 15.047175 10.784756 14.787958 10.429955 14.397677 c +7.895135 11.609377 l +7.876595 11.588863 l +7.810806 11.515877 7.711236 11.405414 7.585287 11.322339 c +7.477557 11.251281 7.358773 11.198621 7.233788 11.166502 c +h +3.310589 11.708820 m +4.251275 10.768134 l +4.114416 10.639646 4.004863 10.482502 3.931640 10.305725 c +3.894677 10.216489 3.864227 10.088942 3.847507 9.843886 c +3.830379 9.592858 3.830019 9.269883 3.830019 8.794843 c +3.830019 8.319802 3.830379 7.996826 3.847507 7.745799 c +3.864227 7.500744 3.894677 7.373197 3.931640 7.283960 c +4.067135 6.956848 4.327024 6.696958 4.654137 6.561463 c +4.743373 6.524501 4.870920 6.494050 5.115975 6.477330 c +5.367003 6.460203 5.689979 6.459843 6.165019 6.459843 c +6.811123 6.459843 l +6.838768 6.459923 l +6.838777 6.459923 l +6.937038 6.460339 7.085750 6.460968 7.231940 6.423656 c +7.357602 6.391583 7.477026 6.338754 7.585287 6.267346 c +7.711238 6.184271 7.810808 6.073807 7.876598 6.000819 c +7.895135 5.980309 l +10.429956 3.192006 l +10.784756 2.801725 11.021238 2.542509 11.205269 2.372434 c +11.300533 2.284393 11.356270 2.245500 11.380270 2.229990 c +11.403254 2.232603 11.425201 2.241089 11.443966 2.254616 c +11.451292 2.282236 11.466372 2.348508 11.477638 2.477734 c +11.498196 2.713500 11.499886 3.039571 11.500010 3.519400 c +12.789057 2.230352 l +12.756243 1.959896 12.682524 1.643966 12.465319 1.396881 c +12.149200 1.037277 11.677307 0.854841 11.201504 0.908281 c +10.819681 0.951166 10.519508 1.195196 10.302576 1.395679 c +10.070659 1.610013 9.795034 1.913215 9.467189 2.273863 c +9.467137 2.273917 l +9.467127 2.273929 l +9.445835 2.297351 l +6.911015 5.085653 l +6.870807 5.129766 l +6.811123 5.129843 l +6.165019 5.129843 l +6.142203 5.129843 l +6.142138 5.129843 l +5.695606 5.129837 5.327103 5.129832 5.025440 5.150415 c +4.712668 5.171756 4.423473 5.217425 4.145168 5.332704 c +3.492168 5.603185 2.973361 6.121991 2.702880 6.774991 c +2.587602 7.053297 2.541932 7.342492 2.520592 7.655264 c +2.500008 7.956944 2.500013 8.325469 2.500019 8.772034 c +2.500019 8.772048 l +2.500019 8.794843 l +2.500019 8.817637 l +2.500019 8.817652 l +2.500013 9.264216 2.500008 9.632744 2.520592 9.934422 c +2.541932 10.247193 2.587602 10.536388 2.702880 10.814693 c +2.843596 11.154413 3.051523 11.457811 3.310589 11.708820 c +h +f* +n +Q + +endstream +endobj + +3 0 obj + 3618 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000003708 00000 n +0000003731 00000 n +0000003904 00000 n +0000003978 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +4037 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Contents.json new file mode 100644 index 0000000000..15ffaff036 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Size=24px, Form=Unmuted.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Size=24px, Form=Unmuted.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Size=24px, Form=Unmuted.pdf new file mode 100644 index 0000000000..c08e61fa8a --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/SoundOn.imageset/Size=24px, Form=Unmuted.pdf @@ -0,0 +1,168 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 2.335022 4.015747 cm +0.000000 0.000000 0.000000 scn +8.880250 14.549129 m +8.856250 14.533619 8.800512 14.494725 8.705249 14.406685 c +8.521219 14.236609 8.284736 13.977392 7.929935 13.587111 c +5.395117 10.798811 l +5.376577 10.778297 l +5.310788 10.705311 5.211218 10.594849 5.085268 10.511773 c +4.977008 10.440365 4.857584 10.387536 4.731922 10.355463 c +4.585728 10.318150 4.437013 10.318780 4.338751 10.319197 c +4.311104 10.319277 l +3.665000 10.319277 l +3.189960 10.319277 2.866984 10.318916 2.615956 10.301789 c +2.370902 10.285069 2.243355 10.254620 2.154118 10.217656 c +1.827006 10.082161 1.567116 9.822271 1.431621 9.495159 c +1.394658 9.405923 1.364208 9.278376 1.347488 9.033321 c +1.330361 8.782293 1.330000 8.459317 1.330000 7.984277 c +1.330000 7.509236 1.330361 7.186260 1.347488 6.935233 c +1.364208 6.690178 1.394658 6.562631 1.431621 6.473394 c +1.567116 6.146282 1.827006 5.886392 2.154118 5.750897 c +2.243355 5.713935 2.370902 5.683484 2.615956 5.666764 c +2.866984 5.649637 3.189960 5.649277 3.665000 5.649277 c +4.311104 5.649277 l +4.338750 5.649357 l +4.338758 5.649357 l +4.437019 5.649773 4.585731 5.650402 4.731922 5.613091 c +4.857584 5.581017 4.977008 5.528188 5.085268 5.456780 c +5.211219 5.373705 5.310790 5.263241 5.376579 5.190253 c +5.395117 5.169743 l +7.929937 2.381440 l +8.284738 1.991159 8.521220 1.731943 8.705249 1.561868 c +8.800513 1.473827 8.856250 1.434934 8.880250 1.419424 c +8.903234 1.422037 8.925182 1.430523 8.943947 1.444050 c +8.951273 1.471670 8.966352 1.537942 8.977619 1.667168 c +8.999385 1.916805 9.000000 2.267685 9.000000 2.795134 c +9.000000 13.173420 l +9.000000 13.700868 8.999385 14.051748 8.977619 14.301385 c +8.966352 14.430611 8.951273 14.496883 8.943947 14.524504 c +8.925182 14.538030 8.903234 14.546515 8.880250 14.549129 c +h +8.701484 15.870837 m +9.177288 15.924278 9.649181 15.741840 9.965300 15.382237 c +10.218978 15.093663 10.276936 14.711178 10.302592 14.416908 c +10.330024 14.102285 10.330013 13.692489 10.330000 13.205047 c +10.330000 13.173420 l +10.330000 2.795134 l +10.330000 2.763506 l +10.330013 2.276065 10.330024 1.866267 10.302592 1.551645 c +10.276936 1.257376 10.218978 0.874890 9.965300 0.586316 c +9.649181 0.226712 9.177288 0.044276 8.701484 0.097716 c +8.319662 0.140601 8.019489 0.384631 7.802558 0.585114 c +7.570635 0.799452 7.295002 1.102662 6.967146 1.463323 c +6.967119 1.463351 l +6.967109 1.463363 l +6.945817 1.486785 l +4.410996 4.275087 l +4.370789 4.319201 l +4.311104 4.319277 l +3.665000 4.319277 l +3.642185 4.319277 l +3.642120 4.319277 l +3.195587 4.319271 2.827084 4.319266 2.525422 4.339849 c +2.212649 4.361190 1.923455 4.406859 1.645149 4.522138 c +0.992149 4.792619 0.473343 5.311425 0.202861 5.964425 c +0.087583 6.242731 0.041913 6.531926 0.020573 6.844698 c +-0.000010 7.146378 -0.000006 7.514905 0.000000 7.961471 c +0.000000 7.961482 l +0.000000 7.984277 l +0.000000 8.007071 l +0.000000 8.007083 l +-0.000006 8.453649 -0.000010 8.822176 0.020573 9.123856 c +0.041913 9.436628 0.087583 9.725822 0.202861 10.004128 c +0.473343 10.657127 0.992149 11.175934 1.645149 11.446416 c +1.923455 11.561693 2.212649 11.607364 2.525422 11.628704 c +2.827105 11.649288 3.195639 11.649282 3.642213 11.649277 c +3.665000 11.649277 l +4.311104 11.649277 l +4.370791 11.649353 l +4.410996 11.693466 l +6.945815 14.481766 l +6.967082 14.505160 l +6.967096 14.505176 l +7.294973 14.865860 7.570623 15.169090 7.802557 15.383438 c +8.019489 15.583921 8.319662 15.827952 8.701484 15.870837 c +h +13.128227 12.048983 m +13.425354 12.264858 13.841225 12.198990 14.057100 11.901863 c +14.884413 10.763165 15.330000 9.391785 15.330000 7.984276 c +15.330000 6.576766 14.884413 5.205387 14.057098 4.066689 c +13.841223 3.769561 13.425352 3.703693 13.128225 3.919569 c +12.831099 4.135445 12.765230 4.551315 12.981106 4.848443 c +13.643330 5.759914 14.000000 6.857635 14.000000 7.984276 c +14.000000 9.110916 13.643330 10.208637 12.981108 11.120110 c +12.765232 11.417236 12.831100 11.833107 13.128227 12.048983 c +h +17.293169 14.253003 m +17.077293 14.550130 16.661423 14.615997 16.364296 14.400123 c +16.067169 14.184247 16.001301 13.768376 16.217176 13.471249 c +17.375912 11.876387 18.000002 9.955633 18.000000 7.984275 c +18.000000 6.012918 17.375910 4.092164 16.217175 2.497302 c +16.001299 2.200174 16.067167 1.784305 16.364294 1.568429 c +16.661421 1.352553 17.077291 1.418420 17.293167 1.715547 c +18.616993 3.537637 19.330000 5.732049 19.330002 7.984275 c +19.330002 10.236501 18.616995 12.430913 17.293169 14.253003 c +h +f* +n +Q + +endstream +endobj + +3 0 obj + 4506 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000004596 00000 n +0000004619 00000 n +0000004792 00000 n +0000004866 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +4925 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index b49b185f73..f2004f17af 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -6499,8 +6499,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G |> deliverOnMainQueue).start(next: { actions in if let strongSelf = self, !actions.options.isEmpty { if let banAuthor = actions.banAuthor { - strongSelf.presentBanMessageOptions(accountPeerId: strongSelf.context.account.peerId, author: banAuthor, messageIds: messageIds, options: actions.options) - completion(.default) + if let contextController = contextController { + contextController.dismiss(completion: { + guard let strongSelf = self else { + return + } + strongSelf.presentBanMessageOptions(accountPeerId: strongSelf.context.account.peerId, author: banAuthor, messageIds: messageIds, options: actions.options) + }) + } else { + strongSelf.presentBanMessageOptions(accountPeerId: strongSelf.context.account.peerId, author: banAuthor, messageIds: messageIds, options: actions.options) + completion(.default) + } } else { var isAction = false if messages.count == 1 { @@ -14901,9 +14910,16 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G actionSheet?.dismissAnimated() }) ])]) - self.chatDisplayNode.dismissInput() - self.present(actionSheet, in: .window(.root)) - completion(.default) + + if let contextController = contextController { + contextController.dismiss(completion: { [weak self] in + self?.present(actionSheet, in: .window(.root)) + }) + } else { + self.chatDisplayNode.dismissInput() + self.present(actionSheet, in: .window(.root)) + completion(.default) + } } } diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 3dc12ce014..2477ad8aef 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1802,7 +1802,7 @@ private final class ChatDeleteMessageContextItemNode: ASDisplayNode, ContextMenu self.statusNode.attributedText = NSAttributedString(string: stringForRemainingTime(Int32(max(0.0, self.item.timestamp - Date().timeIntervalSince1970)), strings: presentationData.strings), font: subtextFont, textColor: presentationData.theme.contextMenu.destructiveColor) let sideInset: CGFloat = 16.0 - let statusSize = self.statusNode.updateLayout(CGSize(width: size.width - sideInset - 32.0, height: .greatestFiniteMagnitude)) + let statusSize = self.statusNode.updateLayout(CGSize(width: size.width - sideInset - 32.0 + 4.0, height: .greatestFiniteMagnitude)) transition.updateFrameAdditive(node: self.statusNode, frame: CGRect(origin: CGPoint(x: self.statusNode.frame.minX, y: self.statusNode.frame.minY), size: statusSize)) } @@ -1821,7 +1821,7 @@ private final class ChatDeleteMessageContextItemNode: ASDisplayNode, ContextMenu } let textSize = self.textNode.updateLayout(CGSize(width: constrainedWidth - sideInset - rightTextInset, height: .greatestFiniteMagnitude)) - let statusSize = self.statusNode.updateLayout(CGSize(width: constrainedWidth - sideInset - rightTextInset - textIconSize.width - 2.0, height: .greatestFiniteMagnitude)) + let statusSize = self.statusNode.updateLayout(CGSize(width: constrainedWidth - sideInset - rightTextInset - textIconSize.width + 2.0, height: .greatestFiniteMagnitude)) let verticalSpacing: CGFloat = 2.0 let combinedTextHeight = textSize.height + verticalSpacing + statusSize.height diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 5e7baa394a..761a74729b 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3615,7 +3615,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate if !isSoundEnabled { items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_EnableSound, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Unmute"), color: theme.contextMenu.primaryColor) + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SoundOn"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.default) @@ -3628,7 +3628,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate }))) } else { items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_DisableSound, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor) + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SoundOff"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.default) @@ -3664,7 +3664,22 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate return context.engine.peers.updatePeerDisplayPreviewsSetting(peerId: peerId, displayPreviews: displayPreviews) |> deliverOnMainQueue } - let exceptionController = notificationPeerExceptionController(context: context, updatedPresentationData: strongSelf.controller?.updatedPresentationData, peer: peer, mode: .users([:]), edit: true, updatePeerSound: { peerId, sound in + let mode: NotificationExceptionMode + if let _ = peer as? TelegramUser { + mode = .users([:]) + } else if let _ = peer as? TelegramSecretChat { + mode = .users([:]) + } else if let channel = peer as? TelegramChannel { + if case .broadcast = channel.info { + mode = .channels([:]) + } else { + mode = .groups([:]) + } + } else { + mode = .groups([:]) + } + + let exceptionController = notificationPeerExceptionController(context: context, updatedPresentationData: strongSelf.controller?.updatedPresentationData, peer: peer, mode: mode, edit: true, updatePeerSound: { peerId, sound in let _ = (updatePeerSound(peer.id, sound) |> deliverOnMainQueue).start(next: { _ in