Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9b25e71
Log everywhere I see onBackPressed... And it doesn't log anything!
justinmc Jan 27, 2023
b10efe3
Just hackily remove all usage of onBack, and predictive back does wor…
justinmc Jan 27, 2023
75d8e38
Undid all of the commenting and deleting and located the one call tha…
justinmc Jan 27, 2023
e8a5130
No logging verbose
justinmc Jan 27, 2023
9c0e7cc
WIP A platform channel API to declare that the nav stack is empty
justinmc Jan 28, 2023
205d1e5
navigationStackIsEmpty method to enable predictive back
justinmc Feb 1, 2023
66d1f84
Migrate to updateNavigationStackStatus, works for inner routes
justinmc Feb 9, 2023
9e8e230
Clean up logs and todos
justinmc Feb 9, 2023
0ed2bec
Rename hasMultiple to frameworkHandlesPop for clarity
justinmc Mar 7, 2023
2afbbad
Merge branch 'main' into predictive-back-root
justinmc Mar 7, 2023
8aeba57
Analyzer fix
justinmc Mar 7, 2023
5e89211
WIP some debugging
justinmc Apr 7, 2023
015f2a5
Merge branch 'main' into predictive-back-root
justinmc Apr 7, 2023
b7b2f17
Merge branch 'main' into predictive-back-root
justinmc May 12, 2023
6bc7d5e
Rename to frameworkHandlesBacks
justinmc May 26, 2023
01a22a2
Clean up
justinmc May 26, 2023
6f22009
Confirmed that it works on my old (API 24) samsung device
justinmc May 26, 2023
440a6ee
I dont think I need to modify flutterfragment(activity)
justinmc May 30, 2023
e075275
Tests and empty implementation for FlutterFragment
justinmc Jun 2, 2023
af98e2c
Merge remote-tracking branch 'upstream/main' into predictive-back-root
justinmc Jun 5, 2023
1db22e5
More specific name for hasRegisteredCallback
justinmc Jun 7, 2023
4701d66
Backs to Back
justinmc Jun 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Log everywhere I see onBackPressed... And it doesn't log anything!
  • Loading branch information
justinmc committed Jan 27, 2023
commit 9b25e716d253be3af50b11beb564dc5ded87f862
2 changes: 2 additions & 0 deletions shell/platform/android/io/flutter/app/FlutterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.os.Bundle;
import androidx.annotation.NonNull;
import io.flutter.app.FlutterActivityDelegate.ViewFactory;
import io.flutter.Log;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.view.FlutterNativeView;
import io.flutter.view.FlutterView;
Expand Down Expand Up @@ -111,6 +112,7 @@ protected void onDestroy() {

@Override
public void onBackPressed() {
Log.v("justin", "onBackPressed in FlutterActivity");
if (!eventDelegate.onBackPressed()) {
super.onBackPressed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ public void onDestroy() {

@Override
public boolean onBackPressed() {
Log.v("justin", "onBackPressed in FlutterActivityDelegate");
if (flutterView != null) {
flutterView.popRoute();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.view.FlutterNativeView;
import io.flutter.view.FlutterView;
import io.flutter.Log;

/**
* Deprecated class for activities that use Flutter who also require the use of the Android v4
Expand Down Expand Up @@ -101,6 +102,7 @@ protected void onDestroy() {

@Override
public void onBackPressed() {
Log.v("justin", "onBackPressed ok in FlutterFragmentActivity");
if (!eventDelegate.onBackPressed()) {
super.onBackPressed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ public void unregisterOnBackInvokedCallback() {
@SuppressWarnings("Override")
@Override
public void onBackInvoked() {
Log.v("justin", "calling onBackPressed in onBackInvokedCallback in FlutterActivity (embedder)");
onBackPressed();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ void onDetach() {
* <p>This method instructs Flutter's navigation system to "pop route".
*/
void onBackPressed() {
Log.v("justin", "onBackPressed in FlutterFragmentAndFragmentDelegate");
ensureAlive();
if (flutterEngine != null) {
Log.v(TAG, "Forwarding onBackPressed() to FlutterEngine.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ public FlutterActivityAndFragmentDelegate createDelegate(
new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
Log.v("justin", "calling onBackPressed in onBackPressedCallback in FlutterFragment (embedder)");
onBackPressed();
}
};
Expand Down Expand Up @@ -1200,6 +1201,7 @@ public void onNewIntent(@NonNull Intent intent) {
*/
@ActivityCallThrough
public void onBackPressed() {
Log.v("justin", "onBackPressed in FlutterFragment (embedder)");
if (stillAttachedForEvent("onBackPressed")) {
delegate.onBackPressed();
}
Expand Down Expand Up @@ -1643,6 +1645,7 @@ public boolean popSystemNavigator() {
// Unless we disable the callback, the dispatcher call will trigger it. This will then
// trigger the fragment's onBackPressed() implementation, which will call through to the
// dart side and likely call back through to this method, creating an infinite call loop.
Log.v("justin", "changine enabled on onBackPressedCallback");
onBackPressedCallback.setEnabled(false);
activity.getOnBackPressedDispatcher().onBackPressed();
onBackPressedCallback.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ protected void onNewIntent(@NonNull Intent intent) {

@Override
public void onBackPressed() {
Log.v("justin", "onBackPressed in FlutterFragmentActivity (embedder)");
flutterFragment.onBackPressed();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ private void popSystemNavigator() {
}

if (activity instanceof OnBackPressedDispatcherOwner) {
Log.v("justin", "calling onBackPressed in popSystemNavigator in PlatformPlugin");
((OnBackPressedDispatcherOwner) activity).getOnBackPressedDispatcher().onBackPressed();
} else {
activity.finish();
Expand Down