|
|
@ -63,8 +63,10 @@ const getAccountLoader = (state: State, selectedAccount: SelectedAccountState):
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (account) return null;
|
|
|
|
// account not found (yet). checking why...
|
|
|
|
// account not found (yet). checking why...
|
|
|
|
if (!account) {
|
|
|
|
|
|
|
|
if (!discovery || (discovery.waitingForDevice || discovery.interrupted)) {
|
|
|
|
if (!discovery || (discovery.waitingForDevice || discovery.interrupted)) {
|
|
|
|
if (device.connected) {
|
|
|
|
if (device.connected) {
|
|
|
|
// case 1: device is connected but discovery not started yet (probably waiting for auth)
|
|
|
|
// case 1: device is connected but discovery not started yet (probably waiting for auth)
|
|
|
@ -76,6 +78,7 @@ const getAccountLoader = (state: State, selectedAccount: SelectedAccountState):
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// case 2: device is unavailable (created with different passphrase settings) account cannot be accessed
|
|
|
|
// case 2: device is unavailable (created with different passphrase settings) account cannot be accessed
|
|
|
|
|
|
|
|
// this is related to device instance in url, it's not used for now (device clones are disabled)
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
|
title: `Device ${device.instanceLabel} is unavailable`,
|
|
|
|
title: `Device ${device.instanceLabel} is unavailable`,
|
|
|
@ -101,16 +104,21 @@ const getAccountLoader = (state: State, selectedAccount: SelectedAccountState):
|
|
|
|
shouldRender: false,
|
|
|
|
shouldRender: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
// case default: account information isn't loaded yet
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
type: 'progress',
|
|
|
|
|
|
|
|
title: 'Loading account',
|
|
|
|
|
|
|
|
shouldRender: false,
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getAccountNotification = (state: State, selectedAccount: SelectedAccountState): ?AccountStatus => {
|
|
|
|
const getAccountNotification = (state: State, selectedAccount: SelectedAccountState): ?AccountStatus => {
|
|
|
|
const device = state.wallet.selectedDevice;
|
|
|
|
const device = state.wallet.selectedDevice;
|
|
|
|
const { network, discovery } = selectedAccount;
|
|
|
|
const { account, network, discovery } = selectedAccount;
|
|
|
|
|
|
|
|
if (!device || !network) return null;
|
|
|
|
|
|
|
|
|
|
|
|
if (device && network) {
|
|
|
|
// case 1: backend status
|
|
|
|
const blockchain = state.blockchain.find(b => b.shortcut === network.shortcut);
|
|
|
|
const blockchain = state.blockchain.find(b => b.shortcut === network.shortcut);
|
|
|
|
if (blockchain && !blockchain.connected) {
|
|
|
|
if (blockchain && !blockchain.connected) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -120,17 +128,16 @@ const getAccountNotification = (state: State, selectedAccount: SelectedAccountSt
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (discovery) {
|
|
|
|
// case 2: account does exists and it's visible but shouldn't be active
|
|
|
|
if (discovery && !discovery.completed && !discovery.waitingForDevice) {
|
|
|
|
if (account && discovery && !discovery.completed && !discovery.waitingForDevice) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
|
title: 'Loading accounts...',
|
|
|
|
title: 'Loading other accounts...',
|
|
|
|
shouldRender: true,
|
|
|
|
shouldRender: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Additional status: account does exists and it's visible but shouldn't be active
|
|
|
|
// case 3: account does exists and device is disconnected
|
|
|
|
if (!device.connected) {
|
|
|
|
if (!device.connected) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
@ -138,6 +145,9 @@ const getAccountNotification = (state: State, selectedAccount: SelectedAccountSt
|
|
|
|
shouldRender: true,
|
|
|
|
shouldRender: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// case 4: account does exists and device is unavailable (created with different passphrase settings) account cannot be accessed
|
|
|
|
|
|
|
|
// this is related to device instance in url, it's not used for now (device clones are disabled)
|
|
|
|
if (!device.available) {
|
|
|
|
if (!device.available) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
@ -146,8 +156,8 @@ const getAccountNotification = (state: State, selectedAccount: SelectedAccountSt
|
|
|
|
shouldRender: true,
|
|
|
|
shouldRender: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// case default
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|