Merge pull request #140 from lil-org/tune-extension-rpc

tune extension rpc
This commit is contained in:
ivan grachev 2024-01-23 22:12:53 +03:00 committed by GitHub
commit 11853fa389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
121 changed files with 199 additions and 174 deletions

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of error.js from trust-web3-provider. // Rewrite of error.js from trust-web3-provider.
"use strict"; "use strict";

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of index.js from trust-web3-provider. // Rewrite of index.js from trust-web3-provider.
"use strict"; "use strict";
@ -22,7 +22,7 @@ class TokenaryEthereum extends EventEmitter {
constructor() { constructor() {
super(); super();
const config = {address: "", chainId: "0x1", rpcUrl: "https://eth.llamarpc.com"}; const config = {address: "", chainId: "0x1"};
this.setConfig(config); this.setConfig(config);
this.idMapping = new IdMapping(); this.idMapping = new IdMapping();
this.callbacks = new Map(); this.callbacks = new Map();
@ -66,15 +66,15 @@ class TokenaryEthereum extends EventEmitter {
this.ready = !!address; this.ready = !!address;
} }
updateAccount(eventName, addresses, chainId, rpcUrl) { updateAccount(eventName, addresses, chainId) {
window.tokenary.eth.setAddress(addresses[0]); window.tokenary.eth.setAddress(addresses[0]);
if (eventName == "switchAccount") { if (eventName == "switchAccount") {
window.tokenary.eth.emit("accountsChanged", addresses); window.tokenary.eth.emit("accountsChanged", addresses);
} }
if (window.tokenary.eth.rpc.rpcUrl != rpcUrl) { if (window.tokenary.eth.rpc.chainId != chainId) {
this.rpc = new RPCServer(rpcUrl); this.rpc = new RPCServer(chainId);
} }
if (window.tokenary.eth.chainId != chainId) { if (window.tokenary.eth.chainId != chainId) {
@ -89,7 +89,7 @@ class TokenaryEthereum extends EventEmitter {
setConfig(config) { setConfig(config) {
this.chainId = config.chainId; this.chainId = config.chainId;
this.rpc = new RPCServer(config.rpcUrl); this.rpc = new RPCServer(config.chainId);
this.setAddress(config.address); this.setAddress(config.address);
this.networkVersion = this.net_version(); this.networkVersion = this.net_version();
} }
@ -199,16 +199,9 @@ class TokenaryEthereum extends EventEmitter {
case "eth_newPendingTransactionFilter": case "eth_newPendingTransactionFilter":
case "eth_uninstallFilter": case "eth_uninstallFilter":
case "eth_subscribe": case "eth_subscribe":
throw new ProviderRpcError(4200, `Tokenary does not support calling ${payload.method}. Please use your own solution`); throw new ProviderRpcError(4200, `tiny wallet does not support ${payload.method}`);
default: default:
this.callbacks.delete(payload.id); return this.rpc.call(payload);
this.wrapResults.delete(payload.id);
return this.rpc
.call(payload)
.then((response) => {
wrapResult ? resolve(response) : resolve(response.result);
})
.catch(reject);
} }
}); });
} }
@ -346,7 +339,7 @@ class TokenaryEthereum extends EventEmitter {
if (response.name == "didLoadLatestConfiguration") { if (response.name == "didLoadLatestConfiguration") {
this.didGetLatestConfiguration = true; this.didGetLatestConfiguration = true;
if (response.chainId) { if (response.chainId) {
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL); this.updateAccount(response.name, response.results, response.chainId);
} }
for(let payload of this.pendingPayloads) { for(let payload of this.pendingPayloads) {
@ -362,14 +355,14 @@ class TokenaryEthereum extends EventEmitter {
} else if ("results" in response) { } else if ("results" in response) {
if (response.name == "switchEthereumChain" || response.name == "addEthereumChain") { if (response.name == "switchEthereumChain" || response.name == "addEthereumChain") {
// Calling it before sending response matters for some dapps // Calling it before sending response matters for some dapps
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL); this.updateAccount(response.name, response.results, response.chainId);
} }
if (response.name != "switchAccount") { if (response.name != "switchAccount") {
this.sendResponse(id, response.results); this.sendResponse(id, response.results);
} }
if (response.name == "requestAccounts" || response.name == "switchAccount") { if (response.name == "requestAccounts" || response.name == "switchAccount") {
// Calling it after sending response matters for some dapps // Calling it after sending response matters for some dapps
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL); this.updateAccount(response.name, response.results, response.chainId);
} }
} else if ("error" in response) { } else if ("error" in response) {
this.sendError(id, response.error); this.sendError(id, response.error);
@ -394,14 +387,15 @@ class TokenaryEthereum extends EventEmitter {
let callback = this.callbacks.get(id); let callback = this.callbacks.get(id);
let wrapResult = this.wrapResults.get(id); let wrapResult = this.wrapResults.get(id);
let data = { jsonrpc: "2.0", id: originId }; let data = { jsonrpc: "2.0", id: originId };
if (result !== null && result.jsonrpc && result.result) { if (result !== null && result.result) {
data.result = result.result; data.result = result.result;
} else { } else {
data.result = result; data.result = result;
} }
if (callback) { if (callback) {
wrapResult ? callback(null, data) : callback(null, result); wrapResult ? callback(null, data) : callback(null, data.result);
this.callbacks.delete(id); this.callbacks.delete(id);
this.wrapResults.delete(id);
} else { } else {
console.log(`callback id: ${id} not found`); console.log(`callback id: ${id} not found`);
} }
@ -413,6 +407,7 @@ class TokenaryEthereum extends EventEmitter {
if (callback) { if (callback) {
callback(error instanceof Error ? error : new Error(error), null); callback(error instanceof Error ? error : new Error(error), null);
this.callbacks.delete(id); this.callbacks.delete(id);
this.wrapResults.delete(id);
} }
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of id_mapping.js from trust-web3-provider. // Rewrite of id_mapping.js from trust-web3-provider.
"use strict"; "use strict";

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of index.js from trust-web3-provider. // Rewrite of index.js from trust-web3-provider.
"use strict"; "use strict";
@ -44,7 +44,9 @@ announceProvider();
// - MARK: Process content script messages // - MARK: Process content script messages
window.addEventListener("message", function(event) { window.addEventListener("message", function(event) {
if (event.source == window && event.data && event.data.direction == "from-content-script") { if (event.source == window && event.data && event.data.direction == "rpc-back") {
provider.processTokenaryResponse(event.data.response.id, event.data.response);
} else if (event.source == window && event.data && event.data.direction == "from-content-script") {
const response = event.data.response; const response = event.data.response;
const id = event.data.id; const id = event.data.id;

View File

@ -1,30 +1,18 @@
// Copyright © 2021 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of rpc.js from trust-web3-provider. // Rewrite of rpc.js from trust-web3-provider.
"use strict"; "use strict";
class RPCServer { class RPCServer {
constructor(rpcUrl) {
this.rpcUrl = rpcUrl; constructor(chainId) {
this.chainId = chainId;
} }
call(payload) { call(payload) {
return fetch(this.rpcUrl, { payload.jsonrpc = "2.0";
method: "POST", window.postMessage({direction: "rpc", message: {id: payload.id, subject: "rpc", chainId: this.chainId, body: JSON.stringify(payload)}}, "*");
headers: { return true;
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(json => {
if (!json.result && json.error) {
console.log("<== rpc error", json.error);
throw new Error(json.error.message || "rpc error");
}
return json;
});
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // ∅ 2024 lil org
// Rewrite of utils.js from trust-web3-provider. // Rewrite of utils.js from trust-web3-provider.
"use strict"; "use strict";

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,12 +1,14 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
struct InternalSafariRequest: Codable { struct InternalSafariRequest: Codable {
let id: Int let id: Int
let subject: Subject let subject: Subject
let body: String?
let chainId: String?
enum Subject: String, Codable { enum Subject: String, Codable {
case getResponse, cancelRequest case getResponse, cancelRequest, rpc
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // ∅ 2024 lil org
if (!("pendingRequestsIds" in document)) { if (!("pendingRequestsIds" in document)) {
document.pendingRequestsIds = new Set(); document.pendingRequestsIds = new Set();
@ -37,7 +37,11 @@ function setup() {
// Receive from inpage // Receive from inpage
window.addEventListener("message", event => { window.addEventListener("message", event => {
if (event.source == window && event.data) { if (event.source == window && event.data) {
if (event.data.direction == "from-page-script") { if (event.data.direction == "rpc") {
browser.runtime.sendMessage(event.data.message).then(response => {
window.postMessage({direction: "rpc-back", response: response}, "*");
}).catch(() => {});
} else if (event.data.direction == "from-page-script") {
sendMessageToNativeApp(event.data.message, false); sendMessageToNativeApp(event.data.message, false);
} else if (event.data.subject == "disconnect") { } else if (event.data.subject == "disconnect") {
const disconnectRequest = event.data; const disconnectRequest = event.data;

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,13 @@
// Copyright © 2023 Tokenary. All rights reserved. // ∅ 2024 lil org
function handleOnMessage(request, sender, sendResponse) { function handleOnMessage(request, sender, sendResponse) {
if (request.subject === "message-to-wallet") { if (request.subject === "rpc") {
browser.runtime.sendNativeMessage("mac.tokenary.io", request).then(response => {
if (typeof response !== "undefined") {
sendResponse(response);
} else { sendResponse(); }
}).catch(() => { sendResponse(); });
} else if (request.subject === "message-to-wallet") {
browser.runtime.sendNativeMessage("mac.tokenary.io", request.message).then(response => { browser.runtime.sendNativeMessage("mac.tokenary.io", request.message).then(response => {
if (typeof response !== "undefined") { if (typeof response !== "undefined") {
sendResponse(response); sendResponse(response);

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import SafariServices import SafariServices
@ -21,6 +21,12 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
if let internalSafariRequest = try? jsonDecoder.decode(InternalSafariRequest.self, from: data) { if let internalSafariRequest = try? jsonDecoder.decode(InternalSafariRequest.self, from: data) {
let id = internalSafariRequest.id let id = internalSafariRequest.id
switch internalSafariRequest.subject { switch internalSafariRequest.subject {
case .rpc:
if let body = internalSafariRequest.body, let chainId = internalSafariRequest.chainId {
rpcRequest(id: id, chainId: chainId, body: body, context: context)
} else {
context.cancelRequest(withError: HandlerError.empty)
}
case .getResponse: case .getResponse:
if let response = ExtensionBridge.getResponse(id: id) { if let response = ExtensionBridge.getResponse(id: id) {
ExtensionBridge.removeResponse(id: id) ExtensionBridge.removeResponse(id: id)
@ -58,6 +64,32 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
} }
} }
private func rpcRequest(id: Int, chainId: String, body: String, context: NSExtensionContext) {
guard let chainIdNumber = Int(hexString: chainId),
let rpcURLString = Nodes.getNode(chainId: chainIdNumber),
let url = URL(string: rpcURLString),
let httpBody = body.data(using: .utf8) else {
respond(with: ["id": id, "error": "something went wrong"], context: context)
return
}
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Accept")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = httpBody
let task = URLSession.shared.dataTask(with: request) { [weak self] data, response, error in
if let data = data, var json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
if json["id"] == nil { json["id"] = id }
self?.respond(with: json, context: context)
} else {
self?.respond(with: ["id": id, "error": "something went wrong"], context: context)
}
}
task.resume()
}
private func respond(with response: [String: Any], context: NSExtensionContext) { private func respond(with response: [String: Any], context: NSExtensionContext) {
let item = NSExtensionItem() let item = NSExtensionItem()
item.userInfo = [SFExtensionMessageKey: response] item.userInfo = [SFExtensionMessageKey: response]

View File

@ -1,3 +1,3 @@
// Copyright © 2022 Tokenary. All rights reserved. // ∅ 2024 lil org
const isMobile = true; const isMobile = true;

View File

@ -42,13 +42,6 @@
"activeTab", "activeTab",
"tabs" "tabs"
], ],
"host_permissions": [
"https://*.llamarpc.com/",
"https://*.infura.io/*",
"https://tokenary.io/*",
"tokenary://*"
],
"web_accessible_resources": [ "inpage.js" ] "web_accessible_resources": [ "inpage.js" ]
} }

View File

@ -1,3 +1,3 @@
// Copyright © 2023 Tokenary. All rights reserved. // ∅ 2024 lil org
const isMobile = false; const isMobile = false;

View File

@ -43,11 +43,5 @@
"tabs" "tabs"
], ],
"host_permissions": [
"https://*.llamarpc.com/",
"https://*.infura.io/*",
"https://tokenary.io/*"
],
"web_accessible_resources": [ "inpage.js" ] "web_accessible_resources": [ "inpage.js" ]
} }

View File

@ -8,5 +8,7 @@
<array> <array>
<string>group.io.tokenary</string> <string>group.io.tokenary</string>
</array> </array>
<key>com.apple.security.network.client</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import BigInt import BigInt

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import BigInt import BigInt

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import SwiftUI import SwiftUI

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
enum ApprovalSubject { enum ApprovalSubject {
case signMessage case signMessage

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
enum AuthenticationReason { enum AuthenticationReason {
case start case start

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import CloudKit import CloudKit

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import CoreTelephony import CoreTelephony

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import StoreKit import StoreKit

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import SwiftUI import SwiftUI

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import SwiftUI import SwiftUI

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
// Rewrite of Wallet.swift from Trust Wallet Core. // Rewrite of Wallet.swift from Trust Wallet Core.
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
// Rewrite of KeyStore.swift from Trust Wallet Core. // Rewrite of KeyStore.swift from Trust Wallet Core.
import Foundation import Foundation

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import XCTest import XCTest

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import XCTest import XCTest

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import XCTest import XCTest
#if os(iOS) #if os(iOS)

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import LocalAuthentication import LocalAuthentication

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import SwiftUI import SwiftUI

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
import Kingfisher import Kingfisher

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import UIKit import UIKit
@ -48,7 +48,7 @@ class PasswordViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
if mode != .enter { if mode != .enter {
passwordTextField.becomeFirstResponder() focusOnPasswordTextField()
} }
} }
@ -89,7 +89,14 @@ class PasswordViewController: UIViewController {
private func didFailLocalAuthentication() { private func didFailLocalAuthentication() {
navigationController?.setNavigationBarHidden(false, animated: false) navigationController?.setNavigationBarHidden(false, animated: false)
initialOverlayView.isHidden = true initialOverlayView.isHidden = true
passwordTextField.becomeFirstResponder() focusOnPasswordTextField()
}
func focusOnPasswordTextField() {
// TODO: remove temporary delay used to fix vision pro crash
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) { [weak self] in
self?.passwordTextField.becomeFirstResponder()
}
} }
@IBAction func okButtonTapped(_ sender: Any) { @IBAction func okButtonTapped(_ sender: Any) {

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa
import SafariServices import SafariServices

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa
import WalletCore import WalletCore

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa

View File

@ -1,4 +1,4 @@
// Copyright © 2022 Tokenary. All rights reserved. // 2024 lil org
import Cocoa import Cocoa

View File

@ -1,4 +1,4 @@
// Copyright © 2023 Tokenary. All rights reserved. // 2024 lil org
import SwiftUI import SwiftUI

View File

@ -1,4 +1,4 @@
// Copyright © 2021 Tokenary. All rights reserved. // 2024 lil org
import Foundation import Foundation

Some files were not shown because too many files have changed in this diff Show More