-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(android): prevent showing base activity #13889
Conversation
…30729_android_window_close
…30729_android_window_close
…v/titanium-sdk into 230729_android_window_close
@m1ga We are currently testing this, but needed some other adjustments done by @prashantsaini1 to support Gradle 8 properly. |
@@ -190,6 +190,24 @@ public static boolean firstOnActivityStack() | |||
public static void addToActivityStack(Activity activity) | |||
{ | |||
if (activity != null) { | |||
if (!isDevelopment && activityStack.size() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this hack might be a symthome of not using the best possible solution. According to both Apple and Google, apps should have the same core-functionality between dev and prod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only need it for Liveview as that needs the first activity not to be closed to restart the app. But we don't have a way to check for Liveview, that's why I've used dev/prod to do the check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, then @prashantsaini1 will know what to do. It's still odd to have this check, but looking at Liveview it may make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it works without it but Liveview will look a bit different as you'll see the home screen and then it will launch again. I don't like the dev/prod difference either 😄 Let's see what Prashant will find 👍
So I checked this PR today a bit more and found following observations:
So to fix @m1ga issue, you can just set
|
I would need to test that. But it still leaves us with the issue that when you use
From my old tests it looked more like a race condition because when you close the windows slowly/normally it works fine; only when you close both fast and you close the root window in the time frame that the internal "close" animation was still running it will end up with the base activity still open. So my guess was more that it was still running some code before it cleared itself from the stack. That's why my solution was to have it not even there anymore so when you close the root window there is no chance to end up at the base activity. As a side effect the |
I also found the same behaviour that windows closing flow runs in a race condition, which is why I didn't prefer any other solution. |
@prashantsaini1 I've added the line in this PR: #14150 That should fix the closing + showing the base activity issue. Then we can look at the |
fixes #13791
Steps to reproduce
more infos in the ticket
Update
I've changed the PR a bit. Instead of checking the stuff when closing the window I'll do it when adding a new activity. If we have more then one and the first one is still TiRootActivity (the launch screen) then it will be removed. This also helps you add
<application android:enableOnBackInvokedCallback="true"/>
in your tiapp.xml to enable Androids new predictive back feature. This way it will show the dashboard instead of the icon!NOTE:
It will only run in a production build. It looks like LiveView needs it so it can restart the app without loading the whole app again.
If you test it make sure to build a dist-playstore app!