Various improvements

This commit is contained in:
Ilya Laktyushin
2022-07-13 12:15:10 +02:00
parent aa46e81a49
commit 9a115af042
53 changed files with 27836 additions and 27476 deletions

View File

@@ -1031,6 +1031,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
let botId = self.botId
let items = context.engine.messages.attachMenuBots()
|> take(1)
|> map { [weak self] attachMenuBots -> ContextController.Items in
var items: [ContextMenuItem] = []
@@ -1039,8 +1040,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
if self?.url == nil, let attachMenuBot = attachMenuBot, attachMenuBot.hasSettings {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_Settings, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Settings"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.default)
}, action: { [weak self] c, _ in
c.dismiss(completion: nil)
if let strongSelf = self {
strongSelf.controllerNode.sendSettingsButtonEvent()
@@ -1051,8 +1052,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
if peerId != botId {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_OpenBot, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Bots"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.default)
}, action: { [weak self] c, _ in
c.dismiss(completion: nil)
if let strongSelf = self, let navigationController = strongSelf.getNavigationController() {
strongSelf.dismiss()
@@ -1063,8 +1064,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_ReloadPage, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reload"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.default)
}, action: { [weak self] c, _ in
c.dismiss(completion: nil)
self?.controllerNode.webView?.reload()
})))
@@ -1072,8 +1073,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
if let _ = attachMenuBot, self?.url == nil {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_RemoveBot, textColor: .destructive, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
}, action: { [weak self] _, f in
f(.default)
}, action: { [weak self] c, _ in
c.dismiss(completion: nil)
if let strongSelf = self {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }