organicmaps icon indicating copy to clipboard operation
organicmaps copied to clipboard

[ios] Share location from OM to other apps

Open biodranik opened this issue 2 years ago • 24 comments

  1. Google Maps
  2. Apple Maps
  3. Tesla app
  4. ...

Let's investigate which formats should be supported and how to better implement them. Together with #7173 it will be easier to switch between apps and migrate/use necessary missing features.

biodranik avatar Jan 15 '24 08:01 biodranik

Hi I am trying to solve but while setting up the project I am getting this error. How to solve it? Screenshot 2024-01-21 at 9 55 17 AM

aniket-singh-01 avatar Jan 21 '24 04:01 aniket-singh-01

@biodranik it's impossible to share the location using the sharing activity controller with the other apps. Because we are sharing the text (link or coordinates). And the apple cannot determine which app should handle the text (link or coodrinates).

goolemaps, apple maps etc don't support any formats - you can see that it impossible to share anything into this apps. They only support the deeplinks.

Possible solution Is to make the list of the apps that we want to share location directly, build the deeplink and open via the UIApplication.openURL(link).

For example:

self.viewController?.openUrl("https://www.google.com/maps/search/?api=1&query=\(self.placePageData.locationCoordinate.latitude),\(self.placePageData.locationCoordinate.longitude)", inSafari: true)

will handle the link as:

https://github.com/organicmaps/organicmaps/assets/79797627/c527db4a-957b-4e21-b1bc-f0c6afb2a473

kirylkaveryn avatar Jun 04 '24 14:06 kirylkaveryn

Thanks! Advertising other maps apps from Organic Maps looks like a controversial feature. We may need some better ideas.

biodranik avatar Jun 04 '24 14:06 biodranik

How to build URLs for Apple Maps: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html#//apple_ref/doc/uid/TP40007899-CH5-SW1

biodranik avatar Jun 10 '24 20:06 biodranik

Thanks! Advertising other maps apps from Organic Maps looks like a controversial feature. We may need some better ideas.

Using other map apps alongside Organic Maps is absolutely a legit use case. For instance, I prefer to use Organic Maps as my primary app, but often I switch to others (e.g., Google Maps, Waze, Yandex) for navigation/reviews/comments. I'll open another app anyway, with or without this button. However, without this button the probability that I stick with another app is actually higher because the current way of switching from Organic to another app is inconvenient. Yes, I know that competitors also try to lock down users, but Organic Maps is a healthy, open app that doesn't need to follow suit.

rtsisyk avatar Jun 18 '24 15:06 rtsisyk

Here is the rough design with 3 variants of how we can implement this feature:

https://www.figma.com/design/tbIeaE9ixXpDW875A3gpd6/OM-ShareToApp?node-id=0-1&t=nvi1vvA8ZH5jsNwT-1

@biodranik @oleg-rswll @rtsisyk please leave your comments!

kirylkaveryn avatar Jun 19 '24 08:06 kirylkaveryn

Option 2.1 looks ok. Mixing displayed coordinates and opening them in apps looks too complex (option 1). Option 2 won't work well with many apps too.

The important thing is to detect apps that are present on a device and only show them if they are installed.

biodranik avatar Jun 19 '24 08:06 biodranik

Option 2.1 looks ok. Mixing displayed coordinates and opening them in apps looks too complex (option 1). Option 2 won't work well with many apps too.

The important thing is to detect apps that are present on a device and only show them if they are installed.

Thanks! If we accept this option I'll start the development.

  1. Also we should prepare the list of applications that we will try to handle (google, apple, ...?).

  2. And should we store the target apps icons? The Telegrams implementation is tricky and uses the app ID to fetch the app logos from the appstore website. So this approach is not offline. Should we store the target applications icons in the bundle?

kirylkaveryn avatar Jun 19 '24 14:06 kirylkaveryn

Here is the rough design with 3 variants of how we can implement this feature:

https://www.figma.com/design/tbIeaE9ixXpDW875A3gpd6/OM-ShareToApp?node-id=0-1&t=nvi1vvA8ZH5jsNwT-1

