Skip to content

Commit

Permalink
fix: potential dependency conflict (AppFlowy-IO#4550)
Browse files Browse the repository at this point in the history
* fix: potential dependency conflict

* fix: ci issues
  • Loading branch information
LucasXu0 authored Jan 30, 2024
1 parent c0aef8f commit 0b7ae73
Show file tree
Hide file tree
Showing 31 changed files with 273 additions and 303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ void main() {
// because this icons are defined in the appflowy_editor package, we can't fetch the icons by SVG data. [textDirectionItems]
final textDirectionIconNames = [
'toolbar/text_direction_auto',
'toolbar/text_direction_left',
'toolbar/text_direction_right',
'toolbar/text_direction_ltr',
'toolbar/text_direction_rtl',
];
// no text direction items in default/LTR mode
var button = find.byWidgetPredicate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final List<CommandShortcutEvent> customTextAlignCommands = [
final CommandShortcutEvent customTextLeftAlignCommand = CommandShortcutEvent(
key: 'Align text to the left',
command: 'ctrl+shift+l',
getDescription: () => 'Align text to the left',
handler: (editorState) => _textAlignHandler(editorState, leftAlignmentKey),
);

Expand All @@ -33,6 +34,7 @@ final CommandShortcutEvent customTextLeftAlignCommand = CommandShortcutEvent(
final CommandShortcutEvent customTextCenterAlignCommand = CommandShortcutEvent(
key: 'Align text to the center',
command: 'ctrl+shift+e',
getDescription: () => 'Align text to the center',
handler: (editorState) => _textAlignHandler(editorState, centerAlignmentKey),
);

Expand All @@ -47,6 +49,7 @@ final CommandShortcutEvent customTextCenterAlignCommand = CommandShortcutEvent(
final CommandShortcutEvent customTextRightAlignCommand = CommandShortcutEvent(
key: 'Align text to the right',
command: 'ctrl+shift+r',
getDescription: () => 'Align text to the right',
handler: (editorState) => _textAlignHandler(editorState, rightAlignmentKey),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -47,7 +49,7 @@ Node calloutNode({

// defining the callout block menu item in selection menu
SelectionMenuItem calloutItem = SelectionMenuItem.node(
name: 'Callout',
getName: () => LocaleKeys.document_plugins_callout.tr(),
iconData: Icons.note,
keywords: [CalloutBlockKeys.type],
nodeBuilder: (editorState, context) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Node codeBlockNode({

// defining the callout block menu item for selection
SelectionMenuItem codeBlockItem = SelectionMenuItem.node(
name: LocaleKeys.document_selectionMenu_codeBlock.tr(),
getName: () => LocaleKeys.document_selectionMenu_codeBlock.tr(),
iconData: Icons.abc,
keywords: ['code', 'codeblock'],
nodeBuilder: (editorState, _) => codeBlockNode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ final CommandShortcutEvent insertNewParagraphNextToCodeBlockCommand =
CommandShortcutEvent(
key: 'insert a new paragraph next to the code block',
command: 'shift+enter',
getDescription: () => 'Insert a new paragraph next to the code block',
handler: _insertNewParagraphNextToCodeBlockCommandHandler,
);

Expand All @@ -71,6 +72,7 @@ final CommandShortcutEvent tabToInsertSpacesInCodeBlockCommand =
CommandShortcutEvent(
key: 'tab to insert two spaces at the line start in code block',
command: 'tab',
getDescription: () => 'Insert two spaces at the line start in code block',
handler: _tabToInsertSpacesInCodeBlockCommandHandler,
);

Expand All @@ -83,6 +85,7 @@ final CommandShortcutEvent tabToDeleteSpacesInCodeBlockCommand =
CommandShortcutEvent(
key: 'shift + tab to delete two spaces at the line start in code block',
command: 'shift+tab',
getDescription: () => 'Delete two spaces at the line start in code block',
handler: _tabToDeleteSpacesInCodeBlockCommandHandler,
);

Expand All @@ -95,6 +98,7 @@ final CommandShortcutEvent selectAllInCodeBlockCommand = CommandShortcutEvent(
key: 'ctrl + a to select all content inside a code block',
command: 'ctrl+a',
macOSCommand: 'meta+a',
getDescription: () => 'Select all content inside a code block',
handler: _selectAllInCodeBlockCommandHandler,
);

Expand All @@ -107,6 +111,7 @@ final CommandShortcutEvent pasteInCodeblock = CommandShortcutEvent(
key: 'paste in codeblock',
command: 'ctrl+v',
macOSCommand: 'cmd+v',
getDescription: () => 'Paste text in codeblock',
handler: _pasteInCodeBlock,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import 'package:easy_localization/easy_localization.dart';
final List<List<ContextMenuItem>> customContextMenuItems = [
[
ContextMenuItem(
name: LocaleKeys.document_plugins_contextMenu_copy.tr(),
getName: () => LocaleKeys.document_plugins_contextMenu_copy.tr(),
onPressed: (editorState) => customCopyCommand.execute(editorState),
),
ContextMenuItem(
name: LocaleKeys.document_plugins_contextMenu_paste.tr(),
getName: () => LocaleKeys.document_plugins_contextMenu_paste.tr(),
onPressed: (editorState) => customPasteCommand.execute(editorState),
),
ContextMenuItem(
name: LocaleKeys.document_plugins_contextMenu_cut.tr(),
getName: () => LocaleKeys.document_plugins_contextMenu_cut.tr(),
onPressed: (editorState) => customCutCommand.execute(editorState),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:flutter/material.dart';
///
final CommandShortcutEvent customCopyCommand = CommandShortcutEvent(
key: 'copy the selected content (with formatting)',
getDescription: () => 'copy the selected content (with formatting)',
command: 'ctrl+c',
macOSCommand: 'cmd+c',
handler: _copyCommandHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
///
final CommandShortcutEvent customCutCommand = CommandShortcutEvent(
key: 'cut the selected content (with formatting)',
getDescription: () => 'cut the selected content (with formatting)',
command: 'ctrl+x',
macOSCommand: 'cmd+x',
handler: _cutCommandHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:string_validator/string_validator.dart';
///
final CommandShortcutEvent customPasteCommand = CommandShortcutEvent(
key: 'paste the content (with formatting)',
getDescription: () => 'paste the content (with formatting)',
command: 'ctrl+v',
macOSCommand: 'cmd+v',
handler: _pasteCommandHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:easy_localization/easy_localization.dart';

SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
SelectionMenuItem(
name: LocaleKeys.document_slashMenu_grid_createANewGrid.tr(),
getName: () => LocaleKeys.document_slashMenu_grid_createANewGrid.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.grid_s,
isSelected: onSelected,
Expand All @@ -31,7 +31,7 @@ SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>

SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>
SelectionMenuItem(
name: LocaleKeys.document_slashMenu_board_createANewBoard.tr(),
getName: () => LocaleKeys.document_slashMenu_board_createANewBoard.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.board_s,
isSelected: onSelected,
Expand All @@ -52,7 +52,8 @@ SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>

SelectionMenuItem inlineCalendarMenuItem(DocumentBloc documentBloc) =>
SelectionMenuItem(
name: LocaleKeys.document_slashMenu_calendar_createANewCalendar.tr(),
getName: () =>
LocaleKeys.document_slashMenu_calendar_createANewCalendar.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.date_s,
isSelected: onSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:easy_localization/easy_localization.dart';
// Document Reference

SelectionMenuItem referencedDocumentMenuItem = SelectionMenuItem(
name: LocaleKeys.document_plugins_referencedDocument.tr(),
getName: () => LocaleKeys.document_plugins_referencedDocument.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.document_s,
isSelected: onSelected,
Expand All @@ -23,7 +23,7 @@ SelectionMenuItem referencedDocumentMenuItem = SelectionMenuItem(
// Database References

SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
name: LocaleKeys.document_plugins_referencedGrid.tr(),
getName: () => LocaleKeys.document_plugins_referencedGrid.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.grid_s,
isSelected: onSelected,
Expand All @@ -35,7 +35,7 @@ SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
);

SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
name: LocaleKeys.document_plugins_referencedBoard.tr(),
getName: () => LocaleKeys.document_plugins_referencedBoard.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.board_s,
isSelected: onSelected,
Expand All @@ -47,7 +47,7 @@ SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
);

SelectionMenuItem referencedCalendarMenuItem = SelectionMenuItem(
name: LocaleKeys.document_plugins_referencedCalendar.tr(),
getName: () => LocaleKeys.document_plugins_referencedCalendar.tr(),
icon: (editorState, onSelected, style) => SelectableSvgWidget(
data: FlowySvgs.date_s,
isSelected: onSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:appflowy_editor/appflowy_editor.dart' hide Log;
import 'package:flutter/material.dart';

final customImageMenuItem = SelectionMenuItem(
name: AppFlowyEditorL10n.current.image,
getName: () => AppFlowyEditorL10n.current.image,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'image',
isSelected: isSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Node mathEquationNode({

// defining the callout block menu item for selection
SelectionMenuItem mathEquationItem = SelectionMenuItem.node(
name: 'MathEquation',
getName: () => LocaleKeys.document_plugins_mathEquation_name.tr(),
iconData: Icons.text_fields_rounded,
keywords: ['tex, latex, katex', 'math equation', 'formula'],
nodeBuilder: (editorState, _) => mathEquationNode(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_block.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:easy_localization/easy_localization.dart';

SelectionMenuItem dateMenuItem = SelectionMenuItem(
name: 'Insert Date',
getName: () => LocaleKeys.document_plugins_date.tr(),
icon: (_, isSelected, style) => FlowySvg(
FlowySvgs.date_s,
color: isSelected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Node autoCompletionNode({
}

SelectionMenuItem autoGeneratorMenuItem = SelectionMenuItem.node(
name: LocaleKeys.document_plugins_autoGeneratorMenuItemName.tr(),
getName: () => LocaleKeys.document_plugins_autoGeneratorMenuItemName.tr(),
iconData: Icons.generating_tokens,
keywords: ['ai', 'openai' 'writer', 'autogenerator'],
nodeBuilder: (editorState, _) {
Expand Down Expand Up @@ -172,9 +172,7 @@ class _AutoCompletionBlockComponentState
maxLines: 5,
focusNode: textFieldFocusNode,
autoFocus: false,
hintTextConstraints: const BoxConstraints(

),
hintTextConstraints: const BoxConstraints(),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OutlineBlockKeys {

// defining the callout block menu item for selection
SelectionMenuItem outlineItem = SelectionMenuItem.node(
name: LocaleKeys.document_selectionMenu_outline.tr(),
getName: () => LocaleKeys.document_selectionMenu_outline.tr(),
iconData: Icons.list_alt,
keywords: ['outline', 'table of contents'],
nodeBuilder: (editorState, _) => outlineBlockNode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Node toggleListBlockNode({

// defining the toggle list block menu item
SelectionMenuItem toggleListBlockItem = SelectionMenuItem.node(
name: LocaleKeys.document_plugins_toggleList.tr(),
getName: () => LocaleKeys.document_plugins_toggleList.tr(),
iconData: Icons.arrow_right,
keywords: ['collapsed list', 'toggle list', 'list'],
nodeBuilder: (editorState, _) => toggleListBlockNode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ CharacterShortcutEvent insertChildNodeInsideToggleList = CharacterShortcutEvent(
// toggle the todo list
final CommandShortcutEvent toggleToggleListCommand = CommandShortcutEvent(
key: 'toggle the toggle list',
getDescription: () => 'Toggle the toggle list',
command: 'ctrl+enter',
macOSCommand: 'cmd+enter',
handler: _toggleToggleListCommandHandler,
Expand Down
34 changes: 17 additions & 17 deletions frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ class InitSupabaseTask extends LaunchTask {
return;
}

supabase?.dispose();
await supabase?.dispose();
supabase = null;
final initializedSupabase = await Supabase.initialize(
url: getIt<AppFlowyCloudSharedEnv>().supabaseConfig.url,
anonKey: getIt<AppFlowyCloudSharedEnv>().supabaseConfig.anon_key,
debug: kDebugMode,
localStorage: const SupabaseLocalStorage(),
authOptions: const FlutterAuthClientOptions(
localStorage: SupabaseLocalStorage(),
),
);

if (realtimeService != null) {
Expand All @@ -60,7 +62,7 @@ class InitSupabaseTask extends LaunchTask {
Future<void> dispose() async {
await realtimeService?.dispose();
realtimeService = null;
supabase?.dispose();
await supabase?.dispose();
supabase = null;
}
}
Expand All @@ -70,16 +72,10 @@ class InitSupabaseTask extends LaunchTask {
/// We don't use the default one because it always save the session in the document directory.
/// When we switch to the different folder, the session still exists.
class SupabaseLocalStorage extends LocalStorage {
const SupabaseLocalStorage()
: super(
initialize: _initialize,
hasAccessToken: _hasAccessToken,
accessToken: _accessToken,
removePersistedSession: _removePersistedSession,
persistSession: _persistSession,
);

static Future<void> _initialize() async {
const SupabaseLocalStorage();

@override
Future<void> initialize() async {
HiveCipher? encryptionCipher;

// customize the path for Hive
Expand All @@ -91,25 +87,29 @@ class SupabaseLocalStorage extends LocalStorage {
);
}

static Future<bool> _hasAccessToken() {
@override
Future<bool> hasAccessToken() {
return Future.value(
Hive.box(hiveBoxName).containsKey(
supabasePersistSessionKey,
),
);
}

static Future<String?> _accessToken() {
@override
Future<String?> accessToken() {
return Future.value(
Hive.box(hiveBoxName).get(supabasePersistSessionKey) as String?,
);
}

static Future<void> _removePersistedSession() {
@override
Future<void> removePersistedSession() {
return Hive.box(hiveBoxName).delete(supabasePersistSessionKey);
}

static Future<void> _persistSession(String persistSessionString) {
@override
Future<void> persistSession(String persistSessionString) {
return Hive.box(hiveBoxName).put(
supabasePersistSessionKey,
persistSessionString,
Expand Down
Loading

0 comments on commit 0b7ae73

Please sign in to comment.