From 22088ab7755afb17a49175e5d3ff668fbb3dcdf6 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 23 Jan 2023 22:05:37 +0000 Subject: [PATCH 01/30] Init offline docs --- app/views/docs/offline.phtml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/views/docs/offline.phtml diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml new file mode 100644 index 000000000..e69de29bb From 8d78b42775e9a05c5adb2f19a0e1b3fbf07e0b35 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 25 Jan 2023 21:38:24 +0000 Subject: [PATCH 02/30] Add intro text --- app/views/docs/offline.phtml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index e69de29bb..547adf384 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -0,0 +1,19 @@ +

+ Appwrite Offline allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of WIFI range. Offline helps your app gracefully handle these real life situations and keep your users engaged. +

+ +

When Should I Enable Offline?

+

+ Appwrite Offline allows you to continue making requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again. +

+

+ You should consider enabling Offline if you expect the user device running your application to experience short periods without a network connection, like going on an airplane to going through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect you app to be offline for days or weeks at a time, you may also need to find alternative solutions. +

+ +

Tradeoffs of Enabling Offline

+

+ Offline support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection. +

+

+ When Offline is enabled, it will change how promises are resolved in the Appwrite SDKs. Requests made Offline can become blocking, which means you will need to change how you handle promises in your application. This means you may need to rewrite some of your code when adding Offline to existing applications. +

