diff --git a/Telegraph/TGLocationUtils.h b/Telegraph/TGLocationUtils.h index 38ccfbf7c..e82eeccf9 100644 --- a/Telegraph/TGLocationUtils.h +++ b/Telegraph/TGLocationUtils.h @@ -44,4 +44,6 @@ + (void)openWazeWithCoordinate:(CLLocationCoordinate2D)coordinate withDirections:(bool)withDirections; + (bool)isWazeInstalled; ++ (void)openSnappWithCoordinate:(CLLocationCoordinate2D)coordinate; ++ (bool)isSnappInstalled; @end diff --git a/Telegraph/TGLocationUtils.m b/Telegraph/TGLocationUtils.m index 31f77dc75..0a7f3a02b 100644 --- a/Telegraph/TGLocationUtils.m +++ b/Telegraph/TGLocationUtils.m @@ -320,4 +320,20 @@ + (bool)isWazeInstalled return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"waze://"]]; } +#pragma mark Snapp + ++ (void)openSnappWithCoordinate:(CLLocationCoordinate2D)coordinate +{ + NSURL *url = nil; + NSString *coordinatePair = [NSString stringWithFormat:@"%f,%f", coordinate.latitude, coordinate.longitude]; + + url = [NSURL URLWithString:[[NSString alloc] initWithFormat:@"snapp://ride/here/%@", coordinatePair]]; + [[UIApplication sharedApplication] openURL:url]; +} + ++ (bool)isSnappInstalled +{ + return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"snapp://"]]; +} + @end diff --git a/Telegraph/TGLocationViewController.m b/Telegraph/TGLocationViewController.m index ef9921230..4caf23ae7 100644 --- a/Telegraph/TGLocationViewController.m +++ b/Telegraph/TGLocationViewController.m @@ -212,6 +212,8 @@ - (void)actionsButtonPressed if ([TGLocationUtils isWazeInstalled]) [openInActions addObject:[[TGActionSheetAction alloc] initWithTitle:TGLocalized(@"Map.OpenInWaze") action:@"openInWaze"]]; + if ([TGLocationUtils isSnappInstalled]) + [openInActions addObject:[[TGActionSheetAction alloc] initWithTitle:@"Get a Ride With Snapp" action:@"openInSnapp"]]; TGActionSheetAction *cancelAction = [[TGActionSheetAction alloc] initWithTitle:TGLocalized(@"Common.Cancel") action:@"cancel" type:TGActionSheetActionTypeCancel]; @@ -266,6 +268,8 @@ - (void)_performActionSheetAction:(NSString *)action [TGLocationUtils openFoursquareWithVenueId:_venue.venueId]; else if ([action isEqualToString:@"openInWaze"]) [TGLocationUtils openWazeWithCoordinate:_location.coordinate withDirections:false]; + else if ([action isEqualToString:@"openInSnapp"]) + [TGLocationUtils openSnappWithCoordinate:_location.coordinate]; } - (void)trackingModePressed diff --git a/Telegraph/Telegraph-Info.plist b/Telegraph/Telegraph-Info.plist index 89d7f24c9..09944e870 100644 --- a/Telegraph/Telegraph-Info.plist +++ b/Telegraph/Telegraph-Info.plist @@ -108,7 +108,7 @@ CFBundleVersion - 55195 + 55206 LSApplicationCategoryType LSApplicationQueriesSchemes @@ -117,6 +117,7 @@ instagram googledrive comgooglemaps-x-callback + snapp foursquare here-location yandexmaps