Skip to content

Commit

Permalink
Merge pull request #1302 from multiversx/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
arhtudormorar authored Nov 6, 2024
2 parents 91e2855 + 8ff54ea commit 8a83c2e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[v3.0.9](https://github.com/multiversx/mx-sdk-dapp/pull/1299)] - 2024-11-06

- [Fix clear initiated login](https://github.com/multiversx/mx-sdk-dapp/pull/1301)

## [[v3.0.8](https://github.com/multiversx/mx-sdk-dapp/pull/1299)] - 2024-11-04

- [Update skip method to clear only initiated login state](https://github.com/multiversx/mx-sdk-dapp/pull/1298)

- [Updated Iframe provider imports](https://github.com/multiversx/mx-sdk-dapp/pull/1297)
- [Fixed Iframe provider reload](https://github.com/multiversx/mx-sdk-dapp/pull/1295)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp",
"version": "3.0.8",
"version": "3.0.9",
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
"author": "MultiversX",
"license": "GPL-3.0-or-later",
Expand Down
28 changes: 19 additions & 9 deletions src/hooks/login/helpers/clearInitiatedLogins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@ import { IframeProvider } from 'lib/sdkWebWalletIframeProvider';
import { LoginMethodsEnum } from 'types';

export const clearInitiatedLogins = (props?: {
intiatedLoginMethod: LoginMethodsEnum;
skipLoginMethod: LoginMethodsEnum;
}) => {
Object.values(LoginMethodsEnum).forEach((method) => {
if (props?.intiatedLoginMethod && method !== props.intiatedLoginMethod) {
if (method === props?.skipLoginMethod) {
return;
}
const crossWindowProvider = CrossWindowProvider.getInstance();
if (crossWindowProvider.isInitialized()) {
crossWindowProvider.dispose();
}
const iframeProvider = IframeProvider.getInstance();
if (iframeProvider.isInitialized()) {
iframeProvider.dispose();
switch (method) {
case LoginMethodsEnum.crossWindow: {
const crossWindowProvider = CrossWindowProvider.getInstance();
if (crossWindowProvider.isInitialized()) {
crossWindowProvider.dispose();
}
break;
}
case LoginMethodsEnum.iframe: {
const iframeProvider = IframeProvider.getInstance();
if (iframeProvider.isInitialized()) {
iframeProvider.dispose();
}
break;
}
default:
break;
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/login/useCrossWindowLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const useCrossWindowLogin = ({
}

clearInitiatedLogins({
intiatedLoginMethod: LoginMethodsEnum.crossWindow
skipLoginMethod: LoginMethodsEnum.crossWindow
});

setIsLoading(true);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/login/useIframeLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useIframeLogin = ({
}

clearInitiatedLogins({
intiatedLoginMethod: LoginMethodsEnum.iframe
skipLoginMethod: LoginMethodsEnum.iframe
});

setIsLoading(true);
Expand Down

0 comments on commit 8a83c2e

Please sign in to comment.