add checkers for device 1 and 2 (waiting modal)
This commit is contained in:
parent
267bb06260
commit
77e8c802b8
@ -13,6 +13,7 @@ export const U32_MAX = 4294967295;
|
|||||||
const storageUrl = `https://demo.4nkweb.com/storage`;
|
const storageUrl = `https://demo.4nkweb.com/storage`;
|
||||||
const BOOTSTRAPURL = [`https://demo.4nkweb.com/ws/`];
|
const BOOTSTRAPURL = [`https://demo.4nkweb.com/ws/`];
|
||||||
|
|
||||||
|
|
||||||
export default class Services {
|
export default class Services {
|
||||||
private static initializing: Promise<Services> | null = null;
|
private static initializing: Promise<Services> | null = null;
|
||||||
private static instance: Services;
|
private static instance: Services;
|
||||||
@ -290,6 +291,13 @@ export default class Services {
|
|||||||
const apiReturn = this.sdkClient.parse_cipher(message);
|
const apiReturn = this.sdkClient.parse_cipher(message);
|
||||||
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
|
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
|
||||||
await this.handleApiReturn(apiReturn);
|
await this.handleApiReturn(apiReturn);
|
||||||
|
|
||||||
|
// Device 1 wait Device 2
|
||||||
|
const waitingModal = document.getElementById('waiting-modal');
|
||||||
|
if (waitingModal) {
|
||||||
|
this.device2Ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Parsed cipher with error: ${e}`);
|
console.error(`Parsed cipher with error: ${e}`);
|
||||||
}
|
}
|
||||||
@ -666,4 +674,13 @@ export default class Services {
|
|||||||
async importJSON(content: any): Promise<void> {
|
async importJSON(content: any): Promise<void> {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Device 1 wait Device 2
|
||||||
|
public device1: boolean = false;
|
||||||
|
public device2Ready: boolean = false;
|
||||||
|
|
||||||
|
public resetState() {
|
||||||
|
this.device1 = false;
|
||||||
|
this.device2Ready = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,9 @@ async function onOkButtonClick() {
|
|||||||
export async function prepareAndSendPairingTx(secondDeviceAddress: string) {
|
export async function prepareAndSendPairingTx(secondDeviceAddress: string) {
|
||||||
const service = await Services.getInstance();
|
const service = await Services.getInstance();
|
||||||
|
|
||||||
|
// Device 1 wait Device 2
|
||||||
|
service.device1 = true;
|
||||||
|
|
||||||
const sharedSecret = await service.getSecretForAddress(secondDeviceAddress);
|
const sharedSecret = await service.getSecretForAddress(secondDeviceAddress);
|
||||||
if (!sharedSecret) {
|
if (!sharedSecret) {
|
||||||
const member = {
|
const member = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user