-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add Application.TryGetFeature, re-add new feature - IActivatableLifetime #14556
Conversation
You can test this PR using the following package version. |
You can test this PR using the following package version. |
Quick question: how does "activation" works with Android when media gallery or camera activity get requested? It would make our activity to be "deactivated", IIRC. |
Correct. But I would say it's an expected behavior, as activity is not anymore in the user view. As per Android documentation, OnStop - "Activity is no longer visible", and OnStart - "Activity is active again". Same logic can be applied to the Avalonia events. |
You can test this PR using the following package version. |
It won't be consistent with other platforms where deactivation is an app-wide event. |
# Conflicts: # src/Browser/Avalonia.Browser/BrowserSingleViewLifetime.cs
You can test this PR using the following package version. |
@kekekeks the only other option would be to not implement this API on Android at all, which is still valid. The problem is, we don't have a Scene/Window API for mobile, to handle it on per-activity level as well. Right now, in this PR, we assume, that root main activity represents the app. That's where these events are raised. Which isn't exactly correct for these situations when user might decide to manually create activities and completely skip conventional Avalonia initialization there. That's where it is different from other platforms, where it is in fact global. But I still don't see issue with child activities (such as file dialogs), as no events are raised from them - only main activity is hidden or shown as visibility to user is changed, and that's excepted imo. |
Merging after @kekekeks verbal approval |
What does the pull request do?
Partially redoing #14106 in a form of different API. While keeping ABI compatibility (old interface is a no-op now though).
And restoring #14492 changes.
Now instead of using optional Application.Lifetime, this feature can be accessed from Application.TryGetFeature.
Obsoletions / Deprecations
Old interface is obsolete and marked as error, with hints on new API.