diff --git a/IntentKit.podspec b/IntentKit.podspec index bbcdc8d..7f86da6 100644 --- a/IntentKit.podspec +++ b/IntentKit.podspec @@ -30,7 +30,7 @@ Pod::Spec.new do |s| s.subspec 'Maps' do |ss| ss.dependency 'IntentKit/Core' ss.source_files = 'IntentKit/Handlers/INKMapsHandler.{h,m}' - ss.resource_bundles = { 'IntentKit-INKMapsHandler' => "IntentKit/Apps/{Maps,Google Maps,Waze}/*.{plist,png}" } + ss.resource_bundles = { 'IntentKit-INKMapsHandler' => "IntentKit/Apps/{Maps,Google Maps,Waze,CityMapper}/*.{plist,png}" } ss.requires_arc = true end diff --git a/IntentKit/Apps/CityMapper/CityMapper.plist b/IntentKit/Apps/CityMapper/CityMapper.plist new file mode 100644 index 0000000..e764192 --- /dev/null +++ b/IntentKit/Apps/CityMapper/CityMapper.plist @@ -0,0 +1,17 @@ + + + + + name + CityMapper + actions + + directionsFrom:to:mode: + citymapper://directions?startcoord={{from}}&endcoord={{to}} + searchForLocation: + citymapper://directions?endcoord={{center}}&endname={{query}} + openLocation:title: + citymapper://directions?endcoord={{coordinate}}&endname={{title}} + + + diff --git a/IntentKit/Apps/CityMapper/CityMapper.png b/IntentKit/Apps/CityMapper/CityMapper.png new file mode 100644 index 0000000..b9648e8 Binary files /dev/null and b/IntentKit/Apps/CityMapper/CityMapper.png differ diff --git a/IntentKit/Apps/CityMapper/CityMapper@2x.png b/IntentKit/Apps/CityMapper/CityMapper@2x.png new file mode 100644 index 0000000..38bee27 Binary files /dev/null and b/IntentKit/Apps/CityMapper/CityMapper@2x.png differ diff --git a/IntentKit/Apps/CityMapper/CityMapper@2x~ipad.png b/IntentKit/Apps/CityMapper/CityMapper@2x~ipad.png new file mode 100644 index 0000000..2e2a944 Binary files /dev/null and b/IntentKit/Apps/CityMapper/CityMapper@2x~ipad.png differ diff --git a/IntentKit/Apps/CityMapper/CityMapper~ipad.png b/IntentKit/Apps/CityMapper/CityMapper~ipad.png new file mode 100644 index 0000000..f09a6b9 Binary files /dev/null and b/IntentKit/Apps/CityMapper/CityMapper~ipad.png differ diff --git a/IntentKit/Apps/Google Maps/Google Maps.plist b/IntentKit/Apps/Google Maps/Google Maps.plist index 2e2b031..096268c 100644 --- a/IntentKit/Apps/Google Maps/Google Maps.plist +++ b/IntentKit/Apps/Google Maps/Google Maps.plist @@ -17,6 +17,8 @@ comgooglemaps://?saddr={{from}}&daddr={{to}}&directionsmode={{mode}} searchForLocation: comgooglemaps://?q={{query}} + openLocation:title: + comgooglemaps://?q={{coordinate}} diff --git a/IntentKit/Apps/Maps/Maps.plist b/IntentKit/Apps/Maps/Maps.plist index a94389a..3664589 100644 --- a/IntentKit/Apps/Maps/Maps.plist +++ b/IntentKit/Apps/Maps/Maps.plist @@ -12,6 +12,8 @@ Plans nl Kaarten + es + Mapas optional @@ -26,6 +28,8 @@ http://maps.apple.com/?saddr={{from}}&daddr={{to}} searchForLocation: http://maps.apple.com/?q={{query}} + openLocation:title: + http://maps.apple.com/?q={{title}}&ll={{coordinate}} diff --git a/IntentKit/Apps/Waze/Waze.plist b/IntentKit/Apps/Waze/Waze.plist index ea47643..98ea93f 100644 --- a/IntentKit/Apps/Waze/Waze.plist +++ b/IntentKit/Apps/Waze/Waze.plist @@ -8,6 +8,10 @@ directionsFrom:to:mode: waze://?ll={{to}}&navigate=yes + openLocation:title: + waze://?ll={{coordinate}} + searchForLocation: + waze://?q={{query}} diff --git a/IntentKit/Handlers/INKMapsHandler.h b/IntentKit/Handlers/INKMapsHandler.h index b0ca3a3..2212967 100644 --- a/IntentKit/Handlers/INKMapsHandler.h +++ b/IntentKit/Handlers/INKMapsHandler.h @@ -50,7 +50,6 @@ typedef NS_ENUM(NSInteger, INKMapsHandlerDirectionsMode) { @return A `INKActivityPresenter` object to present. @warning This does not currently verify that an application can support multiple modes of transportation. If you pick an application that doesn't support the mode of transporation you've asked for, that application will likely ignore that part of the request. */ - - (INKActivityPresenter *)directionsFrom:(NSString *)from to:(NSString *)to mode:(INKMapsHandlerDirectionsMode)mode; /** Brings up turn-by-turn driving directions between two locations @@ -60,4 +59,13 @@ typedef NS_ENUM(NSInteger, INKMapsHandlerDirectionsMode) { @see directionsFrom:to:mode: */ - (INKActivityPresenter *)directionsFrom:(NSString *)from to:(NSString *)to; + +/** Opens a specific point in a map + + @param coordinate Coordinate to open + @param title String Name of the location. Note that some providers can not display name + @return A `INKActivityPresenter` object to present. */ +- (INKActivityPresenter *)openLocation:(CLLocationCoordinate2D)coordinate title:(NSString *)title; + + @end diff --git a/IntentKit/Handlers/INKMapsHandler.m b/IntentKit/Handlers/INKMapsHandler.m index dc98220..e420a44 100644 --- a/IntentKit/Handlers/INKMapsHandler.m +++ b/IntentKit/Handlers/INKMapsHandler.m @@ -56,6 +56,17 @@ - (INKActivityPresenter *)directionsFrom:(NSString *)from to:(NSString *)to { return [self directionsFrom:from to:to mode:INKMapsHandlerDirectionsModeDriving]; } + +- (INKActivityPresenter *)openLocation:(CLLocationCoordinate2D)coordinate title:(NSString *)title { + NSString *command = NSStringFromSelector(_cmd); + NSDictionary *args = [self argsDictionaryWithDictionary: @{ + @"title": title, + @"coordinate": [NSString stringWithFormat:@"%f,%f", coordinate.latitude, coordinate.longitude] + }]; + + return [self performCommand:command withArguments:args]; +} + #pragma mark - Private methods - (NSDictionary *)argsDictionaryWithDictionary:(NSDictionary *)args { NSMutableDictionary *newArgs = [args mutableCopy];