feat(electron): onboarding at first launch logic for client and web (#5183)

- Added a simple abstraction of persistent storage class.
- Different persistence solutions are provided for web and client.
    - web: stored in localStorage
    - client: stored in the application directory as `.json` file
- Define persistent app-config schema
- Add a new hook that can interactive with persistent-app-config reactively
This commit is contained in:
Cats Juice
2023-12-19 07:17:54 +00:00
parent e0d328676d
commit 15dd20ef48
32 changed files with 470 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
import { test } from '@affine-test/kit/playwright';
import { skipOnboarding, test } from '@affine-test/kit/playwright';
import {
addUserToWorkspace,
createRandomUser,
@@ -56,6 +56,7 @@ test('can enable share page', async ({ page, browser }) => {
// check share page is accessible
{
const context = await browser.newContext();
await skipOnboarding(context);
const url: string = await page.evaluate(() =>
navigator.clipboard.readText()
);
@@ -97,6 +98,7 @@ test('share page with default edgeless', async ({ page, browser }) => {
// check share page is accessible
{
const context = await browser.newContext();
await skipOnboarding(context);
const url: string = await page.evaluate(() =>
navigator.clipboard.readText()
);
@@ -135,6 +137,7 @@ test('can collaborate with other user and name should display when editing', asy
const workspaceId = currentUrl.split('/')[4];
const userB = await createRandomUser();
const context = await browser.newContext();
await skipOnboarding(context);
const page2 = await context.newPage();
await loginUser(page2, userB.email);
await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */);
@@ -205,6 +208,7 @@ test('can sync collections between different browser', async ({
{
const context = await browser.newContext();
await skipOnboarding(context);
const page2 = await context.newPage();
await loginUser(page2, user.email);
await page2.goto(page.url());
@@ -268,6 +272,7 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
{
const context = await browser.newContext();
await skipOnboarding(context);
const page2 = await context.newPage();
await loginUser(page2, user.email);
await page2.goto(page.url());