mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: upgrade rust version to 1.70 (#2749)
* chore: upgrade rust version to 1.70 * ci: fix wanrings * ci: fix clippy warings
This commit is contained in:
2
.github/workflows/flutter_ci.yaml
vendored
2
.github/workflows/flutter_ci.yaml
vendored
@ -23,7 +23,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
FLUTTER_VERSION: "3.10.1"
|
FLUTTER_VERSION: "3.10.1"
|
||||||
RUST_TOOLCHAIN: "1.65"
|
RUST_TOOLCHAIN: "1.70"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
FLUTTER_VERSION: "3.10.1"
|
FLUTTER_VERSION: "3.10.1"
|
||||||
RUST_TOOLCHAIN: "1.65"
|
RUST_TOOLCHAIN: "1.70"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-release:
|
create-release:
|
||||||
|
2
.github/workflows/rust_ci.yaml
vendored
2
.github/workflows/rust_ci.yaml
vendored
@ -21,7 +21,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
RUST_TOOLCHAIN: "1.65"
|
RUST_TOOLCHAIN: "1.70"
|
||||||
FLUTTER_VERSION: "3.10.1"
|
FLUTTER_VERSION: "3.10.1"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
2
.github/workflows/rust_coverage.yml
vendored
2
.github/workflows/rust_coverage.yml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
FLUTTER_VERSION: "3.10.1"
|
FLUTTER_VERSION: "3.10.1"
|
||||||
RUST_TOOLCHAIN: "1.65"
|
RUST_TOOLCHAIN: "1.70"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
2
.github/workflows/tauri_ci.yaml
vendored
2
.github/workflows/tauri_ci.yaml
vendored
@ -8,7 +8,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
NODE_VERSION: "18.16.0"
|
NODE_VERSION: "18.16.0"
|
||||||
PNPM_VERSION: "8.5.0"
|
PNPM_VERSION: "8.5.0"
|
||||||
RUST_TOOLCHAIN: "1.65"
|
RUST_TOOLCHAIN: "1.70"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tauri-build:
|
tauri-build:
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.65"
|
channel = "1.70"
|
||||||
|
@ -58,7 +58,7 @@ pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) {
|
|||||||
},
|
},
|
||||||
Some(e) => e.event_dispatcher.clone(),
|
Some(e) => e.event_dispatcher.clone(),
|
||||||
};
|
};
|
||||||
let _ = AFPluginDispatcher::async_send_with_callback(
|
AFPluginDispatcher::async_send_with_callback(
|
||||||
dispatcher,
|
dispatcher,
|
||||||
request,
|
request,
|
||||||
move |resp: AFPluginEventResponse| {
|
move |resp: AFPluginEventResponse| {
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||||
use lib_dispatch::prelude::{AFPluginEventResponse, Payload, StatusCode};
|
use lib_dispatch::prelude::{AFPluginEventResponse, Payload, StatusCode};
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Clone, Copy)]
|
#[derive(ProtoBuf_Enum, Clone, Copy, Default)]
|
||||||
pub enum FFIStatusCode {
|
pub enum FFIStatusCode {
|
||||||
|
#[default]
|
||||||
Ok = 0,
|
Ok = 0,
|
||||||
Err = 1,
|
Err = 1,
|
||||||
Internal = 2,
|
Internal = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for FFIStatusCode {
|
|
||||||
fn default() -> FFIStatusCode {
|
|
||||||
FFIStatusCode::Ok
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(ProtoBuf, Default)]
|
#[derive(ProtoBuf, Default)]
|
||||||
pub struct FFIResponse {
|
pub struct FFIResponse {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
@ -45,7 +45,7 @@ impl SnapshotPersistence for SnapshotDBImpl {
|
|||||||
.map_err(|e| PersistenceError::Internal(Box::new(e)))?,
|
.map_err(|e| PersistenceError::Internal(Box::new(e)))?,
|
||||||
);
|
);
|
||||||
|
|
||||||
let _ = tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || {
|
||||||
if let Some(pool) = weak_pool.upgrade() {
|
if let Some(pool) = weak_pool.upgrade() {
|
||||||
let conn = pool
|
let conn = pool
|
||||||
.get()
|
.get()
|
||||||
|
@ -475,7 +475,9 @@ pub struct FieldChangesetParams {
|
|||||||
Deserialize_repr,
|
Deserialize_repr,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum FieldType {
|
pub enum FieldType {
|
||||||
|
#[default]
|
||||||
RichText = 0,
|
RichText = 0,
|
||||||
Number = 1,
|
Number = 1,
|
||||||
DateTime = 2,
|
DateTime = 2,
|
||||||
@ -488,12 +490,6 @@ pub enum FieldType {
|
|||||||
CreatedTime = 9,
|
CreatedTime = 9,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for FieldType {
|
|
||||||
fn default() -> Self {
|
|
||||||
FieldType::RichText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for FieldType {
|
impl Display for FieldType {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
let value: i64 = self.clone().into();
|
let value: i64 = self.clone().into();
|
||||||
|
@ -10,7 +10,9 @@ pub struct CheckboxFilterPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum CheckboxFilterConditionPB {
|
pub enum CheckboxFilterConditionPB {
|
||||||
|
#[default]
|
||||||
IsChecked = 0,
|
IsChecked = 0,
|
||||||
IsUnChecked = 1,
|
IsUnChecked = 1,
|
||||||
}
|
}
|
||||||
@ -21,12 +23,6 @@ impl std::convert::From<CheckboxFilterConditionPB> for u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for CheckboxFilterConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
CheckboxFilterConditionPB::IsChecked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for CheckboxFilterConditionPB {
|
impl std::convert::TryFrom<u8> for CheckboxFilterConditionPB {
|
||||||
type Error = ErrorCode;
|
type Error = ErrorCode;
|
||||||
|
|
||||||
|
@ -10,8 +10,10 @@ pub struct ChecklistFilterPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum ChecklistFilterConditionPB {
|
pub enum ChecklistFilterConditionPB {
|
||||||
IsComplete = 0,
|
IsComplete = 0,
|
||||||
|
#[default]
|
||||||
IsIncomplete = 1,
|
IsIncomplete = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,12 +23,6 @@ impl std::convert::From<ChecklistFilterConditionPB> for u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for ChecklistFilterConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
ChecklistFilterConditionPB::IsIncomplete
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for ChecklistFilterConditionPB {
|
impl std::convert::TryFrom<u8> for ChecklistFilterConditionPB {
|
||||||
type Error = ErrorCode;
|
type Error = ErrorCode;
|
||||||
|
|
||||||
|
@ -42,7 +42,9 @@ impl FromStr for DateFilterContentPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum DateFilterConditionPB {
|
pub enum DateFilterConditionPB {
|
||||||
|
#[default]
|
||||||
DateIs = 0,
|
DateIs = 0,
|
||||||
DateBefore = 1,
|
DateBefore = 1,
|
||||||
DateAfter = 2,
|
DateAfter = 2,
|
||||||
@ -58,11 +60,6 @@ impl std::convert::From<DateFilterConditionPB> for u32 {
|
|||||||
value as u32
|
value as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::default::Default for DateFilterConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
DateFilterConditionPB::DateIs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for DateFilterConditionPB {
|
impl std::convert::TryFrom<u8> for DateFilterConditionPB {
|
||||||
type Error = ErrorCode;
|
type Error = ErrorCode;
|
||||||
|
@ -13,7 +13,9 @@ pub struct NumberFilterPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum NumberFilterConditionPB {
|
pub enum NumberFilterConditionPB {
|
||||||
|
#[default]
|
||||||
Equal = 0,
|
Equal = 0,
|
||||||
NotEqual = 1,
|
NotEqual = 1,
|
||||||
GreaterThan = 2,
|
GreaterThan = 2,
|
||||||
@ -24,12 +26,6 @@ pub enum NumberFilterConditionPB {
|
|||||||
NumberIsNotEmpty = 7,
|
NumberIsNotEmpty = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for NumberFilterConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
NumberFilterConditionPB::Equal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<NumberFilterConditionPB> for u32 {
|
impl std::convert::From<NumberFilterConditionPB> for u32 {
|
||||||
fn from(value: NumberFilterConditionPB) -> Self {
|
fn from(value: NumberFilterConditionPB) -> Self {
|
||||||
value as u32
|
value as u32
|
||||||
|
@ -14,7 +14,9 @@ pub struct SelectOptionFilterPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum SelectOptionConditionPB {
|
pub enum SelectOptionConditionPB {
|
||||||
|
#[default]
|
||||||
OptionIs = 0,
|
OptionIs = 0,
|
||||||
OptionIsNot = 1,
|
OptionIsNot = 1,
|
||||||
OptionIsEmpty = 2,
|
OptionIsEmpty = 2,
|
||||||
@ -27,12 +29,6 @@ impl std::convert::From<SelectOptionConditionPB> for u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for SelectOptionConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
SelectOptionConditionPB::OptionIs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for SelectOptionConditionPB {
|
impl std::convert::TryFrom<u8> for SelectOptionConditionPB {
|
||||||
type Error = ErrorCode;
|
type Error = ErrorCode;
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ pub struct TextFilterPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum TextFilterConditionPB {
|
pub enum TextFilterConditionPB {
|
||||||
|
#[default]
|
||||||
Is = 0,
|
Is = 0,
|
||||||
IsNot = 1,
|
IsNot = 1,
|
||||||
Contains = 2,
|
Contains = 2,
|
||||||
@ -30,12 +32,6 @@ impl std::convert::From<TextFilterConditionPB> for u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for TextFilterConditionPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
TextFilterConditionPB::Is
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for TextFilterConditionPB {
|
impl std::convert::TryFrom<u8> for TextFilterConditionPB {
|
||||||
type Error = ErrorCode;
|
type Error = ErrorCode;
|
||||||
|
|
||||||
|
@ -54,7 +54,9 @@ pub struct DateGroupConfigurationPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum DateCondition {
|
pub enum DateCondition {
|
||||||
|
#[default]
|
||||||
Relative = 0,
|
Relative = 0,
|
||||||
Day = 1,
|
Day = 1,
|
||||||
Week = 2,
|
Week = 2,
|
||||||
@ -62,12 +64,6 @@ pub enum DateCondition {
|
|||||||
Year = 4,
|
Year = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for DateCondition {
|
|
||||||
fn default() -> Self {
|
|
||||||
DateCondition::Relative
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
|
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
|
||||||
pub struct CheckboxGroupConfigurationPB {
|
pub struct CheckboxGroupConfigurationPB {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
@ -35,18 +35,14 @@ pub struct DatabaseViewSettingPB {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum DatabaseLayoutPB {
|
pub enum DatabaseLayoutPB {
|
||||||
|
#[default]
|
||||||
Grid = 0,
|
Grid = 0,
|
||||||
Board = 1,
|
Board = 1,
|
||||||
Calendar = 2,
|
Calendar = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for DatabaseLayoutPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
DatabaseLayoutPB::Grid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<DatabaseLayout> for DatabaseLayoutPB {
|
impl std::convert::From<DatabaseLayout> for DatabaseLayoutPB {
|
||||||
fn from(rev: DatabaseLayout) -> Self {
|
fn from(rev: DatabaseLayout) -> Self {
|
||||||
match rev {
|
match rev {
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||||
|
|
||||||
#[derive(Debug, ProtoBuf_Enum, Clone)]
|
#[derive(Debug, ProtoBuf_Enum, Clone, Default)]
|
||||||
pub enum DatabaseExportDataType {
|
pub enum DatabaseExportDataType {
|
||||||
|
#[default]
|
||||||
CSV = 0,
|
CSV = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DatabaseExportDataType {
|
|
||||||
fn default() -> Self {
|
|
||||||
DatabaseExportDataType::CSV
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, ProtoBuf, Default, Clone)]
|
#[derive(Debug, ProtoBuf, Default, Clone)]
|
||||||
pub struct DatabaseExportDataPB {
|
pub struct DatabaseExportDataPB {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
@ -75,19 +75,15 @@ impl From<DateTypeOptionPB> for DateTypeOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Copy, EnumIter, ProtoBuf_Enum)]
|
#[derive(Clone, Debug, Copy, EnumIter, ProtoBuf_Enum, Default)]
|
||||||
pub enum DateFormatPB {
|
pub enum DateFormatPB {
|
||||||
Local = 0,
|
Local = 0,
|
||||||
US = 1,
|
US = 1,
|
||||||
ISO = 2,
|
ISO = 2,
|
||||||
|
#[default]
|
||||||
Friendly = 3,
|
Friendly = 3,
|
||||||
DayMonthYear = 4,
|
DayMonthYear = 4,
|
||||||
}
|
}
|
||||||
impl std::default::Default for DateFormatPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
DateFormatPB::Friendly
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<DateFormatPB> for DateFormat {
|
impl From<DateFormatPB> for DateFormat {
|
||||||
fn from(data: DateFormatPB) -> Self {
|
fn from(data: DateFormatPB) -> Self {
|
||||||
@ -113,18 +109,13 @@ impl From<DateFormat> for DateFormatPB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, ProtoBuf_Enum)]
|
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, ProtoBuf_Enum, Default)]
|
||||||
pub enum TimeFormatPB {
|
pub enum TimeFormatPB {
|
||||||
TwelveHour = 0,
|
TwelveHour = 0,
|
||||||
|
#[default]
|
||||||
TwentyFourHour = 1,
|
TwentyFourHour = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for TimeFormatPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
TimeFormatPB::TwentyFourHour
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<TimeFormatPB> for TimeFormat {
|
impl From<TimeFormatPB> for TimeFormat {
|
||||||
fn from(data: TimeFormatPB) -> Self {
|
fn from(data: TimeFormatPB) -> Self {
|
||||||
match data {
|
match data {
|
||||||
|
@ -39,8 +39,9 @@ impl From<NumberTypeOptionPB> for NumberTypeOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, ProtoBuf_Enum)]
|
#[derive(Clone, Copy, Debug, ProtoBuf_Enum, Default)]
|
||||||
pub enum NumberFormatPB {
|
pub enum NumberFormatPB {
|
||||||
|
#[default]
|
||||||
Num = 0,
|
Num = 0,
|
||||||
USD = 1,
|
USD = 1,
|
||||||
CanadianDollar = 2,
|
CanadianDollar = 2,
|
||||||
@ -79,12 +80,6 @@ pub enum NumberFormatPB {
|
|||||||
Percent = 36,
|
Percent = 36,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for NumberFormatPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
NumberFormatPB::Num
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<NumberFormat> for NumberFormatPB {
|
impl From<NumberFormat> for NumberFormatPB {
|
||||||
fn from(data: NumberFormat) -> Self {
|
fn from(data: NumberFormat) -> Self {
|
||||||
match data {
|
match data {
|
||||||
|
@ -57,7 +57,9 @@ pub struct RepeatedSelectOptionPayload {
|
|||||||
|
|
||||||
#[derive(ProtoBuf_Enum, PartialEq, Eq, Debug, Clone)]
|
#[derive(ProtoBuf_Enum, PartialEq, Eq, Debug, Clone)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum SelectOptionColorPB {
|
pub enum SelectOptionColorPB {
|
||||||
|
#[default]
|
||||||
Purple = 0,
|
Purple = 0,
|
||||||
Pink = 1,
|
Pink = 1,
|
||||||
LightPink = 2,
|
LightPink = 2,
|
||||||
@ -69,12 +71,6 @@ pub enum SelectOptionColorPB {
|
|||||||
Blue = 8,
|
Blue = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for SelectOptionColorPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
SelectOptionColorPB::Purple
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<SelectOptionColor> for SelectOptionColorPB {
|
impl From<SelectOptionColor> for SelectOptionColorPB {
|
||||||
fn from(data: SelectOptionColor) -> Self {
|
fn from(data: SelectOptionColor) -> Self {
|
||||||
match data {
|
match data {
|
||||||
|
@ -3,8 +3,9 @@ use flowy_notification::NotificationBuilder;
|
|||||||
|
|
||||||
const OBSERVABLE_CATEGORY: &str = "Grid";
|
const OBSERVABLE_CATEGORY: &str = "Grid";
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Debug)]
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
||||||
pub enum DatabaseNotification {
|
pub enum DatabaseNotification {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
/// Trigger after inserting/deleting/updating a row
|
/// Trigger after inserting/deleting/updating a row
|
||||||
DidUpdateViewRows = 20,
|
DidUpdateViewRows = 20,
|
||||||
@ -44,12 +45,6 @@ pub enum DatabaseNotification {
|
|||||||
DidMoveDatabaseViewToTrash = 84,
|
DidMoveDatabaseViewToTrash = 84,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for DatabaseNotification {
|
|
||||||
fn default() -> Self {
|
|
||||||
DatabaseNotification::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<DatabaseNotification> for i32 {
|
impl std::convert::From<DatabaseNotification> for i32 {
|
||||||
fn from(notification: DatabaseNotification) -> Self {
|
fn from(notification: DatabaseNotification) -> Self {
|
||||||
notification as i32
|
notification as i32
|
||||||
|
@ -1059,8 +1059,8 @@ fn cell_changesets_from_cell_by_field_id(
|
|||||||
) -> Vec<CellChangesetNotifyPB> {
|
) -> Vec<CellChangesetNotifyPB> {
|
||||||
let row_id = row_id.into_inner();
|
let row_id = row_id.into_inner();
|
||||||
cell_by_field_id
|
cell_by_field_id
|
||||||
.into_iter()
|
.into_keys()
|
||||||
.map(|(field_id, _cell)| CellChangesetNotifyPB {
|
.map(|field_id| CellChangesetNotifyPB {
|
||||||
view_id: view_id.to_string(),
|
view_id: view_id.to_string(),
|
||||||
row_id: row_id.clone(),
|
row_id: row_id.clone(),
|
||||||
field_id,
|
field_id,
|
||||||
|
@ -675,7 +675,7 @@ impl DatabaseViewEditor {
|
|||||||
let filter_type = UpdatedFilterType::new(Some(old), new);
|
let filter_type = UpdatedFilterType::new(Some(old), new);
|
||||||
let filter_changeset = FilterChangeset::from_update(filter_type);
|
let filter_changeset = FilterChangeset::from_update(filter_type);
|
||||||
let filter_controller = self.filter_controller.clone();
|
let filter_controller = self.filter_controller.clone();
|
||||||
let _ = tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Some(notification) = filter_controller
|
if let Some(notification) = filter_controller
|
||||||
.did_receive_changes(filter_changeset)
|
.did_receive_changes(filter_changeset)
|
||||||
.await
|
.await
|
||||||
|
@ -251,7 +251,7 @@ impl CellDataChangeset for DateTypeOption {
|
|||||||
Ok(time) => Ok(Some(time)),
|
Ok(time) => Ok(Some(time)),
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
let msg = format!("Parse {} failed", time_str);
|
let msg = format!("Parse {} failed", time_str);
|
||||||
Err(FlowyError::new(ErrorCode::InvalidDateTimeFormat, &msg))
|
Err(FlowyError::new(ErrorCode::InvalidDateTimeFormat, msg))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -191,19 +191,15 @@ impl ToString for DateCellData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Copy, EnumIter, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Copy, EnumIter, Serialize, Deserialize, Default)]
|
||||||
pub enum DateFormat {
|
pub enum DateFormat {
|
||||||
Local = 0,
|
Local = 0,
|
||||||
US = 1,
|
US = 1,
|
||||||
ISO = 2,
|
ISO = 2,
|
||||||
|
#[default]
|
||||||
Friendly = 3,
|
Friendly = 3,
|
||||||
DayMonthYear = 4,
|
DayMonthYear = 4,
|
||||||
}
|
}
|
||||||
impl std::default::Default for DateFormat {
|
|
||||||
fn default() -> Self {
|
|
||||||
DateFormat::Friendly
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<i64> for DateFormat {
|
impl std::convert::From<i64> for DateFormat {
|
||||||
fn from(value: i64) -> Self {
|
fn from(value: i64) -> Self {
|
||||||
@ -237,9 +233,10 @@ impl DateFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, Serialize, Deserialize, Default)]
|
||||||
pub enum TimeFormat {
|
pub enum TimeFormat {
|
||||||
TwelveHour = 0,
|
TwelveHour = 0,
|
||||||
|
#[default]
|
||||||
TwentyFourHour = 1,
|
TwentyFourHour = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,12 +267,6 @@ impl TimeFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for TimeFormat {
|
|
||||||
fn default() -> Self {
|
|
||||||
TimeFormat::TwentyFourHour
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DecodedCellData for DateCellDataPB {
|
impl DecodedCellData for DateCellDataPB {
|
||||||
type Object = DateCellDataPB;
|
type Object = DateCellDataPB;
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@ lazy_static! {
|
|||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumIter, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumIter, Serialize, Deserialize, Default)]
|
||||||
pub enum NumberFormat {
|
pub enum NumberFormat {
|
||||||
|
#[default]
|
||||||
Num = 0,
|
Num = 0,
|
||||||
USD = 1,
|
USD = 1,
|
||||||
CanadianDollar = 2,
|
CanadianDollar = 2,
|
||||||
@ -58,12 +59,6 @@ impl NumberFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for NumberFormat {
|
|
||||||
fn default() -> Self {
|
|
||||||
NumberFormat::Num
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<i64> for NumberFormat {
|
impl From<i64> for NumberFormat {
|
||||||
fn from(value: i64) -> Self {
|
fn from(value: i64) -> Self {
|
||||||
match value {
|
match value {
|
||||||
|
@ -31,7 +31,9 @@ impl SelectOption {
|
|||||||
|
|
||||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum SelectOptionColor {
|
pub enum SelectOptionColor {
|
||||||
|
#[default]
|
||||||
Purple = 0,
|
Purple = 0,
|
||||||
Pink = 1,
|
Pink = 1,
|
||||||
LightPink = 2,
|
LightPink = 2,
|
||||||
@ -43,12 +45,6 @@ pub enum SelectOptionColor {
|
|||||||
Blue = 8,
|
Blue = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for SelectOptionColor {
|
|
||||||
fn default() -> Self {
|
|
||||||
SelectOptionColor::Purple
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SelectOptionCellData {
|
pub struct SelectOptionCellData {
|
||||||
pub options: Vec<SelectOption>,
|
pub options: Vec<SelectOption>,
|
||||||
|
@ -72,16 +72,15 @@ mod tests {
|
|||||||
let field_type = FieldType::MultiSelect;
|
let field_type = FieldType::MultiSelect;
|
||||||
|
|
||||||
let france = SelectOption::new("france");
|
let france = SelectOption::new("france");
|
||||||
let france_option_id = france.id.clone();
|
|
||||||
|
|
||||||
let argentina = SelectOption::new("argentina");
|
let argentina = SelectOption::new("argentina");
|
||||||
let argentina_option_id = argentina.id.clone();
|
|
||||||
|
|
||||||
let multi_select = MultiSelectTypeOption {
|
let multi_select = MultiSelectTypeOption {
|
||||||
options: vec![france.clone(), argentina.clone()],
|
options: vec![france.clone(), argentina.clone()],
|
||||||
disable_color: false,
|
disable_color: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let france_option_id = france.id;
|
||||||
|
let argentina_option_id = argentina.id;
|
||||||
|
|
||||||
let field_rev = FieldBuilder::new(field_type.clone(), multi_select).build();
|
let field_rev = FieldBuilder::new(field_type.clone(), multi_select).build();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -55,7 +55,6 @@ impl CSVImporter {
|
|||||||
|
|
||||||
let rows = reader
|
let rows = reader
|
||||||
.records()
|
.records()
|
||||||
.into_iter()
|
|
||||||
.flat_map(|r| r.ok())
|
.flat_map(|r| r.ok())
|
||||||
.map(|record| {
|
.map(|record| {
|
||||||
record
|
record
|
||||||
|
@ -158,19 +158,14 @@ pub struct BlockEventPayloadPB {
|
|||||||
pub value: String,
|
pub value: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
|
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone, Default)]
|
||||||
pub enum ExportType {
|
pub enum ExportType {
|
||||||
|
#[default]
|
||||||
Text = 0,
|
Text = 0,
|
||||||
Markdown = 1,
|
Markdown = 1,
|
||||||
Link = 2,
|
Link = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ExportType {
|
|
||||||
fn default() -> Self {
|
|
||||||
ExportType::Text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<i32> for ExportType {
|
impl From<i32> for ExportType {
|
||||||
fn from(val: i32) -> Self {
|
fn from(val: i32) -> Self {
|
||||||
match val {
|
match val {
|
||||||
@ -203,17 +198,12 @@ pub struct ExportDataPB {
|
|||||||
#[pb(index = 2)]
|
#[pb(index = 2)]
|
||||||
pub export_type: ExportType,
|
pub export_type: ExportType,
|
||||||
}
|
}
|
||||||
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
|
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone, Default)]
|
||||||
pub enum ConvertType {
|
pub enum ConvertType {
|
||||||
|
#[default]
|
||||||
Json = 0,
|
Json = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ConvertType {
|
|
||||||
fn default() -> Self {
|
|
||||||
ConvertType::Json
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<i32> for ConvertType {
|
impl From<i32> for ConvertType {
|
||||||
fn from(val: i32) -> Self {
|
fn from(val: i32) -> Self {
|
||||||
match val {
|
match val {
|
||||||
|
@ -3,19 +3,14 @@ use flowy_notification::NotificationBuilder;
|
|||||||
|
|
||||||
const OBSERVABLE_CATEGORY: &str = "Document";
|
const OBSERVABLE_CATEGORY: &str = "Document";
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Debug)]
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
||||||
pub(crate) enum DocumentNotification {
|
pub(crate) enum DocumentNotification {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
|
|
||||||
DidReceiveUpdate = 1,
|
DidReceiveUpdate = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for DocumentNotification {
|
|
||||||
fn default() -> Self {
|
|
||||||
DocumentNotification::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<DocumentNotification> for i32 {
|
impl std::convert::From<DocumentNotification> for i32 {
|
||||||
fn from(notification: DocumentNotification) -> Self {
|
fn from(notification: DocumentNotification) -> Self {
|
||||||
notification as i32
|
notification as i32
|
||||||
|
@ -31,7 +31,7 @@ macro_rules! static_flowy_error {
|
|||||||
impl FlowyError {
|
impl FlowyError {
|
||||||
pub fn new<T: ToString>(code: ErrorCode, msg: T) -> Self {
|
pub fn new<T: ToString>(code: ErrorCode, msg: T) -> Self {
|
||||||
Self {
|
Self {
|
||||||
code: code.value() as i32,
|
code: code.value(),
|
||||||
msg: msg.to_string(),
|
msg: msg.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ impl FlowyError {
|
|||||||
impl std::convert::From<ErrorCode> for FlowyError {
|
impl std::convert::From<ErrorCode> for FlowyError {
|
||||||
fn from(code: ErrorCode) -> Self {
|
fn from(code: ErrorCode) -> Self {
|
||||||
FlowyError {
|
FlowyError {
|
||||||
code: code.value() as i32,
|
code: code.value(),
|
||||||
msg: format!("{}", code),
|
msg: format!("{}", code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ lib-infra = { path = "../../../shared-lib/lib-infra" }
|
|||||||
tokio = { version = "1.26", features = ["full"] }
|
tokio = { version = "1.26", features = ["full"] }
|
||||||
nanoid = "0.4.0"
|
nanoid = "0.4.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
chrono = { version = "0.4.24"}
|
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
|
||||||
strum = "0.21"
|
strum = "0.21"
|
||||||
strum_macros = "0.21"
|
strum_macros = "0.21"
|
||||||
protobuf = {version = "2.28.0"}
|
protobuf = {version = "2.28.0"}
|
||||||
|
@ -57,20 +57,15 @@ pub fn view_pb_with_child_views(view: View, child_views: Vec<View>) -> ViewPB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone)]
|
#[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone, Default)]
|
||||||
pub enum ViewLayoutPB {
|
pub enum ViewLayoutPB {
|
||||||
|
#[default]
|
||||||
Document = 0,
|
Document = 0,
|
||||||
Grid = 1,
|
Grid = 1,
|
||||||
Board = 2,
|
Board = 2,
|
||||||
Calendar = 3,
|
Calendar = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for ViewLayoutPB {
|
|
||||||
fn default() -> Self {
|
|
||||||
ViewLayoutPB::Document
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ViewLayoutPB {
|
impl ViewLayoutPB {
|
||||||
pub fn is_database(&self) -> bool {
|
pub fn is_database(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
|
@ -6,8 +6,9 @@ use lib_dispatch::prelude::ToBytes;
|
|||||||
|
|
||||||
const OBSERVABLE_CATEGORY: &str = "Workspace";
|
const OBSERVABLE_CATEGORY: &str = "Workspace";
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Debug)]
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
||||||
pub(crate) enum FolderNotification {
|
pub(crate) enum FolderNotification {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
/// Trigger after creating a workspace
|
/// Trigger after creating a workspace
|
||||||
DidCreateWorkspace = 1,
|
DidCreateWorkspace = 1,
|
||||||
@ -31,12 +32,6 @@ pub(crate) enum FolderNotification {
|
|||||||
DidUpdateTrash = 34,
|
DidUpdateTrash = 34,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for FolderNotification {
|
|
||||||
fn default() -> Self {
|
|
||||||
FolderNotification::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<FolderNotification> for i32 {
|
impl std::convert::From<FolderNotification> for i32 {
|
||||||
fn from(notification: FolderNotification) -> Self {
|
fn from(notification: FolderNotification) -> Self {
|
||||||
notification as i32
|
notification as i32
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq)]
|
#[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq, Default)]
|
||||||
pub enum NetworkTypePB {
|
pub enum NetworkTypePB {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Wifi = 1,
|
Wifi = 1,
|
||||||
Cell = 2,
|
Cell = 2,
|
||||||
@ -21,12 +22,6 @@ impl NetworkTypePB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for NetworkTypePB {
|
|
||||||
fn default() -> Self {
|
|
||||||
NetworkTypePB::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(ProtoBuf, Debug, Default, Clone)]
|
#[derive(ProtoBuf, Debug, Default, Clone)]
|
||||||
pub struct NetworkStatePB {
|
pub struct NetworkStatePB {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
@ -24,7 +24,7 @@ postgrest = "1.0"
|
|||||||
tokio-retry = "0.3"
|
tokio-retry = "0.3"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
uuid = { version = "1.3.3", features = ["v4"] }
|
uuid = { version = "1.3.3", features = ["v4"] }
|
||||||
chrono = "0.4.24"
|
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
|
||||||
|
|
||||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||||
flowy-user = { path = "../flowy-user" }
|
flowy-user = { path = "../flowy-user" }
|
||||||
|
@ -9,7 +9,6 @@ use std::{fmt::Debug, io, path::Path};
|
|||||||
|
|
||||||
pub use diesel::*;
|
pub use diesel::*;
|
||||||
pub use diesel_derives::*;
|
pub use diesel_derives::*;
|
||||||
use diesel_migrations::*;
|
|
||||||
|
|
||||||
use crate::sqlite::PoolConfig;
|
use crate::sqlite::PoolConfig;
|
||||||
pub use crate::sqlite::{ConnectionPool, DBConnection, Database};
|
pub use crate::sqlite::{ConnectionPool, DBConnection, Database};
|
||||||
|
@ -49,19 +49,14 @@ pub struct AppearanceSettingsPB {
|
|||||||
|
|
||||||
const DEFAULT_RESET_VALUE: fn() -> bool = || APPEARANCE_RESET_AS_DEFAULT;
|
const DEFAULT_RESET_VALUE: fn() -> bool = || APPEARANCE_RESET_AS_DEFAULT;
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug)]
|
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug, Default)]
|
||||||
pub enum ThemeModePB {
|
pub enum ThemeModePB {
|
||||||
Light = 0,
|
Light = 0,
|
||||||
Dark = 1,
|
Dark = 1,
|
||||||
|
#[default]
|
||||||
System = 2,
|
System = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for ThemeModePB {
|
|
||||||
fn default() -> Self {
|
|
||||||
ThemeModePB::System
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct LocaleSettingsPB {
|
pub struct LocaleSettingsPB {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
@ -2,19 +2,14 @@ use flowy_derive::ProtoBuf_Enum;
|
|||||||
use flowy_notification::NotificationBuilder;
|
use flowy_notification::NotificationBuilder;
|
||||||
const OBSERVABLE_CATEGORY: &str = "User";
|
const OBSERVABLE_CATEGORY: &str = "User";
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Debug)]
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
||||||
pub(crate) enum UserNotification {
|
pub(crate) enum UserNotification {
|
||||||
|
#[default]
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
DidUserSignIn = 1,
|
DidUserSignIn = 1,
|
||||||
DidUpdateUserProfile = 2,
|
DidUpdateUserProfile = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for UserNotification {
|
|
||||||
fn default() -> Self {
|
|
||||||
UserNotification::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<UserNotification> for i32 {
|
impl std::convert::From<UserNotification> for i32 {
|
||||||
fn from(notification: UserNotification) -> Self {
|
fn from(notification: UserNotification) -> Self {
|
||||||
notification as i32
|
notification as i32
|
||||||
|
@ -177,7 +177,7 @@ impl UserSession {
|
|||||||
|
|
||||||
let server = self.cloud_services.get_auth_service()?;
|
let server = self.cloud_services.get_auth_service()?;
|
||||||
let token = session.token;
|
let token = session.token;
|
||||||
let _ = tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
match server.sign_out(token).await {
|
match server.sign_out(token).await {
|
||||||
Ok(_) => {},
|
Ok(_) => {},
|
||||||
Err(e) => tracing::error!("Sign out failed: {:?}", e),
|
Err(e) => tracing::error!("Sign out failed: {:?}", e),
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.65"
|
channel = "1.70"
|
||||||
|
14
shared-lib/Cargo.lock
generated
14
shared-lib/Cargo.lock
generated
@ -164,11 +164,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"time",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1737,17 +1734,6 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.44"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.5.1"
|
version = "1.5.1"
|
||||||
|
@ -133,6 +133,8 @@ fn write_rust_crate_mod_file(crate_contexts: &[ProtobufCrateContext]) {
|
|||||||
let mut mod_file_content = String::new();
|
let mut mod_file_content = String::new();
|
||||||
|
|
||||||
mod_file_content.push_str("#![cfg_attr(rustfmt, rustfmt::skip)]\n");
|
mod_file_content.push_str("#![cfg_attr(rustfmt, rustfmt::skip)]\n");
|
||||||
|
mod_file_content.push_str(" #![allow(ambiguous_glob_reexports)]\n");
|
||||||
|
|
||||||
mod_file_content.push_str("// Auto-generated, do not edit\n");
|
mod_file_content.push_str("// Auto-generated, do not edit\n");
|
||||||
walk_dir(
|
walk_dir(
|
||||||
context.protobuf_crate.proto_output_path(),
|
context.protobuf_crate.proto_output_path(),
|
||||||
|
@ -27,6 +27,7 @@ impl ProtobufCrateContext {
|
|||||||
let mod_file_path =
|
let mod_file_path =
|
||||||
path_string_with_component(&self.protobuf_crate.protobuf_crate_path(), vec!["mod.rs"]);
|
path_string_with_component(&self.protobuf_crate.protobuf_crate_path(), vec!["mod.rs"]);
|
||||||
let mut content = "#![cfg_attr(rustfmt, rustfmt::skip)]\n".to_owned();
|
let mut content = "#![cfg_attr(rustfmt, rustfmt::skip)]\n".to_owned();
|
||||||
|
content.push_str(" #![allow(ambiguous_glob_reexports)]\n");
|
||||||
content.push_str("// Auto-generated, do not edit\n");
|
content.push_str("// Auto-generated, do not edit\n");
|
||||||
content.push_str("mod model;\npub use model::*;");
|
content.push_str("mod model;\npub use model::*;");
|
||||||
match OpenOptions::new()
|
match OpenOptions::new()
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.23"
|
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
|
||||||
bytes = { version = "1.4" }
|
bytes = { version = "1.4" }
|
||||||
pin-project = "1.0.12"
|
pin-project = "1.0.12"
|
||||||
futures-core = { version = "0.3" }
|
futures-core = { version = "0.3" }
|
||||||
|
@ -44,9 +44,7 @@ impl<T, E> FutureResult<T, E> {
|
|||||||
where
|
where
|
||||||
F: Future<Output = Result<T, E>> + Send + Sync + 'static,
|
F: Future<Output = Result<T, E>> + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
Self {
|
Self { fut: Box::pin(f) }
|
||||||
fut: Box::pin(async { f.await }),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ impl<'de> Deserialize<'de> for AttributeValue {
|
|||||||
where
|
where
|
||||||
E: de::Error,
|
E: de::Error,
|
||||||
{
|
{
|
||||||
Ok(AttributeValue::from_int(value as i64))
|
Ok(AttributeValue::from_int(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_u8<E>(self, value: u8) -> Result<Self::Value, E>
|
fn visit_u8<E>(self, value: u8) -> Result<Self::Value, E>
|
||||||
@ -133,7 +133,7 @@ impl<'de> Deserialize<'de> for AttributeValue {
|
|||||||
where
|
where
|
||||||
E: de::Error,
|
E: de::Error,
|
||||||
{
|
{
|
||||||
Ok(AttributeValue::from_float(value as f64))
|
Ok(AttributeValue::from_float(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||||
|
@ -245,7 +245,7 @@ fn check_bound(current: usize, target: usize) -> Result<(), OTError> {
|
|||||||
let msg = format!("{} should be greater than current: {}", target, current);
|
let msg = format!("{} should be greater than current: {}", target, current);
|
||||||
return Err(
|
return Err(
|
||||||
ErrorBuilder::new(OTErrorCode::IncompatibleLength)
|
ErrorBuilder::new(OTErrorCode::IncompatibleLength)
|
||||||
.msg(&msg)
|
.msg(msg)
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ where
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.utf16_base_len += n as usize;
|
self.utf16_base_len += n;
|
||||||
if let Some(DeltaOperation::Delete(n_last)) = self.ops.last_mut() {
|
if let Some(DeltaOperation::Delete(n_last)) = self.ops.last_mut() {
|
||||||
*n_last += n;
|
*n_last += n;
|
||||||
} else {
|
} else {
|
||||||
@ -156,8 +156,8 @@ where
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.utf16_base_len += n as usize;
|
self.utf16_base_len += n;
|
||||||
self.utf16_target_len += n as usize;
|
self.utf16_target_len += n;
|
||||||
|
|
||||||
if let Some(DeltaOperation::<T>::Retain(retain)) = self.ops.last_mut() {
|
if let Some(DeltaOperation::<T>::Retain(retain)) = self.ops.last_mut() {
|
||||||
if let Some(new_op) = retain.merge_or_new(n, attributes) {
|
if let Some(new_op) = retain.merge_or_new(n, attributes) {
|
||||||
@ -212,7 +212,7 @@ where
|
|||||||
for op in &self.ops {
|
for op in &self.ops {
|
||||||
match &op {
|
match &op {
|
||||||
DeltaOperation::Retain(retain) => {
|
DeltaOperation::Retain(retain) => {
|
||||||
for c in code_point_iter.take(retain.n as usize) {
|
for c in code_point_iter.take(retain.n) {
|
||||||
new_s.push_str(str::from_utf8(c.0).unwrap_or(""));
|
new_s.push_str(str::from_utf8(c.0).unwrap_or(""));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -274,8 +274,7 @@ where
|
|||||||
},
|
},
|
||||||
DeltaOperation::Delete(delete) => {
|
DeltaOperation::Delete(delete) => {
|
||||||
let bytes = code_point_iter
|
let bytes = code_point_iter
|
||||||
.take(*delete as usize)
|
.take(*delete)
|
||||||
.into_iter()
|
|
||||||
.flat_map(|a| str::from_utf8(a.0).ok())
|
.flat_map(|a| str::from_utf8(a.0).ok())
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
|
|
||||||
@ -500,7 +499,7 @@ where
|
|||||||
let mut inverted = DeltaOperations::default();
|
let mut inverted = DeltaOperations::default();
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
for op in &self.ops {
|
for op in &self.ops {
|
||||||
let len: usize = op.len() as usize;
|
let len: usize = op.len();
|
||||||
match op {
|
match op {
|
||||||
DeltaOperation::Delete(n) => {
|
DeltaOperation::Delete(n) => {
|
||||||
invert_other(&mut inverted, other, op, index, index + *n);
|
invert_other(&mut inverted, other, op, index, index + *n);
|
||||||
@ -512,14 +511,14 @@ where
|
|||||||
false => {
|
false => {
|
||||||
// tracing::trace!("invert retain: {} by retain {} {}", op, len,
|
// tracing::trace!("invert retain: {} by retain {} {}", op, len,
|
||||||
// op.get_attributes());
|
// op.get_attributes());
|
||||||
inverted.retain(len as usize, op.get_attributes())
|
inverted.retain(len, op.get_attributes())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
index += len;
|
index += len;
|
||||||
},
|
},
|
||||||
DeltaOperation::Insert(_) => {
|
DeltaOperation::Insert(_) => {
|
||||||
// tracing::trace!("invert insert: {} by delete {}", op, len);
|
// tracing::trace!("invert insert: {} by delete {}", op, len);
|
||||||
inverted.delete(len as usize);
|
inverted.delete(len);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,18 +120,13 @@ impl NodeDataBuilder {
|
|||||||
/// The NodeBody implements the [`OperationTransform`] trait which means it can perform
|
/// The NodeBody implements the [`OperationTransform`] trait which means it can perform
|
||||||
/// compose, transform and invert.
|
/// compose, transform and invert.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub enum Body {
|
pub enum Body {
|
||||||
|
#[default]
|
||||||
Empty,
|
Empty,
|
||||||
Delta(DeltaTextOperations),
|
Delta(DeltaTextOperations),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for Body {
|
|
||||||
fn default() -> Self {
|
|
||||||
Body::Empty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
matches!(self, Body::Empty)
|
matches!(self, Body::Empty)
|
||||||
|
@ -94,8 +94,9 @@ impl Transaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
pub enum Extension {
|
pub enum Extension {
|
||||||
|
#[default]
|
||||||
Empty,
|
Empty,
|
||||||
TextSelection {
|
TextSelection {
|
||||||
before_selection: Selection,
|
before_selection: Selection,
|
||||||
@ -103,12 +104,6 @@ pub enum Extension {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for Extension {
|
|
||||||
fn default() -> Self {
|
|
||||||
Extension::Empty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Extension {
|
impl Extension {
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
matches!(self, Extension::Empty)
|
matches!(self, Extension::Empty)
|
||||||
|
@ -53,18 +53,14 @@ where
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize_repr, Deserialize_repr, Display, PartialEq, Eq)]
|
#[derive(Debug, Clone, Serialize_repr, Deserialize_repr, Display, PartialEq, Eq)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum ErrorCode {
|
pub enum ErrorCode {
|
||||||
|
#[default]
|
||||||
InternalError = 0,
|
InternalError = 0,
|
||||||
UnsupportedMessage = 1,
|
UnsupportedMessage = 1,
|
||||||
Unauthorized = 2,
|
Unauthorized = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for ErrorCode {
|
|
||||||
fn default() -> Self {
|
|
||||||
ErrorCode::InternalError
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::From<url::ParseError> for WSError {
|
impl std::convert::From<url::ParseError> for WSError {
|
||||||
fn from(error: ParseError) -> Self {
|
fn from(error: ParseError) -> Self {
|
||||||
WSError::internal().context(error)
|
WSError::internal().context(error)
|
||||||
|
@ -21,18 +21,14 @@ impl WebSocketRawMessage {
|
|||||||
// The lib-ws crate should not contain business logic.So WSChannel should be removed into another place.
|
// The lib-ws crate should not contain business logic.So WSChannel should be removed into another place.
|
||||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum WSChannel {
|
pub enum WSChannel {
|
||||||
|
#[default]
|
||||||
Document = 0,
|
Document = 0,
|
||||||
Folder = 1,
|
Folder = 1,
|
||||||
Database = 2,
|
Database = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for WSChannel {
|
|
||||||
fn default() -> Self {
|
|
||||||
WSChannel::Document
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToString for WSChannel {
|
impl ToString for WSChannel {
|
||||||
fn to_string(&self) -> String {
|
fn to_string(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.65"
|
channel = "1.70"
|
||||||
|
Reference in New Issue
Block a user