Skip to content

Commit

Permalink
CP-9375 Don't show Use Wallet Connect dialog if not interacted with a…
Browse files Browse the repository at this point in the history
…pp (#2169)
  • Loading branch information
neven-s authored Dec 20, 2024
1 parent 9d369d9 commit 6d1ab24
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function useInjectedJavascript(): InjectedJavascripts {
setTimeout(() => {
let notified = false;
const request = async function (json) {
if (!notified) {
if (!notified && window.hasInteracted) {
const message = {
method: 'window_ethereum_used',
payload: json
Expand Down Expand Up @@ -173,11 +173,15 @@ export function useInjectedJavascript(): InjectedJavascripts {
}
})();`

/**
* Caution, the coreConnectInterceptor function depends on window.hasInteracted which is manipulated here
*/
const injectCustomPrompt = `(async function(){
var focused = false;
Object.freeze(Object);
window.onfocus = function(){
focused = true;
window.hasInteracted = true;
};
window.onblur = function(){
focused = false;
Expand Down

0 comments on commit 6d1ab24

Please sign in to comment.