Skip to content

Commit 319fa82

Browse files
authored
v2.1 React Native (#373)
* v2.1 - RN * v2.1 RN - Tests * v2.1 RN - Demos * v2.1 RN - Global yarn? * v2.1 RN - Package source updates * v2.1 RN - Missing maven repo spec * v2.1 RN - Demo podfile update * v2.1 RN - Update Podfile source * v2.1 RN - Podfile wipe
1 parent 6a70431 commit 319fa82

File tree

15 files changed

+93
-50
lines changed

15 files changed

+93
-50
lines changed

.github/workflows/react-native-demos.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ jobs:
3636
node-version: ${{ matrix.node-version }}
3737

3838
- name: Pre-build dependencies
39-
run: npm install yarn
39+
run: npm install -g yarn
40+
41+
# ************ REMOVE AFTER RELEASE *****************
42+
- name: Build and package binding
43+
working-directory: binding/react-native
44+
run: yarn && yarn pkg
45+
46+
- name: Add to demo
47+
run: yarn add ../../binding/react-native/pkg/picovoice-cheetah-react-native-2.1.0.tgz
48+
# ***************************************************
4049

4150
- name: Install dependencies
4251
run: yarn android-install
@@ -64,7 +73,16 @@ jobs:
6473
node-version: ${{ matrix.node-version }}
6574

6675
- name: Pre-build dependencies
67-
run: npm install yarn
76+
run: npm install -g yarn
77+
78+
# ************ REMOVE AFTER RELEASE *****************
79+
- name: Build and package binding
80+
working-directory: binding/react-native
81+
run: yarn && yarn pkg
82+
83+
- name: Add to demo
84+
run: yarn add ../../binding/react-native/pkg/picovoice-cheetah-react-native-2.1.0.tgz
85+
# ***************************************************
6886

6987
- name: Install dependencies
7088
run: yarn ios-install

binding/android/CheetahTestApp/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
google()
88
mavenCentral()
99
maven {
10-
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1353/'
10+
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1355/'
1111
}
1212
}
1313
dependencies {
@@ -20,7 +20,7 @@ allprojects {
2020
google()
2121
mavenCentral()
2222
maven {
23-
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1353/'
23+
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1355/'
2424
}
2525
}
2626
}

binding/ios/Cheetah-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
2222
DESC
2323
s.homepage = 'https://github.com/Picovoice/cheetah/tree/master/binding/ios'
2424
s.author = { 'Picovoice' => '[email protected]' }
25-
s.source = { :git => "https://github.com/Picovoice/cheetah.git", :branch => "v2.1-flutter" }
25+
s.source = { :git => "https://github.com/Picovoice/cheetah.git", :branch => "v2.1-react-native" }
2626
s.ios.deployment_target = '13.0'
2727
s.swift_version = '5.0'
2828
s.vendored_frameworks = 'lib/ios/PvCheetah.xcframework'

