@dr33m/react-native-readium 5.0.0-rc.20 → 5.0.0-rc.22
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.
|
@@ -276,30 +276,28 @@ abstract class BaseReaderFragment : Fragment() {
|
|
|
276
276
|
private fun applyTTSDecoration(locator: Locator) {
|
|
277
277
|
if (!isNavigatorReady) return
|
|
278
278
|
val decorableNavigator = navigator as? DecorableNavigator ?: return
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
// Call applyDecorations directly — it is a regular (non-suspend) function in
|
|
280
|
+
// Readium 3.x. The test app (VisualReaderFragment) does the same: no launch {},
|
|
281
|
+
// no channel routing. Wrapping in viewScope.launch defers the call to the next
|
|
282
|
+
// dispatch cycle and was preventing the highlight from ever appearing.
|
|
283
|
+
decorableNavigator.applyDecorations(
|
|
284
|
+
listOf(
|
|
285
|
+
Decoration(
|
|
286
|
+
id = "tts",
|
|
287
|
+
locator = locator,
|
|
288
|
+
style = Decoration.Style.Highlight(
|
|
289
|
+
tint = android.graphics.Color.argb(89, 0xF2, 0xCA, 0x50) // #f2ca50 @ 35%
|
|
289
290
|
)
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
)
|
|
292
|
+
),
|
|
293
|
+
"tts"
|
|
294
|
+
)
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
private fun clearTTSDecoration() {
|
|
297
298
|
if (!isNavigatorReady) return
|
|
298
299
|
val decorableNavigator = navigator as? DecorableNavigator ?: return
|
|
299
|
-
|
|
300
|
-
viewScope.launch {
|
|
301
|
-
decorableNavigator.applyDecorations(emptyList(), "tts")
|
|
302
|
-
}
|
|
300
|
+
decorableNavigator.applyDecorations(emptyList(), "tts")
|
|
303
301
|
}
|
|
304
302
|
|
|
305
303
|
override fun onDestroyView() {
|