Skip to content

Commit

Permalink
v2.0 flutter (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
laves authored Nov 23, 2023
1 parent 556606b commit c39ef3b
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 31 deletions.
6 changes: 5 additions & 1 deletion binding/flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
* True-casing and automatic punctuation insertion enabled

## [1.1.1] - 2023-08-24
* Native packages updated
* Native packages updated

## [2.0.0] - 2023-11-17
* Engine improvements
* Improved error reporting
2 changes: 1 addition & 1 deletion binding/flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Cheetah is an on-device speech-to-text engine. Cheetah is:
This binding is for running Cheetah on **Flutter 2.8.1+** on the following platforms:

- Android 5.0+ (API 21+)
- iOS 9.0+
- iOS 13.0+

## Installation

Expand Down
10 changes: 8 additions & 2 deletions binding/flutter/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
group 'ai.picovoice.flutter.cheetah'
version '1.1.1'
version '2.0.0'

buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1302/'
}
}

dependencies {
Expand All @@ -16,6 +19,9 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1302/'
}
}
}

Expand All @@ -33,5 +39,5 @@ android {
}

dependencies {
implementation 'ai.picovoice:cheetah-android:1.1.2'
implementation 'ai.picovoice:cheetah-android:2.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBindin
flutterContext = flutterPluginBinding.getApplicationContext();
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "cheetah");
channel.setMethodCallHandler(this);

Cheetah.setSdk("flutter");
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion binding/flutter/ios/Classes/SwiftCheetahPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022 Picovoice Inc.
// Copyright 2022-2023 Picovoice Inc.
//
// You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
// file accompanying this source.
Expand Down Expand Up @@ -28,6 +28,8 @@ public class SwiftCheetahPlugin: NSObject, FlutterPlugin {

let methodChannel = FlutterMethodChannel(name: "cheetah", binaryMessenger: registrar.messenger())
registrar.addMethodCallDelegate(instance, channel: methodChannel)

Cheetah.setSdk(sdk: "flutter")
}

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
Expand Down
6 changes: 3 additions & 3 deletions binding/flutter/ios/cheetah_flutter.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'cheetah_flutter'
s.version = '1.1.1'
s.version = '2.0.0'
s.summary = 'A Flutter package plugin for Picovoice\'s Cheetah Speech-to-Text engine'
s.description = <<-DESC
A Flutter package plugin for Picovoice\'s Cheetah Speech-to-Text engine
Expand All @@ -10,9 +10,9 @@ Pod::Spec.new do |s|
s.author = { 'Picovoice' => '[email protected]' }
s.source = { :git => "https://github.com/Picovoice/cheetah.git" }
s.source_files = 'Classes/**/*'
s.platform = :ios, '9.0'
s.platform = :ios, '13.0'
s.dependency 'Flutter'
s.dependency 'Cheetah-iOS', '~> 1.1.0'
s.dependency 'Cheetah-iOS', '~> 2.0.0'

s.swift_version = '5.0'
end
2 changes: 1 addition & 1 deletion binding/flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cheetah_flutter
description: A Flutter plugin for Picovoice's Cheetah Speech-to-Text engine
version: 1.1.1
version: 2.0.0
homepage: https://picovoice.ai/
repository: https://github.com/Picovoice/cheetah/
documentation: https://picovoice.ai/docs/cheetah/
Expand Down
4 changes: 2 additions & 2 deletions demo/flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

lintOptions {
disable 'InvalidPackage'
Expand All @@ -35,7 +35,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "ai.picovoice.flutter.cheetahdemo"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
6 changes: 6 additions & 0 deletions demo/flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ buildscript {
repositories {
google()
jcenter()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1302/'
}
}

dependencies {
Expand All @@ -13,6 +16,9 @@ allprojects {
repositories {
google()
jcenter()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1302/'
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion demo/flutter/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down Expand Up @@ -28,6 +28,7 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
flutter_ios_podfile_setup

target 'Runner' do
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec'
use_frameworks!
use_modular_headers!

Expand Down
16 changes: 9 additions & 7 deletions demo/flutter/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- Cheetah-iOS (1.1.0)
- cheetah_flutter (1.1.1):
- Cheetah-iOS (~> 1.1.0)
- Cheetah-iOS (2.0.0)
- cheetah_flutter (2.0.0):
- Cheetah-iOS (~> 2.0.0)
- Flutter
- Flutter (1.0.0)
- flutter_voice_processor (1.1.0):
Expand All @@ -14,6 +14,7 @@ PODS:
- Flutter

DEPENDENCIES:
- Cheetah-iOS (from `https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec`)
- cheetah_flutter (from `.symlinks/plugins/cheetah_flutter/ios`)
- Flutter (from `Flutter`)
- flutter_voice_processor (from `.symlinks/plugins/flutter_voice_processor/ios`)
Expand All @@ -22,10 +23,11 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- Cheetah-iOS
- ios-voice-processor

EXTERNAL SOURCES:
Cheetah-iOS:
:podspec: https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec
cheetah_flutter:
:path: ".symlinks/plugins/cheetah_flutter/ios"
Flutter:
Expand All @@ -38,14 +40,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_ios/ios"

SPEC CHECKSUMS:
Cheetah-iOS: 6fb7be693878f5b1dec0ea5b6534fbba30954afc
cheetah_flutter: 1733299241a5babdc9ed3d0f3fdd4c14991e30cf
Cheetah-iOS: d98a5edcbf3b74dda6027aeac6a8c0f5997a47a2
cheetah_flutter: 3f7be021953be4901655a0f4d9741bf8ac5f3413
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_voice_processor: 53afbf59ad3feb82f4a379fea9ed8dc98495210f
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5

PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
PODFILE CHECKSUM: effbeff7b91bb3bd110090e42f80abf8a0c41c57

COCOAPODS: 1.11.3
6 changes: 3 additions & 3 deletions demo/flutter/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
STRIP_STYLE = "non-global";
Expand Down Expand Up @@ -429,7 +429,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -479,7 +479,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
STRIP_STYLE = "non-global";
Expand Down
3 changes: 0 additions & 3 deletions demo/flutter/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ class _MyAppState extends State<MyApp> {
try {
_cheetahManager = await CheetahManager.create(
accessKey, modelPath, transcriptCallback, errorCallback);
} on CheetahInvalidArgumentException catch (ex) {
errorCallback(CheetahInvalidArgumentException(
"${ex.message}\nEnsure your accessKey '$accessKey' is a valid access key."));
} on CheetahActivationException {
errorCallback(CheetahActivationException("AccessKey activation error."));
} on CheetahActivationLimitException {
Expand Down
8 changes: 4 additions & 4 deletions demo/flutter/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ packages:
cheetah_flutter:
dependency: "direct main"
description:
name: cheetah_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
path: "../../binding/flutter"
relative: true
source: path
version: "2.0.0"
clock:
dependency: transitive
description:
Expand Down
5 changes: 3 additions & 2 deletions demo/flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the cheetah plugin.

publish_to: 'none'

version: 1.0.0
version: 2.0.0

environment:
sdk: ">=2.14.0 <3.0.0"
Expand All @@ -14,7 +14,8 @@ dependencies:
sdk: flutter

flutter_voice_processor: ^1.1.0
cheetah_flutter: ^1.1.1
cheetah_flutter:
path: ../../binding/flutter

dev_dependencies:
integration_test:
Expand Down

0 comments on commit c39ef3b

Please sign in to comment.