Skip to content

Commit

Permalink
Merge pull request #152 from AElfProject/feature/ecoEarn-support
Browse files Browse the repository at this point in the history
fix: change execute time for initializeTelegram
  • Loading branch information
aelf-lxy authored Sep 12, 2024
2 parents 647f558 + c09ab5b commit 91a2580
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-base",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-bridge",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
15 changes: 10 additions & 5 deletions packages/bridge/src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ const SignInModal: React.FC<ISignInModalProps> = (props: ISignInModalProps) => {
// const isLocking = store.getState().isLocking;
// console.log('isLocking', isLocking);

const initializeTelegram = () => {
const handleLogout = async () => {
await bridgeInstance.onPortkeyAAUnLock(defaultPin);
await bridgeInstance.doubleCheckDisconnect();
};
TelegramPlatform.initializeTelegramWebApp({ handleLogout });
};

useEffect(() => {
if (cancelAutoLoginInTelegram) {
return;
Expand All @@ -255,11 +263,7 @@ const SignInModal: React.FC<ISignInModalProps> = (props: ISignInModalProps) => {
return;
}
console.log('begin to init and execute handleTelegram', TelegramPlatform.isTelegramPlatform());
const handleLogout = async () => {
await bridgeInstance.onPortkeyAAUnLock(defaultPin);
await bridgeInstance.doubleCheckDisconnect();
};
TelegramPlatform.initializeTelegramWebApp({ handleLogout });
initializeTelegram();
async function autoAuthInTelegram() {
console.log('begin to excute autoAuthInTelegram');
if (enhancedLocalStorage.getItem('connectedWallet') === PORTKEYAA) {
Expand All @@ -273,6 +277,7 @@ const SignInModal: React.FC<ISignInModalProps> = (props: ISignInModalProps) => {
}, [bridgeInstance, cancelAutoLoginInTelegram, defaultPin, handleTelegram]);

bridgeInstance.autoLogin = () => {
initializeTelegram();
handleTelegram();
};

Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-react",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/utils",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/night-elf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-night-elf",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/portkey-aa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-portkey-aa",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/portkey-discover/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-web-login/wallet-adapter-portkey-discover",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down

0 comments on commit 91a2580

Please sign in to comment.