Skip to content

Commit

Permalink
feat: in telegram, unlock before logout
Browse files Browse the repository at this point in the history
  • Loading branch information
aelf-lxy committed Aug 12, 2024
1 parent db2bb43 commit f2f0a66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/login/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aelf-web-login",
"version": "2.1.5",
"version": "2.1.6",
"main": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
Expand Down
9 changes: 7 additions & 2 deletions packages/login/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Portkey from './wallets/portkey/Portkey';
import PortkeyV1 from './wallets/portkey/Portkey/indexV1';
import { useElf } from './wallets/elf/useElf';
import { getConfig, event$ } from './config';
import { WalletType, WebLoginState, WebLoginEvents } from './constants';
import { WalletType, WebLoginState, WebLoginEvents, DEFAULT_PIN } from './constants';
import { CommonBaseModal, PortkeyLoading, TelegramPlatform } from '@portkey/did-ui-react';
import { check } from './wallets/elf/utils';
import isMobile from './utils/isMobile';
Expand Down Expand Up @@ -391,10 +391,15 @@ function WebLoginProvider({
return;
}
async function handleSDKLogout() {
if (version === 'v1') {
await portkeyApiV1.onUnlock(DEFAULT_PIN);
} else {
await portkeyApi.onUnlock(DEFAULT_PIN);
}
await logout();
}
TelegramPlatform.initializeTelegramWebApp({ handleLogout: handleSDKLogout });
}, [logout]);
}, [logout, portkeyApi, portkeyApiV1, version]);

const ConfirmLogoutDialogComponent = portkeyOpts.ConfirmLogoutDialog || ConfirmLogoutDialog;

Expand Down

0 comments on commit f2f0a66

Please sign in to comment.