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

Meta PR: Implement offline support through CozyPouchLink #1507

Merged
merged 84 commits into from
Sep 24, 2024

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Jul 26, 2024

This PR is a temporary "main" for all Offline features until everything is ready to be merged into our main branch

PR List:


Related PRs:

Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Jul 30, 2024
We want the Flagship app to work when offline

To make this possible we configure cozy-client with CozyPouchLink which
role will be to synchronize necessary doctypes into a local PouchDB and
serve them from it instead of from the cozy-stack when the device is
offline

For now the list of synchronized doctypes is hardcoded but in the
future we expect to implement a dynamic list based on cozy-apps'
manifests

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Jul 30, 2024
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Jul 30, 2024
This plugin is required by cozy-client to process `find` queries

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
We want the Flagship app to work when offline

To make this possible we configure cozy-client with CozyPouchLink which
role will be to synchronize necessary doctypes into a local PouchDB and
serve them from it instead of from the cozy-stack when the device is
offline

For now the list of synchronized doctypes is hardcoded but in the
future we expect to implement a dynamic list based on cozy-apps'
manifests

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
This plugin is required by cozy-client to process `find` queries

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
We want the Flagship app to work when offline

To make this possible we configure cozy-client with CozyPouchLink which
role will be to synchronize necessary doctypes into a local PouchDB and
serve them from it instead of from the cozy-stack when the device is
offline

For now the list of synchronized doctypes is hardcoded but in the
future we expect to implement a dynamic list based on cozy-apps'
manifests

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Aug 26, 2024
This plugin is required by cozy-client to process `find` queries

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Aug 26, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Aug 27, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
packages/cozy-pouch-link/src/remote.spec.js Dismissed Show dismissed Hide dismissed
packages/cozy-pouch-link/src/remote.spec.js Dismissed Show dismissed Hide dismissed
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Sep 13, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Sep 13, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/cozy-home that referenced this pull request Sep 16, 2024
We want cozy-home to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/cozy-home that referenced this pull request Sep 19, 2024
We want cozy-home to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
@Ldoppea Ldoppea force-pushed the feat/meta_offline branch 2 times, most recently from d1aee07 to 09c2314 Compare September 19, 2024 14:01
By doing so we add unnecessary values to the capabilities object that
will now contain more data than just `.attributes`

As those are supernumerary values we consider that this is not
problematic, but we may want to find a cleaner solution in the future
Calls of `isInstalled` and all related methods have been checked and
`apps` parameter is always a result of `client.query()` so we know that
`.slug` can be used in replacement of `.attributes.slug`
Calls of those methods have been checked and `instanceInfo` parameter
is always a result of `useInstanceInfo` so we know that `.attributes`
can be omited
For some reason the Pouch engine would ignore any partialFilter if it
is not included in the selector

This may be the same reason we had to do this fix:
7c69838#diff-41848dd46551544674c134f359a5d7cddea46dd1e47c21da6814e1d1d585173dR482-R489
Previous implementation would not be backward compatible with older
Flagship app versions

By checking for method availability, we ensure the code is called only
on the correct Flagship app versions, otherwise the old process is
called

Related PR: #1518
In previous implementation we did not await for the
`persistVirtualDocuments()` result before completing the request

This was done because the persistance was not mandatory for the
request's result and doing it in parallel would be a good way to
optimize timings

But in some recent experiments we found a scenario where we would
benefit from the `await` in order to some external code until the data
is actually persisted

Related PR: #1486
In the Flagship app, we want to be able to reset the local PouchDB
files in order to prevent beta testers to be blocked by an erroneous
Pouch replication

To make this possible we want to expose a public method that resets all
the cozy-client's links
`fetchJSON()` calls are not compatible with offline mode unless we wrap
them in the `.query()` dsl

Recently we added a `fetchJSON()` call inside of cozy-home in order to
display the new grouped-by-category folders in the home's konnectors
section

So we want to move this call inside of the AppsRegistryCollection in
order to make it compatible with offline mode

Related PR: cozy/cozy-home#2186
This should clarify that this link should be run on the web side and
not on the Flagship app side
@Ldoppea Ldoppea merged commit 180f51a into master Sep 24, 2024
4 checks passed
@Ldoppea Ldoppea deleted the feat/meta_offline branch September 24, 2024 10:01
Ldoppea added a commit to cozy/cozy-libs that referenced this pull request Sep 24, 2024
This version introduces the new `downloadFile()` method that is
compatible with Offline mode

Related PR: cozy/cozy-client#1507

BREAKING CHANGE: cozy-viewer now requires cozy-client >= 49.0.0 (used
for offline support)
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 24, 2024
We want the Flagship app to work when offline

To make this possible we configure cozy-client with CozyPouchLink which
role will be to synchronize necessary doctypes into a local PouchDB and
serve them from it instead of from the cozy-stack when the device is
offline

For now the list of synchronized doctypes is hardcoded but in the
future we expect to implement a dynamic list based on cozy-apps'
manifests

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 24, 2024
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 24, 2024
This plugin is required by cozy-client to process `find` queries

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-libs that referenced this pull request Sep 24, 2024
This version introduces the new `downloadFile()` method that is
compatible with Offline mode

Related PR: cozy/cozy-client#1507

BREAKING CHANGE: cozy-viewer now requires cozy-client >= 49.0.0 (used
for offline support)
Ldoppea added a commit to cozy/cozy-home that referenced this pull request Sep 24, 2024
`cozy-client` has been upgraded to `49.0.0` in order to retrieve the
Offline mode support

`cozy-intent` has been upgraded to `2.23.0` as it is the new minimal
version for `cozy-client` since `49.0.0`

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-home that referenced this pull request Sep 24, 2024
We want cozy-home to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Sep 24, 2024
`cozy-client` has been upgraded to `49.0.0` in order to retrieve the
Offline mode support

`cozy-intent` has been upgraded to `2.23.0` as it is the new minimal
version for `cozy-client` since `49.0.0`

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Sep 24, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/mespapiers that referenced this pull request Sep 25, 2024
We want mespapiers to be compatible with the new Flagship app's Offline
mode

When hosted in a Flagship app's WebView we now want to use FlagshipLink
instead of StackLink in cozy-client

This link will allow to redirect all queries to the Flagship app that
will handle data access when offline but also when online

Related PR: cozy/cozy-client#1507
Related PR: cozy/cozy-flagship-app#1239
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 25, 2024
We want the Flagship app to work when offline

To make this possible we configure cozy-client with CozyPouchLink which
role will be to synchronize necessary doctypes into a local PouchDB and
serve them from it instead of from the cozy-stack when the device is
offline

For now the list of synchronized doctypes is hardcoded but in the
future we expect to implement a dynamic list based on cozy-apps'
manifests

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 25, 2024
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this pull request Sep 25, 2024
This plugin is required by cozy-client to process `find` queries

Related PR: cozy/cozy-client#1507
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.

1 participant