@biodranik @oleg-rswll @rtsisyk please leave your comments!

Option 2.1 looks good to me.

rtsisyk avatar Jun 21 '24 07:06 rtsisyk

Option 2.1 looks ok. Mixing displayed coordinates and opening them in apps looks too complex (option 1). Option 2 won't work well with many apps too. The important thing is to detect apps that are present on a device and only show them if they are installed.

Thanks! If we accept this option I'll start the development.

  1. Also we should prepare the list of applications that we will try to handle (google, apple, ...?).

Let me prepare a draft.

  1. And should we store the target apps icons? The Telegrams implementation is tricky and uses the app ID to fetch the app logos from the appstore website. So this approach is not offline. Should we store the target applications icons in the bundle?

I don't see any issues with storing other apps icons. Let's keep things simple.

rtsisyk avatar Jun 21 '24 07:06 rtsisyk

My ask for apps:

rtsisyk avatar Jun 21 '24 07:06 rtsisyk

@JustFxDev input from #5262:

Originally posted by @JustFxDev in https://github.com/organicmaps/organicmaps/issues/5626#issuecomment-2154686636

Hi, i think starting Google Maps directly from Organic Maps with hand over of the coordinates to start that app in the right mode is a must have feature.

I'um using Organic Maps as my one stop places /poi storage system. e.g. on vacation or while traveling i have all me destination points / POIs in organic maps. Some of them are destinations to go by car. I use Google as my favorite navigation system for driveing by car. It has the best traffic and traffic jam informations at the moment.

On a walk or bike ride i prefere Organic Maps. Sometimes i also use osmand.

I'am sure this is not a special need by me. I think even more that organic map should be able to call other navigation apps as well. For e. g. the Park4Night Travel App presents the user 8 (!) different Navigations Apps to start navigation to a place i've found in the app to stay for a night...

It does not matter if the call to other apps is done by Apple sharing button or by an extra menu / button.

At the moment Apple sharing from Organic Maps to Google Maps App is, from my point of view, broken. This is not a complain! Just my feeling on this.

I'am using the beta app and i can help to test things. If i can provide other kind of support just let my know! Unfortunately i have not the skills to contribute code to Organic Maps. I'am able to develop but not in C or Java.

Originally posted by @JustFxDev in https://github.com/organicmaps/organicmaps/issues/5626#issuecomment-2162440126

Hi,

i would like to suggest a possible "solution". At the moment i can toggle possible strings for a waypoint and copy that string by long press to the clipboard.

IMG_739873607832

Maybe one can add a function to handover that string to iOS (or Android) to handle that string. In this example: "Open the browser with that string". This may lead to open the https://... link in the webbrowser instead of copy, open browser, past link.

So we just have to

  • add a button to excute a function with that string
  • create an array of strings (already there, but to be exptened)
  • and information what to to with that string (hand over to OS, call an App...
  • Excecute the function with that string on button press

What do you think?

rtsisyk avatar Jun 21 '24 08:06 rtsisyk

Hi!

Thanks for investigating this topic further!

I would like to adjust my inital idea:

At the moment the visble string is copied to the clipboard by doing a long press on it

Maybe an other option on long press might be:

  • do not copy to clipbard
  • instead open a local menu with all possible calls like ** Copy string to clipboard ** Open Google Maps with the string (coordinates) ** Open "name of app" with that string...

Maybe this is more easy and fast to implement

Later on in let's say "advanced option" one can add own calls to that menu... :-)

Cheers, Fx

JustFxDev avatar Jun 21 '24 08:06 JustFxDev

Thanks for your feedback!! Please take a look at option 2.1 in https://www.figma.com/design/tbIeaE9ixXpDW875A3gpd6/OM-ShareToApp?node-id=0-1&t=nvi1vvA8ZH5jsNwT-1.

rtsisyk avatar Jun 21 '24 08:06 rtsisyk

I tried that befor i posted my comment. But figma.com does not load. It complains my firefox is to old. But i'am using the very latest version....

So i could not look into it. I try with an other browser or without addins :-))

JustFxDev avatar Jun 21 '24 08:06 JustFxDev

