mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: integrate appflowy-cloud (#3359)
* feat: draft: code dependency * chore: update ref * feat: signup using client_api * feat: support auto sign_in after sign_up if already confirmed(WIP) * chore: update collab commit id * chore: fix compile errors * chore: user AFServer trait to provide optional service * chore: refactor workspace * chore: disable aws config * chore: return ws connect * chore: update collab rev * chore: fmt and clippy * chore: fix test * chore: update chrono version * chore: add script to update the collab crates commit id * chore: update --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
@ -9,24 +9,24 @@ edition = "2021"
|
||||
collab = { version = "0.1.0" }
|
||||
collab-database = { version = "0.1.0" }
|
||||
collab-define = { version = "0.1.0" }
|
||||
appflowy-integrate = {version = "0.1.0" }
|
||||
flowy-database-deps = { path = "../flowy-database-deps" }
|
||||
collab-integrate = { workspace = true }
|
||||
flowy-database-deps = { workspace = true }
|
||||
|
||||
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
|
||||
flowy-notification = { path = "../flowy-notification" }
|
||||
flowy-notification = { workspace = true }
|
||||
parking_lot = "0.12.1"
|
||||
protobuf = {version = "2.28.0"}
|
||||
flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error", "impl_from_collab"]}
|
||||
lib-dispatch = { path = "../lib-dispatch" }
|
||||
flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_collab"]}
|
||||
lib-dispatch = { workspace = true }
|
||||
tokio = { version = "1.26", features = ["sync"] }
|
||||
flowy-task= { path = "../flowy-task" }
|
||||
flowy-task= { workspace = true }
|
||||
bytes = { version = "1.4" }
|
||||
tracing = { version = "0.1", features = ["log"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = {version = "1.0"}
|
||||
serde_repr = "0.1"
|
||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
|
||||
chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
|
||||
rust_decimal = "1.28.1"
|
||||
rusty-money = {version = "0.4.1", features = ["iso"]}
|
||||
lazy_static = "1.4.0"
|
||||
|
@ -1,8 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
|
||||
use appflowy_integrate::{CollabPersistenceConfig, RocksCollabDB};
|
||||
use collab::core::collab::{CollabRawData, MutexCollab};
|
||||
use collab_database::blocks::BlockEvent;
|
||||
use collab_database::database::{DatabaseData, YrsDocAction};
|
||||
@ -15,6 +13,8 @@ use collab_database::views::{CreateDatabaseParams, CreateViewParams, DatabaseLay
|
||||
use collab_define::CollabType;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use collab_integrate::collab_builder::AppFlowyCollabBuilder;
|
||||
use collab_integrate::{CollabPersistenceConfig, RocksCollabDB};
|
||||
use flowy_database_deps::cloud::DatabaseCloudService;
|
||||
use flowy_error::{internal_error, FlowyError, FlowyResult};
|
||||
use flowy_task::TaskDispatcher;
|
||||
|
@ -1464,7 +1464,7 @@ impl DatabaseViewData for DatabaseViewDataImpl {
|
||||
field_id: &str,
|
||||
visibility: Option<FieldVisibility>,
|
||||
) {
|
||||
let field_settings_map = self.get_field_settings(view_id, &vec![field_id.to_string()]);
|
||||
let field_settings_map = self.get_field_settings(view_id, &[field_id.to_string()]);
|
||||
|
||||
let new_field_settings = if let Some(field_settings) = field_settings_map.get(field_id) {
|
||||
let mut field_settings = field_settings.to_owned();
|
||||
|
@ -910,10 +910,7 @@ impl DatabaseViewEditor {
|
||||
.send();
|
||||
}
|
||||
|
||||
pub async fn v_get_field_settings(
|
||||
&self,
|
||||
field_ids: &Vec<String>,
|
||||
) -> HashMap<String, FieldSettings> {
|
||||
pub async fn v_get_field_settings(&self, field_ids: &[String]) -> HashMap<String, FieldSettings> {
|
||||
self.delegate.get_field_settings(&self.view_id, field_ids)
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ mod tests {
|
||||
let native_timestamp = 1647251762;
|
||||
let native = NaiveDateTime::from_timestamp_opt(native_timestamp, 0).unwrap();
|
||||
|
||||
let utc = chrono::DateTime::<chrono::Utc>::from_utc(native, chrono::Utc);
|
||||
let utc = chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset(native, chrono::Utc);
|
||||
// utc_timestamp doesn't carry timezone
|
||||
let utc_timestamp = utc.timestamp();
|
||||
assert_eq!(native_timestamp, utc_timestamp);
|
||||
@ -304,7 +304,8 @@ mod tests {
|
||||
|
||||
// Mon Mar 14 2022 17:56:02 GMT+0800 (China Standard Time)
|
||||
let gmt_8_offset = FixedOffset::east_opt(8 * 3600).unwrap();
|
||||
let china_local = chrono::DateTime::<chrono::Local>::from_utc(native, gmt_8_offset);
|
||||
let china_local =
|
||||
chrono::DateTime::<chrono::Local>::from_naive_utc_and_offset(native, gmt_8_offset);
|
||||
let china_local_time = format!(
|
||||
"{}",
|
||||
china_local.format_with_items(StrftimeItems::new(&format))
|
||||
|
@ -22,23 +22,13 @@ use crate::services::sort::SortCondition;
|
||||
/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::LastEditedTime], and [FieldType::CreatedTime].
|
||||
/// So, storing the field type is necessary to distinguish the field type.
|
||||
/// Most of the cases, each [FieldType] has its own [TypeOption] implementation.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
||||
pub struct DateTypeOption {
|
||||
pub date_format: DateFormat,
|
||||
pub time_format: TimeFormat,
|
||||
pub timezone_id: String,
|
||||
}
|
||||
|
||||
impl Default for DateTypeOption {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
date_format: Default::default(),
|
||||
time_format: Default::default(),
|
||||
timezone_id: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeOption for DateTypeOption {
|
||||
type CellData = DateCellData;
|
||||
type CellChangeset = DateCellChangeset;
|
||||
@ -113,7 +103,7 @@ impl DateTypeOption {
|
||||
if let Some(timestamp) = timestamp {
|
||||
let naive = chrono::NaiveDateTime::from_timestamp_opt(*timestamp, 0).unwrap();
|
||||
let offset = self.get_timezone_offset(naive);
|
||||
let date_time = DateTime::<Local>::from_utc(naive, offset);
|
||||
let date_time = DateTime::<Local>::from_naive_utc_and_offset(naive, offset);
|
||||
|
||||
let fmt = self.date_format.format_str();
|
||||
let date = format!("{}", date_time.format(fmt));
|
||||
|
@ -108,7 +108,7 @@ impl TimestampTypeOption {
|
||||
if let Some(timestamp) = timestamp {
|
||||
let naive = chrono::NaiveDateTime::from_timestamp_opt(*timestamp, 0).unwrap();
|
||||
let offset = Local::now().offset().fix();
|
||||
let date_time = DateTime::<Local>::from_utc(naive, offset);
|
||||
let date_time = DateTime::<Local>::from_naive_utc_and_offset(naive, offset);
|
||||
|
||||
let fmt = self.date_format.format_str();
|
||||
let date = format!("{}", date_time.format(fmt));
|
||||
|
@ -262,16 +262,12 @@ pub fn default_type_option_data_from_type(field_type: &FieldType) -> TypeOptionD
|
||||
match field_type {
|
||||
FieldType::RichText => RichTextTypeOption::default().into(),
|
||||
FieldType::Number => NumberTypeOption::default().into(),
|
||||
FieldType::DateTime => DateTypeOption {
|
||||
..Default::default()
|
||||
}
|
||||
.into(),
|
||||
FieldType::DateTime => DateTypeOption::default().into(),
|
||||
FieldType::LastEditedTime | FieldType::CreatedTime => TimestampTypeOption {
|
||||
field_type: field_type.clone(),
|
||||
date_format: DateFormat::Friendly,
|
||||
time_format: TimeFormat::TwelveHour,
|
||||
include_time: true,
|
||||
..Default::default()
|
||||
}
|
||||
.into(),
|
||||
FieldType::SingleSelect => SingleSelectTypeOption::default().into(),
|
||||
|
@ -443,7 +443,7 @@ fn date_time_from_timestamp(timestamp: Option<i64>, timezone_id: &str) -> DateTi
|
||||
Err(_) => *Local::now().offset(),
|
||||
};
|
||||
|
||||
DateTime::<Local>::from_utc(naive, offset)
|
||||
DateTime::<Local>::from_naive_utc_and_offset(naive, offset)
|
||||
},
|
||||
None => DateTime::default(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user