Skip to content

Commit 31a46a6

Browse files
committed
fix(ios): avoid emitting error events after "end" event has been emitted
1 parent c6df79c commit 31a46a6

File tree

8 files changed

+81
-53
lines changed

8 files changed

+81
-53
lines changed

example/ios/Podfile

+21
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties
77
ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
88
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
99

10+
use_autolinking_method_symbol = ('use' + '_native' + '_modules!').to_sym
11+
origin_autolinking_method = self.method(use_autolinking_method_symbol)
12+
self.define_singleton_method(use_autolinking_method_symbol) do |*args|
13+
if ENV['EXPO_UNSTABLE_CORE_AUTOLINKING'] == '1'
14+
Pod::UI.puts('Using expo-modules-autolinking as core autolinking source'.green)
15+
config_command = [
16+
'node',
17+
'--no-warnings',
18+
'--eval',
19+
'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))',
20+
'react-native-config',
21+
'--json',
22+
'--platform',
23+
'ios'
24+
]
25+
origin_autolinking_method.call(config_command)
26+
else
27+
origin_autolinking_method.call()
28+
end
29+
end
30+
1031
platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4'
1132
install! 'cocoapods',
1233
:deterministic_uuids => false

example/ios/Podfile.lock

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ PODS:
66
- ReactCommon/turbomodule/core
77
- EXConstants (16.0.2):
88
- ExpoModulesCore
9-
- Expo (51.0.30):
9+
- Expo (51.0.32):
1010
- ExpoModulesCore
1111
- ExpoAsset (10.0.10):
1212
- ExpoModulesCore
1313
- ExpoFileSystem (17.0.1):
1414
- ExpoModulesCore
15-
- ExpoFont (12.0.9):
15+
- ExpoFont (12.0.10):
1616
- ExpoModulesCore
1717
- ExpoKeepAwake (13.0.2):
1818
- ExpoModulesCore
19-
- ExpoModulesCore (1.12.22):
19+
- ExpoModulesCore (1.12.24):
2020
- DoubleConversion
2121
- glog
2222
- hermes-engine
@@ -39,7 +39,7 @@ PODS:
3939
- ReactCommon/turbomodule/bridging
4040
- ReactCommon/turbomodule/core
4141
- Yoga
42-
- ExpoSpeechRecognition (0.2.14):
42+
- ExpoSpeechRecognition (0.2.15):
4343
- ExpoModulesCore
4444
- EXSplashScreen (0.27.5):
4545
- DoubleConversion
@@ -66,9 +66,9 @@ PODS:
6666
- FBLazyVector (0.74.5)
6767
- fmt (9.1.0)
6868
- glog (0.3.5)
69-
- hermes-engine (0.74.3):
70-
- hermes-engine/Pre-built (= 0.74.3)
71-
- hermes-engine/Pre-built (0.74.3)
69+
- hermes-engine (0.74.5):
70+
- hermes-engine/Pre-built (= 0.74.5)
71+
- hermes-engine/Pre-built (0.74.5)
7272
- RCT-Folly (2024.01.01.00):
7373
- boost
7474
- DoubleConversion
@@ -1437,18 +1437,18 @@ SPEC CHECKSUMS:
14371437
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
14381438
EXAV: afa491e598334bbbb92a92a2f4dd33d7149ad37f
14391439
EXConstants: 409690fbfd5afea964e5e9d6c4eb2c2b59222c59
1440-
Expo: 61b2953ad6afa979729f639c5992c182e8eb9040
1440+
Expo: 33132a667698a3259a4e6c0af1b4936388e5fa33
14411441
ExpoAsset: 323700f291684f110fb55f0d4022a3362ea9f875
14421442
ExpoFileSystem: 80bfe850b1f9922c16905822ecbf97acd711dc51
1443-
ExpoFont: e7f2275c10ca8573c991e007329ad6bf98086485
1443+
ExpoFont: 00756e6c796d8f7ee8d211e29c8b619e75cbf238
14441444
ExpoKeepAwake: 3b8815d9dd1d419ee474df004021c69fdd316d08
1445-
ExpoModulesCore: ccb0f619a6114b76c6a86224a52a77f5db5f1998
1446-
ExpoSpeechRecognition: 58538c1b083bfc28ee2d9531ad264d664d456a03
1445+
ExpoModulesCore: a113755f96c40590671f01cfcdce8ebdf0cf5f83
1446+
ExpoSpeechRecognition: 8dd88aa1af16251924232f0b90bed0bd90a7835a
14471447
EXSplashScreen: a7e8d13c476f9937e39d654af4235758b567a1be
14481448
FBLazyVector: ac12dc084d1c8ec4cc4d7b3cf1b0ebda6dab85af
14491449
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
14501450
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
1451-
hermes-engine: 1f547997900dd0752dc0cc0ae6dd16173c49e09b
1451+
hermes-engine: 8c1577f3fdb849cbe7729c2e7b5abc4b845e88f8
14521452
RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47
14531453
RCTDeprecation: 3afceddffa65aee666dafd6f0116f1d975db1584
14541454
RCTRequired: ec1239bc9d8bf63e10fb92bd8b26171a9258e0c1
@@ -1499,6 +1499,6 @@ SPEC CHECKSUMS:
14991499
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
15001500
Yoga: 2246eea72aaf1b816a68a35e6e4b74563653ae09
15011501

