fix: notification test (#5440)

* fix: notification test

* fix: use default emoji font family on iOS

* fix: unable to delete duplicated recent view
This commit is contained in:
Lucas.Xu 2024-05-30 15:19:07 +08:00 committed by GitHub
parent a1395cb54a
commit 8b04506ac4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 25 deletions

View File

@ -8,8 +8,8 @@ import '../../shared/util.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('board add row test', () {
testWidgets('Add card from header', (tester) async {
group('notification test', () {
testWidgets('enable notification', (tester) async {
await tester.initializeAppFlowy();
await tester.tapAnonymousSignInButton();
@ -17,7 +17,7 @@ void main() {
await tester.openSettingsPage(SettingsPage.notifications);
await tester.pumpAndSettle();
final switchFinder = find.byType(Switch);
final switchFinder = find.byType(Switch).first;
// Defaults to enabled
Switch switchWidget = tester.widget(switchFinder);

View File

@ -1,11 +1,9 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/application/mobile_router.dart';
import 'package:appflowy/mobile/presentation/bottom_sheet/default_mobile_action_pane.dart';
import 'package:appflowy/mobile/presentation/home/section_folder/mobile_home_section_folder_header.dart';
import 'package:appflowy/mobile/presentation/page_item/mobile_view_item.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/view/view_bloc.dart';
import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:easy_localization/easy_localization.dart';
@ -71,16 +69,6 @@ class MobileSectionFolder extends StatelessWidget {
leftPadding: HomeSpaceViewSizes.leftPadding,
isFeedback: false,
onSelected: context.pushView,
endActionPane: (context) {
final view = context.read<ViewBloc>().state.view;
return buildEndActionPane(context, [
MobilePaneActionType.delete,
view.isFavorite
? MobilePaneActionType.removeFromFavorites
: MobilePaneActionType.addToFavorites,
MobilePaneActionType.more,
]);
},
),
),
],

View File

@ -154,6 +154,9 @@ class MobileViewCard extends StatelessWidget {
Widget _buildTitle(BuildContext context, RecentViewState state) {
final name = state.name;
final icon = state.icon;
final fontFamily = Platform.isAndroid || Platform.isLinux
? GoogleFonts.notoColorEmoji().fontFamily
: null;
return RichText(
maxLines: 3,
overflow: TextOverflow.ellipsis,
@ -164,10 +167,10 @@ class MobileViewCard extends StatelessWidget {
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
fontSize: 17.0,
fontWeight: FontWeight.w600,
fontFamily: GoogleFonts.notoColorEmoji().fontFamily,
fontFamily: fontFamily,
),
),
const TextSpan(text: ' '),
if (icon.isNotEmpty) const WidgetSpan(child: HSpace(2.0)),
TextSpan(
text: name,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(

View File

@ -48,13 +48,22 @@ class CachedRecentService {
Future<FlowyResult<void, FlowyError>> updateRecentViews(
List<String> viewIds,
bool addInRecent,
) async =>
FolderEventUpdateRecentViews(
UpdateRecentViewPayloadPB(
viewIds: viewIds,
addInRecent: addInRecent,
),
).send();
) async {
final List<String> duplicatedViewIds = [];
for (final viewId in viewIds) {
for (final view in _recentViews) {
if (view.item.id == viewId) {
duplicatedViewIds.add(viewId);
}
}
}
return FolderEventUpdateRecentViews(
UpdateRecentViewPayloadPB(
viewIds: addInRecent ? viewIds : duplicatedViewIds,
addInRecent: addInRecent,
),
).send();
}
Future<FlowyResult<RepeatedRecentViewPB, FlowyError>> _readRecentViews() =>
FolderEventReadRecentViews().send();

View File

@ -138,7 +138,7 @@ class FlowyText extends StatelessWidget {
var fontFamily = this.fontFamily;
var fallbackFontFamily = this.fallbackFontFamily;
if (isEmoji) {
if (isEmoji && (Platform.isLinux || Platform.isAndroid)) {
fontFamily = _loadEmojiFontFamilyIfNeeded();
if (fontFamily != null && fallbackFontFamily == null) {
fallbackFontFamily = [fontFamily];