Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

When launching alephium wallet a second time on Windows, it offers option to import/start new wallet #77

Closed
diomark opened this issue Dec 13, 2021 · 11 comments · Fixed by #90
Assignees

Comments

@diomark
Copy link

diomark commented Dec 13, 2021

I had alephium wallet running in the background and didn't realize it. launched alephium wallet again and it gave me the option to import/start new wallet.. might be confusing to some. (I almost re-imported my keys before realizing I had it running backgrounded in a different window).

It's basically launching a second instance instead of focusing on the already launched instance.

@nop33
Copy link
Member

nop33 commented Dec 14, 2021

Hi @diomark, thanks for the feedback. Which version of Windows are you using?

When you say that the wallet was running in the background, do you mean that there was a window open and hidden behind other windows? Or that all windows of the application were closed and the process was still running in the background?

Was this the screen you saw when you opened the application the second time, after already creating a wallet?

image

Thanks a lot for the valuable feedback!

@polarker
Copy link
Member

@nop33 @mvaivre is this related to our latest fix PR? If so, we need to assign a bounty for this issue report

@nop33
Copy link
Member

nop33 commented Dec 15, 2021

I haven't been able to reproduce this on my macbook, waiting for input from @diomark. I can check with @Arbaba who is using Windows, when I see him on Friday.

@diomark
Copy link
Author

diomark commented Dec 15, 2021

Windows 10 [Version 10.0.19043.1348]

The existing wallet window was just hiding behind other windows (i.e. functioning correctly/not crashed)

This is pretty easy to replicate -

Start alephium wallet, login

Start alephium wallet again (from start menu. It will give the options of new wallet or importing wallet (vs just focusing on the already opened wallet)

@diomark
Copy link
Author

diomark commented Dec 15, 2021

btw - yes - that's the screen that shows up when launching a second time. (option for new wallet or importing)

@nop33
Copy link
Member

nop33 commented Dec 20, 2021

I managed to reproduce the issue. I still haven't found a solution. Some notes during my debugging:

  • We create new windows only when 2 events get triggered: ready and activate.
  • Even when commenting out the callback of the activate event completely, when clicking the installed Windows Alephium app it still opens a second window. The only place where createWindow is now called is in the ready event callback. Updating the callback to the following snippet does not solve the problem (second window opens again):
    app.on('ready', () => {
      if (mainWindow === null) createWindow()
    })
  • I tried this, also no success:
    app.on('ready', () => {
      if (BrowserWindow.getAllWindows().length === 0) createWindow()
    })
  • I tried updating the snippet to the following, again, without success:
    app.whenReady().then(() => {
      if (mainWindow === null) createWindow()
    })
  • It would seem that every time the installed exe is launched on Windows (located at C:\Users\<my-user-name>\AppData\Local\Programs\alephium-wallet\Alephium.exe), the mainWindow variable is set to null.

Need to keep debugging...

@polarker
Copy link
Member

polarker commented Dec 21, 2021

I managed to reproduce the issue. I still haven't found a solution. Some notes during my debugging:

  • We create new windows only when 2 events get triggered: ready and activate.
  • Even when commenting out the callback of the activate event completely, when clicking the installed Windows Alephium app it still opens a second window. The only place where createWindow is now called is in the ready event callback. Updating the callback to the following snippet does not solve the problem (second window opens again):
    app.on('ready', () => {
      if (mainWindow === null) createWindow()
    })
  • I tried this, also no success:
    app.on('ready', () => {
      if (BrowserWindow.getAllWindows().length === 0) createWindow()
    })
  • I tried updating the snippet to the following, again, without success:
    app.whenReady().then(() => {
      if (mainWindow === null) createWindow()
    })
  • It would seem that every time the installed exe is launched on Windows (located at C:\Users\<my-user-name>\AppData\Local\Programs\alephium-wallet\Alephium.exe), the mainWindow variable is set to null.

Need to keep debugging...

Is this the same for Macos ?

@nop33
Copy link
Member

nop33 commented Dec 21, 2021

Is this the same for Macos ?

No. Everything works fine there.

@nop33
Copy link
Member

nop33 commented Dec 21, 2021

It turns out that this is not a bug. This is the expected behavior on Windows. Here is an example with another popular electron app (Visual Studio Code). As you can see in the demo, double-clicking the executable opens a new window, exactly as it happens with our wallet.

Kapture.2021-12-21.at.15.36.24.mp4

@nop33
Copy link
Member

nop33 commented Dec 21, 2021

However, if an account has already been created, the second window should display the Login page, not the new wallet creation/import page.

@nop33
Copy link
Member

nop33 commented Dec 21, 2021

For the record, here's a demo of the problem:

Kapture.2021-12-21.at.15.48.54.mp4

nop33 added a commit that referenced this issue Dec 21, 2021
@nop33 nop33 self-assigned this Dec 21, 2021
@nop33 nop33 closed this as completed in #90 Dec 22, 2021
LeeAlephium pushed a commit that referenced this issue May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants