diff --git a/README.md b/README.md index 81b9b8c5..22864028 100644 --- a/README.md +++ b/README.md @@ -12,24 +12,22 @@ There are thunsands of them in the wild. This mine is an excuse for learning [El ### features -- [ ] system integration (play folder/file) -- [ ] images from tags -- [ ] artists' albums -- [ ] smaller screen support (UI refactor) -- [ ] enqueue tracks/albums by dragging to tracks queue -- [ ] add to playlist from Album details/Playlist details/Search results pages -- [ ] configure replay gain from settings - [ ] configurable simple/double click behaviour - [ ] configurable "play now" behaviour: either clear & add, or enqueue and jump -- [ ] display years (artist & album details page) +- [ ] add to playlist from Album details/Playlist details/Search results pages +- [ ] enqueue tracks/albums by dragging to tracks queue +- [ ] system integration (play folder/file) +- [ ] images from tags - [ ] display album/artist descriptions - [ ] number of disk on album details page +- [ ] display years (artist & album details page) +- [ ] configure replay gain from settings - [ ] display tracks/albums/artists count in settings - [ ] allow reseting database from settings +- [ ] smaller screen support (UI refactor) ### tools -- [x] Automated release process with github action - [ ] App automated end to end tests - [ ] Code coverage follow-up (https://app.codacy.com/login/https://codeclimate.com/dashboard) - [ ] more technical documentation (install & release process notably) @@ -57,7 +55,6 @@ There are thunsands of them in the wild. This mine is an excuse for learning [El 1. startup performance isn't great 1. now that I'm not using FLIP animations, native drag'n drop may be leaner than my mouse-event based implementation -1. When DB has albums and playlists, tutorial enters infinite loop 1. Undetected live changes: remove tracks and re-add them. This is a linux-only issue with chokidar - https://github.com/paulmillr/chokidar/issues/917 - https://github.com/paulmillr/chokidar/issues/591 diff --git a/package.json b/package.json index 2a389c83..2ffb2de1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dev": "rollup -c -w", "postinstall": "electron-builder install-app-deps", "release:artifacts": "electron-builder", - "release:bump": "standard-version -prerelease alpha", + "release:bump": "standard-version -s -prerelease alpha", "release:publish": "electron-builder -p onTagOrDraft", "start": "electron .", "storybook": "start-storybook -p 6006 -s ./fixtures", @@ -125,4 +125,4 @@ "node scripts/remove-secrets" ] } -} +} \ No newline at end of file diff --git a/renderer/stores/tutorial.js b/renderer/stores/tutorial.js index f9cda0d4..30b18f2e 100644 --- a/renderer/stores/tutorial.js +++ b/renderer/stores/tutorial.js @@ -76,20 +76,29 @@ const current$ = new BehaviorSubject(null) const clickNextButton$ = new Subject() +let subscription = null + function awaitsEvent(store, criteria = () => true) { - const subscription = store.subscribe(async value => { + subscription = store.subscribe(async value => { if (criteria(value)) { await tick() - if (typeof subscription === 'function') { - subscription() - } else { - subscription.unsubscribe() - } + unsubscribe() next() } }) } +function unsubscribe() { + if (subscription) { + if (typeof subscription === 'function') { + subscription() + } else { + subscription.unsubscribe() + } + subscription = null + } +} + function next() { const idx = steps.indexOf(current$.value) if (idx === -1 || idx < steps.length - 1) { @@ -113,6 +122,7 @@ export async function start() { } export async function stop() { + unsubscribe() if (current$.value !== null) { current$.next(null) allowNavigation() diff --git a/renderer/stores/tutorial.test.js b/renderer/stores/tutorial.test.js index 77bce3fe..e4fbcbcb 100644 --- a/renderer/stores/tutorial.test.js +++ b/renderer/stores/tutorial.test.js @@ -150,14 +150,23 @@ describe('tutorial store', () => { it('can be started and stopped', async () => { start() await sleep() + + handleNextButtonClick() + await sleep() + expect(get(current)).toEqual( expect.objectContaining({ - anchorId: 'locale', - messageKey: 'tutorial.chooseLocale', - nextButtonKey: 'alright' + anchorId: 'folder', + messageKey: 'tutorial.findMusic' }) ) + stop() + // make sure tutorial is not awaiting + push('/album') + await sleep(10) + expect(get(current)).toEqual(null) + expect(location.hash).toEqual('#/album') }) })