You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The poem is saved to the buffer storage with Capacitor Filesystem interface.
Doing so allows us to: (1) keep the same interface for all platforms and (2) on Android, buffered poems will be saved to the device's storage instead of IndexedDB, which can be cleared by the OS.
The buffered poem is serialized with JSON and has the following structure:
For each entry in the poem directory:
2.1. If a buffered poem with the corresponding URI exists, continue.
2.2. If there's no buffered poem for the URI, read the file and save it to the buffered poem.
Render the list of poems from the buffer, ordered by timestamp. Display name, preview of the poem text, and a marking that shows whether this poem has unsaved changes.
3. Loading individual poem
User clicks the poem to navigate to.
Load the poem from the buffer.
2.1. If there are unsaved changed, display appropriate indication.
Render the poem.
In this way, we always interact with the poem directory through the buffer abstraction.
4. Editing previously saved poem
User navigates to the required poem.
Similarly to the draft, all changes are saved to the buffered poem on the fly.
2.1. Since we're working directly with the filesystem, the saving operation is debounced.
2.2. Depending on the debounce time, a flag preventing user from navigating away has to be added. If the changes haven't been written yet, show alert asking user to wait.
If there are no unsaved changes, user saves the poem.
3.1. The poem is updated.
3.2. The buffered poem is updated.
If there are unsaved changes, user can accept or discard them.
4.1. If the user accepts the changes, the poem is updated with contents of the buffer and the status of the buffer is updated (no more unsaved changes). Optionally, user can make changed to the buffered version.
4.2. If the user discards the buffered version, the original poem is loaded and the buffered version is updated along with its status.
5. Deleting the poem
User initiates deleting the poem.
The poem is deleted.
The buffered poem is deleted.
The text was updated successfully, but these errors were encountered:
1. Saving new poem
Filesystem
interface.The buffered poem is serialized with JSON and has the following structure:
2. Loading the list of poems
2.1. If a buffered poem with the corresponding URI exists, continue.
2.2. If there's no buffered poem for the URI, read the file and save it to the buffered poem.
3. Loading individual poem
2.1. If there are unsaved changed, display appropriate indication.
4. Editing previously saved poem
2.1. Since we're working directly with the filesystem, the saving operation is debounced.
2.2. Depending on the debounce time, a flag preventing user from navigating away has to be added. If the changes haven't been written yet, show alert asking user to wait.
3.1. The poem is updated.
3.2. The buffered poem is updated.
4.1. If the user accepts the changes, the poem is updated with contents of the buffer and the status of the buffer is updated (no more unsaved changes). Optionally, user can make changed to the buffered version.
4.2. If the user discards the buffered version, the original poem is loaded and the buffered version is updated along with its status.
5. Deleting the poem
The text was updated successfully, but these errors were encountered: