Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:修复pop逻辑错误 #6

Merged
merged 1 commit into from Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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