blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
780 B
25 lines
780 B
//
|
|
// SafariWebExtensionHandler.swift
|
|
// AlphaWalletSafariExtension
|
|
//
|
|
// Created by Vladyslav Shepitko on 28.09.2021.
|
|
//
|
|
|
|
import SafariServices
|
|
import os.log
|
|
|
|
let SFExtensionMessageKey = "message"
|
|
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|
|
|
func beginRequest(with context: NSExtensionContext) {
|
|
let item = context.inputItems[0] as! NSExtensionItem
|
|
let message = item.userInfo?[SFExtensionMessageKey]
|
|
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)
|
|
|
|
let response = NSExtensionItem()
|
|
response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ]
|
|
|
|
context.completeRequest(returningItems: [response], completionHandler: nil)
|
|
}
|
|
|
|
}
|
|
|