@capacitor-community/text-to-speech 4.0.1 → 4.0.2

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.
package/README.md CHANGED
@@ -30,20 +30,6 @@ npm install @capacitor-community/text-to-speech
30
30
  npx cap sync
31
31
  ```
32
32
 
33
- ### Android
34
-
35
- According to the [Android documentation](https://developer.android.com/reference/android/speech/tts/TextToSpeech), apps targeting **Android 11** should declare [TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE](https://developer.android.com/reference/android/speech/tts/TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE) in the queries elements of their manifest:
36
-
37
- ```xml
38
- <queries>
39
- <intent>
40
- <action android:name="android.intent.action.TTS_SERVICE" />
41
- </intent>
42
- </queries>
43
- ```
44
-
45
- [Here](https://github.com/robingenz/capacitor-plugin-demo/commit/b7dc6c6d6652be9356d354df1faeb6a40e442797) you can find an example commit.
46
-
47
33
  ## Configuration
48
34
 
49
35
  No configuration required for this plugin.
@@ -1,2 +1,7 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <queries>
3
+ <intent>
4
+ <action android:name="android.intent.action.TTS_SERVICE" />
5
+ </intent>
6
+ </queries>
2
7
  </manifest>
@@ -13,7 +13,6 @@ import com.getcapacitor.JSArray;
13
13
  import com.getcapacitor.JSObject;
14
14
  import java.util.ArrayList;
15
15
  import java.util.Collections;
16
- import java.util.Comparator;
17
16
  import java.util.HashMap;
18
17
  import java.util.Locale;
19
18
  import java.util.Set;
@@ -116,6 +115,9 @@ public class TextToSpeech implements android.speech.tts.TextToSpeech.OnInitListe
116
115
  return result;
117
116
  }
118
117
 
118
+ /**
119
+ * @return Ordered list of voices. The order is guaranteed to remain the same as long as the voices in tts.getVoices() do not change.
120
+ */
119
121
  public ArrayList<Voice> getSupportedVoicesOrdered() {
120
122
  Set<Voice> supportedVoices = tts.getVoices();
121
123
  ArrayList<Voice> orderedVoices = new ArrayList<Voice>();
@@ -123,7 +125,8 @@ public class TextToSpeech implements android.speech.tts.TextToSpeech.OnInitListe
123
125
  orderedVoices.add(supportedVoice);
124
126
  }
125
127
 
126
- Collections.sort(orderedVoices, Comparator.comparing(Voice::hashCode));
128
+ //voice.getName() is guaranteed to be unique, so will be used for sorting.
129
+ Collections.sort(orderedVoices, (v1, v2) -> v1.getName().compareTo(v2.getName()));
127
130
 
128
131
  return orderedVoices;
129
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/text-to-speech",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Capacitor plugin for synthesizing speech from text.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",