Skip to content

Commit 120db68

Browse files
authored
feat: open gitbook openAI link when tapping learn more button (#2002)
1 parent 6b14983 commit 120db68

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import 'package:url_launcher/url_launcher.dart';
2+
3+
Future<void> openLearnMorePage() async {
4+
final uri = Uri.parse(
5+
'https://appflowy.gitbook.io/docs/essential-documentation/appflowy-x-openai');
6+
if (await canLaunchUrl(uri)) {
7+
await launchUrl(uri);
8+
}
9+
}

frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/auto_completion_node_widget.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22

33
import 'package:appflowy/plugins/document/presentation/plugins/openai/service/openai_client.dart';
4+
import 'package:appflowy/plugins/document/presentation/plugins/openai/util/learn_more_action.dart';
45
import 'package:appflowy/plugins/document/presentation/plugins/openai/widgets/loading.dart';
56
import 'package:appflowy/user/application/user_service.dart';
67
import 'package:appflowy_editor/appflowy_editor.dart';
@@ -118,9 +119,15 @@ class _AutoCompletionInputState extends State<_AutoCompletionInput> {
118119
fontSize: 14,
119120
),
120121
const Spacer(),
121-
FlowyText.regular(
122-
LocaleKeys.document_plugins_autoGeneratorLearnMore.tr(),
123-
),
122+
FlowyButton(
123+
useIntrinsicWidth: true,
124+
text: FlowyText.regular(
125+
LocaleKeys.document_plugins_autoGeneratorLearnMore.tr(),
126+
),
127+
onTap: () async {
128+
await openLearnMorePage();
129+
},
130+
)
124131
],
125132
);
126133
}

frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:appflowy/plugins/document/presentation/plugins/openai/service/error.dart';
22
import 'package:appflowy/plugins/document/presentation/plugins/openai/service/openai_client.dart';
33
import 'package:appflowy/plugins/document/presentation/plugins/openai/service/text_edit.dart';
4+
import 'package:appflowy/plugins/document/presentation/plugins/openai/util/learn_more_action.dart';
45
import 'package:appflowy/plugins/document/presentation/plugins/openai/widgets/smart_edit_action.dart';
56
import 'package:appflowy/user/application/user_service.dart';
67
import 'package:appflowy_editor/appflowy_editor.dart';
@@ -119,9 +120,15 @@ class _SmartEditInputState extends State<_SmartEditInput> {
119120
fontSize: 14,
120121
),
121122
const Spacer(),
122-
FlowyText.regular(
123-
LocaleKeys.document_plugins_autoGeneratorLearnMore.tr(),
124-
),
123+
FlowyButton(
124+
useIntrinsicWidth: true,
125+
text: FlowyText.regular(
126+
LocaleKeys.document_plugins_autoGeneratorLearnMore.tr(),
127+
),
128+
onTap: () async {
129+
await openLearnMorePage();
130+
},
131+
)
125132
],
126133
);
127134
}

0 commit comments

Comments
 (0)