@focus8/expo-acapela-tts 0.1.6 → 0.1.11

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.
Files changed (33) hide show
  1. package/.eslintrc.js +0 -0
  2. package/README.md +0 -0
  3. package/android/build.gradle +7 -0
  4. package/android/libs/acattsandroid-sdk-library-release.aar +0 -0
  5. package/android/src/main/AndroidManifest.xml +0 -0
  6. package/android/src/main/java/expo/modules/acapelatts/ExpoAcapelaTtsModule.kt +22 -7
  7. package/android/src/main/jniLibs/arm64-v8a/libacattsandroid.so +0 -0
  8. package/android/src/main/jniLibs/armeabi-v7a/libacattsandroid.so +0 -0
  9. package/android/src/main/jniLibs/x86/libacattsandroid.so +0 -0
  10. package/android/src/main/jniLibs/x86_64/libacattsandroid.so +0 -0
  11. package/build/ExpoAcapelaTts.types.d.ts +0 -0
  12. package/build/ExpoAcapelaTts.types.d.ts.map +0 -0
  13. package/build/ExpoAcapelaTts.types.js +0 -0
  14. package/build/ExpoAcapelaTts.types.js.map +0 -0
  15. package/build/ExpoAcapelaTtsModule.android.d.ts +1 -1
  16. package/build/ExpoAcapelaTtsModule.android.d.ts.map +0 -0
  17. package/build/ExpoAcapelaTtsModule.android.js +0 -0
  18. package/build/ExpoAcapelaTtsModule.android.js.map +1 -1
  19. package/build/ExpoAcapelaTtsModule.d.ts +1 -1
  20. package/build/ExpoAcapelaTtsModule.d.ts.map +0 -0
  21. package/build/ExpoAcapelaTtsModule.js +0 -0
  22. package/build/ExpoAcapelaTtsModule.js.map +1 -1
  23. package/build/index.d.ts +0 -0
  24. package/build/index.d.ts.map +0 -0
  25. package/build/index.js +0 -0
  26. package/build/index.js.map +0 -0
  27. package/expo-module.config.json +0 -0
  28. package/package.json +1 -1
  29. package/src/ExpoAcapelaTts.types.ts +0 -0
  30. package/src/ExpoAcapelaTtsModule.android.ts +1 -1
  31. package/src/ExpoAcapelaTtsModule.ts +1 -1
  32. package/src/index.ts +0 -0
  33. package/tsconfig.json +0 -0
package/.eslintrc.js CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -32,6 +32,13 @@ android {
32
32
  defaultConfig {
33
33
  versionCode 1
34
34
  versionName "0.1.0"
35
+
36
+ buildConfigField "long", "ACAPELA_USER_ID", "${System.getenv('ACAPELA_USER_ID') ?: '0'}L"
37
+ buildConfigField "long", "ACAPELA_PASSWORD", "${System.getenv('ACAPELA_PASSWORD') ?: '0'}L"
38
+ buildConfigField "String", "ACAPELA_LICENSE_KEY", "\"${System.getenv('ACAPELA_LICENSE_KEY') ?: ''}\""
39
+ }
40
+ buildFeatures {
41
+ buildConfig true
35
42
  }
36
43
  lintOptions {
37
44
  abortOnError false
File without changes
@@ -113,11 +113,11 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
113
113
  }
114
114
  }
115
115
 
