Skip to content

Commit 321937d

Browse files
authored
Merge branch 'master' into fix-clearning-untyped
2 parents dffe000 + a0e74e6 commit 321937d

File tree

16 files changed

+188
-281
lines changed

16 files changed

+188
-281
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart`
2+
// Edit lib/app_config.dart and enter your Supabase and PowerSync project details.
13
class AppConfig {
2-
static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co';
3-
static const String supabaseAnonKey =
4-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y';
4+
static const String supabaseUrl = 'https://foo.supabase.co';
5+
static const String supabaseAnonKey = 'foo';
56
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart`
2+
// Edit lib/app_config.dart and enter your Supabase and PowerSync project details.
13
class AppConfig {
2-
static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co';
3-
static const String supabaseAnonKey =
4-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y';
4+
static const String supabaseUrl = 'https://foo.supabase.co';
5+
static const String supabaseAnonKey = 'foo';
56
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart`
2+
// Edit lib/app_config.dart and enter your Supabase and PowerSync project details.
13
class AppConfig {
2-
static const String supabaseUrl = 'https://aaaaaaaaaaaa.supabase.co';
3-
static const String supabaseAnonKey = 'eyeyeyeyeyeye';
4-
static const String powersyncUrl =
5-
'https://65130c9db6679a3682ba380a.powersync.journeyapps.com';
4+
static const String supabaseUrl = 'https://foo.supabase.co';
5+
static const String supabaseAnonKey = 'foo';
6+
static const String powersyncUrl = 'https://foo.powersync.journeyapps.com';
67
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart`
2+
// Edit lib/app_config.dart and enter your Supabase and PowerSync project details.
13
class AppConfig {
2-
static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co';
3-
static const String supabaseAnonKey =
4-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y';
5-
static const String powersyncUrl =
6-
'https://64d392172a3c226cddbd5070.powersync.journeyapps.com';
4+
static const String supabaseUrl = 'https://foo.supabase.co';
5+
static const String supabaseAnonKey = 'foo';
6+
static const String powersyncUrl = 'https://foo.powersync.journeyapps.com';
77
static const String supabaseStorageBucket =
8-
''; // Optional if you want to test out attachments
8+
''; // Optional. Only required when syncing attachments and using Supabase Storage. See packages/powersync_attachments_helper.
99
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class _TakePhotoWidgetState extends State<TakePhotoWidget> {
5858
int photoSize = await photo.length();
5959

6060
TodoItem.addPhoto(photoId, widget.todoId);
61-
attachmentQueue.savePhoto(photoId, photoSize);
61+
attachmentQueue.saveFile(photoId, photoSize);
6262
} catch (e) {
6363
log.info('Error taking photo: $e');
6464
}

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ class PhotoAttachmentQueue extends AbstractAttachmentQueue {
3939
}
4040

4141
@override
42-
Future<Attachment> savePhoto(String photoId, int size) async {
43-
String filename = '$photoId.jpg';
42+
Future<Attachment> saveFile(String fileId, int size,
43+
{mediaType = 'image/jpeg'}) async {
44+
String filename = '$fileId.jpg';
45+
4446
Attachment photoAttachment = Attachment(
45-
id: photoId,
47+
id: fileId,
4648
filename: filename,
4749
state: AttachmentState.queuedUpload.index,
48-
mediaType: 'image/jpeg',
50+
mediaType: mediaType,
4951
localUri: getLocalFilePathSuffix(filename),
5052
size: size,
5153
);
@@ -54,10 +56,11 @@ class PhotoAttachmentQueue extends AbstractAttachmentQueue {
5456
}
5557

5658
@override
57-
Future<Attachment> deletePhoto(String photoId) async {
58-
String filename = '$photoId.jpg';
59+
Future<Attachment> deleteFile(String fileId) async {
60+
String filename = '$fileId.jpg';
61+
5962
Attachment photoAttachment = Attachment(
60-
id: photoId,
63+
id: fileId,
6164
filename: filename,
6265
state: AttachmentState.queuedDelete.index);
6366

demos/supabase-todolist/lib/widgets/todo_item_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TodoItemWidget extends StatelessWidget {
2323

2424
Future<void> deleteTodo(TodoItem todo) async {
2525
if (todo.photoId != null) {
26-
attachmentQueue.deletePhoto(todo.photoId!);
26+
attachmentQueue.deleteFile(todo.photoId!);
2727
}
2828
await todo.delete();
2929
}

0 commit comments

Comments
 (0)