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

Add Application.TryGetFeature, re-add new feature - IActivatableLifetime #14556

Merged
merged 10 commits into from
Mar 5, 2024

Conversation

maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Feb 9, 2024

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.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0044705-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0044709-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks
Copy link
Member

kekekeks commented Feb 9, 2024

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.

@maxkatz6
Copy link
Member Author

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.
And developer would react in the same way to these event - pause any background work, like media playback or, possibly, animations running.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0044773-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks
Copy link
Member

But I would say it's an expected behavior

It won't be consistent with other platforms where deactivation is an app-wide event.

# Conflicts:
#	src/Browser/Avalonia.Browser/BrowserSingleViewLifetime.cs
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0044932-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member Author

maxkatz6 commented Feb 20, 2024

It won't be consistent with other platforms where deactivation is an app-wide event.

@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.

@maxkatz6 maxkatz6 added the customer-priority Issue reported by a customer with a support agreement. label Feb 23, 2024
@maxkatz6
Copy link
Member Author

maxkatz6 commented Mar 5, 2024

Merging after @kekekeks verbal approval

@maxkatz6 maxkatz6 merged commit b9ec339 into master Mar 5, 2024
7 checks passed
@maxkatz6 maxkatz6 deleted the app-try-get-feature branch March 5, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-priority Issue reported by a customer with a support agreement. wont-backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants