mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: database sync indicator (#5005)
* feat: database sync indicator * fix: sync state error * fix: ios ci
This commit is contained in:
@ -2,7 +2,7 @@ use collab::core::collab_state::SyncState;
|
||||
use collab_database::rows::RowId;
|
||||
use collab_database::views::DatabaseLayout;
|
||||
|
||||
use flowy_derive::ProtoBuf;
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_error::{ErrorCode, FlowyError};
|
||||
|
||||
use lib_infra::validator_fn::required_not_empty_str;
|
||||
@ -273,18 +273,27 @@ impl TryInto<DatabaseLayoutMeta> for DatabaseLayoutMetaPB {
|
||||
#[derive(Debug, Default, ProtoBuf)]
|
||||
pub struct DatabaseSyncStatePB {
|
||||
#[pb(index = 1)]
|
||||
pub is_syncing: bool,
|
||||
pub value: DatabaseSyncState,
|
||||
}
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub is_finish: bool,
|
||||
#[derive(Debug, Default, ProtoBuf_Enum, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum DatabaseSyncState {
|
||||
#[default]
|
||||
InitSyncBegin = 0,
|
||||
InitSyncEnd = 1,
|
||||
Syncing = 2,
|
||||
SyncFinished = 3,
|
||||
}
|
||||
|
||||
impl From<SyncState> for DatabaseSyncStatePB {
|
||||
fn from(value: SyncState) -> Self {
|
||||
Self {
|
||||
is_syncing: value.is_syncing(),
|
||||
is_finish: value.is_sync_finished(),
|
||||
}
|
||||
let value = match value {
|
||||
SyncState::InitSyncBegin => DatabaseSyncState::InitSyncBegin,
|
||||
SyncState::InitSyncEnd => DatabaseSyncState::InitSyncEnd,
|
||||
SyncState::Syncing => DatabaseSyncState::Syncing,
|
||||
SyncState::SyncFinished => DatabaseSyncState::SyncFinished,
|
||||
};
|
||||
Self { value }
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user