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 Essentials Maps TryOpen #5834

Merged
merged 8 commits into from
Apr 20, 2022
Merged

Add Essentials Maps TryOpen #5834

merged 8 commits into from
Apr 20, 2022

Conversation

jfversluis
Copy link
Member

@jfversluis jfversluis commented Apr 5, 2022

Description of Change

Port from this Xamarin.Essentials PR here: xamarin/Essentials#1665

Note, this feature will not be merged in Essentials, but it was approved at the time, so I thought it might be a nice addition for .NET MAUI

  • Added Map.TryOpenAsync method for every Map.OpenAsync.
  • I also did some refactoring of this module to remove code duplication.
  • I contemplated that I could also add Map.CanOpenAsync. However, I'm not sure how to implement this on iOS.
  • I came across weird behavior on Android 11. I could run geo intent, however PackageManager.QueryIntentActivities() always returned me empty list for some reason. I did some research, and I think that it's necessary to add this intent to AndroidManifest, like all other intents.
    <intent> <action android:name="android.intent.action.VIEW" /> <data android:scheme="geo" /> </intent>
  • I'm not sure whether I should write some tests for this.

API Changes

Added:

  • Task<bool> TryOpenAsync(Location location)
  • Task<bool> TryOpenAsync(Location location, MapLaunchOptions options)
  • Task<bool> TryOpenAsync(double latitude, double longitude)
  • Task<bool> TryOpenAsync(double latitude, double longitude, MapLaunchOptions options)
  • Task<bool> TryOpenAsync(Placemark placemark)
  • Task<bool> TryOpenAsync(Placemark placemark, MapLaunchOptions options)

Issues Fixed

Original Xamarin.Essentials issue: xamarin/Essentials#1289

@Eilon Eilon added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Apr 5, 2022
@jfversluis
Copy link
Member Author

@mattleibow is there a specific reason that not all overloads are surfaced in the IMap??

@jfversluis jfversluis marked this pull request as ready for review April 5, 2022 19:58
@jfversluis
Copy link
Member Author

Do we want to have XML API docs for this? Do we generate that? How does it work?

@mattleibow
Copy link
Member

@mattleibow is there a specific reason that not all overloads are surfaced in the IMap??

Mostly because a lot are the same api, just different parameters. The overload are echoed via extension methods in the shared code.

@mattleibow
Copy link
Member

Do we want to have XML API docs for this? Do we generate that? How does it work?

Not yet for the interfaces. We need to. And the extension methods

@rmarinho rmarinho requested review from Redth and mattleibow April 8, 2022 09:26
@mattleibow mattleibow added this to the 6.0.300-rc.2 milestone Apr 20, 2022
@mattleibow mattleibow added the t/enhancement ☀️ New feature or request label Apr 20, 2022
@mattleibow mattleibow enabled auto-merge (squash) April 20, 2022 07:20
@Redth Redth modified the milestones: 6.0.300-rc.2, 6.0.300-rc.3 Apr 20, 2022
@mattleibow mattleibow merged commit 538ac4a into main Apr 20, 2022
@mattleibow mattleibow deleted the xe-1665-port branch April 20, 2022 16:10
@g0dpain
Copy link

g0dpain commented Nov 2, 2022

does this only check if some map is installed to be opened or should it open maps too?

@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2023
@samhouts samhouts added the fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! t/enhancement ☀️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants