capacitor-microphone 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,6 +168,13 @@ private void startListeningInternal(PluginCall call, String lang) {
168
168
  stopSpeech();
169
169
  }
170
170
 
171
+ notifyListeners(
172
+ "partialResult",
173
+ new JSObject()
174
+ .put("text", "")
175
+ .put("isFinal", true)
176
+ );
177
+
171
178
  this.currentCall = call;
172
179
 
173
180
  getActivity().runOnUiThread(() -> {
@@ -189,7 +196,10 @@ private void startListeningInternal(PluginCall call, String lang) {
189
196
  error == SpeechRecognizer.ERROR_SPEECH_TIMEOUT) {
190
197
 
191
198
  if (!isDestroyed && isListening && speechRecognizer != null) {
192
- speechRecognizer.startListening(speechIntent);
199
+ if (speechIntent != null) {
200
+ speechRecognizer.startListening(speechIntent);
201
+ }
202
+
193
203
  }
194
204
  return;
195
205
  }
@@ -214,9 +224,10 @@ private void startListeningInternal(PluginCall call, String lang) {
214
224
  );
215
225
  }
216
226
 
217
- if (!isDestroyed && isListening && speechRecognizer != null) {
227
+ if (!isDestroyed && isListening && speechRecognizer != null && speechIntent != null) {
218
228
  speechRecognizer.startListening(speechIntent);
219
229
  }
230
+
220
231
  }
221
232
 
222
233
  @Override
@@ -319,6 +330,7 @@ public void restartListening(PluginCall call) {
319
330
  .postDelayed(() -> {
320
331
  isDestroyed = false;
321
332
  isListening = true;
333
+ speechIntent = null;
322
334
  startListeningInternal(call, lang);
323
335
  }, 250);
324
336
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-microphone",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "plugin to use the microphone",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",