Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions demos/django-todolist/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ final List<RegExp> fatalResponseCodes = [
];

class DjangoConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

DjangoConnector(this.db);
DjangoConnector();

final ApiClient apiClient = ApiClient(AppConfig.djangoUrl);

Expand Down Expand Up @@ -123,7 +121,7 @@ Future<void> openDatabase() async {
if (await isLoggedIn()) {
// If the user is already logged in, connect immediately.
// Otherwise, connect once logged in.
currentConnector = DjangoConnector(db);
currentConnector = DjangoConnector();
db.connect(connector: currentConnector);
}
}
Expand Down
6 changes: 2 additions & 4 deletions demos/supabase-anonymous-auth/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ final List<RegExp> fatalResponseCodes = [

/// Use Supabase for authentication and data upload.
class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

// ignore: unused_field
Future<void>? _refreshFuture;

SupabaseConnector(this.db);
SupabaseConnector();

/// Get a Supabase token to authenticate against the PowerSync instance.
@override
Expand Down Expand Up @@ -152,5 +150,5 @@ Future<void> openDatabase() async {

await loadSupabase();

db.connect(connector: SupabaseConnector(db));
db.connect(connector: SupabaseConnector());
}
8 changes: 3 additions & 5 deletions demos/supabase-edge-function-auth/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ final List<RegExp> fatalResponseCodes = [

/// Use Supabase for authentication and data upload.
class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

// ignore: unused_field
Future<void>? _refreshFuture;

SupabaseConnector(this.db);
SupabaseConnector();

/// Get a Supabase token to authenticate against the PowerSync instance.
@override
Expand Down Expand Up @@ -160,15 +158,15 @@ Future<void> openDatabase() async {
if (isLoggedIn()) {
// If the user is already logged in, connect immediately.
// Otherwise, connect once logged in.
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector);
}

Supabase.instance.client.auth.onAuthStateChange.listen((data) async {
final AuthChangeEvent event = data.event;
if (event == AuthChangeEvent.signedIn) {
// Connect to PowerSync when the user is signed in
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector!);
} else if (event == AuthChangeEvent.signedOut) {
// Implicit sign out - disconnect, but don't delete data
Expand Down
7 changes: 3 additions & 4 deletions demos/supabase-simple-chat/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ Future<void> openDatabase() async {
SupabaseConnector? currentConnector;

if (isLoggedIn()) {
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector);
}

Supabase.instance.client.auth.onAuthStateChange.listen((data) async {
final AuthChangeEvent event = data.event;
if (event == AuthChangeEvent.signedIn) {
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector!);
} else if (event == AuthChangeEvent.signedOut) {
currentConnector = null;
Expand All @@ -66,8 +66,7 @@ Future<void> openDatabase() async {
}

class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;
SupabaseConnector(this.db);
SupabaseConnector();

@override
Future<void> uploadData(PowerSyncDatabase database) async {
Expand Down
8 changes: 3 additions & 5 deletions demos/supabase-todolist-drift/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ final List<RegExp> fatalResponseCodes = [

/// Use Supabase for authentication and data upload.
class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

Future<void>? _refreshFuture;

SupabaseConnector(this.db);
SupabaseConnector();

/// Get a Supabase token to authenticate against the PowerSync instance.
@override
Expand Down Expand Up @@ -172,15 +170,15 @@ Future<void> openDatabase() async {
if (isLoggedIn()) {
// If the user is already logged in, connect immediately.
// Otherwise, connect once logged in.
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector);
}

Supabase.instance.client.auth.onAuthStateChange.listen((data) async {
final AuthChangeEvent event = data.event;
if (event == AuthChangeEvent.signedIn) {
// Connect to PowerSync when the user is signed in
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector!);
} else if (event == AuthChangeEvent.signedOut) {
// Implicit sign out - disconnect, but don't delete data
Expand Down
6 changes: 2 additions & 4 deletions demos/supabase-todolist-optional-sync/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ final List<RegExp> fatalResponseCodes = [

/// Use Supabase for authentication and data upload.
class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

Future<void>? _refreshFuture;

SupabaseConnector(this.db);
SupabaseConnector();

/// Get a Supabase token to authenticate against the PowerSync instance.
@override
Expand Down Expand Up @@ -189,7 +187,7 @@ Future<void> connectDatabase() async {
await switchToSyncedSchema(db, getUserId());
}

currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
await db.connect(connector: currentConnector);

Supabase.instance.client.auth.onAuthStateChange.listen((data) async {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
59 changes: 0 additions & 59 deletions demos/supabase-todolist-optional-sync/web_old/index.html

This file was deleted.

35 changes: 0 additions & 35 deletions demos/supabase-todolist-optional-sync/web_old/manifest.json

This file was deleted.

8 changes: 3 additions & 5 deletions demos/supabase-todolist/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ final List<RegExp> fatalResponseCodes = [

/// Use Supabase for authentication and data upload.
class SupabaseConnector extends PowerSyncBackendConnector {
PowerSyncDatabase db;

Future<void>? _refreshFuture;

SupabaseConnector(this.db);
SupabaseConnector();

/// Get a Supabase token to authenticate against the PowerSync instance.
@override
Expand Down Expand Up @@ -168,15 +166,15 @@ Future<void> openDatabase() async {
if (isLoggedIn()) {
// If the user is already logged in, connect immediately.
// Otherwise, connect once logged in.
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector);
}

Supabase.instance.client.auth.onAuthStateChange.listen((data) async {
final AuthChangeEvent event = data.event;
if (event == AuthChangeEvent.signedIn) {
// Connect to PowerSync when the user is signed in
currentConnector = SupabaseConnector(db);
currentConnector = SupabaseConnector();
db.connect(connector: currentConnector!);
} else if (event == AuthChangeEvent.signedOut) {
// Implicit sign out - disconnect, but don't delete data
Expand Down
Loading