feat: reminder on date (#4288)

* feat: support reminder on date

* feat: support reminder on date in database

* fix: include time static

* fix: do not force unwrap

* chore: clean flutter code

* test: add test for reminder in database

* fix: interpret reminder option

* feat: date and reminder on mobile

* feat: improve notification actions and support open row

* feat: support dates in document

* fix: minor changes + review

* feat: support reminder on mobile in document

* feat: support open row on database reminder mobile

* test: add more tests

* fix: first part of review

* fix: open row responsibility

* fix: abstract application logic from presentation layer

* fix: update reminder on date cell update

* test: fix failing test

* fix: show correct selected day after end date toggled
This commit is contained in:
Mathias Mogensen 2024-01-24 15:15:57 +01:00 committed by GitHub
parent 8105da1c2b
commit baa7c8d826
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 2556 additions and 1315 deletions

View file

@ -1,3 +1,5 @@
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/application/doc_bloc.dart';
import 'package:appflowy/plugins/document/presentation/banner.dart';
@ -13,7 +15,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_editor/appflowy_editor.dart' hide Log;
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/widget/error_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
enum EditorNotificationType {
@ -35,12 +36,14 @@ class EditorNotification extends Notification {
class DocumentPage extends StatefulWidget {
const DocumentPage({
super.key,
required this.onDeleted,
required this.view,
required this.onDeleted,
this.initialSelection,
});
final VoidCallback onDeleted;
final ViewPB view;
final VoidCallback onDeleted;
final Selection? initialSelection;
@override
State<DocumentPage> createState() => _DocumentPageState();
@ -88,10 +91,8 @@ class _DocumentPageState extends State<DocumentPage> {
return BlocListener<NotificationActionBloc, NotificationActionState>(
listener: _onNotificationAction,
child: _buildEditorPage(
context,
state,
),
listenWhen: (_, curr) => curr.action != null,
child: _buildEditorPage(context, state),
);
},
),
@ -107,6 +108,7 @@ class _DocumentPageState extends State<DocumentPage> {
padding: EditorStyleCustomizer.documentPadding,
),
header: _buildCoverAndIcon(context, state.editorState!),
initialSelection: widget.initialSelection,
);
return Column(
@ -167,14 +169,12 @@ class _DocumentPageState extends State<DocumentPage> {
NotificationActionState state,
) async {
if (state.action != null && state.action!.type == ActionType.jumpToBlock) {
final path = state.action?.arguments?[ActionArgumentKeys.nodePath.name];
final path = state.action?.arguments?[ActionArgumentKeys.nodePath];
final editorState = context.read<DocumentBloc>().state.editorState;
if (editorState != null && widget.view.id == state.action?.objectId) {
editorState.updateSelectionWithReason(
Selection.collapsed(
Position(path: [path]),
),
Selection.collapsed(Position(path: [path])),
reason: SelectionUpdateReason.transaction,
);
}