fix:切换主题风格后会 “自动跳转最近阅读”
This commit is contained in:
1 parent
242fba70e8
commit
cc8008e7e3
1 file changed
+8
-2
@@ -66,6 +66,8 @@ import kotlin.coroutines.suspendCoroutine
|
|||||||
open class MainActivity : BaseComposeActivity(), VariableDialog.Callback {
|
open class MainActivity : BaseComposeActivity(), VariableDialog.Callback {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private var isFirstLaunch = true
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
var hasActiveReadBookRoute: Boolean = false
|
var hasActiveReadBookRoute: Boolean = false
|
||||||
|
|
||||||
@@ -142,7 +144,6 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback {
|
|||||||
private val routeEvents = MutableSharedFlow<NavKey>(extraBufferCapacity = 1)
|
private val routeEvents = MutableSharedFlow<NavKey>(extraBufferCapacity = 1)
|
||||||
private var bookInfoVariableSetter: ((String, String?) -> Unit)? = null
|
private var bookInfoVariableSetter: ((String, String?) -> Unit)? = null
|
||||||
internal var activeReadBookInputHandler: ReadBookInputHandler? = null
|
internal var activeReadBookInputHandler: ReadBookInputHandler? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
installSplashScreen()
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -193,9 +194,11 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback {
|
|||||||
|
|
||||||
val startRoutes = remember {
|
val startRoutes = remember {
|
||||||
val resolved = MainNavigator.resolveStartRoute(intent)
|
val resolved = MainNavigator.resolveStartRoute(intent)
|
||||||
if (OtherConfig.defaultToRead && resolved == MainRouteHome) {
|
if (isFirstLaunch && OtherConfig.defaultToRead && resolved == MainRouteHome) {
|
||||||
|
isFirstLaunch = false
|
||||||
arrayOf(MainRouteHome, MainRouteReadBook())
|
arrayOf(MainRouteHome, MainRouteReadBook())
|
||||||
} else {
|
} else {
|
||||||
|
isFirstLaunch = false
|
||||||
arrayOf(resolved)
|
arrayOf(resolved)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,6 +422,9 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback {
|
|||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
if (!isChangingConfigurations) {
|
||||||
|
isFirstLaunch = true
|
||||||
|
}
|
||||||
Coroutine.async {
|
Coroutine.async {
|
||||||
BookHelp.clearInvalidCache()
|
BookHelp.clearInvalidCache()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user