From bcb8d0f05f78feb797a7f4289b49fa0d3daead83 Mon Sep 17 00:00:00 2001 From: Kirill Zhdanovich Date: Thu, 29 Aug 2013 13:58:33 +0300 Subject: [PATCH] Added parameter that allows open pin url on balloon click --- README.md | 5 +++++ api/MapsWithMeAPI.h | 2 ++ api/MapsWithMeAPI.m | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 8af823a..17c0b6c 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,10 @@ Returns NO if MapsWithMe is not installed or outdated version doesn't support AP With this method you can check that user needs to install MapsWithMe and display your custom UI. Alternatively, you can do nothing and use built-in dialog which will offer users to install MapsWithMe. +### Set value if you want to open pin URL on balloon click (Available in 2.4.5) + + + (void) setOpenUrlOnBalloonClick:(BOOL)value; + ### [Sample Code][linkSample] ### Support @@ -150,6 +154,7 @@ Applications "talk" to each other using URL Scheme. API v1 supports the followin * **id** - any string you want to receive back in your app, OR alternatively, any valid URL which will be opened on *More Info* button click * **backurl** - usually, your unique app scheme to open back your app * **appname** - string to display in navigation bar on top of the map in MapsWithMe +* **balloonAction** - pass openUrlOnBalloonClick as a parameter, if you want to open pin url on balloon click(Usually pin url opens when "Show more info" button is pressed). (Available in 2.4.5) Note that you can display as many pins as you want, the only rule is that **ll** parameter comes before **n** and **id** for each point. diff --git a/api/MapsWithMeAPI.h b/api/MapsWithMeAPI.h index 160aad6..239404d 100644 --- a/api/MapsWithMeAPI.h +++ b/api/MapsWithMeAPI.h @@ -65,5 +65,7 @@ // Displays any number of pins + (BOOL) showPins:(NSArray *)pins; + (void) showMapsWithMeIsNotInstalledDialog; +// Set value = YES if you want to open pin URL on balloon click, default value is NO ++(void) setOpenUrlOnBalloonClick:(BOOL)value; @end diff --git a/api/MapsWithMeAPI.m b/api/MapsWithMeAPI.m index dc7ed14..9908d8a 100644 --- a/api/MapsWithMeAPI.m +++ b/api/MapsWithMeAPI.m @@ -31,6 +31,7 @@ #define MAPSWITHME_API_VERSION 1 static NSString * MWMUrlScheme = @"mapswithme://"; +static BOOL openUrlOnBalloonClick = NO; @implementation MWMPin @@ -173,6 +174,9 @@ static NSString * MWMUrlScheme = @"mapswithme://"; } } + if (openUrlOnBalloonClick) + [str appendString:@"&balloonAction=openUrlOnBalloonClick"]; + NSURL * url = [[NSURL alloc] initWithString:str]; [str release]; BOOL const result = [[UIApplication sharedApplication] openURL:url]; @@ -242,4 +246,9 @@ static NSString * mapsWithMeIsNotInstalledPage = [[[UIApplication sharedApplication] delegate].window.rootViewController presentModalViewController:navController animated:YES]; } ++(void) setOpenUrlOnBalloonClick:(BOOL)value +{ + openUrlOnBalloonClick = value; +} + @end