Skip to content

Commit 5efb6ab

Browse files
updated from master
2 parents 56b814e + ea8e924 commit 5efb6ab

File tree

22 files changed

+163
-83
lines changed

22 files changed

+163
-83
lines changed

demos/supabase-anonymous-auth/pubspec.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ packages:
156156
dependency: transitive
157157
description:
158158
name: gotrue
159-
sha256: f40610bacf1074723354b0856a4f586508ffb075b799f72466f34e843133deb9
159+
sha256: "1bf6354278a98b8a1867263e94921da8a239de07e9babceab2b4e80af651a098"
160160
url: "https://pub.dev"
161161
source: hosted
162-
version: "2.5.0"
162+
version: "2.5.1"
163163
gtk:
164164
dependency: transitive
165165
description:
@@ -332,10 +332,10 @@ packages:
332332
dependency: transitive
333333
description:
334334
name: postgrest
335-
sha256: "748ebffffb60b4eaa270955dcf3742a19a2b315344c41ff1b4a0ebcd322b5181"
335+
sha256: "9a3b590cf123f8d323b6a918702e037f037027d12a01902f9dc6ee38fdc05d6c"
336336
url: "https://pub.dev"
337337
source: hosted
338-
version: "2.1.0"
338+
version: "2.1.1"
339339
powersync:
340340
dependency: "direct main"
341341
description:
@@ -347,10 +347,10 @@ packages:
347347
dependency: transitive
348348
description:
349349
name: realtime_client
350-
sha256: "5831636c19802ba936093a35a7c5b745b130e268fa052e84b4b5290139d2ae03"
350+
sha256: "41d6c5e0327d6c270b98b79bfed672928244af60e2856770f3eff697f9efe459"
351351
url: "https://pub.dev"
352352
source: hosted
353-
version: "2.0.0"
353+
version: "2.0.1"
354354
retry:
355355
dependency: transitive
356356
description:
@@ -411,10 +411,10 @@ packages:
411411
dependency: transitive
412412
description:
413413
name: shared_preferences_web
414-
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
414+
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
415415
url: "https://pub.dev"
416416
source: hosted
417-
version: "2.2.2"
417+
version: "2.2.1"
418418
shared_preferences_windows:
419419
dependency: transitive
420420
description:
@@ -504,18 +504,18 @@ packages:
504504
dependency: transitive
505505
description:
506506
name: supabase
507-
sha256: "4bce9c49f264f4cd44b4ffc895647af2dca0c40125c169045be9f708fd2a2a40"
507+
sha256: f431753d2a4cb9dacd72c7378154f806c2b2cef23859bd9cee1add23821e874d
508508
url: "https://pub.dev"
509509
source: hosted
510-
version: "2.0.7"
510+
version: "2.0.8"
511511
supabase_flutter:
512512
dependency: "direct main"
513513
description:
514514
name: supabase_flutter
515-
sha256: "5ef71289c380b6429216e941c69971c75eaab50d67fd7b540f6c1f6ebfc00ed7"
515+
sha256: "30e966b89ee61dc9de845e2d7e1c60967b3189c410d105c6d42f09b6259f4cb6"
516516
url: "https://pub.dev"
517517
source: hosted
518-
version: "2.3.3"
518+
version: "2.3.4"
519519
term_glyph:
520520
dependency: transitive
521521
description:
@@ -592,18 +592,18 @@ packages:
592592
dependency: transitive
593593
description:
594594
name: url_launcher_platform_interface
595-
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
595+
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
596596
url: "https://pub.dev"
597597
source: hosted
598-
version: "2.3.1"
598+
version: "2.3.2"
599599
url_launcher_web:
600600
dependency: transitive
601601
description:
602602
name: url_launcher_web
603-
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
603+
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
604604
url: "https://pub.dev"
605605
source: hosted
606-
version: "2.2.3"
606+
version: "2.2.0"
607607
url_launcher_windows:
608608
dependency: transitive
609609
description:
@@ -670,4 +670,4 @@ packages:
670670
version: "2.0.0"
671671
sdks:
672672
dart: ">=3.2.3 <4.0.0"
673-
flutter: ">=3.16.0"
673+
flutter: ">=3.13.0"

