Mathias Mogensen 0d69b895aa
feat: sub page block (#6427)
* feat: base subpage block and behavior

* fix: do not record undo

* refactor: add BlockTransactionHandler

* test: start adding coverage

* test: delete w/ backspace

* test: add to runner

* fix: rebuild issue on create

* test: copy+paste base test

* fix: conflict behavior and test coverage

* fix: after merge

* test: add wait duration

* test: more tests

* fix: cut behavior + tests

* fix: refactor copy+paste and more test cov

* fix: localization + test coverage + cleanup

* test: add drag subpageblock node test

* test: remove backspace test
2024-10-03 04:58:08 +02:00

36 lines
1.1 KiB
Dart

import 'dart:async';
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
import 'package:appflowy_result/appflowy_result.dart';
class TrashService {
Future<FlowyResult<RepeatedTrashPB, FlowyError>> readTrash() {
return FolderEventListTrashItems().send();
}
static Future<FlowyResult<void, FlowyError>> putback(String trashId) {
final id = TrashIdPB.create()..id = trashId;
return FolderEventRestoreTrashItem(id).send();
}
Future<FlowyResult<void, FlowyError>> deleteViews(List<String> trash) {
final items = trash.map((trash) {
return TrashIdPB.create()..id = trash;
});
final ids = RepeatedTrashIdPB(items: items);
return FolderEventPermanentlyDeleteTrashItem(ids).send();
}
Future<FlowyResult<void, FlowyError>> restoreAll() {
return FolderEventRecoverAllTrashItems().send();
}
Future<FlowyResult<void, FlowyError>> deleteAll() {
return FolderEventPermanentlyDeleteAllTrashItem().send();
}
}