Add hints label and settings
MODIFY
HiddenWallet/HiddenWallet.GUI/HiddenWallet.GUI.njsproj
HiddenWallet/HiddenWallet.GUI/HiddenWallet.GUI.njsproj
<Compile Include="app\js\default.js">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="app\js\settings.js" />
<Compile Include="app\js\status.js" />
<Compile Include="app\js\wallet-phase.js" />
<Compile Include="main.js" />

MODIFY
HiddenWallet/HiddenWallet.GUI/app/js/decryption-phase.js
HiddenWallet/HiddenWallet.GUI/app/js/decryption-phase.js
@@ -6,7 +6,7 @@ function decryptionPhaseShow(menuItem = "") {
if (walletExists === true) {
var alreadyRunning = httpGetWallet("status").WalletState.toUpperCase() !== "NotStarted".toUpperCase();
if (alreadyRunning) {
- walletPhaseShow("alice");
+ walletPhaseShow();
}
else {
decryptionPhaseShow("decrypt");
@@ -135,6 +135,6 @@ function decryptWallet() {
alert(result.Message, "Could not decrypt wallet");
}
else {
- walletPhaseShow("alice");
+ walletPhaseShow();
}
}
\ No newline at end of file

MODIFY
HiddenWallet/HiddenWallet.GUI/app/js/default.js
HiddenWallet/HiddenWallet.GUI/app/js/default.js
@@ -31,3 +31,7 @@ document.getElementById("title").innerHTML = document.title;
}
};
})();
+
+function writeHint(message) {
+ document.getElementById('hint').innerHTML = message;
+}
\ No newline at end of file

ADD
HiddenWallet/HiddenWallet.GUI/app/js/settings.js
+const storage = require('electron-json-storage');
+
+storage.has('lastAccount', function (error, hasKey) {
+ if (error) throw error;
+
+ if (!hasKey) {
+ storage.set('lastAccount', { lastAccount: 'alice' }, function (error) {
+ if (error) throw error;
+ });
+ }
+});
\ No newline at end of file

MODIFY
HiddenWallet/HiddenWallet.GUI/app/js/wallet-phase.js
HiddenWallet/HiddenWallet.GUI/app/js/wallet-phase.js
-function walletPhaseShow(tabItem) {
+function walletPhaseShow(tabItem = "") {
document.getElementById("hide-btn").hidden = false;
if (tabItem === "alice") {
document.getElementById("tabs").innerHTML = document.getElementById("wallet-phase-tabs-frame").contentWindow.document.getElementById("alice-active").innerHTML;
+
+ storage.set('lastAccount', { lastAccount: 'alice' }, function (error) {
+ if (error) throw error;
+ });
}
else if (tabItem === "bob") {
document.getElementById("tabs").innerHTML = document.getElementById("wallet-phase-tabs-frame").contentWindow.document.getElementById("bob-active").innerHTML;
+ storage.set('lastAccount', { lastAccount: 'bob' }, function (error) {
+ if (error) throw error;
+ });
+ }
+ else if (tabItem === "") {
+ storage.get('lastAccount', function (error, data) {
+ if (error) throw error;
+
+ walletPhaseShow(data.lastAccount);
+ return;
+ });
}
+ writeHint("Move coins between Alice and Bob only by mixing!");
+
document.getElementById("menu").innerHTML = "menu not implemented";
document.getElementById("content").innerHTML = "content not implemented";
}
\ No newline at end of file

MODIFY
HiddenWallet/HiddenWallet.GUI/package.json
HiddenWallet/HiddenWallet.GUI/package.json
"dependencies": {
"bootstrap": "^3.3.7",
"electron": "^1.6.8",
- "electron-builder": "^17.1.2"
+ "electron-builder": "^17.1.2",
+ "electron-json-storage": "^3.0.5",
+ "jquery": "^3.2.1"
},
"scripts": {
"start": "electron .",

Add hints label and settings