From d012b7e7cf6adb697770165e4ff90d2506f6c005 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 4 Jul 2013 20:44:10 +0300 Subject: [PATCH] [ios][api] Added simple showMap api call --- api/iOS/src/MapsWithMeAPI.h | 2 ++ api/iOS/src/MapsWithMeAPI.m | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/api/iOS/src/MapsWithMeAPI.h b/api/iOS/src/MapsWithMeAPI.h index 3a111c80ef..f11b3a07f6 100644 --- a/api/iOS/src/MapsWithMeAPI.h +++ b/api/iOS/src/MapsWithMeAPI.h @@ -55,6 +55,8 @@ + (MWMPin *) pinFromUrl:(NSURL *)url; // returns NO if MapsWithMe is not installed or outdated version doesn't support API calls + (BOOL) isApiSupported; +// Simply opens MapsWithMe app ++ (BOOL) showMap; // Displays given point on a map, title and id are optional // If id contains valid url, it will be opened from MapsWithMe after selecting "More Details..." for the pin + (BOOL) showLat:(double)lat lon:(double)lon title:(NSString *)optionalTitle id:(NSString *)optionalId; diff --git a/api/iOS/src/MapsWithMeAPI.m b/api/iOS/src/MapsWithMeAPI.m index 8058654301..5bbe4e6b2f 100644 --- a/api/iOS/src/MapsWithMeAPI.m +++ b/api/iOS/src/MapsWithMeAPI.m @@ -127,6 +127,11 @@ static NSString * MWMUrlScheme = @"mapswithme://"; return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:MWMUrlScheme]]; } ++ (BOOL) showMap +{ + return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[MWMUrlScheme stringByAppendingFormat:@"map?v=%d", MAPSWITHME_API_VERSION]]]; +} + + (BOOL) showLat:(double)lat lon:(double)lon title:(NSString *)optionalTitle id:(NSString *)optionalId { MWMPin * pin = [[[MWMPin alloc] initWithLat:lat lon:lon title:optionalTitle id:optionalId] autorelease];