116
- Function("setLicense") { userId: Long, password: Long, key: String ->
117
- licenseUserId = userId
118
- licensePassword = password
116
+ Function("setLicense") { userIdStr: String, passwordStr: String, key: String ->
117
+ licenseUserId = java.lang.Long.decode(userIdStr)
118
+ licensePassword = java.lang.Long.decode(passwordStr)
119
119
  licenseKey = key
120
- logInfo("License set")
120
+ logInfo("License set: userId=0x${java.lang.Long.toHexString(licenseUserId!!)} password=0x${java.lang.Long.toHexString(licensePassword!!)}")
121
121
  }
122
122
 
123
123
  AsyncFunction("initializeAsync") {
@@ -131,8 +131,13 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
131
131
  return@AsyncFunction true
132
132
  }
133
133
 
134
- if (licenseUserId == null || licensePassword == null || licenseKey == null) {
135
- logWarning("Cannot initialize: license not set. Call setLicense() first.")
134
+ // Use BuildConfig values as fallback if setLicense() was not called from JS
135
+ val uid = licenseUserId ?: BuildConfig.ACAPELA_USER_ID
136
+ val pwd = licensePassword ?: BuildConfig.ACAPELA_PASSWORD
137
+ val key = licenseKey ?: BuildConfig.ACAPELA_LICENSE_KEY
138
+
139
+ if (uid == 0L || key.isNullOrEmpty()) {
140
+ logWarning("Cannot initialize: no license configured (neither via setLicense() nor BuildConfig)")
136
141
  return@AsyncFunction false
137
142
  }
138
143
 
@@ -144,7 +149,13 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
144
149
 
145
150
  tts = acattsandroid(context, this@ExpoAcapelaTtsModule, null)
146
151
  tts!!.setLog(true)
147
- tts!!.setLicense(licenseUserId!!, licensePassword!!, licenseKey)
152
+ logInfo("setLicense userId=0x${java.lang.Long.toHexString(uid)} password=0x${java.lang.Long.toHexString(pwd)} keyLength=${key?.length}")
153
+ tts!!.setLicense(uid, pwd, key)
154
+
155
+ // Store for re-use after getVoicesList
156
+ licenseUserId = uid
157
+ licensePassword = pwd
158
+ licenseKey = key
148
159
 
149
160
  val version = tts!!.version
150
161
  logInfo("Initialized, SDK version: $version")
@@ -178,6 +189,10 @@ class ExpoAcapelaTtsModule : Module(), iTTSEventsCallback {
178
189
  }
179
190
  }
180
191
  val voicesList = tts!!.getVoicesList(voiceDirPaths) ?: emptyArray()
192
+ // Re-set license after getVoicesList as it may reset internal state
193
+ if (licenseUserId != null && licensePassword != null && licenseKey != null) {
194
+ tts!!.setLicense(licenseUserId!!, licensePassword!!, licenseKey)
195
+ }
181
196
  logInfo("Found ${voicesList.size} voices")
182
197
  for (v in voicesList) {
183
198
  logInfo(" Voice: $v")
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,7 +5,7 @@ declare class ExpoAcapelaTtsModule extends NativeModule<ExpoAcapelaTtsModuleEven
5
5
  hasStoragePermission(): boolean;
6
6
  requestStoragePermissionAsync(): Promise<boolean>;
7
7
  addVoicePath(path: string): void;
8
- setLicense(userId: number, password: number, key: string): void;
8
+ setLicense(userId: string, password: string, key: string): void;
9
9
  initializeAsync(): Promise<boolean>;
10
10
  getVoicesAsync(): Promise<AcapelaVoice[]>;
11
11
  loadVoiceAsync(voiceName: string): Promise<boolean>;
File without changes
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAcapelaTtsModule.android.js","sourceRoot":"","sources":["../src/ExpoAcapelaTtsModule.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAyBzD,eAAe,mBAAmB,CAAuB,gBAAgB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport {\n AcapelaVoice,\n ExpoAcapelaTtsModuleEvents,\n} from './ExpoAcapelaTts.types';\n\ndeclare class ExpoAcapelaTtsModule extends NativeModule<ExpoAcapelaTtsModuleEvents> {\n isAvailable(): boolean;\n hasStoragePermission(): boolean;\n requestStoragePermissionAsync(): Promise<boolean>;\n addVoicePath(path: string): void;\n setLicense(userId: number, password: number, key: string): void;\n initializeAsync(): Promise<boolean>;\n getVoicesAsync(): Promise<AcapelaVoice[]>;\n loadVoiceAsync(voiceName: string): Promise<boolean>;\n speakAsync(text: string): Promise<number>;\n stop(): void;\n isSpeaking(): boolean;\n setSpeechRate(rate: number): void;\n setPitch(pitch: number): void;\n setAudioBoost(boost: number): void;\n shutdownAsync(): Promise<void>;\n}\n\nexport default requireNativeModule<ExpoAcapelaTtsModule>('ExpoAcapelaTts');\n"]}
1
+ {"version":3,"file":"ExpoAcapelaTtsModule.android.js","sourceRoot":"","sources":["../src/ExpoAcapelaTtsModule.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAyBzD,eAAe,mBAAmB,CAAuB,gBAAgB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport {\n AcapelaVoice,\n ExpoAcapelaTtsModuleEvents,\n} from './ExpoAcapelaTts.types';\n\ndeclare class ExpoAcapelaTtsModule extends NativeModule<ExpoAcapelaTtsModuleEvents> {\n isAvailable(): boolean;\n hasStoragePermission(): boolean;\n requestStoragePermissionAsync(): Promise<boolean>;\n addVoicePath(path: string): void;\n setLicense(userId: string, password: string, key: string): void;\n initializeAsync(): Promise<boolean>;\n getVoicesAsync(): Promise<AcapelaVoice[]>;\n loadVoiceAsync(voiceName: string): Promise<boolean>;\n speakAsync(text: string): Promise<number>;\n stop(): void;\n isSpeaking(): boolean;\n setSpeechRate(rate: number): void;\n setPitch(pitch: number): void;\n setAudioBoost(boost: number): void;\n shutdownAsync(): Promise<void>;\n}\n\nexport default requireNativeModule<ExpoAcapelaTtsModule>('ExpoAcapelaTts');\n"]}
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  hasStoragePermission(): boolean;
4
4
  requestStoragePermissionAsync(): Promise<boolean>;
5
5
  addVoicePath(_path: string): void;
6
- setLicense(_userId: number, _password: number, _key: string): void;
6
+ setLicense(_userId: string, _password: string, _key: string): void;
7
7
  initializeAsync(): Promise<boolean>;
8
8
  getVoicesAsync(): Promise<never[]>;
9
9
  loadVoiceAsync(_voiceName: string): Promise<boolean>;
File without changes
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAcapelaTtsModule.js","sourceRoot":"","sources":["../src/ExpoAcapelaTtsModule.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,eAAe;IACb,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,oBAAoB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,YAAY,CAAC,KAAa,IAAG,CAAC;IAC9B,UAAU,CAAC,OAAe,EAAE,SAAiB,EAAE,IAAY,IAAG,CAAC;IAC/D,KAAK,CAAC,eAAe;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,UAAkB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,KAAI,CAAC;IACT,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IACD,aAAa,CAAC,KAAa,IAAG,CAAC;IAC/B,QAAQ,CAAC,MAAc,IAAG,CAAC;IAC3B,aAAa,CAAC,MAAc,IAAG,CAAC;IAChC,KAAK,CAAC,aAAa,KAAI,CAAC;IACxB,WAAW;QACT,OAAO,EAAE,MAAM,KAAI,CAAC,EAAE,CAAC;IACzB,CAAC;IACD,eAAe,KAAI,CAAC;CACrB,CAAC","sourcesContent":["// No-op stub for non-Android platforms\nexport default {\n isAvailable(): boolean {\n return false;\n },\n hasStoragePermission(): boolean {\n return true;\n },\n async requestStoragePermissionAsync(): Promise<boolean> {\n return true;\n },\n addVoicePath(_path: string) {},\n setLicense(_userId: number, _password: number, _key: string) {},\n async initializeAsync(): Promise<boolean> {\n return false;\n },\n async getVoicesAsync() {\n return [];\n },\n async loadVoiceAsync(_voiceName: string): Promise<boolean> {\n return false;\n },\n async speakAsync(_text: string): Promise<number> {\n return -1;\n },\n stop() {},\n isSpeaking(): boolean {\n return false;\n },\n setSpeechRate(_rate: number) {},\n setPitch(_pitch: number) {},\n setAudioBoost(_boost: number) {},\n async shutdownAsync() {},\n addListener() {\n return { remove() {} };\n },\n removeListeners() {},\n};\n"]}
1
+ {"version":3,"file":"ExpoAcapelaTtsModule.js","sourceRoot":"","sources":["../src/ExpoAcapelaTtsModule.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,eAAe;IACb,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,oBAAoB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,YAAY,CAAC,KAAa,IAAG,CAAC;IAC9B,UAAU,CAAC,OAAe,EAAE,SAAiB,EAAE,IAAY,IAAG,CAAC;IAC/D,KAAK,CAAC,eAAe;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,UAAkB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,KAAI,CAAC;IACT,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IACD,aAAa,CAAC,KAAa,IAAG,CAAC;IAC/B,QAAQ,CAAC,MAAc,IAAG,CAAC;IAC3B,aAAa,CAAC,MAAc,IAAG,CAAC;IAChC,KAAK,CAAC,aAAa,KAAI,CAAC;IACxB,WAAW;QACT,OAAO,EAAE,MAAM,KAAI,CAAC,EAAE,CAAC;IACzB,CAAC;IACD,eAAe,KAAI,CAAC;CACrB,CAAC","sourcesContent":["// No-op stub for non-Android platforms\nexport default {\n isAvailable(): boolean {\n return false;\n },\n hasStoragePermission(): boolean {\n return true;\n },\n async requestStoragePermissionAsync(): Promise<boolean> {\n return true;\n },\n addVoicePath(_path: string) {},\n setLicense(_userId: string, _password: string, _key: string) {},\n async initializeAsync(): Promise<boolean> {\n return false;\n },\n async getVoicesAsync() {\n return [];\n },\n async loadVoiceAsync(_voiceName: string): Promise<boolean> {\n return false;\n },\n async speakAsync(_text: string): Promise<number> {\n return -1;\n },\n stop() {},\n isSpeaking(): boolean {\n return false;\n },\n setSpeechRate(_rate: number) {},\n setPitch(_pitch: number) {},\n setAudioBoost(_boost: number) {},\n async shutdownAsync() {},\n addListener() {\n return { remove() {} };\n },\n removeListeners() {},\n};\n"]}
package/build/index.d.ts CHANGED
File without changes
File without changes
package/build/index.js CHANGED
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@focus8/expo-acapela-tts",
3
- "version": "0.1.6",
3
+ "version": "0.1.11",
4
4
  "description": "Acapela TTS integration for Expo on Android",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
File without changes
@@ -10,7 +10,7 @@ declare class ExpoAcapelaTtsModule extends NativeModule<ExpoAcapelaTtsModuleEven
10
10
  hasStoragePermission(): boolean;
11
11
  requestStoragePermissionAsync(): Promise<boolean>;
12
12
  addVoicePath(path: string): void;
13
- setLicense(userId: number, password: number, key: string): void;
13
+ setLicense(userId: string, password: string, key: string): void;
14
14
  initializeAsync(): Promise<boolean>;
15
15
  getVoicesAsync(): Promise<AcapelaVoice[]>;
16
16
  loadVoiceAsync(voiceName: string): Promise<boolean>;
@@ -10,7 +10,7 @@ export default {
10
10
  return true;
11
11
  },
12
12
  addVoicePath(_path: string) {},
13
- setLicense(_userId: number, _password: number, _key: string) {},
13
+ setLicense(_userId: string, _password: string, _key: string) {},
14
14
  async initializeAsync(): Promise<boolean> {
15
15
  return false;
16
16
  },
package/src/index.ts CHANGED
File without changes
package/tsconfig.json CHANGED
File without changes