Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
aivoice_plugin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王苏进
aivoice_plugin
Commits
67d744f6
提交
67d744f6
authored
9月 07, 2024
作者:
王苏进
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 增加相关 api
上级
cd580b3e
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
84 行增加
和
13 行删除
+84
-13
AivoicePlugin.java
...ain/java/com/yourcompany/aivoiceplugin/AivoicePlugin.java
+12
-3
AivoicePlugin.m
ios/Classes/AivoicePlugin.m
+12
-3
aivoice_plugin.dart
lib/aivoice_plugin.dart
+16
-3
aivoice_plugin_method_channel.dart
lib/aivoice_plugin_method_channel.dart
+19
-3
aivoice_plugin_platform_interface.dart
lib/aivoice_plugin_platform_interface.dart
+10
-1
method_channel_aivoice_plugin.dart
lib/method_channel_aivoice_plugin.dart
+15
-0
没有找到文件。
android/src/main/java/com/yourcompany/aivoiceplugin/AivoicePlugin.java
浏览文件 @
67d744f6
...
@@ -18,9 +18,18 @@ public class AivoicePlugin implements FlutterPlugin, MethodCallHandler {
...
@@ -18,9 +18,18 @@ public class AivoicePlugin implements FlutterPlugin, MethodCallHandler {
@Override
@Override
public
void
onMethodCall
(
@NonNull
MethodCall
call
,
@NonNull
Result
result
)
{
public
void
onMethodCall
(
@NonNull
MethodCall
call
,
@NonNull
Result
result
)
{
if
(
call
.
method
.
equals
(
"getPlatformVersion"
))
{
// 删除了 getPlatformVersion 方法的实现
result
.
success
(
"Android "
+
android
.
os
.
Build
.
VERSION
.
RELEASE
);
}
else
if
(
call
.
method
.
equals
(
"initEngine"
))
{
if
(
call
.
method
.
equals
(
"initEngine"
))
{
// 空实现
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"stopEngine"
))
{
// 空实现
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"uninitEngine"
))
{
// 空实现
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"startOrStopEngine"
))
{
// 空实现
// 空实现
result
.
success
(
null
);
result
.
success
(
null
);
}
else
{
}
else
{
...
...
ios/Classes/AivoicePlugin.m
浏览文件 @
67d744f6
...
@@ -14,9 +14,18 @@
...
@@ -14,9 +14,18 @@
}
}
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
([
@"getPlatformVersion"
isEqualToString
:
call
.
method
])
{
// 删除了 getPlatformVersion 方法的实现
result
([
@"iOS "
stringByAppendingString
:[[
UIDevice
currentDevice
]
systemVersion
]]);
}
else
if
([
@"initEngine"
isEqualToString
:
call
.
method
])
{
if
([
@"initEngine"
isEqualToString
:
call
.
method
])
{
// 空实现
result
(
nil
);
}
else
if
([
@"stopEngine"
isEqualToString
:
call
.
method
])
{
// 空实现
result
(
nil
);
}
else
if
([
@"uninitEngine"
isEqualToString
:
call
.
method
])
{
// 空实现
result
(
nil
);
}
else
if
([
@"startOrStopEngine"
isEqualToString
:
call
.
method
])
{
// 空实现
// 空实现
result
(
nil
);
result
(
nil
);
}
else
{
}
else
{
...
...
lib/aivoice_plugin.dart
浏览文件 @
67d744f6
import
'aivoice_plugin_platform_interface.dart'
;
import
'aivoice_plugin_platform_interface.dart'
;
class
AivoicePlugin
{
class
AivoicePlugin
{
Future
<
String
?>
getPlatformVersion
()
{
// 删除了 getPlatformVersion 方法
return
AivoicePluginPlatform
.
instance
.
getPlatformVersion
();
}
// 新增的 initEngine 方法
// 新增的 initEngine 方法
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
)
{
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
)
{
return
AivoicePluginPlatform
.
instance
.
initEngine
(
config
);
return
AivoicePluginPlatform
.
instance
.
initEngine
(
config
);
}
}
// 新增的 stopEngine 方法
Future
<
void
>
stopEngine
()
{
return
AivoicePluginPlatform
.
instance
.
stopEngine
();
}
// 新增的 uninitEngine 方法
Future
<
void
>
uninitEngine
()
{
return
AivoicePluginPlatform
.
instance
.
uninitEngine
();
}
// 新增的 startOrStopEngine 方法
Future
<
void
>
startOrStopEngine
(
bool
isBegin
)
{
return
AivoicePluginPlatform
.
instance
.
startOrStopEngine
(
isBegin
);
}
}
}
lib/aivoice_plugin_method_channel.dart
浏览文件 @
67d744f6
...
@@ -9,9 +9,25 @@ class MethodChannelAivoicePlugin extends AivoicePluginPlatform {
...
@@ -9,9 +9,25 @@ class MethodChannelAivoicePlugin extends AivoicePluginPlatform {
@visibleForTesting
@visibleForTesting
final
methodChannel
=
const
MethodChannel
(
'aivoice_plugin'
);
final
methodChannel
=
const
MethodChannel
(
'aivoice_plugin'
);
// 删除了 getPlatformVersion 方法
@override
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
)
async
{
await
methodChannel
.
invokeMethod
<
void
>(
'initEngine'
,
config
);
}
@override
Future
<
void
>
stopEngine
()
async
{
await
methodChannel
.
invokeMethod
<
void
>(
'stopEngine'
);
}
@override
Future
<
void
>
uninitEngine
()
async
{
await
methodChannel
.
invokeMethod
<
void
>(
'uninitEngine'
);
}
@override
@override
Future
<
String
?>
getPlatformVersion
()
async
{
Future
<
void
>
startOrStopEngine
(
bool
isBegin
)
async
{
final
version
=
await
methodChannel
.
invokeMethod
<
String
>(
'getPlatformVersion'
);
await
methodChannel
.
invokeMethod
<
void
>(
'startOrStopEngine'
,
{
'isBegin'
:
isBegin
});
return
version
;
}
}
}
}
lib/aivoice_plugin_platform_interface.dart
浏览文件 @
67d744f6
...
@@ -23,8 +23,17 @@ abstract class AivoicePluginPlatform extends PlatformInterface {
...
@@ -23,8 +23,17 @@ abstract class AivoicePluginPlatform extends PlatformInterface {
_instance
=
instance
;
_instance
=
instance
;
}
}
Future
<
String
?>
getPlatformVersion
();
// 删除了 getPlatformVersion 方法
// 新增的 initEngine 方法
// 新增的 initEngine 方法
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
);
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
);
// 新增的 stopEngine 方法
Future
<
void
>
stopEngine
();
// 新增的 uninitEngine 方法
Future
<
void
>
uninitEngine
();
// 新增的 startOrStopEngine 方法
Future
<
void
>
startOrStopEngine
(
bool
isBegin
);
}
}
lib/method_channel_aivoice_plugin.dart
浏览文件 @
67d744f6
...
@@ -14,4 +14,19 @@ class MethodChannelAivoicePlugin extends AivoicePluginPlatform {
...
@@ -14,4 +14,19 @@ class MethodChannelAivoicePlugin extends AivoicePluginPlatform {
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
)
{
Future
<
void
>
initEngine
(
Map
<
String
,
dynamic
>
config
)
{
return
_channel
.
invokeMethod
<
void
>(
'initEngine'
,
config
);
return
_channel
.
invokeMethod
<
void
>(
'initEngine'
,
config
);
}
}
@override
Future
<
void
>
stopEngine
()
{
return
_channel
.
invokeMethod
<
void
>(
'stopEngine'
);
}
@override
Future
<
void
>
uninitEngine
()
{
return
_channel
.
invokeMethod
<
void
>(
'uninitEngine'
);
}
@override
Future
<
void
>
startOrStopEngine
(
bool
isBegin
)
{
return
_channel
.
invokeMethod
<
void
>(
'startOrStopEngine'
,
{
'isBegin'
:
isBegin
});
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论