chore: Merge branch 'release/0.0.4'

This commit is contained in:
appflowy 2022-04-08 20:22:40 +08:00
commit 4f2c733746
15 changed files with 206 additions and 61 deletions

View File

@ -66,7 +66,7 @@ jobs:
working-directory: frontend
run: |
flutter config --enable-linux-desktop
cargo make --profile production-linux-x86 appflowy
cargo make --env APP_VERSION=${{ github.ref_name }} --profile production-linux-x86 appflowy
- name: Upload Release Asset
id: upload-release-asset
@ -111,7 +111,7 @@ jobs:
working-directory: frontend
run: |
flutter config --enable-macos-desktop
cargo make --profile production-mac-x86 appflowy
cargo make --env APP_VERSION=${{ github.ref_name }} --profile production-mac-x86 appflowy
- name: Archive macOS app
working-directory: ${{ env.MACOS_APP_RELEASE_PATH }}

View File

@ -21,7 +21,7 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi"
LIB_NAME = "dart_ffi"
VERSION = "0.0.3"
CURRENT_APP_VERSION = "0.0.4"
FEATURES = "flutter"
PRODUCT_NAME = "AppFlowy"
#CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html

View File

@ -32,7 +32,7 @@ class SelectOptionService {
);
}
Future<Either<Unit, FlowyError>> insert({
Future<Either<Unit, FlowyError>> update({
required String gridId,
required String fieldId,
required String rowId,
@ -43,7 +43,7 @@ class SelectOptionService {
..fieldId = fieldId
..rowId = rowId;
final payload = SelectOptionChangesetPayload.create()
..insertOption = option
..updateOption = option
..cellIdentifier = cellIdentifier;
return GridEventApplySelectOptionChangeset(payload).send();
}

View File

@ -88,7 +88,7 @@ class SelectOptionEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOptionE
}
void _updateOption(SelectOption option) async {
final result = await _selectOptionService.insert(
final result = await _selectOptionService.update(
gridId: state.gridId,
fieldId: state.field.id,
rowId: state.rowId,

View File

@ -16,12 +16,12 @@ part 'grid_bloc.freezed.dart';
class GridBloc extends Bloc<GridEvent, GridState> {
final View view;
final GridService service;
late GridFieldsListener _fieldListener;
late GridBlockService _blockService;
GridBloc({required this.view, required this.service}) : super(GridState.initial()) {
_fieldListener = GridFieldsListener(gridId: view.id);
final GridFieldsListener _fieldListener;
GridBlockService? _blockService;
GridBloc({required this.view, required this.service})
: _fieldListener = GridFieldsListener(gridId: view.id),
super(GridState.initial()) {
on<GridEvent>(
(event, emit) async {
await event.map(
@ -48,7 +48,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
@override
Future<void> close() async {
await _fieldListener.stop();
await _blockService.stop();
await _blockService?.stop();
return super.close();
}
@ -70,7 +70,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
blockOrders: grid.blockOrders,
);
_blockService.blocksUpdateNotifier?.addPublishListener((result) {
_blockService?.blocksUpdateNotifier?.addPublishListener((result) {
result.fold(
(blockMap) => add(GridEvent.didReceiveRowUpdate(_buildRows(blockMap))),
(err) => Log.error('$err'),

View File

@ -157,7 +157,8 @@ class SelectOptionTextField extends StatelessWidget {
class SelectOptionTag extends StatelessWidget {
final SelectOption option;
const SelectOptionTag({required this.option, Key? key}) : super(key: key);
final bool isSelected;
const SelectOptionTag({required this.option, this.isSelected = false, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -18,6 +18,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:textfield_tags/textfield_tags.dart';
import 'extension.dart';
@ -196,7 +197,7 @@ class _SelectOptionCell extends StatelessWidget {
config: HoverDisplayConfig(hoverColor: theme.hover),
builder: (_, onHover) {
List<Widget> children = [
SelectOptionTag(option: option),
SelectOptionTag(option: option, isSelected: isSelected),
const Spacer(),
];
@ -206,7 +207,7 @@ class _SelectOptionCell extends StatelessWidget {
if (onHover) {
children.add(FlowyIconButton(
width: 28,
width: 30,
onPressed: () => _showEditOptionPannel(context),
iconPadding: const EdgeInsets.fromLTRB(4, 4, 4, 4),
icon: svgWidget("editor/details", color: theme.iconColor),

View File

@ -205,6 +205,11 @@ enum SelectOptionChangesetPayload_OneOfInsertOption {
notSet
}
enum SelectOptionChangesetPayload_OneOfUpdateOption {
updateOption,
notSet
}
enum SelectOptionChangesetPayload_OneOfDeleteOption {
deleteOption,
notSet
@ -215,16 +220,22 @@ class SelectOptionChangesetPayload extends $pb.GeneratedMessage {
2 : SelectOptionChangesetPayload_OneOfInsertOption.insertOption,
0 : SelectOptionChangesetPayload_OneOfInsertOption.notSet
};
static const $core.Map<$core.int, SelectOptionChangesetPayload_OneOfUpdateOption> _SelectOptionChangesetPayload_OneOfUpdateOptionByTag = {
3 : SelectOptionChangesetPayload_OneOfUpdateOption.updateOption,
0 : SelectOptionChangesetPayload_OneOfUpdateOption.notSet
};
static const $core.Map<$core.int, SelectOptionChangesetPayload_OneOfDeleteOption> _SelectOptionChangesetPayload_OneOfDeleteOptionByTag = {
3 : SelectOptionChangesetPayload_OneOfDeleteOption.deleteOption,
4 : SelectOptionChangesetPayload_OneOfDeleteOption.deleteOption,
0 : SelectOptionChangesetPayload_OneOfDeleteOption.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SelectOptionChangesetPayload', createEmptyInstance: create)
..oo(0, [2])
..oo(1, [3])
..oo(2, [4])
..aOM<$0.CellIdentifierPayload>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellIdentifier', subBuilder: $0.CellIdentifierPayload.create)
..aOM<SelectOption>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertOption', subBuilder: SelectOption.create)
..aOM<SelectOption>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deleteOption', subBuilder: SelectOption.create)
..aOM<SelectOption>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'updateOption', subBuilder: SelectOption.create)
..aOM<SelectOption>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deleteOption', subBuilder: SelectOption.create)
..hasRequiredFields = false
;
@ -232,6 +243,7 @@ class SelectOptionChangesetPayload extends $pb.GeneratedMessage {
factory SelectOptionChangesetPayload({
$0.CellIdentifierPayload? cellIdentifier,
SelectOption? insertOption,
SelectOption? updateOption,
SelectOption? deleteOption,
}) {
final _result = create();
@ -241,6 +253,9 @@ class SelectOptionChangesetPayload extends $pb.GeneratedMessage {
if (insertOption != null) {
_result.insertOption = insertOption;
}
if (updateOption != null) {
_result.updateOption = updateOption;
}
if (deleteOption != null) {
_result.deleteOption = deleteOption;
}
@ -270,8 +285,11 @@ class SelectOptionChangesetPayload extends $pb.GeneratedMessage {
SelectOptionChangesetPayload_OneOfInsertOption whichOneOfInsertOption() => _SelectOptionChangesetPayload_OneOfInsertOptionByTag[$_whichOneof(0)]!;
void clearOneOfInsertOption() => clearField($_whichOneof(0));
SelectOptionChangesetPayload_OneOfDeleteOption whichOneOfDeleteOption() => _SelectOptionChangesetPayload_OneOfDeleteOptionByTag[$_whichOneof(1)]!;
void clearOneOfDeleteOption() => clearField($_whichOneof(1));
SelectOptionChangesetPayload_OneOfUpdateOption whichOneOfUpdateOption() => _SelectOptionChangesetPayload_OneOfUpdateOptionByTag[$_whichOneof(1)]!;
void clearOneOfUpdateOption() => clearField($_whichOneof(1));
SelectOptionChangesetPayload_OneOfDeleteOption whichOneOfDeleteOption() => _SelectOptionChangesetPayload_OneOfDeleteOptionByTag[$_whichOneof(2)]!;
void clearOneOfDeleteOption() => clearField($_whichOneof(2));
@$pb.TagNumber(1)
$0.CellIdentifierPayload get cellIdentifier => $_getN(0);
@ -296,15 +314,26 @@ class SelectOptionChangesetPayload extends $pb.GeneratedMessage {
SelectOption ensureInsertOption() => $_ensure(1);
@$pb.TagNumber(3)
SelectOption get deleteOption => $_getN(2);
SelectOption get updateOption => $_getN(2);
@$pb.TagNumber(3)
set deleteOption(SelectOption v) { setField(3, v); }
set updateOption(SelectOption v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasDeleteOption() => $_has(2);
$core.bool hasUpdateOption() => $_has(2);
@$pb.TagNumber(3)
void clearDeleteOption() => clearField(3);
void clearUpdateOption() => clearField(3);
@$pb.TagNumber(3)
SelectOption ensureDeleteOption() => $_ensure(2);
SelectOption ensureUpdateOption() => $_ensure(2);
@$pb.TagNumber(4)
SelectOption get deleteOption => $_getN(3);
@$pb.TagNumber(4)
set deleteOption(SelectOption v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasDeleteOption() => $_has(3);
@$pb.TagNumber(4)
void clearDeleteOption() => clearField(4);
@$pb.TagNumber(4)
SelectOption ensureDeleteOption() => $_ensure(3);
}
enum SelectOptionCellChangesetPayload_OneOfInsertOptionId {

View File

@ -66,16 +66,18 @@ const SelectOptionChangesetPayload$json = const {
'2': const [
const {'1': 'cell_identifier', '3': 1, '4': 1, '5': 11, '6': '.CellIdentifierPayload', '10': 'cellIdentifier'},
const {'1': 'insert_option', '3': 2, '4': 1, '5': 11, '6': '.SelectOption', '9': 0, '10': 'insertOption'},
const {'1': 'delete_option', '3': 3, '4': 1, '5': 11, '6': '.SelectOption', '9': 1, '10': 'deleteOption'},
const {'1': 'update_option', '3': 3, '4': 1, '5': 11, '6': '.SelectOption', '9': 1, '10': 'updateOption'},
const {'1': 'delete_option', '3': 4, '4': 1, '5': 11, '6': '.SelectOption', '9': 2, '10': 'deleteOption'},
],
'8': const [
const {'1': 'one_of_insert_option'},
const {'1': 'one_of_update_option'},
const {'1': 'one_of_delete_option'},
],
};
/// Descriptor for `SelectOptionChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List selectOptionChangesetPayloadDescriptor = $convert.base64Decode('ChxTZWxlY3RPcHRpb25DaGFuZ2VzZXRQYXlsb2FkEj8KD2NlbGxfaWRlbnRpZmllchgBIAEoCzIWLkNlbGxJZGVudGlmaWVyUGF5bG9hZFIOY2VsbElkZW50aWZpZXISNAoNaW5zZXJ0X29wdGlvbhgCIAEoCzINLlNlbGVjdE9wdGlvbkgAUgxpbnNlcnRPcHRpb24SNAoNZGVsZXRlX29wdGlvbhgDIAEoCzINLlNlbGVjdE9wdGlvbkgBUgxkZWxldGVPcHRpb25CFgoUb25lX29mX2luc2VydF9vcHRpb25CFgoUb25lX29mX2RlbGV0ZV9vcHRpb24=');
final $typed_data.Uint8List selectOptionChangesetPayloadDescriptor = $convert.base64Decode('ChxTZWxlY3RPcHRpb25DaGFuZ2VzZXRQYXlsb2FkEj8KD2NlbGxfaWRlbnRpZmllchgBIAEoCzIWLkNlbGxJZGVudGlmaWVyUGF5bG9hZFIOY2VsbElkZW50aWZpZXISNAoNaW5zZXJ0X29wdGlvbhgCIAEoCzINLlNlbGVjdE9wdGlvbkgAUgxpbnNlcnRPcHRpb24SNAoNdXBkYXRlX29wdGlvbhgDIAEoCzINLlNlbGVjdE9wdGlvbkgBUgx1cGRhdGVPcHRpb24SNAoNZGVsZXRlX29wdGlvbhgEIAEoCzINLlNlbGVjdE9wdGlvbkgCUgxkZWxldGVPcHRpb25CFgoUb25lX29mX2luc2VydF9vcHRpb25CFgoUb25lX29mX3VwZGF0ZV9vcHRpb25CFgoUb25lX29mX2RlbGV0ZV9vcHRpb24=');
@$core.Deprecated('Use selectOptionCellChangesetPayloadDescriptor instead')
const SelectOptionCellChangesetPayload$json = const {
'1': 'SelectOptionCellChangesetPayload',

View File

@ -231,11 +231,16 @@ pub(crate) async fn select_option_changeset_handler(
if let Some(mut field_meta) = editor.get_field_meta(&changeset.cell_identifier.field_id).await {
let mut type_option = select_option_operation(&field_meta)?;
let mut cell_data = None;
if let Some(option) = changeset.insert_option {
cell_data = Some(SelectOptionCellChangeset::from_insert(&option.id).cell_data());
type_option.insert_option(option);
}
if let Some(option) = changeset.update_option {
type_option.insert_option(option);
}
if let Some(option) = changeset.delete_option {
cell_data = Some(SelectOptionCellChangeset::from_delete(&option.id).cell_data());
type_option.delete_option(option);

View File

@ -663,6 +663,7 @@ pub struct SelectOptionChangesetPayload {
pub cell_identifier: ::protobuf::SingularPtrField<super::cell_entities::CellIdentifierPayload>,
// message oneof groups
pub one_of_insert_option: ::std::option::Option<SelectOptionChangesetPayload_oneof_one_of_insert_option>,
pub one_of_update_option: ::std::option::Option<SelectOptionChangesetPayload_oneof_one_of_update_option>,
pub one_of_delete_option: ::std::option::Option<SelectOptionChangesetPayload_oneof_one_of_delete_option>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
@ -680,6 +681,11 @@ pub enum SelectOptionChangesetPayload_oneof_one_of_insert_option {
insert_option(SelectOption),
}
#[derive(Clone,PartialEq,Debug)]
pub enum SelectOptionChangesetPayload_oneof_one_of_update_option {
update_option(SelectOption),
}
#[derive(Clone,PartialEq,Debug)]
pub enum SelectOptionChangesetPayload_oneof_one_of_delete_option {
delete_option(SelectOption),
@ -772,7 +778,56 @@ impl SelectOptionChangesetPayload {
}
}
// .SelectOption delete_option = 3;
// .SelectOption update_option = 3;
pub fn get_update_option(&self) -> &SelectOption {
match self.one_of_update_option {
::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(ref v)) => v,
_ => <SelectOption as ::protobuf::Message>::default_instance(),
}
}
pub fn clear_update_option(&mut self) {
self.one_of_update_option = ::std::option::Option::None;
}
pub fn has_update_option(&self) -> bool {
match self.one_of_update_option {
::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(..)) => true,
_ => false,
}
}
// Param is passed by value, moved
pub fn set_update_option(&mut self, v: SelectOption) {
self.one_of_update_option = ::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(v))
}
// Mutable pointer to the field.
pub fn mut_update_option(&mut self) -> &mut SelectOption {
if let ::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(_)) = self.one_of_update_option {
} else {
self.one_of_update_option = ::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(SelectOption::new()));
}
match self.one_of_update_option {
::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(ref mut v)) => v,
_ => panic!(),
}
}
// Take field
pub fn take_update_option(&mut self) -> SelectOption {
if self.has_update_option() {
match self.one_of_update_option.take() {
::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(v)) => v,
_ => panic!(),
}
} else {
SelectOption::new()
}
}
// .SelectOption delete_option = 4;
pub fn get_delete_option(&self) -> &SelectOption {
@ -834,6 +889,11 @@ impl ::protobuf::Message for SelectOptionChangesetPayload {
return false;
}
}
if let Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(ref v)) = self.one_of_update_option {
if !v.is_initialized() {
return false;
}
}
if let Some(SelectOptionChangesetPayload_oneof_one_of_delete_option::delete_option(ref v)) = self.one_of_delete_option {
if !v.is_initialized() {
return false;
@ -856,6 +916,12 @@ impl ::protobuf::Message for SelectOptionChangesetPayload {
self.one_of_insert_option = ::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_insert_option::insert_option(is.read_message()?));
},
3 => {
if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
self.one_of_update_option = ::std::option::Option::Some(SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(is.read_message()?));
},
4 => {
if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
@ -885,6 +951,14 @@ impl ::protobuf::Message for SelectOptionChangesetPayload {
},
};
}
if let ::std::option::Option::Some(ref v) = self.one_of_update_option {
match v {
&SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(ref v) => {
let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
},
};
}
if let ::std::option::Option::Some(ref v) = self.one_of_delete_option {
match v {
&SelectOptionChangesetPayload_oneof_one_of_delete_option::delete_option(ref v) => {
@ -913,10 +987,19 @@ impl ::protobuf::Message for SelectOptionChangesetPayload {
},
};
}
if let ::std::option::Option::Some(ref v) = self.one_of_update_option {
match v {
&SelectOptionChangesetPayload_oneof_one_of_update_option::update_option(ref v) => {
os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
},
};
}
if let ::std::option::Option::Some(ref v) = self.one_of_delete_option {
match v {
&SelectOptionChangesetPayload_oneof_one_of_delete_option::delete_option(ref v) => {
os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
},
@ -970,6 +1053,11 @@ impl ::protobuf::Message for SelectOptionChangesetPayload {
SelectOptionChangesetPayload::has_insert_option,
SelectOptionChangesetPayload::get_insert_option,
));
fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, SelectOption>(
"update_option",
SelectOptionChangesetPayload::has_update_option,
SelectOptionChangesetPayload::get_update_option,
));
fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, SelectOption>(
"delete_option",
SelectOptionChangesetPayload::has_delete_option,
@ -993,6 +1081,7 @@ impl ::protobuf::Clear for SelectOptionChangesetPayload {
fn clear(&mut self) {
self.cell_identifier.clear();
self.one_of_insert_option = ::std::option::Option::None;
self.one_of_update_option = ::std::option::Option::None;
self.one_of_delete_option = ::std::option::Option::None;
self.unknown_fields.clear();
}
@ -1710,24 +1799,26 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\r.SelectOptionR\x07options\x12#\n\rdisable_color\x18\x02\x20\x01(\x08R\
\x0cdisableColor\"\\\n\x0cSelectOption\x12\x0e\n\x02id\x18\x01\x20\x01(\
\tR\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12(\n\x05color\
\x18\x03\x20\x01(\x0e2\x12.SelectOptionColorR\x05color\"\xfb\x01\n\x1cSe\
\x18\x03\x20\x01(\x0e2\x12.SelectOptionColorR\x05color\"\xc9\x02\n\x1cSe\
lectOptionChangesetPayload\x12?\n\x0fcell_identifier\x18\x01\x20\x01(\
\x0b2\x16.CellIdentifierPayloadR\x0ecellIdentifier\x124\n\rinsert_option\
\x18\x02\x20\x01(\x0b2\r.SelectOptionH\0R\x0cinsertOption\x124\n\rdelete\
_option\x18\x03\x20\x01(\x0b2\r.SelectOptionH\x01R\x0cdeleteOptionB\x16\
\n\x14one_of_insert_optionB\x16\n\x14one_of_delete_option\"\xfb\x01\n\
\x20SelectOptionCellChangesetPayload\x12\x17\n\x07grid_id\x18\x01\x20\
\x01(\tR\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\
\x19\n\x08field_id\x18\x03\x20\x01(\tR\x07fieldId\x12*\n\x10insert_optio\
n_id\x18\x04\x20\x01(\tH\0R\x0einsertOptionId\x12*\n\x10delete_option_id\
\x18\x05\x20\x01(\tH\x01R\x0edeleteOptionIdB\x19\n\x17one_of_insert_opti\
on_idB\x19\n\x17one_of_delete_option_id\"t\n\x13SelectOptionContext\x12'\
\n\x07options\x18\x01\x20\x03(\x0b2\r.SelectOptionR\x07options\x124\n\
\x0eselect_options\x18\x02\x20\x03(\x0b2\r.SelectOptionR\rselectOptions*\
y\n\x11SelectOptionColor\x12\n\n\x06Purple\x10\0\x12\x08\n\x04Pink\x10\
\x01\x12\r\n\tLightPink\x10\x02\x12\n\n\x06Orange\x10\x03\x12\n\n\x06Yel\
low\x10\x04\x12\x08\n\x04Lime\x10\x05\x12\t\n\x05Green\x10\x06\x12\x08\n\
\x04Aqua\x10\x07\x12\x08\n\x04Blue\x10\x08b\x06proto3\
\x18\x02\x20\x01(\x0b2\r.SelectOptionH\0R\x0cinsertOption\x124\n\rupdate\
_option\x18\x03\x20\x01(\x0b2\r.SelectOptionH\x01R\x0cupdateOption\x124\
\n\rdelete_option\x18\x04\x20\x01(\x0b2\r.SelectOptionH\x02R\x0cdeleteOp\
tionB\x16\n\x14one_of_insert_optionB\x16\n\x14one_of_update_optionB\x16\
\n\x14one_of_delete_option\"\xfb\x01\n\x20SelectOptionCellChangesetPaylo\
ad\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_i\
d\x18\x02\x20\x01(\tR\x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\
\x07fieldId\x12*\n\x10insert_option_id\x18\x04\x20\x01(\tH\0R\x0einsertO\
ptionId\x12*\n\x10delete_option_id\x18\x05\x20\x01(\tH\x01R\x0edeleteOpt\
ionIdB\x19\n\x17one_of_insert_option_idB\x19\n\x17one_of_delete_option_i\
d\"t\n\x13SelectOptionContext\x12'\n\x07options\x18\x01\x20\x03(\x0b2\r.\
SelectOptionR\x07options\x124\n\x0eselect_options\x18\x02\x20\x03(\x0b2\
\r.SelectOptionR\rselectOptions*y\n\x11SelectOptionColor\x12\n\n\x06Purp\
le\x10\0\x12\x08\n\x04Pink\x10\x01\x12\r\n\tLightPink\x10\x02\x12\n\n\
\x06Orange\x10\x03\x12\n\n\x06Yellow\x10\x04\x12\x08\n\x04Lime\x10\x05\
\x12\t\n\x05Green\x10\x06\x12\x08\n\x04Aqua\x10\x07\x12\x08\n\x04Blue\
\x10\x08b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -17,7 +17,8 @@ message SelectOption {
message SelectOptionChangesetPayload {
CellIdentifierPayload cell_identifier = 1;
oneof one_of_insert_option { SelectOption insert_option = 2; };
oneof one_of_delete_option { SelectOption delete_option = 3; };
oneof one_of_update_option { SelectOption update_option = 3; };
oneof one_of_delete_option { SelectOption delete_option = 4; };
}
message SelectOptionCellChangesetPayload {
string grid_id = 1;

View File

@ -279,12 +279,16 @@ pub struct SelectOptionChangesetPayload {
pub insert_option: Option<SelectOption>,
#[pb(index = 3, one_of)]
pub update_option: Option<SelectOption>,
#[pb(index = 4, one_of)]
pub delete_option: Option<SelectOption>,
}
pub struct SelectOptionChangeset {
pub cell_identifier: CellIdentifier,
pub insert_option: Option<SelectOption>,
pub update_option: Option<SelectOption>,
pub delete_option: Option<SelectOption>,
}
@ -296,6 +300,7 @@ impl TryInto<SelectOptionChangeset> for SelectOptionChangesetPayload {
Ok(SelectOptionChangeset {
cell_identifier,
insert_option: self.insert_option,
update_option: self.update_option,
delete_option: self.delete_option,
})
}
@ -324,6 +329,7 @@ pub struct SelectOptionCellChangesetParams {
pub field_id: String,
pub row_id: String,
pub insert_option_id: Option<String>,
pub delete_option_id: Option<String>,
}

View File

@ -365,11 +365,8 @@ impl ClientGridEditor {
F: for<'a> FnOnce(&'a mut GridMetaPad) -> FlowyResult<Option<GridChangeset>>,
{
let mut write_guard = self.pad.write().await;
match f(&mut *write_guard)? {
None => {}
Some(change) => {
let _ = self.apply_change(change).await?;
}
if let Some(changeset) = f(&mut *write_guard)? {
let _ = self.apply_change(changeset).await?;
}
Ok(())
}

View File

@ -5,16 +5,16 @@ linux_alias = "appflowy-linux"
[tasks.appflowy-macos]
dependencies = ["flowy-sdk-release"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
script_runner = "@shell"
[tasks.appflowy-windows]
dependencies = ["flowy-sdk-release"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
[tasks.appflowy-linux]
dependencies = ["flowy-sdk-release"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product", "create-release-archive"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product", "create-release-archive"] }
script_runner = "@shell"
[tasks.appflowy-dev]
@ -24,16 +24,16 @@ linux_alias = "appflowy-linux-dev"
[tasks.appflowy-macos-dev]
dependencies = ["flowy-sdk-dev"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
script_runner = "@shell"
[tasks.appflowy-windows-dev]
dependencies = ["flowy-sdk-dev"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
[tasks.appflowy-linux-dev]
dependencies = ["flowy-sdk-dev"]
run_task = { name = ["code_generation", "flutter-build", "copy-to-product"] }
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
script_runner = "@shell"
[tasks.copy-to-product]
@ -44,7 +44,7 @@ linux_alias = "copy-to-product-linux"
[tasks.copy-to-product-macos]
script = [
"""
product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}
product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${APP_VERSION}
output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
if [ -d "${output_path}" ]; then
rm -rf ${output_path}/
@ -61,7 +61,7 @@ script_runner = "@shell"
[tasks.copy-to-product-linux]
script = [
"""
product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}
product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${APP_VERSION}
output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
if [ -d "${output_path}" ]; then
rm -rf ${output_path}/
@ -81,7 +81,7 @@ script_runner = "@shell"
[tasks.copy-to-product-windows]
script = [
"""
product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}
product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${APP_VERSION}
output_path= set ${product_path}/${TARGET_OS}
if is_path_exists ${output_path}
rm -r ${output_path}/
@ -95,6 +95,18 @@ script = [
]
script_runner = "@duckscript"
[tasks.set-app-version]
script = [
"""
if is_empty ${APP_VERSION}
APP_VERSION = set ${CURRENT_APP_VERSION}
set_env APP_VERSION ${CURRENT_APP_VERSION}
end
echo APP_VERSION: ${APP_VERSION}
""",
]
script_runner = "@duckscript"
# The following tasks will create an archive that will be used on the GitHub Releases section
# The archives are created using different compression programs depending on the target OS
# The archive will be composed of all files that are located in the /Release/AppFlowy directory
@ -129,7 +141,7 @@ script = [
cd app_flowy/
flutter clean
flutter pub get
flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${VERSION}
flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
""",
]
script_runner = "@shell"