diff --git a/src/services/service.ts b/src/services/service.ts index a4af98f..f340bf3 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -13,6 +13,7 @@ export const U32_MAX = 4294967295; const storageUrl = `https://demo.4nkweb.com/storage`; const BOOTSTRAPURL = [`https://demo.4nkweb.com/ws/`]; + export default class Services { private static initializing: Promise | null = null; private static instance: Services; @@ -290,6 +291,13 @@ export default class Services { const apiReturn = this.sdkClient.parse_cipher(message); console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn); await this.handleApiReturn(apiReturn); + + // Device 1 wait Device 2 + const waitingModal = document.getElementById('waiting-modal'); + if (waitingModal) { + this.device2Ready = true; + } + } catch (e) { console.error(`Parsed cipher with error: ${e}`); } @@ -666,4 +674,13 @@ export default class Services { async importJSON(content: any): Promise { return Promise.resolve(); } + + // Device 1 wait Device 2 + public device1: boolean = false; + public device2Ready: boolean = false; + + public resetState() { + this.device1 = false; + this.device2Ready = false; + } } diff --git a/src/utils/sp-address.utils.ts b/src/utils/sp-address.utils.ts index f6f24da..b0eb3ad 100755 --- a/src/utils/sp-address.utils.ts +++ b/src/utils/sp-address.utils.ts @@ -161,6 +161,9 @@ async function onOkButtonClick() { export async function prepareAndSendPairingTx(secondDeviceAddress: string) { const service = await Services.getInstance(); + // Device 1 wait Device 2 + service.device1 = true; + const sharedSecret = await service.getSecretForAddress(secondDeviceAddress); if (!sharedSecret) { const member = {