1502-
PODFILE CHECKSUM: 3310afcf7f865ca9740f949c34eec5ae855777c6
1502+
PODFILE CHECKSUM: ceec9518dac8a3c13e167f58439e04a010b51688
15031503

15041504
COCOAPODS: 1.15.2

example/ios/expospeechrecognitionexample.xcodeproj/project.pbxproj

+16-16
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
1111
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
1212
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
13+
283EB900409B50244647361C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = E8A36AE903FBB62C40B7E02B /* PrivacyInfo.xcprivacy */; };
14+
3C2C6067777F4D7888829EFB /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86E5BC3716734270BD717EF8 /* noop-file.swift */; };
1315
3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; };
14-
666E82030F000651F3096310 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = DB2E5F3A0BD0D38175C4D15E /* PrivacyInfo.xcprivacy */; };
1516
96905EF65AED1B983A6B3ABC /* libPods-expospeechrecognitionexample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-expospeechrecognitionexample.a */; };
1617
B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; };
17-
B7CC87D3B2034F53B76C7DC9 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0E757E34B544218AFE2693F /* noop-file.swift */; };
1818
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
1919
/* End PBXBuildFile section */
2020

@@ -28,12 +28,12 @@
2828
58EEBF8E8E6FB1BC6CAF49B5 /* libPods-expospeechrecognitionexample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-expospeechrecognitionexample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
2929
6C2E3173556A471DD304B334 /* Pods-expospeechrecognitionexample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-expospeechrecognitionexample.debug.xcconfig"; path = "Target Support Files/Pods-expospeechrecognitionexample/Pods-expospeechrecognitionexample.debug.xcconfig"; sourceTree = "<group>"; };
3030
7A4D352CD337FB3A3BF06240 /* Pods-expospeechrecognitionexample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-expospeechrecognitionexample.release.xcconfig"; path = "Target Support Files/Pods-expospeechrecognitionexample/Pods-expospeechrecognitionexample.release.xcconfig"; sourceTree = "<group>"; };
31+
86E5BC3716734270BD717EF8 /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "expospeechrecognitionexample/noop-file.swift"; sourceTree = "<group>"; };
3132
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = expospeechrecognitionexample/SplashScreen.storyboard; sourceTree = "<group>"; };
3233
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
33-
C0E757E34B544218AFE2693F /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "expospeechrecognitionexample/noop-file.swift"; sourceTree = "<group>"; };
34-
C4FBBC72942A40C6AED5D237 /* expospeechrecognitionexample-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "expospeechrecognitionexample-Bridging-Header.h"; path = "expospeechrecognitionexample/expospeechrecognitionexample-Bridging-Header.h"; sourceTree = "<group>"; };
35-
DB2E5F3A0BD0D38175C4D15E /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = expospeechrecognitionexample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
34+
E8A36AE903FBB62C40B7E02B /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = expospeechrecognitionexample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3635
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
36+
F8F2B138B2864164A22FB241 /* expospeechrecognitionexample-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "expospeechrecognitionexample-Bridging-Header.h"; path = "expospeechrecognitionexample/expospeechrecognitionexample-Bridging-Header.h"; sourceTree = "<group>"; };
3737
FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-expospeechrecognitionexample/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
3838
/* End PBXFileReference section */
3939

