@dr33m/react-native-readium 5.0.0-rc.20 → 5.0.0-rc.21

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.
@@ -274,12 +274,12 @@ abstract class BaseReaderFragment : Fragment() {
274
274
  fun ttsSkipPrevious() { ttsManager?.skipPrevious() }
275
275
 
276
276
  private fun applyTTSDecoration(locator: Locator) {
277
- if (!isNavigatorReady) return
278
- val decorableNavigator = navigator as? DecorableNavigator ?: return
279
- val viewScope = viewLifecycleOwner.lifecycleScope
280
- viewScope.launch {
281
- decorableNavigator.applyDecorations(
282
- listOf(
277
+ // Route through the public applyDecorations so the "tts" group is registered
278
+ // via addDecorationListener before the first applyDecorations call — Readium
279
+ // silently ignores decorations for groups that have no registered listener.
280
+ applyDecorations(
281
+ mapOf(
282
+ "tts" to listOf(
283
283
  Decoration(
284
284
  id = "tts-current",
285
285
  locator = locator,
@@ -287,19 +287,13 @@ abstract class BaseReaderFragment : Fragment() {
287
287
  tint = android.graphics.Color.argb(89, 0xF2, 0xCA, 0x50) // #f2ca50 @ 35%
288
288
  )
289
289
  )
290
- ),
291
- "tts"
290
+ )
292
291
  )
293
- }
292
+ )
294
293
  }
295
294
 
296
295
  private fun clearTTSDecoration() {
297
- if (!isNavigatorReady) return
298
- val decorableNavigator = navigator as? DecorableNavigator ?: return
299
- val viewScope = viewLifecycleOwner.lifecycleScope
300
- viewScope.launch {
301
- decorableNavigator.applyDecorations(emptyList(), "tts")
302
- }
296
+ applyDecorations(mapOf("tts" to emptyList()))
303
297
  }
304
298
 
305
299
  override fun onDestroyView() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dr33m/react-native-readium",
3
- "version": "5.0.0-rc.20",
3
+ "version": "5.0.0-rc.21",
4
4
  "description": "A react-native wrapper for https://readium.org/",
5
5
  "main": "lib/src/index",
6
6
  "types": "lib/src/index.d.ts",