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: Handle offline mode in Flagship app #2186

Merged
merged 13 commits into from
Feb 12, 2025
Merged

feat: Handle offline mode in Flagship app #2186

merged 13 commits into from
Feb 12, 2025

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented 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
Related PR: cozy/cozy-libs#2562
Related PR: cozy/cozy-libs#2581
Related PR: cozy/cozy-libs#2585

### ✨ Features

* Add support for Offline mode in Flagship app

### 🐛 Bug Fixes

*

### 🔧 Tech

*

TODO:

Copy link

bundlemon bot commented Sep 19, 2024

BundleMon

Files updated (3)
Status Path Size Limits
vendors/home.(hash).js
1.81MB (+8.91KB +0.48%) -
intents/home.(hash).js
25.91KB (+99B +0.37%) -
app/home.(hash).js
48.62KB (-117B -0.23%) -
Unchanged files (10)
Status Path Size Limits
services/softDeleteOrRestoreAccounts/home.js
466.15KB -
services/updateAccounts/home.js
463.29KB -
services/deleteAccounts/home.js
311.95KB -
services/myselfFromIdenties/home.js
236.35KB -
services/polyfillFetch/home.js
97.38KB -
vendors-home.(hash).(hash).min.css
38.02KB -
services/attributesHelpers/home.js
15.22KB -
app-home.(hash).min.css
1.96KB -
intents/index.html
651B -
intents-home.(hash).min.css
158B -

Total files change +8.89KB +0.25%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 19, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 19, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 19, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 23, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 23, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 24, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 24, 2024
`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
Ldoppea added a commit to cozy/cozy-client that referenced this pull request Sep 24, 2024
`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
@Ldoppea Ldoppea force-pushed the feat/offline branch 2 times, most recently from cd96ab4 to ab7e80b Compare February 6, 2025 18:25
Copy link
Contributor

@paultranvan paultranvan left a comment

Choose a reason for hiding this comment

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

🚀

Ldoppea and others added 9 commits February 12, 2025 11:42
In cozy/cozy-client#1460 we implemented a new `useSettings` hook

This hook can be used in `DefaultRedirectionSnackbar` in order to
simplify code and homogenize the way we access cozy-apps settings
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
At startup we check some "app highlights" status, typicallky for backup
or geolocation tracking.
In the tracking case, we need to query the database in order to check if
there is some geolocation data.
This query might fail in offline if the local database is not ready.

And this failure was causing an infinite loop, because a retry was made
for each failed query.
paultranvan and others added 2 commits February 12, 2025 11:42
`cozy-dataproxy-lib` has been upgraded to `3.4.1` in order to retrieve
a fix on the Assistant icon that would not be displayed on Flagship app
in offline mode

Related PR: cozy/cozy-libs#2732
Ldoppea and others added 2 commits February 12, 2025 11:51
Since cozy/cozy-libs#2711 `cozy-pouch-link` is now a peer-dependency of
cozy-dataproxy-lib

So we want to add it to cozy-home

However it won't be used in the cozy-home context, we may want in the
future to split the cozy-dataproxy-lib into 2 dedicated libraries for
the consuming apps and for the dataproxy part (which is the one
requiring cozy-pouch-link)
At each new focus, a full render was triggered, making a visual refresh
for the user.
To fix this, we do not use query options in the ReloadFocus component,
because of: cozy/cozy-client#931
Especially for the apps query, the fetchPolicy is always applied here,
because it is called elsewhere, making the query's lastUpdate very close
in time. And because of this, the home is rendered after each focus, as
the same query gives different result (a complete response, vs an early
empty return in this case)
@Ldoppea Ldoppea merged commit 9c7d4e9 into master Feb 12, 2025
4 checks passed
@Ldoppea Ldoppea deleted the feat/offline branch February 12, 2025 15:24
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