From 8105da1c2bce1c858cf2e20d5217edda83f8ad47 Mon Sep 17 00:00:00 2001 From: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:07:02 +0100 Subject: [PATCH] Fix: mobile improvements (#4480) * fix: copy on notifications screen is caught off * fix: mobile event screen no events copy * fix: hide notifications toggle from settings * fix: cannot change type of field in grid --- frontend/appflowy_flutter/ios/Podfile.lock | 4 +- .../field/mobile_edit_field_screen.dart | 5 +- .../field/mobile_field_bottom_sheets.dart | 3 +- .../mobile_field_type_option_editor.dart | 5 +- .../mobile_calendar_events_empty.dart | 35 +++++++++ .../mobile_calendar_events_screen.dart | 73 ++++++++++--------- .../home/mobile_home_setting_page.dart | 3 +- .../widgets/notifications_hub_empty.dart | 1 + frontend/resources/translations/en.json | 4 + 9 files changed, 91 insertions(+), 42 deletions(-) create mode 100644 frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_empty.dart diff --git a/frontend/appflowy_flutter/ios/Podfile.lock b/frontend/appflowy_flutter/ios/Podfile.lock index 9057a91ab5..60484becc5 100644 --- a/frontend/appflowy_flutter/ios/Podfile.lock +++ b/frontend/appflowy_flutter/ios/Podfile.lock @@ -179,7 +179,7 @@ SPEC CHECKSUMS: file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c + fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 @@ -202,4 +202,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart index 6d37fb7ff5..4d29762cb8 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart @@ -1,3 +1,5 @@ +import 'package:flutter/material.dart'; + import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/base/app_bar_actions.dart'; import 'package:appflowy/mobile/presentation/database/field/mobile_field_type_option_editor.dart'; @@ -7,7 +9,6 @@ import 'package:appflowy/plugins/database/application/field/field_service.dart'; import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; -import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class MobileEditPropertyScreen extends StatefulWidget { @@ -75,7 +76,7 @@ class _MobileEditPropertyScreenState extends State { await fieldService.updateField(name: newField.name); } - if (newField.type != field.type) { + if (newField.type != widget.field.fieldType) { await fieldService.updateFieldType(fieldType: newField.type); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_bottom_sheets.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_bottom_sheets.dart index dc89598790..0980fb4524 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_bottom_sheets.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_bottom_sheets.dart @@ -1,8 +1,9 @@ +import 'package:flutter/material.dart'; + import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart'; import 'package:appflowy/plugins/database/application/field/field_controller.dart'; import 'package:appflowy/plugins/database/application/field/field_info.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'mobile_create_field_screen.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart index 4f277ade3e..47ba1d8a9d 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart @@ -202,9 +202,10 @@ class _FieldOptionEditorState extends State { () { if (widget.mode == FieldOptionMode.add) { controller.text = type.i18n; - _updateOptionValues(name: type.i18n); + _updateOptionValues(name: type.i18n, type: type); + } else { + _updateOptionValues(type: type); } - _updateOptionValues(type: type); }, ), ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_empty.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_empty.dart new file mode 100644 index 0000000000..29fcb6bdde --- /dev/null +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_empty.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +import 'package:appflowy/generated/locale_keys.g.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flowy_infra_ui/widget/spacing.dart'; + +class MobileCalendarEventsEmpty extends StatelessWidget { + const MobileCalendarEventsEmpty({super.key}); + + @override + Widget build(BuildContext context) { + return Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + FlowyText( + LocaleKeys.calendar_mobileEventScreen_emptyTitle.tr(), + fontWeight: FontWeight.w700, + fontSize: 14, + ), + const VSpace(8), + FlowyText.regular( + LocaleKeys.calendar_mobileEventScreen_emptyBody.tr(), + textAlign: TextAlign.center, + maxLines: 2, + ), + ], + ), + ), + ); + } +} diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart index f988e17814..565a6b2719 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart @@ -1,3 +1,6 @@ +import 'package:flutter/material.dart'; + +import 'package:appflowy/mobile/presentation/database/mobile_calendar_events_empty.dart'; import 'package:appflowy/plugins/database/application/row/row_cache.dart'; import 'package:appflowy/plugins/database/calendar/application/calendar_bloc.dart'; import 'package:appflowy/plugins/database/calendar/presentation/calendar_event_card.dart'; @@ -5,7 +8,6 @@ import 'package:calendar_view/calendar_view.dart'; import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class MobileCalendarEventsScreen extends StatefulWidget { @@ -44,37 +46,40 @@ class _MobileCalendarEventsScreenState @override Widget build(BuildContext context) { - return BlocProvider.value( - value: widget.calendarBloc, - child: BlocBuilder( - buildWhen: (p, c) => - p.newEvent != c.newEvent && - c.newEvent?.date.withoutTime == widget.date, - builder: (context, state) { - if (state.newEvent?.event != null && - _events - .none((e) => e.eventId == state.newEvent!.event!.eventId) && - state.newEvent!.date.withoutTime == widget.date) { - _events.add(state.newEvent!.event!); - } + return Scaffold( + floatingActionButton: FloatingActionButton( + key: const Key('add_event_fab'), + elevation: 6, + backgroundColor: Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of(context).colorScheme.onPrimary, + onPressed: () => + widget.calendarBloc.add(CalendarEvent.createEvent(widget.date)), + child: const Text('+'), + ), + appBar: AppBar( + title: Text( + DateFormat.yMMMMd(context.locale.toLanguageTag()).format(widget.date), + ), + ), + body: BlocProvider.value( + value: widget.calendarBloc, + child: BlocBuilder( + buildWhen: (p, c) => + p.newEvent != c.newEvent && + c.newEvent?.date.withoutTime == widget.date, + builder: (context, state) { + if (state.newEvent?.event != null && + _events + .none((e) => e.eventId == state.newEvent!.event!.eventId) && + state.newEvent!.date.withoutTime == widget.date) { + _events.add(state.newEvent!.event!); + } - return Scaffold( - floatingActionButton: FloatingActionButton( - key: const Key('add_event_fab'), - elevation: 6, - backgroundColor: Theme.of(context).colorScheme.primary, - foregroundColor: Theme.of(context).colorScheme.onPrimary, - onPressed: () => widget.calendarBloc - .add(CalendarEvent.createEvent(widget.date)), - child: const Text('+'), - ), - appBar: AppBar( - title: Text( - DateFormat.yMMMMd(context.locale.toLanguageTag()) - .format(widget.date), - ), - ), - body: SingleChildScrollView( + if (_events.isEmpty) { + return const MobileCalendarEventsEmpty(); + } + + return SingleChildScrollView( child: Column( children: [ const VSpace(10), @@ -95,9 +100,9 @@ class _MobileCalendarEventsScreenState const VSpace(24), ], ), - ), - ); - }, + ); + }, + ), ), ); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart index 5d2b3f6a03..c9fad0e7af 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart @@ -75,7 +75,8 @@ class _MobileHomeSettingPageState extends State { PersonalInfoSettingGroup( userProfile: userProfile, ), - const NotificationsSettingGroup(), + // TODO: Enable and implement along with Push Notifications + // const NotificationsSettingGroup(), const AppearanceSettingGroup(), const LanguageSettingGroup(), if (Env.enableCustomCloud) const CloudSettingGroup(), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notifications_hub_empty.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notifications_hub_empty.dart index 9e6276d278..03eeec921f 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notifications_hub_empty.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notifications_hub_empty.dart @@ -24,6 +24,7 @@ class NotificationsHubEmpty extends StatelessWidget { FlowyText.regular( LocaleKeys.notificationHub_emptyBody.tr(), textAlign: TextAlign.center, + maxLines: 2, ), ], ), diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json index 127261de3d..80d7265667 100644 --- a/frontend/resources/translations/en.json +++ b/frontend/resources/translations/en.json @@ -917,6 +917,10 @@ "previousMonth": "Previous Month", "nextMonth": "Next Month" }, + "mobileEventScreen": { + "emptyTitle": "No events yet", + "emptyBody": "Press the plus button to create an event on this day." + }, "settings": { "showWeekNumbers": "Show week numbers", "showWeekends": "Show weekends",