Skip to content

Commit 5d924c5

Browse files
committed
Use sync worker in example
1 parent fffef0a commit 5d924c5

File tree

14 files changed

+166
-13
lines changed

14 files changed

+166
-13
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';
@@ -99,8 +100,14 @@ Future<bool> isLoggedIn() async {
99100
}
100101

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

106113
// opens the database and connects if logged in

demos/django-todolist/pubspec.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,18 @@ packages:
164164
dependency: transitive
165165
description:
166166
name: leak_tracker
167-
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
167+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
168168
url: "https://pub.dev"
169169
source: hosted
170-
version: "10.0.4"
170+
version: "10.0.5"
171171
leak_tracker_flutter_testing:
172172
dependency: transitive
173173
description:
174174
name: leak_tracker_flutter_testing
175-
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
175+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
176176
url: "https://pub.dev"
177177
source: hosted
178-
version: "3.0.3"
178+
version: "3.0.5"
179179
leak_tracker_testing:
180180
dependency: transitive
181181
description:
@@ -212,18 +212,18 @@ packages:
212212
dependency: transitive
213213
description:
214214
name: material_color_utilities
215-
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
215+
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
216216
url: "https://pub.dev"
217217
source: hosted
218-
version: "0.8.0"
218+
version: "0.11.1"
219219
meta:
220220
dependency: transitive
221221
description:
222222
name: meta
223-
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
223+
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
224224
url: "https://pub.dev"
225225
source: hosted
226-
version: "1.12.0"
226+
version: "1.15.0"
227227
mutex:
228228
dependency: transitive
229229
description:
@@ -479,10 +479,10 @@ packages:
479479
dependency: transitive
480480
description:
481481
name: test_api
482-
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
482+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
483483
url: "https://pub.dev"
484484
source: hosted
485-
version: "0.7.0"
485+
version: "0.7.2"
486486
typed_data:
487487
dependency: transitive
488488
description:
@@ -519,10 +519,10 @@ packages:
519519
dependency: transitive
520520
description:
521521
name: vm_service
522-
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
522+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
523523
url: "https://pub.dev"
524524
source: hosted
525-
version: "14.2.1"
525+
version: "14.2.5"
526526
web:
527527
dependency: transitive
528528
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)