Fix crash
This commit is contained in:
@@ -261,7 +261,10 @@
|
||||
}
|
||||
|
||||
function _setSiaSettings(settings, cb) {
|
||||
window.appActions.setSiaSettings(settings, cb);
|
||||
}
|
||||
|
||||
function _autoMountDrive() {
|
||||
window.appActions.autoMountDrive();
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -273,7 +276,8 @@
|
||||
shutdown: _shutdown,
|
||||
setRenterSettings: _setRenterSettings,
|
||||
calculateEstimatedStorage: _calculateEstimatedStorage,
|
||||
setSiaSettings: _setSiaSettings
|
||||
setSiaSettings: _setSiaSettings,
|
||||
autoMountDrive: _autoMountDrive
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -330,7 +334,7 @@
|
||||
const okButton = document.getElementById('ID_RenterUploadsOk');
|
||||
okButton.onclick = () => {
|
||||
okButton.onclick = null;
|
||||
beginMainApplication();
|
||||
beginMainApplication(false);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -340,7 +344,7 @@
|
||||
cancelButton.onclick = () => {
|
||||
cancelButton.onclick = null;
|
||||
saveButton.onclick = null;
|
||||
beginMainApplication();
|
||||
beginMainApplication(false);
|
||||
};
|
||||
|
||||
const saveButton = document.getElementById('ID_SiaSettingsOK');
|
||||
@@ -360,7 +364,7 @@
|
||||
'AutoMountOnUnlock': getChecked('ID_Settings_AutoMountOnUnlock')
|
||||
}, (success, reason) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
beginMainApplication(false);
|
||||
} else {
|
||||
displayErrorPopup('Settings Failed', reason);
|
||||
handleSiaEditSettings();
|
||||
@@ -369,7 +373,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
function beginMainApplication() {
|
||||
function beginMainApplication(checkAutoMount) {
|
||||
setMainWindow('app_window');
|
||||
const settingsEditLink = document.getElementById('ID_Sia_Settings_Edit');
|
||||
settingsEditLink.onclick = () => {
|
||||
@@ -422,6 +426,9 @@
|
||||
}
|
||||
};
|
||||
mountButton.onclick = _mountHandler;
|
||||
if (checkAutoMount) {
|
||||
AppActions.autoMountDrive( );
|
||||
}
|
||||
}
|
||||
|
||||
function handleRenterEditSettings() {
|
||||
@@ -451,7 +458,7 @@
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
defaultsButton.onclick = null;
|
||||
beginMainApplication();
|
||||
beginMainApplication(false);
|
||||
};
|
||||
|
||||
const saveButton = document.getElementById('ID_RenterSettingsOK');
|
||||
@@ -467,7 +474,7 @@
|
||||
'RenewWindowInBlocks': getValue('ID_RenterSetRenewWindow')
|
||||
}, (success, reason) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
beginMainApplication(false);
|
||||
} else {
|
||||
displayErrorPopup('Allocation Failed', reason);
|
||||
handleRenterEditSettings();
|
||||
@@ -484,7 +491,7 @@
|
||||
const password = document.getElementById('ID_WalletUnlockPwd');
|
||||
if (AppActions.unlockWallet(password.value, (success, reason) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
beginMainApplication(true);
|
||||
} else {
|
||||
displayErrorPopup('Error', reason, () => {
|
||||
handleUnlockWallet();
|
||||
@@ -503,7 +510,7 @@
|
||||
if (UiState.getStoreUnlockPassword()) {
|
||||
if (AppActions.autoUnlockWallet((success) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
beginMainApplication(true);
|
||||
} else {
|
||||
manualUnlockWallet();
|
||||
}
|
||||
@@ -544,7 +551,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
function reloadApplication() {
|
||||
function reloadApplication(checkAutoMount) {
|
||||
document.getElementById('ID_SiaDrive').innerText = 'SiaDrive ' + UiState.clientVersion();
|
||||
document.getElementById('ID_ServerVersion').innerText = '...';
|
||||
if (UiState.isOnline()) {
|
||||
@@ -552,7 +559,7 @@
|
||||
if (UiState.isWalletLocked()) {
|
||||
handleUnlockWallet();
|
||||
} else {
|
||||
beginMainApplication();
|
||||
beginMainApplication(checkAutoMount);
|
||||
}
|
||||
} else {
|
||||
handleCreateWallet();
|
||||
@@ -564,6 +571,6 @@
|
||||
|
||||
window.addEventListener('load', ()=> {
|
||||
console.log('Main window load');
|
||||
reloadApplication();
|
||||
reloadApplication(true);
|
||||
});
|
||||
})();
|
Reference in New Issue
Block a user