\ No newline at end of file From a46cc354cbc0ff88d2f9122486a6420e8b12ecdc Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:45:30 -0500 Subject: [PATCH 03/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 547adf384..f80010c84 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -1,5 +1,5 @@

- Appwrite Offline allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of WIFI range. Offline helps your app gracefully handle these real life situations and keep your users engaged. + The Appwrite SDKs' Offline Support allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support helps your app gracefully handle these real-life situations and keeps your users engaged.

When Should I Enable Offline?

From a5cf410b799d18a436a21fc2d2a1fe0c88ebb28a Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:45:36 -0500 Subject: [PATCH 04/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index f80010c84..78fb35619 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -2,7 +2,7 @@ The Appwrite SDKs' Offline Support allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support helps your app gracefully handle these real-life situations and keeps your users engaged.

-

When Should I Enable Offline?

+

When Should I Enable Offline Support?

Appwrite Offline allows you to continue making requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again.

From 2cc25998695b7c6866fc02eb3cf2db5ae00c71e9 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:45:44 -0500 Subject: [PATCH 05/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 78fb35619..d3b844af1 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -7,7 +7,7 @@ Appwrite Offline allows you to continue making requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again.

- You should consider enabling Offline if you expect the user device running your application to experience short periods without a network connection, like going on an airplane to going through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect you app to be offline for days or weeks at a time, you may also need to find alternative solutions. + You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

Tradeoffs of Enabling Offline

From 284eab43be8880016bbc1ba2943c2700f7c65d8e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:46:00 -0500 Subject: [PATCH 06/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index d3b844af1..9d40cf1ed 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -4,7 +4,7 @@

When Should I Enable Offline Support?

- Appwrite Offline allows you to continue making requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again. + With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again.

You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. From c84c16071a56f32ec3c27e6ebd56884d9f5077c9 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:46:07 -0500 Subject: [PATCH 07/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 9d40cf1ed..01751ed20 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -10,7 +10,7 @@ You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

-

Tradeoffs of Enabling Offline

+

Tradeoffs of Enabling Offline Support

Offline support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection.

From 4894a138468c51898f1b14c5f6daaa7bce9850ce Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 17:46:13 -0500 Subject: [PATCH 08/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 01751ed20..dd98bf41a 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -15,5 +15,5 @@ Offline support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection.

- When Offline is enabled, it will change how promises are resolved in the Appwrite SDKs. Requests made Offline can become blocking, which means you will need to change how you handle promises in your application. This means you may need to rewrite some of your code when adding Offline to existing applications. + When Offline Support is enabled, it will change how API calls are made in the Appwrite SDKs. Write requests made while offline will not return until online again, which means you will need to change how you call these methods in your application. This means you may need to rewrite some of your code when adding Offline Support to existing applications.

\ No newline at end of file From 69e5c823d0c2c07622c6476d1dba8e21f02dd2c7 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 26 Jan 2023 22:53:22 +0000 Subject: [PATCH 09/30] Rewrite trade offs + existing projects --- app/views/docs/offline.phtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index dd98bf41a..fba136423 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -2,7 +2,7 @@ The Appwrite SDKs' Offline Support allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support helps your app gracefully handle these real-life situations and keeps your users engaged.

-

When Should I Enable Offline Support?

+

When Should I Enable Offline Support?

With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again.

@@ -10,10 +10,11 @@ You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

-

Tradeoffs of Enabling Offline Support

+

Considerations and Tradeoffs

- Offline support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection. + Offline Support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection.

+

Offline Support for Existing Projects

- When Offline Support is enabled, it will change how API calls are made in the Appwrite SDKs. Write requests made while offline will not return until online again, which means you will need to change how you call these methods in your application. This means you may need to rewrite some of your code when adding Offline Support to existing applications. + Promises may not resolve immediately when Offline Support is enabled. Existing projects will require some code to be rewritten when adopting Offline Support. Learn more about promise resolution.

\ No newline at end of file From ae66a2ba4af2bd8d006eaf4e4ffbb51b2b022f91 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 6 Feb 2023 11:05:40 -0500 Subject: [PATCH 10/30] Update app/views/docs/offline.phtml Co-authored-by: Bradley Schofield --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index fba136423..c072e2f44 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -7,7 +7,7 @@ With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again.

- You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. + You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

Considerations and Tradeoffs

From 7ca33c46ba181bc79ac58890706f5d8ff0860d5e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 6 Feb 2023 12:03:53 -0500 Subject: [PATCH 11/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index c072e2f44..37d099efb 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -16,5 +16,5 @@

Offline Support for Existing Projects

- Promises may not resolve immediately when Offline Support is enabled. Existing projects will require some code to be rewritten when adopting Offline Support. Learn more about promise resolution. + Asynchronous operations may not resolve immediately when Offline Support is enabled. Existing projects will require some code to be rewritten when adopting Offline Support. Learn more about how to handle asynchronous operation.

\ No newline at end of file From 8c0b39e89d9514590975fa3eef637a839592b433 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 10 Feb 2023 13:26:23 -0500 Subject: [PATCH 12/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 37d099efb..aba188cef 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -4,7 +4,7 @@

When Should I Enable Offline Support?

- With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cache data, and write requests will be queued and executed once the device is online again. + With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again.

You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. From 5828b058e7a9fe2814b87101579ec8b0635ef054 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 10 Feb 2023 13:26:38 -0500 Subject: [PATCH 13/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index aba188cef..8fd3a603f 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -7,7 +7,7 @@ With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again.

- You should consider enabling Offline Support if you expect the user device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. + You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

Considerations and Tradeoffs

From ba58a55652a3524a5c8a49baede116ad35c2de5a Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 10 Feb 2023 21:16:28 +0000 Subject: [PATCH 14/30] Plan body of offline doc --- app/views/docs/offline.phtml | 51 +++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 8fd3a603f..fb43f1714 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -4,17 +4,54 @@

When Should I Enable Offline Support?

- With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache. While offline, read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again. + You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions.

+ +

Enable Offline Support

- You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. +

-

Considerations and Tradeoffs

- Offline Support adds a cache layer that takes up additional resources and adds overhead to your requests. This may not be desirable for some applications, especially if it's not expected to be used without a stable internet connection. + Offline Support can be enabled by setting setOffilnePersistency to true on your SDK's client.

-

Offline Support for Existing Projects

+ +[TODO: Code Example]

- Asynchronous operations may not resolve immediately when Offline Support is enabled. Existing projects will require some code to be rewritten when adopting Offline Support. Learn more about how to handle asynchronous operation. -

\ No newline at end of file + Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16KB and can be configured using the setOfflineCacheSize method. +

+ +[TODO: Code Example] + +

Asynchronous Operation

+

+ When Offline Support is enabled, asynchronous operations only resolve after the request is accepted by the server. Requests made with the Client SDK may block code execution until network connection is available again. +

+[TODO: Show UML diagram] + +

+ For example, the code example below will block code execution when the device is offline. +

+ +[TODO: Show Example, in comments clearly mark that it's ] + +

+ To avoid blocking code execution, asynchronous operations should be handled [TODO: fill description] +

+ +[TODO: Show correct version of example. ] + +

Conflict Resolution

+

+ With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache when offline. Read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again. This can lead to write conflicts when the device is online again. +

+

+ [TODO: Describe resolution behavior + tips if available.] +

+ +

+ Additional considerations need to be considered when updating data based on the current value, such as incrementing a counter or appending values to then end of a paragraph. The default conflict resolution behavior may result in incorrect updates and writes. Consider disabling these operations while offline or use Appwrite Functions to implement logic to resolve conflicts. +

+ + + From e6ed7e089d3e2ca0ebfe0f441c70b8a0a0b008ae Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 10 Feb 2023 21:24:10 +0000 Subject: [PATCH 15/30] Special care for async ops in a notice --- app/views/docs/offline.phtml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index fb43f1714..c5548e9ff 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -8,14 +8,17 @@

Enable Offline Support

-

- -

Offline Support can be enabled by setting setOffilnePersistency to true on your SDK's client.

+
+

Adding Offline Support to Existing Projects

+

Enabling Offline Support introduces breaking changes to the behavior of Client SDKs. Asynchronous operations may not resolve until the device is online again. Existing projects will have to be updated.

+

Learn more about asynchronous operations

+
+ [TODO: Code Example]

Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16KB and can be configured using the setOfflineCacheSize method. @@ -23,7 +26,7 @@ [TODO: Code Example] -

Asynchronous Operation

+

Asynchronous Operation

When Offline Support is enabled, asynchronous operations only resolve after the request is accepted by the server. Requests made with the Client SDK may block code execution until network connection is available again.

From 1f2c4773f4cd8edc7da48a78efb9e684d15ac722 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 24 Feb 2023 18:28:46 -0500 Subject: [PATCH 16/30] Update app/views/docs/offline.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index c5548e9ff..36ce24bb4 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -28,7 +28,7 @@

Asynchronous Operation

- When Offline Support is enabled, asynchronous operations only resolve after the request is accepted by the server. Requests made with the Client SDK may block code execution until network connection is available again. + When Offline Support is enabled, asynchronous write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

[TODO: Show UML diagram] From 3f2c85aedada9fcc4bc6f0316f14c2cc9553744f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 24 Feb 2023 18:32:56 -0500 Subject: [PATCH 17/30] Update offline.phtml --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 36ce24bb4..47486cc42 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -21,7 +21,7 @@ [TODO: Code Example]

- Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16KB and can be configured using the setOfflineCacheSize method. + Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16MB and can be configured using the setOfflineCacheSize method.

[TODO: Code Example] From 198b4a9b6fc340ed356e7651aee75101f2d0507b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Mar 2023 19:27:02 +0000 Subject: [PATCH 18/30] Add code snippets for offline --- app/views/docs/offline.phtml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 47486cc42..89c15a14e 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -19,12 +19,16 @@

Learn more about asynchronous operations

-[TODO: Code Example] +
+
client.setOfflinePersistency(status: true);
+

Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16MB and can be configured using the setOfflineCacheSize method.

-[TODO: Code Example] +
+
client.setOfflineCacheSize(40000);
+

Asynchronous Operation

@@ -35,14 +39,28 @@

For example, the code example below will block code execution when the device is offline.

- -[TODO: Show Example, in comments clearly mark that it's ] +
+
// This await will not resolve until your device is online
+final document = await databases.createDocument(
+    databaseId: '[DATABASE_ID]',
+    collectionId: '[COLLECTION_ID]',
+    documentId: ID.unique(),
+    data: {},
+);
+

- To avoid blocking code execution, asynchronous operations should be handled [TODO: fill description] + To avoid blocking code execution, update local states and UI optimisitically instead of waiting for awaiting asynchronous operations.

-[TODO: Show correct version of example. ] +
+
final document = databases.createDocument(
+    databaseId: '[DATABASE_ID]',
+    collectionId: '[COLLECTION_ID]',
+    documentId: ID.unique(),
+    data: {},
+);
+

Conflict Resolution

From 8e66831a70a00476566ed89ea36f7ff2183e99b9 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Mar 2023 20:26:50 +0000 Subject: [PATCH 19/30] update description for conflict resolution --- app/views/docs/offline.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 89c15a14e..a14642ca3 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -67,7 +67,7 @@ final document = await databases.createDocument( With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache when offline. Read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again. This can lead to write conflicts when the device is online again.

- [TODO: Describe resolution behavior + tips if available.] + Document updates made while your device is offline will be queued locally with a timestamp. When your device comes online, Appwrite will compare the timestamps of local updates with the timestamp of the remote document, accepting the latest version. Appwrite will reject a document update if the remote document been updated later than the locally queued update.

From 0c0680e77f87977a0ef381dac2c395fc3bc47102 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Mar 2023 23:11:27 +0000 Subject: [PATCH 20/30] Adds information about the state --- app/views/docs/offline.phtml | 68 +++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index a14642ca3..de7a01301 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -40,13 +40,34 @@ For example, the code example below will block code execution when the device is offline.

-
// This await will not resolve until your device is online
-final document = await databases.createDocument(
-    databaseId: '[DATABASE_ID]',
-    collectionId: '[COLLECTION_ID]',
-    documentId: ID.unique(),
-    data: {},
-);
+
  void blockingSubmitTodo() async {
+    if (inputController.text.isEmpty || isLoading) return;
+    final messenger = ScaffoldMessenger.of(context);
+    final newTodo = Todo(
+      content: inputController.text,
+      id: ID.unique(),
+    );
+
+    try {
+      await _databases.createDocument(
+        databaseId: '[DATABASE_ID]',
+        collectionId: '[COLLECTION_ID]',
+        documentId: newTodo.id,
+        data: {
+          "content": newTodo.content,
+          "isComplete": newTodo.isComplete,
+        },
+      );
+      inputController.text = '';
+      todos.add(newTodo);
+    } catch (e) {
+      messenger.showSnackBar(createErrorSnackBar(e.toString()));
+    }
+
+    setState(() {
+      isLoading = false;
+    });
+  }

@@ -54,12 +75,33 @@ final document = await databases.createDocument(

-
final document = databases.createDocument(
-    databaseId: '[DATABASE_ID]',
-    collectionId: '[COLLECTION_ID]',
-    documentId: ID.unique(),
-    data: {},
-);
+
  void nonBlockingSubmitTodo() async {
+    if (inputController.text.isEmpty || isLoading) return;
+    final messenger = ScaffoldMessenger.of(context);
+    final newTodo = Todo(
+      content: inputController.text,
+      id: ID.unique(),
+    );
+
+    _databases.createDocument(
+      databaseId: '[DATABASE_ID]',
+      collectionId: '[COLLECTION_ID]',
+      documentId: newTodo.id,
+      data: {
+        "content": newTodo.content,
+        "isComplete": newTodo.isComplete,
+      },
+    ).catchError((e) {
+      messenger.showSnackBar(createErrorSnackBar(e.toString()));
+      todos.remove(newTodo);
+    });
+
+    setState(() {
+      inputController.text = '';
+      todos.add(newTodo);
+      isLoading = false;
+    });
+  }

Conflict Resolution

From 953705b323df8f0206565d0bb90a24be1a614022 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 13 Mar 2023 22:39:12 +0000 Subject: [PATCH 21/30] Style and Grammar --- app/views/docs/offline.phtml | 129 +++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index de7a01301..01c3f8c7c 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -1,73 +1,101 @@ + +

- The Appwrite SDKs' Offline Support allows your client apps to continue functioning without an internet connection. Your users' mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like when going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support helps your app gracefully handle these real-life situations and keeps your users engaged. + Offline Support allows your client apps to continue functioning without an internet connection. Mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support keeps your users engaged when transitioning through these real-life situations.

-

When Should I Enable Offline Support?

+

When Should I Enable Offline Support?

- You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel. Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks at a time, you may also need to find alternative solutions. + You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel.

- -

Enable Offline Support

-

- Offline Support can be enabled by setting setOffilnePersistency to true on your SDK's client. + Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks, you may need to find alternative solutions.

+

Enable Offline Support

+
-

Adding Offline Support to Existing Projects

-

Enabling Offline Support introduces breaking changes to the behavior of Client SDKs. Asynchronous operations may not resolve until the device is online again. Existing projects will have to be updated.

-

Learn more about asynchronous operations

+

Breaking Changes

+

Enabling Offline Support introduces breaking changes to the asynchronous operation behavior of Client SDKs. Existing projects must be updated.

+

Learn more about asynchronous operations

+

Toggle Persistency

+

+ You can enable Offline Support by setting setOffilnePersistency to true on your SDK's client. +

+
client.setOfflinePersistency(status: true);
+ +

Configure Cache

- Offline Support will cache all read request in a Least Recently Used (LRU) cache, so the information can remain available even with no internet connection. The LRU cache defaults to a size of 16MB and can be configured using the setOfflineCacheSize method. + Offline Support will cache all read requests in a Least Recently Used (LRU) cache, so the information can remain available without internet connection. The LRU cache defaults to 16MB and can be configured using the setOfflineCacheSize method.

client.setOfflineCacheSize(40000);
-

Asynchronous Operation

+

Asynchronous Operation

- When Offline Support is enabled, asynchronous write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again. + When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

+ +

+ You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future. +

+ +setParam('srcLight', '/images-ee/docs/offline-writes-uml-light.png') + ->setParam('srcDark', '/images-ee/docs/offline-writes-uml-light.png') + ->setParam('alt', 'Function settings page.') + ->setParam('description', 'Function settings page.') + ->render(); +?> [TODO: Show UML diagram] +

Example

For example, the code example below will block code execution when the device is offline.

-
  void blockingSubmitTodo() async {
-    if (inputController.text.isEmpty || isLoading) return;
-    final messenger = ScaffoldMessenger.of(context);
-    final newTodo = Todo(
-      content: inputController.text,
-      id: ID.unique(),
+  
void blockingSubmitTodo() async {
+  if (inputController.text.isEmpty || isLoading) return;
+  final messenger = ScaffoldMessenger.of(context);
+  final newTodo = Todo(
+    content: inputController.text,
+    id: ID.unique(),
+  );
+
+  try {
+    // THIS BLOCKS EXECUTION WHEN OFFLINE
+    await _databases.createDocument(
+      databaseId: '[DATABASE_ID]',
+      collectionId: '[COLLECTION_ID]',
+      documentId: newTodo.id,
+      data: {
+        "content": newTodo.content,
+        "isComplete": newTodo.isComplete,
+      },
     );
-
-    try {
-      await _databases.createDocument(
-        databaseId: '[DATABASE_ID]',
-        collectionId: '[COLLECTION_ID]',
-        documentId: newTodo.id,
-        data: {
-          "content": newTodo.content,
-          "isComplete": newTodo.isComplete,
-        },
-      );
-      inputController.text = '';
-      todos.add(newTodo);
-    } catch (e) {
-      messenger.showSnackBar(createErrorSnackBar(e.toString()));
-    }
-
-    setState(() {
-      isLoading = false;
-    });
-  }
+ inputController.text = ''; + todos.add(newTodo); + } catch (e) { + // ... handle errors + } + + setState(() { + isLoading = false; + }); +}

@@ -83,6 +111,7 @@ id: ID.unique(), ); + // This won't block execution, but will still allow error handling. _databases.createDocument( databaseId: '[DATABASE_ID]', collectionId: '[COLLECTION_ID]', @@ -92,8 +121,7 @@ "isComplete": newTodo.isComplete, }, ).catchError((e) { - messenger.showSnackBar(createErrorSnackBar(e.toString())); - todos.remove(newTodo); + // ... handle errors }); setState(() { @@ -104,17 +132,18 @@ } -

Conflict Resolution

-

- With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache when offline. Read requests will be fetched from the local cached data, and write requests will be queued and executed once the device is online again. This can lead to write conflicts when the device is online again. -

+

Conflict Resolution

- Document updates made while your device is offline will be queued locally with a timestamp. When your device comes online, Appwrite will compare the timestamps of local updates with the timestamp of the remote document, accepting the latest version. Appwrite will reject a document update if the remote document been updated later than the locally queued update. + With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache when offline. Read requests will be fetched from the locally cached data. Write requests will be queued and executed once the device is online again. This can lead to conflicts if another device makes a different change.

+

How Appwrite Handles Offline Writes

+

- Additional considerations need to be considered when updating data based on the current value, such as incrementing a counter or appending values to then end of a paragraph. The default conflict resolution behavior may result in incorrect updates and writes. Consider disabling these operations while offline or use Appwrite Functions to implement logic to resolve conflicts. + Document updates made while your device is offline will be queued locally with a timestamp. When your device comes online, Appwrite will use the timestamps to accept the latest version of the document. Appwrite will reject a document update if the remote document has been updated later than the local document.

- - +

Special Cases

+

+ Additional considerations need to be considered when updating data based on the current value, such as incrementing a counter or appending values to the end of a paragraph. The default conflict resolution behavior may result in incorrect updates and writes. Consider disabling these operations while offline or using Appwrite Functions to implement logic to resolve conflicts. +

\ No newline at end of file From 2fc9646dd61a2e49fd7ef1ba40ac19e4b747fdcd Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 13 Mar 2023 22:48:26 +0000 Subject: [PATCH 22/30] Update example for Flutter --- app/views/docs/offline.phtml | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 01c3f8c7c..fca610bef 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -67,13 +67,7 @@ $image = new View(__DIR__.'/../general/image.phtml'); For example, the code example below will block code execution when the device is offline.

-
void blockingSubmitTodo() async {
-  if (inputController.text.isEmpty || isLoading) return;
-  final messenger = ScaffoldMessenger.of(context);
-  final newTodo = Todo(
-    content: inputController.text,
-    id: ID.unique(),
-  );
+  
void blockingSubmitTodo(Map todo) async {
 
   try {
     // THIS BLOCKS EXECUTION WHEN OFFLINE
@@ -81,12 +75,8 @@ $image = new View(__DIR__.'/../general/image.phtml');
       databaseId: '[DATABASE_ID]',
       collectionId: '[COLLECTION_ID]',
       documentId: newTodo.id,
-      data: {
-        "content": newTodo.content,
-        "isComplete": newTodo.isComplete,
-      },
+      data: todo,
     );
-    inputController.text = '';
     todos.add(newTodo);
   } catch (e) {
     // ... handle errors
@@ -103,29 +93,19 @@ $image = new View(__DIR__.'/../general/image.phtml');
 

-
  void nonBlockingSubmitTodo() async {
-    if (inputController.text.isEmpty || isLoading) return;
-    final messenger = ScaffoldMessenger.of(context);
-    final newTodo = Todo(
-      content: inputController.text,
-      id: ID.unique(),
-    );
+  
  void nonBlockingSubmitTodo(Map todo) async {
 
     // This won't block execution, but will still allow error handling.
     _databases.createDocument(
       databaseId: '[DATABASE_ID]',
       collectionId: '[COLLECTION_ID]',
       documentId: newTodo.id,
-      data: {
-        "content": newTodo.content,
-        "isComplete": newTodo.isComplete,
-      },
+      data: todo,
     ).catchError((e) {
       // ... handle errors
     });
 
     setState(() {
-      inputController.text = '';
       todos.add(newTodo);
       isLoading = false;
     });

From 93ed5e4d364b1c04d6fc5461f8a1ef58ef88ad03 Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Mon, 20 Mar 2023 18:15:20 +0000
Subject: [PATCH 23/30] Fix code examples

---
 app/views/docs/offline.phtml | 46 +++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml
index fca610bef..e29158ae2 100644
--- a/app/views/docs/offline.phtml
+++ b/app/views/docs/offline.phtml
@@ -42,26 +42,40 @@ use Appwrite\Utopia\View;
   
client.setOfflineCacheSize(40000);
+

Offline Support Cache

+

+When Offline Support is enabled, Appwrite allows you to query and write data by adding a cache layer. +

+ +

Reading Data Offline

+

+ Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache. +

+ +
+ +
+ +

Writing Data Offline

+

+ Writes will update the local cache first. If the device is online, the changes will be sent to Appwrite immediately. If the device is not connected to the internet, the operation will be queued and synced to Appwrite when internet is available again. +

+ +
+ +
+

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

- +
+ +

You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future.

-setParam('srcLight', '/images-ee/docs/offline-writes-uml-light.png') - ->setParam('srcDark', '/images-ee/docs/offline-writes-uml-light.png') - ->setParam('alt', 'Function settings page.') - ->setParam('description', 'Function settings page.') - ->render(); -?> -[TODO: Show UML diagram] -

Example

For example, the code example below will block code execution when the device is offline. @@ -74,10 +88,10 @@ $image = new View(__DIR__.'/../general/image.phtml'); await _databases.createDocument( databaseId: '[DATABASE_ID]', collectionId: '[COLLECTION_ID]', - documentId: newTodo.id, + documentId: todo.id, data: todo, ); - todos.add(newTodo); + todos.add(todo); } catch (e) { // ... handle errors } @@ -99,14 +113,14 @@ $image = new View(__DIR__.'/../general/image.phtml'); _databases.createDocument( databaseId: '[DATABASE_ID]', collectionId: '[COLLECTION_ID]', - documentId: newTodo.id, + documentId: todo.id, data: todo, ).catchError((e) { // ... handle errors }); setState(() { - todos.add(newTodo); + todos.add(todo); isLoading = false; }); }

From 759ffbb2d1a3888dfc275a0aa45caf7052de9a30 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 15 May 2023 19:54:05 +0000 Subject: [PATCH 24/30] Relative linkes --- app/views/docs/offline.phtml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index e29158ae2..77ee2fc5c 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -8,7 +8,7 @@ use Appwrite\Utopia\View; Offline Support allows your client apps to continue functioning without an internet connection. Mobile devices frequently encounter situations where internet access becomes unstable or temporarily unavailable, like going through tunnels, getting on airplanes and subways, or going in and out of Wi-Fi range. Offline Support keeps your users engaged when transitioning through these real-life situations.

-

When Should I Enable Offline Support?

+

When Should I Enable Offline Support?

You should consider enabling Offline Support if you expect the device running your application to experience short periods without a network connection, like going on an airplane or through a tunnel.

@@ -16,12 +16,12 @@ use Appwrite\Utopia\View; Offline Support can't help you if the app's data needs to remain up to date with frequent updates or if write requests need to be processed immediately. If you expect your app to be offline for days or weeks, you may need to find alternative solutions.

-

Enable Offline Support

+

Enable Offline Support

Breaking Changes

Enabling Offline Support introduces breaking changes to the asynchronous operation behavior of Client SDKs. Existing projects must be updated.

-

Learn more about asynchronous operations

+

Learn more about asynchronous operations

Toggle Persistency

@@ -42,7 +42,7 @@ use Appwrite\Utopia\View;
client.setOfflineCacheSize(40000);
-

Offline Support Cache

+

Offline Support Cache

When Offline Support is enabled, Appwrite allows you to query and write data by adding a cache layer.

@@ -65,7 +65,7 @@ When Offline Support is enabled, Appwrite allows you to query and write data by -

Asynchronous Operation

+

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

@@ -126,7 +126,7 @@ When Offline Support is enabled, Appwrite allows you to query and write data by }
-

Conflict Resolution

+

Conflict Resolution

With Offline Support enabled, your app can continue sending requests to Appwrite APIs while offline through a cache when offline. Read requests will be fetched from the locally cached data. Write requests will be queued and executed once the device is online again. This can lead to conflicts if another device makes a different change.

From 6648bffaa15deb5d3ba6b4ed09267ff6a69849d3 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 15 May 2023 20:17:41 +0000 Subject: [PATCH 25/30] test image container --- app/views/docs/offline.phtml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 77ee2fc5c..a69d1c074 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -52,9 +52,15 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache.

-
- -
+setParam('srcLight', '/images-ee/docs/offline-read-uml-light.png') + ->setParam('srcDark', '/images-ee/docs/offline-read-uml-dark.png') + ->setParam('alt', 'Function settings page.') + ->setParam('description', 'Function settings page.') + ->render(); +?>

Writing Data Offline

From bb3ccb82af08ff76d6f323737530cc545c657bff Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 15 May 2023 21:06:31 +0000 Subject: [PATCH 26/30] Update to 6 images --- app/views/docs/offline.phtml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index a69d1c074..c3de49fcd 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -52,32 +52,25 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache.

-setParam('srcLight', '/images-ee/docs/offline-read-uml-light.png') - ->setParam('srcDark', '/images-ee/docs/offline-read-uml-dark.png') - ->setParam('alt', 'Function settings page.') - ->setParam('description', 'Function settings page.') - ->render(); -?> +UML diagram depicting offline read operations. +UML diagram depicting offline read operations. +

Writing Data Offline

Writes will update the local cache first. If the device is online, the changes will be sent to Appwrite immediately. If the device is not connected to the internet, the operation will be queued and synced to Appwrite when internet is available again.

-
- -
+UML diagram depicting offline write operations. +UML diagram depicting offline write operations.

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

-
- -
+UML diagram depicting offline cache in async operations. +UML diagram depicting offline cache in async operations. +

You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future.

From cdeff777cc7ed4bb015300145f2eba97d4c29097 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 15 May 2023 21:14:25 +0000 Subject: [PATCH 27/30] Fix width --- app/views/docs/offline.phtml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index c3de49fcd..d2e97e56c 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -52,8 +52,8 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache.

-UML diagram depicting offline read operations. -UML diagram depicting offline read operations. +UML diagram depicting offline read operations. +UML diagram depicting offline read operations.

Writing Data Offline

@@ -61,15 +61,15 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Writes will update the local cache first. If the device is online, the changes will be sent to Appwrite immediately. If the device is not connected to the internet, the operation will be queued and synced to Appwrite when internet is available again.

-UML diagram depicting offline write operations. -UML diagram depicting offline write operations. +UML diagram depicting offline write operations. +UML diagram depicting offline write operations.

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

-UML diagram depicting offline cache in async operations. -UML diagram depicting offline cache in async operations. +UML diagram depicting offline cache in async operations. +UML diagram depicting offline cache in async operations.

You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future. From d1f66fb005313417161cbda0638ec6493af81d17 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 15 May 2023 21:18:59 +0000 Subject: [PATCH 28/30] Fix broken HTML tags --- app/views/docs/offline.phtml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index d2e97e56c..acd853816 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -52,8 +52,8 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache.

-UML diagram depicting offline read operations. -UML diagram depicting offline read operations. +UML diagram depicting offline read operations. +UML diagram depicting offline read operations.

Writing Data Offline

@@ -61,15 +61,15 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Writes will update the local cache first. If the device is online, the changes will be sent to Appwrite immediately. If the device is not connected to the internet, the operation will be queued and synced to Appwrite when internet is available again.

-UML diagram depicting offline write operations. -UML diagram depicting offline write operations. +UML diagram depicting offline write operations. +UML diagram depicting offline write operations.

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

-UML diagram depicting offline cache in async operations. -UML diagram depicting offline cache in async operations. +UML diagram depicting offline cache in async operations. +UML diagram depicting offline cache in async operations.

You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future. From 68a8f4fdfac8f964289db5ef1bbce5f184166c61 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 16 May 2023 19:28:42 +0000 Subject: [PATCH 29/30] Change back to the old style of image view --- app/views/docs/offline.phtml | 37 ++++++++++++++++++++++++++++------- app/views/general/image.phtml | 15 +++++++++++--- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index acd853816..8c8058b75 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -52,24 +52,47 @@ When Offline Support is enabled, Appwrite allows you to query and write data by Queries will fetch data from Appwrite and update the cache while the device is online. If the device is not connected to the internet, the query fetches data from the local cache.

-UML diagram depicting offline read operations. -UML diagram depicting offline read operations. - +setParam('srcLight', '/images-ee/docs/offline-read-uml-light.png') + ->setParam('srcDark', '/images-ee/docs/offline-read-uml-dark.png') + ->setParam('alt', 'UML diagram depicting offline read operations.') + ->setParam('description', 'UML diagram depicting offline read operations.') + ->setParam('width', '100%') + ->render(); +?>

Writing Data Offline

Writes will update the local cache first. If the device is online, the changes will be sent to Appwrite immediately. If the device is not connected to the internet, the operation will be queued and synced to Appwrite when internet is available again.

-UML diagram depicting offline write operations. -UML diagram depicting offline write operations. +setParam('srcLight', '/images-ee/docs/offline-write-uml-light.png') + ->setParam('srcDark', '/images-ee/docs/offline-write-uml-dark.png') + ->setParam('alt', 'UML diagram depicting offline write operations.') + ->setParam('description', 'UML diagram depicting offline write operations.') + ->setParam('width', '100%') + ->render(); +?>

Asynchronous Operation

When Offline Support is enabled, write operations only resolve after the server accepts the request. Requests made with the Client SDK may block code execution until network connection is available again.

-UML diagram depicting offline cache in async operations. -UML diagram depicting offline cache in async operations. +setParam('srcLight', '/images-ee/docs/offline-async-uml-light.png') + ->setParam('srcDark', '/images-ee/docs/offline-async-uml-dark.png') + ->setParam('alt', 'UML diagram depicting offline cache in async operations.') + ->setParam('description', 'UML diagram depicting offline cache in async operations.') + ->setParam('width', '100%') + ->render(); +?>

You should optimistically update your app's local state after a write operation. Once you're online again, the write will be synced with your Appwrite project, which will be fetched when you app restarts in the future. diff --git a/app/views/general/image.phtml b/app/views/general/image.phtml index 22513b85f..fbb268416 100644 --- a/app/views/general/image.phtml +++ b/app/views/general/image.phtml @@ -1,13 +1,22 @@ getParam('srcLight', ''); $srcDark = $this->getParam('srcDark', $srcLight); -$alt = $this->getParam('alt', 'Screenshot'); +$description = $this->getParam('description', ''); +$width = $this->getParam('width', ''); $description = $this->getParam('description', ''); ?>

- <?php echo $this->escape($alt); ?> - <?php echo $this->escape($alt); ?> + <?php echo $this->escape($alt); ?> + <?php echo $this->escape($alt); ?> From 5322745f648df2581dfd17f29dac3d21001608c0 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 16 May 2023 19:29:18 +0000 Subject: [PATCH 30/30] Try without forcing 100% width --- app/views/docs/offline.phtml | 2 -- app/views/general/image.phtml | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/views/docs/offline.phtml b/app/views/docs/offline.phtml index 8c8058b75..fd3ac12ba 100644 --- a/app/views/docs/offline.phtml +++ b/app/views/docs/offline.phtml @@ -59,7 +59,6 @@ $image = new View(__DIR__.'/../general/image.phtml'); ->setParam('srcDark', '/images-ee/docs/offline-read-uml-dark.png') ->setParam('alt', 'UML diagram depicting offline read operations.') ->setParam('description', 'UML diagram depicting offline read operations.') - ->setParam('width', '100%') ->render(); ?> @@ -75,7 +74,6 @@ $image = new View(__DIR__.'/../general/image.phtml'); ->setParam('srcDark', '/images-ee/docs/offline-write-uml-dark.png') ->setParam('alt', 'UML diagram depicting offline write operations.') ->setParam('description', 'UML diagram depicting offline write operations.') - ->setParam('width', '100%') ->render(); ?> diff --git a/app/views/general/image.phtml b/app/views/general/image.phtml index fbb268416..22513b85f 100644 --- a/app/views/general/image.phtml +++ b/app/views/general/image.phtml @@ -1,22 +1,13 @@ getParam('srcLight', ''); $srcDark = $this->getParam('srcDark', $srcLight); -$description = $this->getParam('description', ''); -$width = $this->getParam('width', ''); +$alt = $this->getParam('alt', 'Screenshot'); $description = $this->getParam('description', ''); ?>
- <?php echo $this->escape($alt); ?> - <?php echo $this->escape($alt); ?> + <?php echo $this->escape($alt); ?> + <?php echo $this->escape($alt); ?>