func Run() {
	app.MailApp = &app.BmMailAppType{
		App:          tview.NewApplication(),
		Pages:        tview.NewPages(),
		MailBoxLists: make(map[string]*api.MailboxList),
	}

	app.MailApp.Pages.AddPage("unlock_vault", layout.NewUnlockVault(), true, false)
	app.MailApp.Pages.AddPage("main_menu", layout.NewMainMenuScreen(), true, false)
	app.MailApp.Pages.AddPage("accounts", layout.NewAccountScreen(), true, false)
	app.MailApp.Pages.AddPage("message-overview", layout.NewMessageOverviewScreen(), true, false)
	app.MailApp.Pages.AddPage("help", layout.NewHelpScreen(), true, false)
	app.MailApp.App.SetRoot(app.MailApp.Pages, true)

	// Check if the vault can be opened. If not, display our unlock modal
	v, err := vault.Open(vault.VaultPath, vault.VaultPassword)
	if err != nil {
		// Switch unlock page
		app.MailApp.Pages.SwitchToPage("unlock_vault")
		app.MailApp.App.SetFocus(layout.ModalDialogInput)
	} else {
		app.MailApp.Vault = v
		app.MailApp.StaleVault = true
		layout.Refresh()
		app.MailApp.Pages.SwitchToPage("main_menu")
		app.MailApp.App.SetFocus(layout.MainMenuGrid)
	}

	if err := app.MailApp.App.EnableMouse(true).Run(); err != nil {
		panic(err)
	}

	fmt.Print("\nThank you for using BitMaelum, the privacy-first email alternative network.\n\n")
}
// Run is the main entrypoint of the gui
Run is the main entrypoint of the gui
// Run is the main entrypoint of the gui
func Run() {
	app.MailApp = &app.BmMailAppType{
		App:          tview.NewApplication(),
		Pages:        tview.NewPages(),
		MailBoxLists: make(map[string]*api.MailboxList),
	}
	app.MailApp.Pages.AddPage("unlock_vault", layout.NewUnlockVault(), true, false)
	app.MailApp.Pages.AddPage("main_menu", layout.NewMainMenuScreen(), true, false)
	app.MailApp.Pages.AddPage("accounts", layout.NewAccountScreen(), true, false)
	app.MailApp.Pages.AddPage("message-overview", layout.NewMessageOverviewScreen(), true, false)
	app.MailApp.Pages.AddPage("help", layout.NewHelpScreen(), true, false)
	app.MailApp.App.SetRoot(app.MailApp.Pages, true)
	v, err := vault.Open(vault.VaultPath, vault.VaultPassword)
	if err != nil {
		app.MailApp.Pages.SwitchToPage("unlock_vault")
		app.MailApp.App.SetFocus(layout.ModalDialogInput)
	} else {
		app.MailApp.Vault = v
		app.MailApp.StaleVault = true
		layout.Refresh()
		app.MailApp.Pages.SwitchToPage("main_menu")
		app.MailApp.App.SetFocus(layout.MainMenuGrid)
	}
	if err := app.MailApp.App.EnableMouse(true).Run(); err != nil {
		panic(err)
	}
	fmt.Print("\nThank you for using BitMaelum, the privacy-first email alternative network.\n\n")
}
func Run ( ) { app . MailApp = & app . BmMailAppType { App : tview . NewApplication ( ) , Pages : tview . NewPages ( ) , MailBoxLists : make ( map [ string ] * api . MailboxList ) , } app . MailApp . Pages . AddPage ( " " , layout . NewUnlockVault ( ) , true , false ) app . MailApp . Pages . AddPage ( " " , layout . NewMainMenuScreen ( ) , true , false ) app . MailApp . Pages . AddPage ( " " , layout . NewAccountScreen ( ) , true , false ) app . MailApp . Pages . AddPage ( " " , layout . NewMessageOverviewScreen ( ) , true , false ) app . MailApp . Pages . AddPage ( " " , layout . NewHelpScreen ( ) , true , false ) app . MailApp . App . SetRoot ( app . MailApp . Pages , true ) v , err := vault . Open ( vault . VaultPath , vault . VaultPassword ) if err != nil { app . MailApp . Pages . SwitchToPage ( " " ) app . MailApp . App . SetFocus ( layout . ModalDialogInput ) } else { app . MailApp . Vault = v app . MailApp . StaleVault = true layout . Refresh ( ) app . MailApp . Pages . SwitchToPage ( " " ) app . MailApp . App . SetFocus ( layout . MainMenuGrid ) } if err := app . MailApp . App . EnableMouse ( true ) . Run ( ) ; err != nil { panic ( err ) } fmt . Print ( " \n \n \n " ) }
Run is the main entrypoint of the gui
Run is the main entrypoint of the gui
// Check if the vault can be opened. If not, display our unlock modal // Switch unlock page