@focus8/expo-acapela-tts 0.1.3 → 0.1.5

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.
@@ -0,0 +1,10 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ xmlns:tools="http://schemas.android.com/tools">
3
+
4
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
5
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
6
+ tools:ignore="ScopedStorage" />
7
+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
8
+ tools:ignore="ScopedStorage" />
9
+
10
+ </manifest>
@@ -1,5 +1,7 @@
1
1
  package expo.modules.acapelatts
2
2
 
3
+ import android.os.Build
4
+ import android.os.Environment
3
5
  import android.util.Log
4
6
  import com.acapelagroup.android.tts.acattsandroid
5
7
  import com.acapelagroup.android.tts.acattsandroid.iTTSEventsCallback
@@ -12,7 +14,7 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
12
14
  private var tts: acattsandroid? = null
13
15
  private var isInitialized = false
14
16
  private var currentVoice: String? = null
15
- private var voicePaths = mutableListOf("/system/media/voices", "/data/media/voices")
17
+ private var voicePaths = mutableListOf("/sdcard/voices", "/system/media/voices", "/data/media/voices")
16
18
  private var licenseUserId: Long? = null
17
19
  private var licensePassword: Long? = null
18
20
  private var licenseKey: String? = null
@@ -39,6 +41,14 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
39
41
 
40
42
  Events("onSpeechStart", "onSpeechEnd", "onError")
41
43
 
44
+ Function("hasStoragePermission") {
45
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
46
+ Environment.isExternalStorageManager()
47
+ } else {
48
+ true
49
+ }
50
+ }
51
+
42
52
  Function("isAvailable") {
43
53
  if (!nativeLibLoaded) {
44
54
  return@Function false
@@ -117,8 +127,21 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
117
127
 
118
128
  try {
119
129
  val voiceDirPaths = voicePaths.toTypedArray()
130
+ logInfo("getVoicesAsync: scanning paths: ${voiceDirPaths.joinToString()}")
131
+ for (path in voiceDirPaths) {
132
+ val dir = java.io.File(path)
133
+ if (dir.exists()) {
134
+ val files = dir.list() ?: emptyArray()
135
+ logInfo(" Path $path: exists=${dir.exists()}, canRead=${dir.canRead()}, entries=${files.size}")
136
+ } else {
137
+ logInfo(" Path $path: does not exist")
138
+ }
139
+ }
120
140
  val voicesList = tts!!.getVoicesList(voiceDirPaths) ?: emptyArray()
121
141
  logInfo("Found ${voicesList.size} voices")
142
+ for (v in voicesList) {
143
+ logInfo(" Voice: $v")
144
+ }
122
145
 
123
146
  val voices = voicesList.map { voiceName ->
124
147
  val info = tts!!.getVoiceInfo(voiceName) ?: emptyMap()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@focus8/expo-acapela-tts",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Acapela TTS integration for Expo on Android",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",