binding/react-native/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ buildscript {
33
repositories {
44
google()
55
mavenCentral()
6+
maven {
7+
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1355/'
8+
}
69
}
710

811
dependencies {
@@ -129,5 +132,5 @@ repositories {
129132
dependencies {
130133
// noinspection GradleDynamicVersion
131134
api 'com.facebook.react:react-native:+'
132-
implementation 'ai.picovoice:cheetah-android:2.0.0'
135+
implementation 'ai.picovoice:cheetah-android:2.1.0'
133136
}

binding/react-native/cheetah-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
1616
s.source_files = "ios/*.{h,m,mm,swift}"
1717

1818
s.dependency "React"
19-
s.dependency "Cheetah-iOS", '~> 2.0.1'
19+
s.dependency "Cheetah-iOS", '~> 2.1.0'
2020
end

binding/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@picovoice/cheetah-react-native",
3-
"version": "2.0.2",
3+
"version": "2.1.0",
44
"description": "Picovoice Cheetah React Native binding",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

binding/react-native/test-app/CheetahTestApp/Tests.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ import {decode as atob} from 'base-64';
44

55
import {Cheetah} from '@picovoice/cheetah-react-native';
66

7+
const testData = require('./test_data.json');
78
const platform = Platform.OS;
89

910
const TEST_ACCESS_KEY: string = '{TESTING_ACCESS_KEY_HERE}';
1011

11-
const LANGUAGE = 'en';
12-
const AUDIO_FILE = 'test.wav';
13-
const EXPECTED_TRANSCRIPT =
14-
'Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.';
15-
const PUNCTUATIONS = ['.'];
16-
const ERROR_RATE = 0.025;
17-
1812
export type Result = {
1913
testName: string;
2014
success: boolean;
@@ -242,28 +236,34 @@ async function initTests(): Promise<Result[]> {
242236
async function processTests(): Promise<Result[]> {
243237
const results: Result[] = [];
244238

245-
let result = await runProcTestCase(
246-
LANGUAGE,
247-
AUDIO_FILE,
248-
EXPECTED_TRANSCRIPT,
249-
PUNCTUATIONS,
250-
ERROR_RATE,
251-
);
252-
logResult(result);
253-
results.push(result);
239+
for (const testParam of testData.tests.language_tests) {
240+
const result = await runProcTestCase(
241+
testParam.language,
242+
testParam.audio_file,
243+
testParam.transcript,
244+
testParam.punctuations,
245+
testParam.error_rate,
246+
);
247+
result.testName = `Process test for '${testParam.language}'`;
248+
logResult(result);
249+
results.push(result);
250+
}
254251

255-
result = await runProcTestCase(
256-
LANGUAGE,
257-
AUDIO_FILE,
258-
EXPECTED_TRANSCRIPT,
259-
PUNCTUATIONS,
260-
ERROR_RATE,
261-
{
262-
enablePunctuation: true,
263-
},
264-
);
265-
logResult(result);
266-
results.push(result);
252+
for (const testParam of testData.tests.language_tests) {
253+
const result = await runProcTestCase(
254+
testParam.language,
255+
testParam.audio_file,
256+
testParam.transcript,
257+
testParam.punctuations,
258+
testParam.error_rate,
259+
{
260+
enablePunctuation: true,
261+
},
262+
);
263+
result.testName = `Process test with punctuation for '${testParam.language}'`;
264+
logResult(result);
265+
results.push(result);
266+
}
267267

268268
return results;
269269
}

binding/react-native/test-app/CheetahTestApp/android/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ buildscript {
1414
repositories {
1515
google()
1616
mavenCentral()
17+
maven {
18+
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1355/'
19+
}
1720
}
1821
dependencies {
1922
classpath("com.android.tools.build:gradle:7.3.1")
@@ -36,6 +39,9 @@ allprojects {
3639

3740
allprojects {
3841
repositories {
42+
maven {
43+
url 'https://s01.oss.sonatype.org/content/repositories/aipicovoice-1355/'
44+
}
3945
maven {
4046
url("$rootDir/../node_modules/detox/Detox-android")
4147
}

binding/react-native/test-app/CheetahTestApp/copy_test_resources.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ mkdir -p ${ANDROID_ASSETS_DIR}/model_files
1818
mkdir -p ${IOS_ASSETS_DIR}/model_files
1919
cp ${LIB_DIR}/common/*.pv ${ANDROID_ASSETS_DIR}/model_files
2020
cp ${LIB_DIR}/common/*.pv ${IOS_ASSETS_DIR}/model_files
21+
22+
echo "Copying test data file..."
23+
cp ${RESOURCE_DIR}/.test/test_data.json .

binding/react-native/test-app/CheetahTestApp/ios/Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ end
1414

1515
target 'CheetahTestApp' do
1616
config = use_native_modules!
17-
pod 'Cheetah-iOS', '~> 2.0.0'
17+
# pod 'Cheetah-iOS', '~> 2.1.0'
18+
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.1-react-native/binding/ios/Cheetah-iOS.podspec'
1819

1920
# Flags change depending on the env values.
2021
flags = get_default_flags()

0 commit comments

Comments
 (0)