Skip to content

Commit

Permalink
Merge pull request #198 from multiversx/development
Browse files Browse the repository at this point in the history
Fix missing safari consentPopups
  • Loading branch information
arhtudormorar authored Mar 28, 2024
2 parents 57408c7 + 8af24fe commit 6e073ce
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/helpers/signAndSendTransactions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Transaction, TransactionsDisplayInfoType } from 'types';

import { refreshAccount, sendTransactions } from './sdkDappHelpers';
import { isSafari } from 'localConstants';

type SignAndSendTransactionsProps = {
transactions: Transaction[];
callbackRoute: string;
transactionsDisplayInfo: TransactionsDisplayInfoType;
};

const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

export const signAndSendTransactions = async ({
transactions,
callbackRoute,
Expand Down
4 changes: 4 additions & 0 deletions src/localConstants/session/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export * from './session.enums';

export const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getBatchTransactions } from '../helpers';
import { sendTransactions } from 'helpers/sdkDappHelpers';
import { SessionEnum } from 'localConstants/session';
import { SessionEnum, isSafari } from 'localConstants/session';
import { SendTransactionProps } from '../types';

export const sendBatchTransactions = async ({
Expand All @@ -19,7 +19,8 @@ export const sendBatchTransactions = async ({
transactions,
signWithoutSending: true,
customTransactionInformation: { redirectAfterSign: true },
callbackRoute
callbackRoute,
hasConsentPopup: isSafari
});

if (error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SessionEnum } from 'localConstants/session';
import { SessionEnum, isSafari } from 'localConstants/session';
import { getBatchTransactions } from '../helpers';
import { refreshAccount } from 'utils/sdkDappUtils';
import { sendBatchTransactions } from 'services/sdkDappServices';
Expand Down Expand Up @@ -34,7 +34,8 @@ export const signAndAutoSendBatchTransactions = async ({
errorMessage: 'An error has occurred during transaction execution',
successMessage: 'Batch transactions successful'
},
callbackRoute
callbackRoute,
hasConsentPopup: isSafari
});
if (error) {
console.error('Could not execute transactions', error);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SessionEnum } from 'localConstants/session';
import { SessionEnum, isSafari } from 'localConstants/session';
import { getSwapAndLockTransactions } from '../helpers';
import { sendBatchTransactions } from 'services/sdkDappServices';
import { refreshAccount } from 'utils/sdkDappUtils';
Expand Down Expand Up @@ -32,7 +32,8 @@ export const swapAndLockTokens = async ({
errorMessage: 'An error has occurred during transaction execution',
successMessage: 'Batch transactions successful'
},
callbackRoute
callbackRoute,
hasConsentPopup: isSafari
});

if (error) {
Expand Down

0 comments on commit 6e073ce

Please sign in to comment.