Skip to content

Commit 37547a6

Browse files
authored
chore: bump up collab (#2740)
* chore: update collab version * chore: log the error when open collab db * chore: add log
1 parent 6e27d55 commit 37547a6

File tree

9 files changed

+63
-57
lines changed

9 files changed

+63
-57
lines changed

frontend/appflowy_flutter/lib/core/config/kv.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ class RustKeyValue implements KeyValueStorage {
7979
}
8080

8181
@override
82-
Future<void> clear() {
83-
// TODO: implement clear
84-
throw UnimplementedError();
82+
Future<void> clear() async {
83+
// TODO(Lucas): implement clear
8584
}
8685
}

frontend/appflowy_flutter/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,10 @@ packages:
693693
dependency: transitive
694694
description:
695695
name: intl_utils
696-
sha256: db392393fbf891e3eb32f6beb1928b00cdb33e3c54597fd5f5dc5c43e5ba601c
696+
sha256: a509a2ada4d12c4dc70f9ca35c2fddf75f8b402409ac1a9e1b3dd8065681986b
697697
url: "https://pub.dev"
698698
source: hosted
699-
version: "2.8.2"
699+
version: "2.8.3"
700700
io:
701701
dependency: transitive
702702
description:

frontend/appflowy_tauri/src-tauri/Cargo.lock

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/appflowy_tauri/src-tauri/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ default = ["custom-protocol"]
3434
custom-protocol = ["tauri/custom-protocol"]
3535

3636
[patch.crates-io]
37-
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
38-
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
39-
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
40-
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
41-
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
42-
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
37+
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
38+
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
39+
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
40+
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
41+
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
42+
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
4343

4444
#collab = { path = "../../AppFlowy-Collab/collab" }
4545
#collab-folder = { path = "../../AppFlowy-Collab/collab-folder" }

frontend/rust-lib/Cargo.lock

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/rust-lib/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ opt-level = 3
3333
incremental = false
3434

3535
[patch.crates-io]
36-
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
37-
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
38-
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
39-
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
40-
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
36+
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
37+
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
38+
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
39+
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
40+
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "87f534" }
4141

4242
#collab = { path = "../AppFlowy-Collab/collab" }
4343
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }

frontend/rust-lib/flowy-error/src/code.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ pub enum ErrorCode {
199199

200200
#[error("Missing auth field")]
201201
MissingAuthField = 65,
202+
203+
#[error("Only one application can access the database")]
204+
MultipleDBInstance = 66,
202205
}
203206

