Skip to content

Commit

Permalink
#3740 Read aloud will stop in closed tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagar0-0 committed Mar 12, 2024
1 parent e9768c6 commit cdf4a01
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ abstract class CoreReaderFragment :
@Inject
var painter: NightModeViewPainter? = null
protected var currentWebViewIndex = 0
private var currentTtsWebViewIndex = 0
protected var actionBar: ActionBar? = null
protected var mainMenu: MainMenu? = null

Expand Down Expand Up @@ -1045,6 +1046,7 @@ abstract class CoreReaderFragment :
}

private fun startReadAloud() {
currentTtsWebViewIndex = currentWebViewIndex

Check warning on line 1049 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1049

Added line #L1049 was not covered by tests
getCurrentWebView()?.let {
tts?.readAloud(it)
}
Expand Down Expand Up @@ -1192,7 +1194,7 @@ abstract class CoreReaderFragment :
}

private fun closeTab(index: Int) {
if (currentWebViewIndex == index) onReadAloudStop()
if (currentTtsWebViewIndex == index) onReadAloudStop()
tempZimFileForUndo = zimReaderContainer?.zimFile
tempWebViewForUndo = webViewList[index]
webViewList.removeAt(index)
Expand Down

0 comments on commit cdf4a01

Please sign in to comment.