Xamarin.forms: Essentials Dependency API Swapfest

Created on 10 Mar 2020  路  3Comments  路  Source: xamarin/Xamarin.Forms

What's This?!

In light of Forms taking on the dependency on Essentials (see #9926), we now have a lot of APIs that can be replaced by a call to Essentials to deduplicate our code. This issue will be a living document for a while where we will first index all the APIs that are suitable for replacement and from there start replacing each one of them in separate PRs.

Awesome! How Can I Help?

If you come across an API in Forms from which you know there is an equivalent in Essentials, leave a comment under this issue. We will check it out, add it to the list and give you a big thank you!

As the list grows, there might also be some relatively easy contributions in here. Please check with a comment first if the API you are eyeballing is not yet in progress, if not, we will confirm and put your name on it. We do expect you to finish it within reasonable time, else we will take over.

Ping us again with the PR here (and mention this issue in the PR itself) and we'll make sure it gets looked at and we update the list. Easy-peasy!

The APIs

(I wish I could do this in a proper table, but that won't allow me to use fancy checkmarks 馃槩)

| Done? | API Forms | API Essentials | In Progress By / PR # |
|:------:| -------------- | ----- | -----:|

  • [x] | Application.RequestedTheme | AppInfo.RequestedTheme | #9926 |
  • [ ] | Device.Idiom | DeviceInfo.Idiom | |
  • [ ] | Device.BeginInvokeOnMainThread | MainThread.BeginInvokeOnMainThread | |
  • [ ] | Device.InvokeOnMainThreadAsync | MainThread.InvokeOnMainThreadAsync | |
  • [ ] | Device.InvokeOnMainThreadAsync | MainThread.InvokeOnMainThreadAsync | |
  • [ ] | Xamarin.Forms.Forms.Context | Platform.CurrentActivity (Android) | |
  • [ ] | Xamarin.Forms.Forms.Context | Platform.AppContext (Android) | |
  • [ ] | Application.Properties | Preferences | |

Most helpful comment

Xamarin.Forms API | Xamarin.Essentials API
Application.Properties | Preferences

All 3 comments

Xamarin.Forms API | Xamarin.Essentials API
Device.BeginInvokeOnMainThread | MainThread.BeginInvokeOnMainThread
Device.InvokeOnMainThreadAsync | MainThread.InvokeOnMainThreadAsync
Device.InvokeOnMainThreadAsync | MainThread.InvokeOnMainThreadAsync
Xamarin.Forms.Forms.Context|Platform.CurrentActivity (Android)
Xamarin.Forms.Forms.Context |Plataform.AppContext (Android)

Xamarin.Forms API | Xamarin.Essentials API
Application.Properties | Preferences

Change of plans, will revisit later

Was this page helpful?
0 / 5 - 0 ratings