mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-09-07 07:43:26 +00:00
31 lines
806 B
Dart
31 lines
806 B
Dart
![]() |
import 'package:app_flowy/workspace/domain/i_view.dart';
|
||
|
import 'package:flowy_sdk/protobuf/flowy-observable/subject.pb.dart';
|
||
|
import 'package:dartz/dartz.dart';
|
||
|
import 'dart:async';
|
||
|
|
||
|
class ViewWatchRepository {
|
||
|
StreamSubscription<ObservableSubject>? _subscription;
|
||
|
ViewUpdatedCallback? _updatedCallback;
|
||
|
String viewId;
|
||
|
ViewWatchRepository({
|
||
|
required this.viewId,
|
||
|
});
|
||
|
|
||
|
void startWatching({
|
||
|
ViewUpdatedCallback? updatedCallback,
|
||
|
}) {
|
||
|
_addViewCallback = addViewCallback;
|
||
|
_updatedCallback = updatedCallback;
|
||
|
_subscription = RustStreamReceiver.listen((observable) {
|
||
|
if (observable.subjectId != appId) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
final ty = WorkspaceObservable.valueOf(observable.ty);
|
||
|
if (ty != null) {
|
||
|
_handleObservableType(ty);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|