diff --git a/demos/supabase-todolist/ios/Flutter/AppFrameworkInfo.plist b/demos/supabase-todolist/ios/Flutter/AppFrameworkInfo.plist
index 9625e105..7c569640 100644
--- a/demos/supabase-todolist/ios/Flutter/AppFrameworkInfo.plist
+++ b/demos/supabase-todolist/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 11.0
+ 12.0
diff --git a/demos/supabase-todolist/ios/Podfile b/demos/supabase-todolist/ios/Podfile
index bab7dec0..656de635 100644
--- a/demos/supabase-todolist/ios/Podfile
+++ b/demos/supabase-todolist/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '11.0'
+# platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -45,4 +45,4 @@ post_install do |installer|
end
end
end
-end
\ No newline at end of file
+end
diff --git a/demos/supabase-todolist/ios/Podfile.lock b/demos/supabase-todolist/ios/Podfile.lock
index 73885df0..67398eaf 100644
--- a/demos/supabase-todolist/ios/Podfile.lock
+++ b/demos/supabase-todolist/ios/Podfile.lock
@@ -59,14 +59,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875
- camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
- Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
- path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
- shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
+ camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
+ Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
+ path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
+ shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273
sqlite3_flutter_libs: eb769059df0356dc52ddda040f09cacc9391a7cf
- url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
+ url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
-PODFILE CHECKSUM: adb9c9fb405cdaf8ac7cbd45ad6db78acaa58c33
+PODFILE CHECKSUM: 13e359f40c4925bcdf0c1bfa13aeba35011fde30
COCOAPODS: 1.14.3
diff --git a/demos/supabase-todolist/ios/Runner.xcodeproj/project.pbxproj b/demos/supabase-todolist/ios/Runner.xcodeproj/project.pbxproj
index 6a93f233..d274f929 100644
--- a/demos/supabase-todolist/ios/Runner.xcodeproj/project.pbxproj
+++ b/demos/supabase-todolist/ios/Runner.xcodeproj/project.pbxproj
@@ -342,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -419,7 +419,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -468,7 +468,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
diff --git a/demos/supabase-todolist/lib/models/schema.dart b/demos/supabase-todolist/lib/models/schema.dart
index 5a27b092..89b69b0c 100644
--- a/demos/supabase-todolist/lib/models/schema.dart
+++ b/demos/supabase-todolist/lib/models/schema.dart
@@ -22,5 +22,6 @@ Schema schema = Schema(([
Column.text('name'),
Column.text('owner_id')
]),
- AttachmentsQueueTable()
+ AttachmentsQueueTable(
+ attachmentsQueueTableName: defaultAttachmentsQueueTableName)
]));
diff --git a/demos/supabase-todolist/pubspec.lock b/demos/supabase-todolist/pubspec.lock
index c4f08b44..f48fccc9 100644
--- a/demos/supabase-todolist/pubspec.lock
+++ b/demos/supabase-todolist/pubspec.lock
@@ -421,7 +421,7 @@ packages:
path: "../../packages/powersync_attachments_helper"
relative: true
source: path
- version: "0.1.5"
+ version: "0.2.0"
realtime_client:
dependency: transitive
description:
diff --git a/packages/powersync_attachments_helper/CHANGELOG.md b/packages/powersync_attachments_helper/CHANGELOG.md
index dec1264c..c59f0d09 100644
--- a/packages/powersync_attachments_helper/CHANGELOG.md
+++ b/packages/powersync_attachments_helper/CHANGELOG.md
@@ -1,6 +1,11 @@
+## 0.2.0
+
+- Potentially BREAKING CHANGE for users who rely on multiple attachment queues.
+ Moved away from randomly generating queue table name in favour of a user creating a queue and table using a name of their choosing.
+
## 0.1.5
-- Allow different file extensions besides jpg
+- Allow different file extensions besides jpg.
## 0.1.4
diff --git a/packages/powersync_attachments_helper/lib/powersync_attachments_helper.dart b/packages/powersync_attachments_helper/lib/powersync_attachments_helper.dart
index e7b344f9..ab0b0f6a 100644
--- a/packages/powersync_attachments_helper/lib/powersync_attachments_helper.dart
+++ b/packages/powersync_attachments_helper/lib/powersync_attachments_helper.dart
@@ -6,4 +6,8 @@ library;
export 'src/attachments_queue.dart';
export 'src/remote_storage_adapter.dart' show AbstractRemoteStorageAdapter;
export 'src/attachments_queue_table.dart'
- show Attachment, AttachmentState, AttachmentsQueueTable;
+ show
+ Attachment,
+ AttachmentState,
+ AttachmentsQueueTable,
+ defaultAttachmentsQueueTableName;
diff --git a/packages/powersync_attachments_helper/lib/src/attachments_queue.dart b/packages/powersync_attachments_helper/lib/src/attachments_queue.dart
index fa736b6e..8dcaa0a1 100644
--- a/packages/powersync_attachments_helper/lib/src/attachments_queue.dart
+++ b/packages/powersync_attachments_helper/lib/src/attachments_queue.dart
@@ -22,14 +22,16 @@ abstract class AbstractAttachmentQueue {
late AttachmentsService attachmentsService;
late SyncingService syncingService;
final LocalStorageAdapter localStorage = LocalStorageAdapter();
+ String attachmentsQueueTableName;
AbstractAttachmentQueue(
{required this.db,
required this.remoteStorage,
this.attachmentDirectoryName = 'attachments',
+ this.attachmentsQueueTableName = defaultAttachmentsQueueTableName,
performInitialSync = true}) {
- attachmentsService =
- AttachmentsService(db, localStorage, attachmentDirectoryName);
+ attachmentsService = AttachmentsService(
+ db, localStorage, attachmentDirectoryName, attachmentsQueueTableName);
syncingService = SyncingService(
db, remoteStorage, localStorage, attachmentsService, getLocalUri);
}
diff --git a/packages/powersync_attachments_helper/lib/src/attachments_queue_table.dart b/packages/powersync_attachments_helper/lib/src/attachments_queue_table.dart
index 1ac3c111..f1bf5a0d 100644
--- a/packages/powersync_attachments_helper/lib/src/attachments_queue_table.dart
+++ b/packages/powersync_attachments_helper/lib/src/attachments_queue_table.dart
@@ -1,9 +1,7 @@
import 'package:powersync/powersync.dart';
import 'package:powersync/sqlite3.dart' as sqlite;
-import 'dart:math';
-/// Global reference to the attachment queue table
-final String attachmentsQueueTable = 'queue_${_getRandomString(6)}';
+const defaultAttachmentsQueueTableName = 'attachments_queue';
/// Class used to create the attachment queue table
/// The table is local only and will not be visible in the remote database
@@ -74,11 +72,12 @@ enum AttachmentState {
class AttachmentsQueueTable extends Table {
AttachmentsQueueTable(
- {List additionalColumns = const [],
+ {String attachmentsQueueTableName = defaultAttachmentsQueueTableName,
+ List additionalColumns = const [],
List indexes = const [],
String? viewName})
: super.localOnly(
- attachmentsQueueTable,
+ attachmentsQueueTableName,
[
const Column.text('filename'),
const Column.text('local_uri'),
@@ -91,9 +90,3 @@ class AttachmentsQueueTable extends Table {
viewName: viewName,
indexes: indexes);
}
-
-const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
-Random _rnd = Random();
-
-String _getRandomString(int length) => String.fromCharCodes(Iterable.generate(
- length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));
diff --git a/packages/powersync_attachments_helper/lib/src/attachments_service.dart b/packages/powersync_attachments_helper/lib/src/attachments_service.dart
index c1900f9d..3c9a3e34 100644
--- a/packages/powersync_attachments_helper/lib/src/attachments_service.dart
+++ b/packages/powersync_attachments_helper/lib/src/attachments_service.dart
@@ -9,12 +9,14 @@ class AttachmentsService {
final PowerSyncDatabase db;
final LocalStorageAdapter localStorage;
final String attachmentDirectoryName;
+ final String attachmentsQueueTableName;
- AttachmentsService(this.db, this.localStorage, this.attachmentDirectoryName);
+ AttachmentsService(this.db, this.localStorage, this.attachmentDirectoryName,
+ this.attachmentsQueueTableName);
/// Table used for storing attachments in the attachment queue.
get table {
- return attachmentsQueueTable;
+ return attachmentsQueueTableName;
}
/// Delete the attachment from the attachment queue.
diff --git a/packages/powersync_attachments_helper/pubspec.yaml b/packages/powersync_attachments_helper/pubspec.yaml
index 1425fb74..9656994d 100644
--- a/packages/powersync_attachments_helper/pubspec.yaml
+++ b/packages/powersync_attachments_helper/pubspec.yaml
@@ -1,6 +1,6 @@
name: powersync_attachments_helper
description: A helper library for handling attachments when using PowerSync.
-version: 0.1.5
+version: 0.2.0
repository: https://github.com/powersync-ja/powersync.dart
homepage: https://www.powersync.com/
environment: