Skip to content

Commit

Permalink
升级0.0.2
Browse files Browse the repository at this point in the history
增加stop方法
  • Loading branch information
jlcool committed Aug 9, 2019
1 parent f41a9bd commit 05af4e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void registerWith(Registrar registrar) {
private FlutterTaiPlugin(Registrar registrar, Activity activity) {
this.activity=activity;
}
private TAIOralEvaluation _oral = new TAIOralEvaluation();
private TAIOralEvaluation _oral;

@Override
public void onMethodCall(MethodCall call, Result result) {
Expand All @@ -75,7 +75,7 @@ public void onMethodCall(MethodCall call, Result result) {

public void onStop(final MethodCall call, final Result result) {
final String _id= call.argument("id");
if (_oral.isRecording()) {
if (_oral!=null && _oral.isRecording()) {
_oral.stopRecordAndEvaluation(new TAIOralEvaluationCallback() {
@Override
public void onResult(final TAIError error) {
Expand Down
14 changes: 14 additions & 0 deletions ios/Classes/FlutterTaiPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,24 @@ - (TAIOralEvaluation *)oralEvaluation
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"record" isEqualToString:call.method]) {
[self onRecord:call result:result];
} else if ([@"stop" isEqualToString:call.method]) {
[self onStop:call result:result];
} else {
result(FlutterMethodNotImplemented);
}
}
- (IBAction)onStop:(FlutterMethodCall*)call result:(FlutterResult)result{
flutterTaiPluginId =call.arguments[@"id"];
if([self.oralEvaluation isRecording]){
[self.oralEvaluation stopRecordAndEvaluation:^(TAIError *error) {
[flutterTaiPluginChannel invokeMethod:@"onStop" arguments:@{
@"err": [NSString stringWithFormat:@"%@", error],
@"id":flutterTaiPluginId
}];
}];
return;
}
}
- (IBAction)onRecord:(FlutterMethodCall*)call result:(FlutterResult)result{
flutterTaiPluginId =call.arguments[@"id"];
if([self.oralEvaluation isRecording]){
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_tai
description: Smart Oral Evaluation

version: 0.0.1
version: 0.0.2
author: jlcool <[email protected]>
homepage: https://github.com/jlcool/flutter_tai

Expand Down

0 comments on commit 05af4e5

Please sign in to comment.