@@ -59,9 +59,9 @@
5959
13B07FB61A68108700A75B9A /* Info.plist */,
6060
13B07FB71A68108700A75B9A /* main.m */,
6161
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */,
62-
C0E757E34B544218AFE2693F /* noop-file.swift */,
63-
C4FBBC72942A40C6AED5D237 /* expospeechrecognitionexample-Bridging-Header.h */,
64-
DB2E5F3A0BD0D38175C4D15E /* PrivacyInfo.xcprivacy */,
62+
86E5BC3716734270BD717EF8 /* noop-file.swift */,
63+
F8F2B138B2864164A22FB241 /* expospeechrecognitionexample-Bridging-Header.h */,
64+
E8A36AE903FBB62C40B7E02B /* PrivacyInfo.xcprivacy */,
6565
);
6666
name = expospeechrecognitionexample;
6767
sourceTree = "<group>";
@@ -75,7 +75,7 @@
7575
name = Frameworks;
7676
sourceTree = "<group>";
7777
};
78-
44E1F19D9D084508A6E9D971 /* Resources */ = {
78+
6C2D907D40E74C2FBE1F7EBA /* Resources */ = {
7979
isa = PBXGroup;
8080
children = (
8181
);
@@ -99,7 +99,7 @@
9999
2D16E6871FA4F8E400B85C8A /* Frameworks */,
100100
D65327D7A22EEC0BE12398D9 /* Pods */,
101101
D7E4C46ADA2E9064B798F356 /* ExpoModulesProviders */,
102-
44E1F19D9D084508A6E9D971 /* Resources */,
102+
6C2D907D40E74C2FBE1F7EBA /* Resources */,
103103
);
104104
indentWidth = 2;
105105
sourceTree = "<group>";
@@ -156,13 +156,13 @@
156156
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "expospeechrecognitionexample" */;
157157
buildPhases = (
158158
08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */,
159-
F01D98036667962292A15DD8 /* [Expo] Configure project */,
159+
96600AB1AE731577DDB13C69 /* [Expo] Configure project */,
160160
13B07F871A680F5B00A75B9A /* Sources */,
161161
13B07F8C1A680F5B00A75B9A /* Frameworks */,
162162
13B07F8E1A680F5B00A75B9A /* Resources */,
163163
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
164164
800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */,
165-
16AC529AFB660315FF286353 /* [CP] Embed Pods Frameworks */,
165+
1CC2B23E9F18318C4B8D9930 /* [CP] Embed Pods Frameworks */,
166166
);
167167
buildRules = (
168168
);
@@ -212,7 +212,7 @@
212212
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */,
213213
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
214214
3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */,
215-
666E82030F000651F3096310 /* PrivacyInfo.xcprivacy in Resources */,
215+
283EB900409B50244647361C /* PrivacyInfo.xcprivacy in Resources */,
216216
);
217217
runOnlyForDeploymentPostprocessing = 0;
218218
};
@@ -256,7 +256,7 @@
256256
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
257257
showEnvVarsInLog = 0;
258258
};
259-
16AC529AFB660315FF286353 /* [CP] Embed Pods Frameworks */ = {
259+
1CC2B23E9F18318C4B8D9930 /* [CP] Embed Pods Frameworks */ = {
260260
isa = PBXShellScriptBuildPhase;
261261
buildActionMask = 2147483647;
262262
files = (
@@ -298,7 +298,7 @@
298298
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-expospeechrecognitionexample/Pods-expospeechrecognitionexample-resources.sh\"\n";
299299
showEnvVarsInLog = 0;
300300
};
301-
F01D98036667962292A15DD8 /* [Expo] Configure project */ = {
301+
96600AB1AE731577DDB13C69 /* [Expo] Configure project */ = {
302302
isa = PBXShellScriptBuildPhase;
303303
alwaysOutOfDate = 1;
304304
buildActionMask = 2147483647;
@@ -327,7 +327,7 @@
327327
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
328328
13B07FC11A68108700A75B9A /* main.m in Sources */,
329329
B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */,
330-
B7CC87D3B2034F53B76C7DC9 /* noop-file.swift in Sources */,
330+
3C2C6067777F4D7888829EFB /* noop-file.swift in Sources */,
331331
);
332332
runOnlyForDeploymentPostprocessing = 0;
333333
};

example/package-lock.json

+22-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"dependencies": {
1212
"babel-plugin-module-resolver": "^5.0.2",
13-
"expo": "~51.0.28",
13+
"expo": "~51.0.31",
1414
"expo-asset": "~10.0.10",
15-
"expo-av": "~14.0.6",
15+
"expo-av": "~14.0.7",
1616
"expo-build-properties": "~0.12.5",
1717
"expo-file-system": "~17.0.1",
1818
"expo-splash-screen": "~0.27.5",

ios/ExpoSpeechRecognizer.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,10 @@ actor ExpoSpeechRecognizer: ObservableObject {
632632
if let error: Error {
633633
// TODO: don't emit no-speech if there were already interim results
634634
Task { @MainActor in
635-
errorHandler(error)
635+
if await task != nil {
636+
// Don't emit any errors after the task has finished
637+
errorHandler(error)
638+
}
636639
}
637640
}
638641

@@ -676,7 +679,6 @@ actor ExpoSpeechRecognizer: ObservableObject {
676679
// Stop listening when the timer fires
677680
// This will finish the current task and emit the final result (or a no-speech event)
678681
await self?.stopListening()
679-
680682
}
681683
}
682684
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "expo-speech-recognition",
3-
"version": "0.2.15",
3+
"version": "0.2.16",
44
"description": "Speech Recognition for React Native Expo projects",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",

0 commit comments

Comments
 (0)