Skip to content

Commit

Permalink
fix:修复pop逻辑错误 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Angdo committed Mar 19, 2020
1 parent 0505660 commit e86d540
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Expand Up @@ -74,15 +74,20 @@ internal object NavigationController {
val record = PageRouteStack.last()
record.resultParams = params
record.animated = animated
record.poppedResult?.get()?.let { it(record.resultParams) }
PageRouteStack.pop(record)
onPop(record) { check(it) { "flutter must not pop fail" } }
val intent = Intent(context, record.clazz)
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
context.startActivity(intent)
action = RouteAction.NONE
result(true)
onPop(record) {
action = RouteAction.NONE
result(it)
if (!it) {
// Flutter WillPopScope is false
return@onPop
}
record.poppedResult?.get()?.let { it(record.resultParams) }
PageRouteStack.pop(record)
val intent = Intent(context, record.clazz)
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
context.startActivity(intent)
}
}

private fun onPop(record: PageRoute, result: Result) {
Expand Down
Expand Up @@ -128,6 +128,9 @@ internal class ReceiveChannel(private val id: String) : MethodChannel.MethodCall
"popTo" -> popTo(call, result)
/** notify **/
"notify" -> notify(call, result)
/** setPopDisabled **/
"setPopDisabled" -> {
}
/** hotRestart **/
"hotRestart" -> {

Expand Down

0 comments on commit e86d540

Please sign in to comment.