Add pricing entry flow and platform admin foundations

This commit is contained in:
egecankomur
2026-06-20 18:24:40 +03:00
parent 1d36ccdf30
commit ac42681f7e
44 changed files with 6567 additions and 1419 deletions
+17 -5
View File
@@ -16,21 +16,33 @@ class RealtimeService {
required void Function(RecordSubscriptionEvent) onEvent,
}) {
UnsubFn? cancel;
bool disposeRequested = false;
bool disposed = false;
_pb.collection(collection).subscribe(topic, onEvent, filter: filter).then((fn) {
_pb
.collection(collection)
.subscribe(topic, onEvent, filter: filter)
.then((fn) async {
if (disposeRequested) {
disposed = true;
await fn();
return;
}
cancel = fn;
});
}).catchError((_) {});
return () async {
if (disposed) return;
disposeRequested = true;
try {
final fn = cancel;
if (fn != null) {
disposed = true;
await fn();
} else {
await _pb.collection(collection).unsubscribe(topic);
}
} catch (_) {
await _pb.collection(collection).unsubscribe(topic);
// swallow — never globally unsubscribe the topic here, because
// other screens may still be subscribed to the same collection/topic.
}
};
}