Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add splash screen on top of ctx refactor #2548

Merged
merged 34 commits into from
Aug 7, 2023

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Jul 8, 2023

Depends on #2378 on the feat/ctx-refactor branch

  • feat: add splash screen
  • tmp: trying to fix e2e tests

Currently failing e2e tests.

Demo

ipfs-desktop-splash-screen-demo

@SgtPooki SgtPooki changed the base branch from main to feat/ctx-refactor July 8, 2023 01:38
Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

src/splash/splash.html Outdated Show resolved Hide resolved
src/splash/splash.html Outdated Show resolved Hide resolved
src/splash/splash.html Outdated Show resolved Hide resolved
src/webui/index.js Outdated Show resolved Hide resolved
@@ -183,17 +187,34 @@ module.exports = async function () {
})

const launchWebUI = ctx.getFn('launchWebUI')
const splashScreenPromise = ctx.getProp('splashScreen')
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showing the splash screen during testing causing some odd issues with playwright electron and not being able to get the actual webui window.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder why that is? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder why that is? 🤔

I think there is some testing that defaults to the first window returned, and if that window is the splash window, the tests fail. I removed the block on TEST and have more tests passing now.

test/e2e/launch.e2e.test.js Outdated Show resolved Hide resolved
test/e2e/launch.e2e.test.js Outdated Show resolved Hide resolved
test/e2e/launch.e2e.test.js Outdated Show resolved Hide resolved
test/e2e/launch.e2e.test.js Outdated Show resolved Hide resolved
test/e2e/launch.e2e.test.js Outdated Show resolved Hide resolved
@SgtPooki SgtPooki marked this pull request as ready for review July 8, 2023 02:17
@SgtPooki SgtPooki requested review from a team and whizzzkid as code owners July 8, 2023 02:17
Copy link
Contributor

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits. not blocking per se, but can be improved.

Comment on lines 24 to 25
await splashScreen.loadFile(path.join(__dirname, './splash.html'))
splashScreen.center()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this in the try block too?

src/splash/splash.html Outdated Show resolved Hide resolved
src/splash/splash.html Outdated Show resolved Hide resolved
@@ -183,17 +187,34 @@ module.exports = async function () {
})

const launchWebUI = ctx.getFn('launchWebUI')
const splashScreenPromise = ctx.getProp('splashScreen')
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder why that is? 🤔

src/webui/index.js Outdated Show resolved Hide resolved
src/splash/create-splash-screen.js Outdated Show resolved Hide resolved
Base automatically changed from feat/ctx-refactor to main July 18, 2023 22:51
Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

src/splash/splash.html Outdated Show resolved Hide resolved
@@ -183,17 +187,34 @@ module.exports = async function () {
})

const launchWebUI = ctx.getFn('launchWebUI')
const splashScreenPromise = ctx.getProp('splashScreen')
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder why that is? 🤔

I think there is some testing that defaults to the first window returned, and if that window is the splash window, the tests fail. I removed the block on TEST and have more tests passing now.

Comment on lines +374 to +377
if (process.env.NODE_ENV === 'test' || process.env.CI != null) {
logger.info('[daemon] CI or TEST mode, skipping busyPortDialog')
promptUser = false
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests fail locally or timeout because of waiting on this prompt.

Comment on lines +16 to +17
width: 250,
height: 275,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduced size due to background page being gone, but it needs to be bigger than the 200x200 px icon

@@ -107,6 +112,7 @@ const createWindow = () => {
})

app.on('before-quit', () => {
logger.info('[web ui] app-quit requested')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests have some race condition where playwright will shut down electron but then use the same instance to try to load webui pages... this helped me debug

Comment on lines +152 to +155
if (window.isDestroyed()) {
logger.error(`[web ui] window is destroyed, not launching web ui with ${path}`)
return
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e tests trying to launch webui even though it already killed electron and is done with the tests.

Comment on lines +207 to +212
window.on('close', () => {
if (splashScreenTimeoutId) {
clearTimeout(splashScreenTimeoutId)
splashScreenTimeoutId = null
}
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when app is closed, clear the timeout.. we don't need to handle splashscreen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't it be auto GCed? I'm trying to understand the benefit of cleaning this up prior to close.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be, but it still causes issues in e2e due to some race condition in how playwright runs electron in our e2e tests.

src/context.js Show resolved Hide resolved
src/splash/create-splash-screen.js Outdated Show resolved Hide resolved
src/splash/splash.html Outdated Show resolved Hide resolved
@SgtPooki SgtPooki requested a review from whizzzkid August 1, 2023 01:04
Copy link
Contributor

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits, approved.

assets/pages/splash.html Outdated Show resolved Hide resolved
src/context.js Show resolved Hide resolved
@@ -0,0 +1 @@
export type CONFIG_KEYS = 'AUTO_LAUNCH' | 'AUTO_GARBAGE_COLLECTOR' | 'SCREENSHOT_SHORTCUT' | 'OPEN_WEBUI_LAUNCH' | 'MONOCHROME_TRAY_ICON' | 'EXPERIMENT_PUBSUB' | 'EXPERIMENT_PUBSUB_NAMESYS'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort?

src/webui/index.js Outdated Show resolved Hide resolved
Comment on lines +207 to +212
window.on('close', () => {
if (splashScreenTimeoutId) {
clearTimeout(splashScreenTimeoutId)
splashScreenTimeoutId = null
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't it be auto GCed? I'm trying to understand the benefit of cleaning this up prior to close.

SgtPooki and others added 2 commits August 1, 2023 11:46
src/context.js Show resolved Hide resolved
Comment on lines +207 to +212
window.on('close', () => {
if (splashScreenTimeoutId) {
clearTimeout(splashScreenTimeoutId)
splashScreenTimeoutId = null
}
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be, but it still causes issues in e2e due to some race condition in how playwright runs electron in our e2e tests.

src/webui/index.js Outdated Show resolved Hide resolved
@SgtPooki
Copy link
Member Author

SgtPooki commented Aug 1, 2023

these e2e tests are so sketchy.. they don't run consistently locally. they don't run consistently in github actions.. we should probably remove any e2e tests that are dependent upon ipfsd-ctl, because that's where i'm seeing a lot of problems.

Also, the ipfsd-ctl configs are still using ipfs-http-client because electron struggles with ESM :|

@SgtPooki SgtPooki merged commit 417875d into main Aug 7, 2023
8 checks passed
@SgtPooki SgtPooki deleted the feat/ctx-refactor-splash-screen branch August 7, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants