Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Aug 22, 2024
2 parents 1e26c23 + c371c6c commit 21e62db
Show file tree
Hide file tree
Showing 36 changed files with 1,232 additions and 290 deletions.
4 changes: 2 additions & 2 deletions frontend/appflowy_flutter/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ SPEC CHECKSUMS:
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
fluttertoast: 723e187574b149e68e63ca4d39b837586b903cfa
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9
Expand All @@ -196,4 +196,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: d0d9b4ff572d8695c38eb3f9b490f55cdfc57eca

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/home/section_folder/mobile_home_section_folder.dart';
import 'package:appflowy/mobile/presentation/home/space/mobile_space.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
import 'package:appflowy/workspace/application/menu/sidebar_sections_bloc.dart';
import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart';
import 'package:appflowy/workspace/application/sidebar/space/space_bloc.dart';
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:go_router/go_router.dart';

// Contains Public And Private Sections
class MobileFolders extends StatelessWidget {
Expand Down Expand Up @@ -73,13 +69,7 @@ class _MobileFolderState extends State<_MobileFolder> {
child: Column(
children: [
..._buildSpaceOrSection(context, state),
const VSpace(4.0),
const Padding(
padding: EdgeInsets.symmetric(
horizontal: HomeSpaceViewSizes.mHorizontalPadding,
),
child: _TrashButton(),
),
const VSpace(80.0),
],
),
);
Expand Down Expand Up @@ -122,28 +112,3 @@ class _MobileFolderState extends State<_MobileFolder> {
];
}
}

class _TrashButton extends StatelessWidget {
const _TrashButton();

@override
Widget build(BuildContext context) {
return SizedBox(
height: 52,
child: FlowyButton(
expand: true,
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 2.0),
leftIcon: const FlowySvg(
FlowySvgs.m_delete_s,
),
leftIconSize: const Size.square(18),
iconPadding: 10.0,
text: FlowyText.regular(
LocaleKeys.trash_text.tr(),
fontSize: 16.0,
),
onTap: () => context.push(MobileHomeTrashPage.routeName),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ class _HomePageState extends State<_HomePage> {
return;
}

Log.info('workspace action result: $actionResult');

final actionType = actionResult.actionType;
final result = actionResult.result;
final isLoading = actionResult.isLoading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/base/gesture.dart';
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/mobile/presentation/home/mobile_home_setting_page.dart';
import 'package:appflowy/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart';
import 'package:appflowy/plugins/base/emoji/emoji_picker_screen.dart';
import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
Expand All @@ -18,6 +17,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import 'setting/settings_popup_menu.dart';

class MobileHomePageHeader extends StatelessWidget {
const MobileHomePageHeader({
super.key,
Expand Down Expand Up @@ -45,15 +46,16 @@ class MobileHomePageHeader extends StatelessWidget {
? _MobileWorkspace(userProfile: userProfile)
: _MobileUser(userProfile: userProfile),
),
GestureDetector(
onTap: () => context.push(
MobileHomeSettingPage.routeName,
),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: FlowySvg(FlowySvgs.m_notification_settings_s),
),
),
const HomePageSettingsPopupMenu(),
// GestureDetector(
// onTap: () => context.push(
// MobileHomeSettingPage.routeName,
// ),
// child: const Padding(
// padding: EdgeInsets.all(8.0),
// child: FlowySvg(FlowySvgs.m_notification_settings_s),
// ),
// ),
const HSpace(8.0),
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import 'package:appflowy/core/helpers/url_launcher.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
import 'package:appflowy/mobile/presentation/setting/workspace/invite_members_screen.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';

enum _MobileSettingsPopupMenuItem {
settings,
members,
trash,
help,
}

class HomePageSettingsPopupMenu extends StatelessWidget {
const HomePageSettingsPopupMenu({super.key});

@override
Widget build(BuildContext context) {
return PopupMenuButton<_MobileSettingsPopupMenuItem>(
offset: const Offset(0, 36),
padding: EdgeInsets.zero,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(12.0),
),
),
// todo: replace it with shadows
shadowColor: const Color(0x68000000),
elevation: 10,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: FlowySvg(
FlowySvgs.m_settings_more_s,
),
),
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<_MobileSettingsPopupMenuItem>>[
_buildItem(
value: _MobileSettingsPopupMenuItem.settings,
svg: FlowySvgs.m_notification_settings_s,
text: LocaleKeys.settings_popupMenuItem_settings.tr(),
),
const PopupMenuDivider(height: 0.5),
_buildItem(
value: _MobileSettingsPopupMenuItem.members,
svg: FlowySvgs.m_settings_member_s,
text: LocaleKeys.settings_popupMenuItem_members.tr(),
),
const PopupMenuDivider(height: 0.5),
_buildItem(
value: _MobileSettingsPopupMenuItem.trash,
svg: FlowySvgs.trash_s,
text: LocaleKeys.settings_popupMenuItem_trash.tr(),
),
const PopupMenuDivider(height: 0.5),
_buildItem(
value: _MobileSettingsPopupMenuItem.help,
svg: FlowySvgs.message_support_s,
text: LocaleKeys.settings_popupMenuItem_helpAndSupport.tr(),
),
],
onSelected: (_MobileSettingsPopupMenuItem value) {
switch (value) {
case _MobileSettingsPopupMenuItem.members:
_openMembersPage(context);
break;
case _MobileSettingsPopupMenuItem.trash:
_openTrashPage(context);
break;
case _MobileSettingsPopupMenuItem.settings:
_openSettingsPage(context);
break;
case _MobileSettingsPopupMenuItem.help:
_openHelpPage(context);
break;
}
},
);
}

PopupMenuItem<T> _buildItem<T>({
required T value,
required FlowySvgData svg,
required String text,
}) {
return PopupMenuItem<T>(
value: value,
padding: EdgeInsets.zero,
child: _PopupButton(
svg: svg,
text: text,
),
);
}

void _openMembersPage(BuildContext context) {
context.push(InviteMembersScreen.routeName);
}

void _openTrashPage(BuildContext context) {
context.push(MobileHomeTrashPage.routeName);
}

void _openHelpPage(BuildContext context) {
afLaunchUrlString('https://discord.com/invite/9Q2xaN37tV');
}

void _openSettingsPage(BuildContext context) {
context.push(MobileHomeSettingPage.routeName);
}
}

class _PopupButton extends StatelessWidget {
const _PopupButton({
required this.svg,
required this.text,
});

final FlowySvgData svg;
final String text;

@override
Widget build(BuildContext context) {
return Container(
height: 44,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
children: [
FlowySvg(svg, size: const Size.square(20)),
const HSpace(12),
FlowyText.regular(
text,
fontSize: 16,
),
],
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MobileNotificationPageHeader extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const HSpace(16.0),
const HSpace(18.0),
FlowyText(
LocaleKeys.settings_notifications_titles_notifications.tr(),
fontSize: 20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
const VSpace(16),
if (exceededLimit) ...[
FlowyText.regular(
LocaleKeys.settings_appearance_members_inviteFailedMemberLimit.tr(),
LocaleKeys.settings_appearance_members_inviteFailedMemberLimitMobile
.tr(),
fontSize: 14.0,
maxLines: 3,
color: Theme.of(context).colorScheme.error,
Expand Down Expand Up @@ -205,7 +206,9 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
(f) {
Log.error('add workspace member failed: $f');
final message = f.code == ErrorCode.WorkspaceMemberLimitExceeded
? LocaleKeys.settings_appearance_members_memberLimitExceeded.tr()
? LocaleKeys
.settings_appearance_members_inviteFailedMemberLimitMobile
.tr()
: LocaleKeys.settings_appearance_members_failedToAddMember.tr();
setState(() {
exceededLimit = f.code == ErrorCode.WorkspaceMemberLimitExceeded;
Expand All @@ -229,7 +232,8 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
(f) {
Log.error('invite workspace member failed: $f');
final message = f.code == ErrorCode.WorkspaceMemberLimitExceeded
? LocaleKeys.settings_appearance_members_inviteFailedMemberLimit
? LocaleKeys
.settings_appearance_members_inviteFailedMemberLimitMobile
.tr()
: LocaleKeys.settings_appearance_members_failedToInviteMember
.tr();
Expand Down
Loading

0 comments on commit 21e62db

Please sign in to comment.