Skip to content
This repository was archived by the owner on May 10, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Telegraph/TGLocationUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@
+ (void)openWazeWithCoordinate:(CLLocationCoordinate2D)coordinate withDirections:(bool)withDirections;
+ (bool)isWazeInstalled;

+ (void)openSnappWithCoordinate:(CLLocationCoordinate2D)coordinate;
+ (bool)isSnappInstalled;
@end
16 changes: 16 additions & 0 deletions Telegraph/TGLocationUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions Telegraph/TGLocationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Telegraph/Telegraph-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>55195</string>
<string>55206</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSApplicationQueriesSchemes</key>
Expand All @@ -117,6 +117,7 @@
<string>instagram</string>
<string>googledrive</string>
<string>comgooglemaps-x-callback</string>
<string>snapp</string>
<string>foursquare</string>
<string>here-location</string>
<string>yandexmaps</string>
Expand Down