fix(T3474): After authentication when main window already visible, close onboarding window

Summary: Fixes T3474

Test Plan: Run tests

Reviewers: dillon, evan

Reviewed By: dillon, evan

Maniphest Tasks: T3474

Differential Revision: https://phab.nylas.com/D1967
This commit is contained in:
Ben Gotow 2015-09-02 11:02:18 -07:00
parent d7c2ce6319
commit 0ea3dfca62
4 changed files with 9 additions and 11 deletions

View file

@ -172,7 +172,7 @@ class Application
_loginSuccessful: =>
@openWindowsForTokenState()
@windowManager.mainWindow().once 'window:loaded', =>
@windowManager.mainWindow().waitForLoad =>
@windowManager.onboardingWindow()?.close()
databasePhase: ->

View file

@ -199,11 +199,8 @@ class AtomWindow
@browserWindow.focusOnWebView() unless @isWindowClosing
sendMessage: (message, detail) ->
if @loaded
@waitForLoad =>
@browserWindow.webContents.send(message, detail)
else
@browserWindow.once 'window:loaded', =>
@browserWindow.webContents.send(message, detail)
sendCommand: (command, args...) ->
if @isSpecWindow()
@ -233,13 +230,15 @@ class AtomWindow
show: -> @browserWindow.show()
showWhenLoaded: ->
if @loaded
@waitForLoad =>
@show()
@focus()
waitForLoad: (fn) ->
if @loaded
fn()
else
@once 'window:loaded', =>
@show()
@focus()
@once('window:loaded', fn)
focus: -> @browserWindow.focus()

View file

@ -62,8 +62,6 @@ class WindowManager
@_mainWindow.focus()
else if !@_mainWindow.isVisible()
@_mainWindow.showWhenLoaded()
else
@_mainWindow.focus()
else
if @devMode

View file

@ -81,6 +81,7 @@ class EdgehillAPI
if token.provider is 'inbox'
token.provider = 'nylas'
atom.config.set('tokens', incoming)
atom.config.save()
unlinkToken: (token) ->
@request