Ha! I managed to open it. Options 2.1 and 2.2 are great!

JustFxDev avatar Jun 21 '24 08:06 JustFxDev

I've designed the 3rd variant with the new cell under the coordinates: https://www.figma.com/design/tbIeaE9ixXpDW875A3gpd6/OM-ShareToApp?node-id=0-1&t=AMq3nRXB06N4NYCC-1

image

kirylkaveryn avatar Jun 24 '24 15:06 kirylkaveryn

Option 2.1 looks good. Storing icons of competitors locally makes more sense than requiring being online. If icons change, they can be updated in the following release.

@kiryl Moving the share button to the top right of the Place Page would align it with the Android version, and would place it where a share icon is quite common for many apps. Looks like a good idea. Adding a separate row in Place Page is probably not necessary with the Share icon already there.

Currently on iOS, when selecting the Share button, it displays contacts on the second line, on the third line apps to open in (looks like most communication apps like messaging and email apps), and below that option for Copy and other app integrations. Can a section be added between contacts and messaging apps for the "Open in" apps?

oleg-rswll avatar Jun 25 '24 02:06 oleg-rswll

image

oleg-rswll avatar Jun 25 '24 02:06 oleg-rswll

Currently on iOS, when selecting the Share button, it displays contacts on the second line, on the third line apps to open in (looks like most communication apps like messaging and email apps), and below that option for Copy and other app integrations. Can a section be added between contacts and messaging apps for the "Open in" apps?

This share screen is fully composed by the system based on the applications that can handle the "data type" (text, image, kml etc) that we pass into it. There is no possibility to edit/compose/directly affect on this share screen.

So the one possible solution is to leave the Share button as it is (and move to the right corner) but introduce a new button with proper description. This solution will not affect the default sharing.

kirylkaveryn avatar Jun 25 '24 07:06 kirylkaveryn

To avoid the icon looking too similar to the share button, how about the icon having arrow pointing to the upper right, something more like this: https://icon-library.com/images/open-window-icon/open-window-icon-1.jpg

This option should probably be below the "Edit Place" button since it doesn't have anything to do with OSM data or bookmark data.

About the feature name, could be: "Open place location in..."

oleg-rswll avatar Jun 25 '24 14:06 oleg-rswll

What about using icons of apps (maybe with their names below) where the coordinate will open, in a horizontal carousel (like in the current system sharing), with a text label "Check this place in:" placed above the carousel?

biodranik avatar Jun 25 '24 20:06 biodranik

with a text label "Check this place in:"

"To check" seems rather specific to me (i.e. the user could do verifying, comparing). Maybe just "Open place in App:" (what the button actually does)?

Misalf-git avatar Jun 26 '24 00:06 Misalf-git

Absolutely need Waze, since I imagine the main use case to be using live traffic navigation. They have documentation on deep links: https://developers.google.com/waze/deeplinks/

Also I agree with @oleg-rswll that a generic "Open in…" icon would be better than app icons.

I designed one, please take a look:

0-open-in

euf avatar Jun 30 '24 12:06 euf

WDYT about adding www.openstreetmap.org to the options? It would help contributors see related data like history or subtags. Does it make sense to put it in here and would it be possible or better to put that apart?

patepelo avatar Jun 30 '24 21:06 patepelo

Giving this more thought, it may be better to use the selector without the logos https://www.figma.com/file/tbIeaE9ixXpDW875A3gpd6?node-id=6:150&locale=en&type=design#844935958

  • Even without logos, there would still be useful integration, but no focus on competitor branding.
  • Apps like Yelp, when selecting a navigation app, show only names of the apps, not the logos.
  • Without logos, there is no need to maintain updates of images when logos change.
  • OM doesn’t even have OSM branding in the Place Page, even though OSM data is used there and an OMS logo would be useful to see. So displaying big tech logos is probably not necessary, just names are enough.

oleg-rswll avatar Jul 01 '24 13:07 oleg-rswll

Only texts are okay. The UX becomes more complicated when the list of apps is very long...

biodranik avatar Jul 01 '24 22:07 biodranik