From 1e71ac0c2594b227796d62dcad48f2835772162f Mon Sep 17 00:00:00 2001 From: rae <633012+okdistribute@users.noreply.github.com> Date: Thu, 1 Sep 2022 16:16:29 -0700 Subject: [PATCH] Update snippets.json --- snippets.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets.json b/snippets.json index 4f94683c9b..2dbe480c17 100644 --- a/snippets.json +++ b/snippets.json @@ -209,8 +209,8 @@ "sync-observe": "// --- DittoRegister live query to update UI\nval liveQuery = ditto.store.collection(\"cars\")\n .findAll()\n .observe { docs, event ->\n // Do something...\n }\n\n", "sync-observe-local": "// --- Action somewhere in your application\nfun userDidInsertCar() {\n ditto.store.collection(\"cars\").upsert(mapOf(\n \"model\" to \"Ford\",\n \"color\" to \"black\"\n ))\n}\n\n// --- DittoRegister live query to update UI\nval observeLocalQuery = ditto.store.collection(\"cars\")\n .findAll()\n .observeLocal { docs, event ->\n // Do something...\n}\n\n", "subscribe": "// --- DittoRegister live query to update UI\nval subscription = ditto.store.collection(\"cars\")\n .find(\"color == 'red'\")\n .subscribe()\n\n", - "online-playground": "try {\n val androidDependencies = AndroidDittoDependencies(context)\n val identity = DittoIdentity.OnlinePlayground(androidDependencies, appID = \"00000000-0000-4000-0000-000000000000\", token = \"REPLACE_ME_WITH_YOUR_PLAYGROUND_TOKEN\")\n val ditto = Ditto(androidDependencies, identity)\n ditto.startSync()\n} catch(e: DittoError) {\n Log.e(\"Ditto error\", e.message!!)\n}\n\n", - "offline-playground": "try {\n val androidDependencies = AndroidDittoDependencies(context)\n val identity = DittoIdentity.OfflinePlayground(androidDependencies, appID = \"00000000-0000-4000-0000-000000000000\")\n val ditto = Ditto(androidDependencies, identity)\n ditto.setOfflineOnlyLicenseToken(validLicense)\n ditto.startSync()\n} catch(e: DittoError) {\n Log.e(\"Ditto error\", e.message!!)\n}\n\n", + "online-playground": "try {\n val androidDependencies = DefaultAndroidDittoDependencies(context)\n val identity = DittoIdentity.OnlinePlayground(androidDependencies, appID = \"00000000-0000-4000-0000-000000000000\", token = \"REPLACE_ME_WITH_YOUR_PLAYGROUND_TOKEN\")\n val ditto = Ditto(androidDependencies, identity)\n ditto.startSync()\n} catch(e: DittoError) {\n Log.e(\"Ditto error\", e.message!!)\n}\n\n", + "offline-playground": "try {\n val androidDependencies = DefaultAndroidDittoDependencies(context)\n val identity = DittoIdentity.OfflinePlayground(androidDependencies, appID = \"00000000-0000-4000-0000-000000000000\")\n val ditto = Ditto(androidDependencies, identity)\n ditto.setOfflineOnlyLicenseToken(validLicense)\n ditto.startSync()\n} catch(e: DittoError) {\n Log.e(\"Ditto error\", e.message!!)\n}\n\n", "shared-key": "// This is just an example. You should use OpenSSL to generate a unique shared key for every application.\nval p256DerB64 = \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgFUUrOkOH52QN+Rr6uDSDsk4hUTcD1eW4mT0UnGGptFehRANCAATJ3fG8TVLQcDwUV18BJJI8efK0hQAjzB3VJeYOVbfOlqnfukVId0V25r/abxwjD3HfHuPsCGEiefzzmkMbjPo9\"\nval androidDependencies = DefaultAndroidDittoDependencies(context)\nval identity = DittoIdentity.SharedKey(\"app\", p256DerB64, null)\nval ditto = Ditto(androidDependencies, identity)\nditto.setOfflineOnlyLicenseToken(validLicense)\n\n", "network-query-overlap-group": "// The passenger only observes orders that they created\npassenger.store.collection(\"orders\").find(\"user_id==abc123\").observe({ docs, event ->\n // render passenger orders in a list UI\n})\n\n// Crew member devices observe all orders that everyone created\ncrewA.store.collection(\"orders\").findAll().observe({ docs, event ->\n // render all orders in a list UI\n})\ncrewB.store.collection(\"orders\").findAll().observe({ docs, event ->\n // render all orders in a list UI\n})\n\nDittoExperimental.setQueryOverlapGroup(2u, crewA)\nDittoExperimental.setQueryOverlapGroup(2u, crewB)\n\ncrewA.tryStartSync()\ncrewB.tryStartSync()\npassenger.tryStartSync()\n\n", "network-set-priority": "DittoExperimental.setPriorityForQueryOverlapGroup(DittoConnectionPriority.High, 2u, crewA)\nDittoExperimental.setPriorityForQueryOverlapGroup(DittoConnectionPriority.High, 2u, crewB)\n\n",