204207
impl ErrorCode {

frontend/rust-lib/flowy-folder2/src/manager.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
66
use appflowy_integrate::CollabPersistenceConfig;
77
use collab::core::collab_state::CollabState;
88
use collab_folder::core::{
9-
Folder, FolderContext, TrashChange, TrashChangeReceiver, TrashInfo, TrashRecord, View,
10-
ViewChange, ViewChangeReceiver, ViewLayout, Workspace,
9+
Folder, FolderContext, TrashChange, TrashChangeReceiver, TrashInfo, View, ViewChange,
10+
ViewChangeReceiver, ViewLayout, Workspace,
1111
};
1212
use parking_lot::Mutex;
1313
use tokio_stream::wrappers::WatchStream;
1414
use tokio_stream::StreamExt;
1515
use tracing::{event, Level};
1616

1717
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
18-
use lib_infra::util::timestamp;
1918

2019
use crate::deps::{FolderCloudService, FolderUser};
2120
use crate::entities::{
@@ -114,7 +113,7 @@ impl Folder2Manager {
114113
}
115114

116115
/// Called immediately after the application launched fi the user already sign in/sign up.
117-
#[tracing::instrument(level = "debug", skip(self), err)]
116+
#[tracing::instrument(level = "info", skip(self), err)]
118117
pub async fn initialize(&self, uid: i64, workspace_id: &str) -> FlowyResult<()> {
119118
let workspace_id = workspace_id.to_string();
120119
if let Ok(collab_db) = self.user.collab_db() {
@@ -176,6 +175,7 @@ impl Folder2Manager {
176175
///
177176
pub async fn clear(&self, _user_id: i64) {}
178177

178+
#[tracing::instrument(level = "info", skip_all, err)]
179179
pub async fn create_workspace(&self, params: CreateWorkspaceParams) -> FlowyResult<Workspace> {
180180
let workspace = self
181181
.cloud_service
@@ -194,6 +194,7 @@ impl Folder2Manager {
194194
Ok(workspace)
195195
}
196196

197+
#[tracing::instrument(level = "info", skip_all, err)]
197198
pub async fn open_workspace(&self, workspace_id: &str) -> FlowyResult<Workspace> {
198199
self.with_folder(Err(FlowyError::internal()), |folder| {
199200
let workspace = folder
@@ -281,7 +282,6 @@ impl Folder2Manager {
281282
let folder = self.mutex_folder.lock();
282283
let folder = folder.as_ref().ok_or_else(folder_not_init_error)?;
283284
let trash_ids = folder
284-
.trash
285285
.get_all_trash()
286286
.into_iter()
287287
.map(|trash| trash.id)
@@ -312,10 +312,7 @@ impl Folder2Manager {
312312
#[tracing::instrument(level = "debug", skip(self), err)]
313313
pub async fn move_view_to_trash(&self, view_id: &str) -> FlowyResult<()> {
314314
self.with_folder((), |folder| {
315-
folder.trash.add_trash(vec![TrashRecord {
316-
id: view_id.to_string(),
317-
created_at: timestamp(),
318-
}]);
315+
folder.add_trash(vec![view_id.to_string()]);
319316

320317
// notify the parent view that the view is moved to trash
321318
send_notification(view_id, FolderNotification::DidMoveViewToTrash)
@@ -463,13 +460,13 @@ impl Folder2Manager {
463460

464461
#[tracing::instrument(level = "trace", skip(self))]
465462
pub(crate) async fn get_all_trash(&self) -> Vec<TrashInfo> {
466-
self.with_folder(vec![], |folder| folder.trash.get_all_trash())
463+
self.with_folder(vec![], |folder| folder.get_all_trash())
467464
}
468465

469466
#[tracing::instrument(level = "trace", skip(self))]
470467
pub(crate) async fn restore_all_trash(&self) {
471468
self.with_folder((), |folder| {
472-
folder.trash.clear();
469+
folder.remote_all_trash();
473470
});
474471

475472
send_notification("trash", FolderNotification::DidUpdateTrash)
@@ -480,14 +477,14 @@ impl Folder2Manager {
480477
#[tracing::instrument(level = "trace", skip(self))]
481478
pub(crate) async fn restore_trash(&self, trash_id: &str) {
482479
self.with_folder((), |folder| {
483-
folder.trash.delete_trash(vec![trash_id]);
480+
folder.delete_trash(vec![trash_id.to_string()]);
484481
});
485482
}
486483

487484
/// Delete all the trash permanently.
488485
#[tracing::instrument(level = "trace", skip(self))]
489486
pub(crate) async fn delete_all_trash(&self) {
490-
let deleted_trash = self.with_folder(vec![], |folder| folder.trash.get_all_trash());
487+
let deleted_trash = self.with_folder(vec![], |folder| folder.get_all_trash());
491488
for trash in deleted_trash {
492489
let _ = self.delete_trash(&trash.id).await;
493490
}
@@ -503,7 +500,7 @@ impl Folder2Manager {
503500
pub async fn delete_trash(&self, view_id: &str) -> FlowyResult<()> {
504501
let view = self.with_folder(None, |folder| folder.views.get_view(view_id));
505502
self.with_folder((), |folder| {
506-
folder.trash.delete_trash(vec![view_id]);
503+
folder.delete_trash(vec![view_id.to_string()]);
507504
folder.views.delete_views(vec![view_id]);
508505
});
509506
if let Some(view) = view {
@@ -667,7 +664,7 @@ fn listen_on_trash_change(mut rx: TrashChangeReceiver, weak_mutex_folder: &Weak<
667664
unique_ids.insert(view.parent_view_id);
668665
}
669666

670-
let repeated_trash: RepeatedTrashPB = folder.trash.get_all_trash().into();
667+
let repeated_trash: RepeatedTrashPB = folder.get_all_trash().into();
671668
send_notification("trash", FolderNotification::DidUpdateTrash)
672669
.payload(repeated_trash)
673670
.send();
@@ -683,7 +680,6 @@ fn listen_on_trash_change(mut rx: TrashChangeReceiver, weak_mutex_folder: &Weak<
683680
/// Return the views that belong to the workspace. The views are filtered by the trash.
684681
fn get_workspace_view_pbs(workspace_id: &str, folder: &Folder) -> Vec<ViewPB> {
685682
let trash_ids = folder
686-
.trash
687683
.get_all_trash()
688684
.into_iter()
689685
.map(|trash| trash.id)
@@ -724,7 +720,6 @@ fn notify_parent_view_did_change<T: AsRef<str>>(
724720
let folder = folder.as_ref()?;
725721
let workspace_id = folder.get_current_workspace_id()?;
726722
let trash_ids = folder
727-
.trash
728723
.get_all_trash()
729724
.into_iter()
730725
.map(|trash| trash.id)

0 commit comments

Comments
 (0)