diff --git a/packages/shared/lib/app.ts b/packages/shared/lib/app.ts index 712717117ff..46cb654e608 100644 --- a/packages/shared/lib/app.ts +++ b/packages/shared/lib/app.ts @@ -6,11 +6,6 @@ import { activeProfile, clearActiveProfile, isStrongholdLocked } from './profile import { resetRouter } from './router' import { api, destroyActor, resetWallet } from './wallet' -/** - * Notification content - */ -export const notification = writable(null) - /** * Mobile mode */ @@ -49,6 +44,28 @@ export const clearSendParams = () => sendParams.set({ amount: 0, address: '', me export const loggedIn = writable(false) /** + * Determines if user can make developer profiles + */ +export const developerMode = persistent('developerMode', false) + +/** + * Cleanup the signup vars + */ + export const cleanupSignup = () => { + mnemonic.set(null) + strongholdPassword.set(null) + walletPin.set(null) +} + +/** + * Log in to the current profile + */ +export const login = () => { + loggedIn.set(true) +} + +/** + * Logout from current profile */ export const logout = () => { @@ -64,7 +81,7 @@ export const logout = () => { resetWallet() resetRouter() clearActiveProfile() - mnemonic.set(null) + loggedIn.set(false) } if (!get(isStrongholdLocked)) { diff --git a/packages/shared/lib/router.ts b/packages/shared/lib/router.ts index 041b8200555..86bfec0aa8b 100644 --- a/packages/shared/lib/router.ts +++ b/packages/shared/lib/router.ts @@ -1,4 +1,4 @@ -import { loggedIn, notification, strongholdPassword, walletPin } from 'shared/lib/app' +import { cleanupSignup, login, strongholdPassword, walletPin } from 'shared/lib/app' import { profiles } from 'shared/lib/profile' import { AccountRoutes, AppRoute, SettingsRoutes, SetupType, Tabs, WalletRoutes } from 'shared/lib/typings/routes' import { get, readable, writable } from 'svelte/store' @@ -24,7 +24,6 @@ export const path = readable(null, (set) => { const updatePath = (): void => { const pathName = window.location.hash.substr(1) set(pathName) - notification.set(null) } window.addEventListener('hashchange', updatePath) @@ -101,7 +100,7 @@ export const routerNext = (event) => { if (shouldAddProfile) { nextRoute = AppRoute.Setup } else { - loggedIn.set(true) + login() nextRoute = AppRoute.Dashboard } break @@ -176,7 +175,8 @@ export const routerNext = (event) => { nextRoute = AppRoute.Congratulations break case AppRoute.Congratulations: - loggedIn.set(true) + cleanupSignup() + login() nextRoute = AppRoute.Dashboard break } @@ -221,5 +221,4 @@ export const resetRouter = () => { settingsRoute.set(SettingsRoutes.Init) dashboardRoute.set(Tabs.Wallet) deepLinkRequestActive.set(false) - loggedIn.set(false) } diff --git a/packages/shared/routes/dashboard/wallet/views/WalletActions.svelte b/packages/shared/routes/dashboard/wallet/views/WalletActions.svelte index dcf2a0dc6e8..095d3c3effc 100644 --- a/packages/shared/routes/dashboard/wallet/views/WalletActions.svelte +++ b/packages/shared/routes/dashboard/wallet/views/WalletActions.svelte @@ -1,5 +1,6 @@