demos/supabase-edge-function-auth/lib/widgets/login_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class _LoginPageState extends State<LoginPage> {
3434
await Supabase.instance.client.auth.signInWithPassword(
3535
email: _usernameController.text, password: _passwordController.text);
3636

37-
if (mounted) {
37+
if (context.mounted) {
3838
Navigator.of(context).pushReplacement(MaterialPageRoute(
3939
builder: (context) => homePage,
4040
));

demos/supabase-edge-function-auth/lib/widgets/signup_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class _SignupPageState extends State<SignupPage> {
3434
final response = await Supabase.instance.client.auth.signUp(
3535
email: _usernameController.text, password: _passwordController.text);
3636

37-
if (mounted) {
37+
if (context.mounted) {
3838
if (response.session != null) {
3939
Navigator.of(context).pushReplacement(MaterialPageRoute(
4040
builder: (context) => homePage,

demos/supabase-edge-function-auth/pubspec.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ packages:
156156
dependency: transitive
157157
description:
158158
name: gotrue
159-
sha256: f40610bacf1074723354b0856a4f586508ffb075b799f72466f34e843133deb9
159+
sha256: "1bf6354278a98b8a1867263e94921da8a239de07e9babceab2b4e80af651a098"
160160
url: "https://pub.dev"
161161
source: hosted
162-
version: "2.5.0"
162+
version: "2.5.1"
163163
gtk:
164164
dependency: transitive
165165
description:
@@ -332,10 +332,10 @@ packages:
332332
dependency: transitive
333333
description:
334334
name: postgrest
335-
sha256: "748ebffffb60b4eaa270955dcf3742a19a2b315344c41ff1b4a0ebcd322b5181"
335+
sha256: "9a3b590cf123f8d323b6a918702e037f037027d12a01902f9dc6ee38fdc05d6c"
336336
url: "https://pub.dev"
337337
source: hosted
338-
version: "2.1.0"
338+
version: "2.1.1"
339339
powersync:
340340
dependency: "direct main"
341341
description:
@@ -347,10 +347,10 @@ packages:
347347
dependency: transitive
348348
description:
349349
name: realtime_client
350-
sha256: "5831636c19802ba936093a35a7c5b745b130e268fa052e84b4b5290139d2ae03"
350+
sha256: "41d6c5e0327d6c270b98b79bfed672928244af60e2856770f3eff697f9efe459"
351351
url: "https://pub.dev"
352352
source: hosted
353-
version: "2.0.0"
353+
version: "2.0.1"
354354
retry:
355355
dependency: transitive
356356
description:
@@ -411,10 +411,10 @@ packages:
411411
dependency: transitive
412412
description:
413413
name: shared_preferences_web
414-
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
414+
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
415415
url: "https://pub.dev"
416416
source: hosted
417-
version: "2.2.2"
417+
version: "2.2.1"
418418
shared_preferences_windows:
419419
dependency: transitive
420420
description:
@@ -504,18 +504,18 @@ packages:
504504
dependency: transitive
505505
description:
506506
name: supabase
507-
sha256: "4bce9c49f264f4cd44b4ffc895647af2dca0c40125c169045be9f708fd2a2a40"
507+
sha256: f431753d2a4cb9dacd72c7378154f806c2b2cef23859bd9cee1add23821e874d
508508
url: "https://pub.dev"
509509
source: hosted
510-
version: "2.0.7"
510+
version: "2.0.8"
511511
supabase_flutter:
512512
dependency: "direct main"
513513
description:
514514
name: supabase_flutter
515-
sha256: "5ef71289c380b6429216e941c69971c75eaab50d67fd7b540f6c1f6ebfc00ed7"
515+
sha256: "30e966b89ee61dc9de845e2d7e1c60967b3189c410d105c6d42f09b6259f4cb6"
516516
url: "https://pub.dev"
517517
source: hosted
518-
version: "2.3.3"
518+
version: "2.3.4"
519519
term_glyph:
520520
dependency: transitive
521521
description:
@@ -592,18 +592,18 @@ packages:
592592
dependency: transitive
593593
description:
594594
name: url_launcher_platform_interface
595-
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
595+
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
596596
url: "https://pub.dev"
597597
source: hosted
598-
version: "2.3.1"
598+
version: "2.3.2"
599599
url_launcher_web:
600600
dependency: transitive
601601
description:
602602
name: url_launcher_web
603-
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
603+
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
604604
url: "https://pub.dev"
605605
source: hosted
606-
version: "2.2.3"
606+
version: "2.2.0"
607607
url_launcher_windows:
608608
dependency: transitive
609609
description:
@@ -670,4 +670,4 @@ packages:
670670
version: "2.0.0"
671671
sdks:
672672
dart: ">=3.2.3 <4.0.0"
673-
flutter: ">=3.16.0"
673+
flutter: ">=3.13.0"

demos/supabase-simple-chat/lib/pages/login_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LoginPageState extends State<LoginPage> {
3737
} catch (_) {
3838
context.showErrorSnackBar(message: unexpectedErrorMessage);
3939
}
40-
if (mounted) {
40+
if (context.mounted) {
4141
setState(() {
4242
_isLoading = true;
4343
});

demos/supabase-simple-chat/pubspec.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,10 @@ packages:
443443
dependency: transitive
444444
description:
445445
name: shared_preferences_web
446-
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
446+
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
447447
url: "https://pub.dev"
448448
source: hosted
449-
version: "2.2.2"
449+
version: "2.2.1"
450450
shared_preferences_windows:
451451
dependency: transitive
452452
description:
@@ -656,18 +656,18 @@ packages:
656656
dependency: transitive
657657
description:
658658
name: url_launcher_platform_interface
659-
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
659+
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
660660
url: "https://pub.dev"
661661
source: hosted
662-
version: "2.3.1"
662+
version: "2.3.2"
663663
url_launcher_web:
664664
dependency: transitive
665665
description:
666666
name: url_launcher_web
667-
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
667+
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
668668
url: "https://pub.dev"
669669
source: hosted
670-
version: "2.2.3"
670+
version: "2.2.0"
671671
url_launcher_windows:
672672
dependency: transitive
673673
description:

demos/supabase-todolist/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
97C146E61CF9000F007C117D /* Project object */ = {
156156
isa = PBXProject;
157157
attributes = {
158-
LastUpgradeCheck = 1430;
158+
LastUpgradeCheck = 1510;
159159
ORGANIZATIONNAME = "";
160160
TargetAttributes = {
161161
97C146ED1CF9000F007C117D = {

demos/supabase-todolist/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

demos/supabase-todolist/lib/attachments/photo_widget.dart

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io';
22

33
import 'package:flutter/material.dart';
4+
import 'package:powersync_attachments_helper/powersync_attachments_helper.dart';
45
import 'package:powersync_flutter_demo/attachments/camera_helpers.dart';
56
import 'package:powersync_flutter_demo/attachments/photo_capture_widget.dart';
67
import 'package:powersync_flutter_demo/attachments/queue.dart';
@@ -23,8 +24,10 @@ class PhotoWidget extends StatefulWidget {
2324
class _ResolvedPhotoState {
2425
String? photoPath;
2526
bool fileExists;
27+
Attachment? attachment;
2628

27-
_ResolvedPhotoState({required this.photoPath, required this.fileExists});
29+
_ResolvedPhotoState(
30+
{required this.photoPath, required this.fileExists, this.attachment});
2831
}
2932

3033
class _PhotoWidgetState extends State<PhotoWidget> {
@@ -38,7 +41,17 @@ class _PhotoWidgetState extends State<PhotoWidget> {
3841

3942
bool fileExists = await File(photoPath).exists();
4043

41-
return _ResolvedPhotoState(photoPath: photoPath, fileExists: fileExists);
44+
final row = await attachmentQueue.db
45+
.getOptional('SELECT * FROM attachments_queue WHERE id = ?', [photoId]);
46+
47+
if (row != null) {
48+
Attachment attachment = Attachment.fromRow(row);
49+
return _ResolvedPhotoState(
50+
photoPath: photoPath, fileExists: fileExists, attachment: attachment);
51+
}
52+
53+
return _ResolvedPhotoState(
54+
photoPath: photoPath, fileExists: fileExists, attachment: null);
4255
}
4356

4457
@override
@@ -54,7 +67,7 @@ class _PhotoWidgetState extends State<PhotoWidget> {
5467
Widget takePhotoButton = ElevatedButton(
5568
onPressed: () async {
5669
final camera = await setupCamera();
57-
if (!mounted) return;
70+
if (!context.mounted) return;
5871

5972
if (camera == null) {
6073
const snackBar = SnackBar(
@@ -84,6 +97,20 @@ class _PhotoWidgetState extends State<PhotoWidget> {
8497

8598
String? filePath = data.photoPath;
8699
bool fileIsDownloading = !data.fileExists;
100+
bool fileArchived =
101+
data.attachment?.state == AttachmentState.archived.index;
102+
103+
if (fileArchived) {
104+
return Column(
105+
crossAxisAlignment: CrossAxisAlignment.center,
106+
mainAxisAlignment: MainAxisAlignment.center,
107+
children: [
108+
const Text("Unavailable"),
109+
const SizedBox(height: 8),
110+
takePhotoButton
111+
],
112+
);
113+
}
87114

88115
if (fileIsDownloading) {
89116
return const Text("Downloading...");

demos/supabase-todolist/lib/attachments/queue.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,21 @@ import 'package:powersync_flutter_demo/models/schema.dart';
1111
late final PhotoAttachmentQueue attachmentQueue;
1212
final remoteStorage = SupabaseStorageAdapter();
1313

14+
/// Function to handle errors when downloading attachments
15+
/// Return false if you want to archive the attachment
16+
Future<bool> onDownloadError(Attachment attachment, Object exception) async {
17+
if (exception.toString().contains('Object not found')) {
18+
return false;
19+
}
20+
return true;
21+
}
22+
1423
class PhotoAttachmentQueue extends AbstractAttachmentQueue {
1524
PhotoAttachmentQueue(db, remoteStorage)
16-
: super(db: db, remoteStorage: remoteStorage);
25+
: super(
26+
db: db,
27+
remoteStorage: remoteStorage,
28+
onDownloadError: onDownloadError);
1729

1830
@override
1931
init() async {

0 commit comments

Comments
 (0)