Skip to content

Commit df408c2

Browse files
committed
Use sync worker in example
1 parent fa9fb0e commit df408c2

File tree

14 files changed

+180
-28
lines changed

14 files changed

+180
-28
lines changed

demos/django-todolist/.metadata

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "5874a72aa4c779a02553007c47dacbefba2374dc"
8+
channel: "stable"
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
17+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
18+
- platform: android
19+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
20+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
21+
- platform: ios
22+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
23+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
24+
- platform: linux
25+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
26+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
27+
- platform: macos
28+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
29+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
30+
- platform: web
31+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
32+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
33+
- platform: windows
34+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
35+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

demos/django-todolist/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ username: testuser
1919
password: testpassword
2020
```
2121

22+
## WEB NOTes
23+
24+
```
25+
flutter run -d web-server
26+
google-chrome --disable-web-security --user-data-dir='.dart_tool/.chrome'
27+
```
28+
2229
# Service Configuration
2330

2431
This demo can be used with cloud or local services.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package co.powersync.django_todolist
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Flutter
2+
import UIKit
3+
import XCTest
4+
5+
class RunnerTests: XCTestCase {
6+
7+
func testExample() {
8+
// If you add code to the Runner application, consider adding tests here.
9+
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10+
}
11+
12+
}

demos/django-todolist/lib/powersync.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// This file performs setup of the PowerSync database
2+
import 'package:flutter/foundation.dart';
23
import 'package:logging/logging.dart';
34
import 'package:path/path.dart';
45
import 'package:path_provider/path_provider.dart';
@@ -101,8 +102,14 @@ Future<bool> isLoggedIn() async {
101102
}
102103

103104
Future<String> getDatabasePath() async {
105+
const dbFilename = 'powersync-demo.db';
106+
// getApplicationSupportDirectory is not supported on Web
107+
if (kIsWeb) {
108+
return dbFilename;
109+
}
110+
104111
final dir = await getApplicationSupportDirectory();
105-
return join(dir.path, 'powersync-demo.db');
112+
return join(dir.path, dbFilename);
106113
}
107114

108115
Future<void> openDatabase() async {

demos/django-todolist/pubspec.lock

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ packages:
124124
dependency: "direct main"
125125
description:
126126
name: http
127-
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
127+
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
128128
url: "https://pub.dev"
129129
source: hosted
130-
version: "1.2.1"
130+
version: "1.2.2"
131131
http_parser:
132132
dependency: transitive
133133
description:
@@ -148,18 +148,18 @@ packages:
148148
dependency: transitive
149149
description:
150150
name: leak_tracker
151-
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
151+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
152152
url: "https://pub.dev"
153153
source: hosted
154-
version: "10.0.4"
154+
version: "10.0.5"
155155
leak_tracker_flutter_testing:
156156
dependency: transitive
157157
description:
158158
name: leak_tracker_flutter_testing
159-
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
159+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
160160
url: "https://pub.dev"
161161
source: hosted
162-
version: "3.0.3"
162+
version: "3.0.5"
163163
leak_tracker_testing:
164164
dependency: transitive
165165
description:
@@ -196,18 +196,18 @@ packages:
196196
dependency: transitive
197197
description:
198198
name: material_color_utilities
199-
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
199+
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
200200
url: "https://pub.dev"
201201
source: hosted
202-
version: "0.8.0"
202+
version: "0.11.1"
203203
meta:
204204
dependency: transitive
205205
description:
206206
name: meta
207-
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
207+
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
208208
url: "https://pub.dev"
209209
source: hosted
210-
version: "1.12.0"
210+
version: "1.15.0"
211211
mutex:
212212
dependency: transitive
213213
description:
@@ -346,10 +346,10 @@ packages:
346346
dependency: transitive
347347
description:
348348
name: shared_preferences_web
349-
sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
349+
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
350350
url: "https://pub.dev"
351351
source: hosted
352-
version: "2.3.0"
352+
version: "2.2.1"
353353
shared_preferences_windows:
354354
dependency: transitive
355355
description:
@@ -383,10 +383,10 @@ packages:
383383
dependency: transitive
384384
description:
385385
name: sqlite3
386-
sha256: "6d17989c0b06a5870b2190d391925186f944cb943e5262d0d3f778fcfca3bc6e"
386+
sha256: "45f168ae2213201b54e09429ed0c593dc2c88c924a1488d6f9c523a255d567cb"
387387
url: "https://pub.dev"
388388
source: hosted
389-
version: "2.4.4"
389+
version: "2.4.6"
390390
sqlite3_flutter_libs:
391391
dependency: transitive
392392
description:
@@ -399,18 +399,17 @@ packages:
399399
dependency: transitive
400400
description:
401401
name: sqlite3_web
402-
sha256: "51fec34757577841cc72d79086067e3651c434669d5af557a5c106787198a76f"
402+
sha256: b4043336e74cac54d3ca44c90434a3c310550b9a80851b09ad1af282af0df6d4
403403
url: "https://pub.dev"
404404
source: hosted
405-
version: "0.1.2-wip"
405+
version: "0.1.3"
406406
sqlite_async:
407407
dependency: "direct main"
408408
description:
409-
name: sqlite_async
410-
sha256: "79e636c857ed43f6cd5e5be72b36967a29f785daa63ff5b078bd34f74f44cb54"
411-
url: "https://pub.dev"
412-
source: hosted
413-
version: "0.8.1"
409+
path: "/home/simon/src/sqlite_async.dart/packages/sqlite_async"
410+
relative: false
411+
source: path
412+
version: "0.9.0"
414413
stack_trace:
415414
dependency: transitive
416415
description:
@@ -447,10 +446,10 @@ packages:
447446
dependency: transitive
448447
description:
449448
name: test_api
450-
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
449+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
451450
url: "https://pub.dev"
452451
source: hosted
453-
version: "0.7.0"
452+
version: "0.7.2"
454453
typed_data:
455454
dependency: transitive
456455
description:
@@ -487,18 +486,18 @@ packages:
487486
dependency: transitive
488487
description:
489488
name: vm_service
490-
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
489+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
491490
url: "https://pub.dev"
492491
source: hosted
493-
version: "14.2.1"
492+
version: "14.2.5"
494493
web:
495494
dependency: transitive
496495
description:
497496
name: web
498-
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
497+
sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
499498
url: "https://pub.dev"
500499
source: hosted
501-
version: "0.5.1"
500+
version: "1.0.0"
502501
win32:
503502
dependency: transitive
504503
description:

demos/django-todolist/pubspec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ dev_dependencies:
2424

2525
flutter_lints: ^3.0.1
2626

27+
dependency_overrides:
28+
sqlite_async:
29+
path: /home/simon/src/sqlite_async.dart/packages/sqlite_async
30+
2731
flutter:
2832
uses-material-design: true

demos/django-todolist/web/favicon.png

917 Bytes
Loading
5.17 KB
Loading
8.06 KB
Loading
Loading
Loading

demos/django-todolist/web/index.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!--
5+
If you are serving your web app in a path other than the root, change the
6+
href value below to reflect the base path you are serving from.
7+
8+
The path provided below has to start and end with a slash "/" in order for
9+
it to work correctly.
10+
11+
For more details:
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13+
14+
This is a placeholder for base href that will be replaced by the value of
15+
the `--base-href` argument provided to `flutter build`.
16+
-->
17+
<base href="$FLUTTER_BASE_HREF">
18+
19+
<meta charset="UTF-8">
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21+
<meta name="description" content="A new Flutter project.">
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes">
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26+
<meta name="apple-mobile-web-app-title" content="django_todolist">
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png"/>
31+
32+
<title>django_todolist</title>
33+
<link rel="manifest" href="manifest.json">
34+
</head>
35+
<body>
36+
<script src="flutter_bootstrap.js" async></script>
37+
</body>
38+
</html>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "django_todolist",
3+
"short_name": "django_todolist",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
},
22+
{
23+
"src": "icons/Icon-maskable-192.png",
24+
"sizes": "192x192",
25+
"type": "image/png",
26+
"purpose": "maskable"
27+
},
28+
{
29+
"src": "icons/Icon-maskable-512.png",
30+
"sizes": "512x512",
31+
"type": "image/png",
32+
"purpose": "maskable"
33+
}
34+
]
35+
}

0 commit comments

Comments
 (0)