Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #6638: Re-land The Wallet Standard (#6869)
Browse files Browse the repository at this point in the history
Inject WalletStandard script atDocumentEnd if a Solana Keyring is created.
  • Loading branch information
StephenHeaps authored Feb 3, 2023
1 parent 70ea0aa commit ca22cab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Client/Frontend/Browser/UserScriptManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ class UserScriptManager {
}
}

if let solanaProvider = tab.walletSolProvider {
solanaProvider.isSolanaKeyringCreated { isSolanaKeyringCreated in
guard isSolanaKeyringCreated, // don't inject if Solana keyring is not created.
let walletStandardScript = tab.walletSolProviderScripts[.walletStandard]
else { return }
let wkScript = WKUserScript.create(
source: walletStandardScript,
injectionTime: .atDocumentEnd,
forMainFrameOnly: true,
in: SolanaProviderScriptHandler.scriptSandbox)
scriptController.addUserScript(wkScript)
}
}

// TODO: Refactor this and get rid of the `UserScriptType`
// Inject Custom scripts
for userScriptType in customScripts.sorted(by: { $0.order < $1.order }) {
Expand Down

0 comments on commit ca22cab

Please sign in to comment.