|
@@ -411,23 +411,29 @@ extension WebxdcViewController: WKScriptMessageHandler {
|
|
|
_ = dcContext.sendWebxdcStatusUpdate(msgId: messageId, payload: payloadString, description: description)
|
|
|
|
|
|
case .sendToChat:
|
|
|
- let alert = UIAlertController(title: String.localized("chat_share_with_title"), message: nil, preferredStyle: .safeActionSheet)
|
|
|
- alert.addAction(UIAlertAction(title: String.localized("select_chat"), style: .default, handler: { _ in
|
|
|
- if let dict = message.body as? [String: AnyObject] {
|
|
|
+ if let dict = message.body as? [String: AnyObject] {
|
|
|
+ let title: String
|
|
|
+ if let name = dict["name"] as? String {
|
|
|
+ title = String.localizedStringWithFormat(String.localized("send_file_to"), name)
|
|
|
+ } else {
|
|
|
+ title = String.localized("send_message_to")
|
|
|
+ }
|
|
|
+
|
|
|
+ let alert = UIAlertController(title: title, message: nil, preferredStyle: .safeActionSheet)
|
|
|
+ alert.addAction(UIAlertAction(title: String.localized("select_chat"), style: .default, handler: { _ in
|
|
|
let base64 = dict["base64"] as? String
|
|
|
let data = base64 != nil ? Data(base64Encoded: base64 ?? "") : nil
|
|
|
- RelayHelper.shared.setForwardMessage(text: dict["text"] as? String, fileData: data, fileName: dict["name"] as? String)
|
|
|
+ RelayHelper.shared.setForwardMessage(dialogTitle: title, text: dict["text"] as? String, fileData: data, fileName: dict["name"] as? String)
|
|
|
|
|
|
if let appDelegate = UIApplication.shared.delegate as? AppDelegate,
|
|
|
let rootController = appDelegate.appCoordinator.tabBarController.selectedViewController as? UINavigationController {
|
|
|
appDelegate.appCoordinator.showTab(index: appDelegate.appCoordinator.chatsTab)
|
|
|
rootController.popToRootViewController(animated: false)
|
|
|
}
|
|
|
- }
|
|
|
- }))
|
|
|
- alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
|
|
|
- self.present(alert, animated: true, completion: nil)
|
|
|
-
|
|
|
+ }))
|
|
|
+ alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
|
|
|
+ self.present(alert, animated: true, completion: nil)
|
|
|
+ }
|
|
|
|
|
|
default:
|
|
|
logger.debug("another method was called")
|