优化toast提示重复

pull/1463/head
gedoor 3 years ago
parent 49bfcc1be2
commit eb9581e655
  1. 7
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

@ -26,6 +26,7 @@ import java.io.IOException
import java.net.ConnectException import java.net.ConnectException
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import java.util.* import java.util.*
import javax.script.ScriptException
class HttpReadAloudService : BaseReadAloudService(), class HttpReadAloudService : BaseReadAloudService(),
MediaPlayer.OnPreparedListener, MediaPlayer.OnPreparedListener,
@ -167,6 +168,12 @@ class HttpReadAloudService : BaseReadAloudService(),
} catch (e: ConcurrentException) { } catch (e: ConcurrentException) {
removeSpeakCache(fileName) removeSpeakCache(fileName)
downloadAudio() downloadAudio()
} catch (e: ScriptException) {
AppLog.put("tts接口错误\n${e.localizedMessage}", e)
toastOnUi("js错误\n${e.localizedMessage}")
Timber.e(e)
cancel()
stopSelf()
} catch (e: SocketTimeoutException) { } catch (e: SocketTimeoutException) {
removeSpeakCache(fileName) removeSpeakCache(fileName)
downloadErrorNo++ downloadErrorNo++

Loading…
Cancel
Save