This repository has been archived by the owner on Aug 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This feature wasn't so much driven by specific user request as it is driven to replace the hacky workarounds I've seen users use to accomplish the same thing. Here are the key points of this commit: 1. Allows users to share the trip they are taking with another person via text message or any other form of communication vended through UIActivityViewController. 2. Trips are shared via URL. These URLs encode the ID of the region that their trips belong to, which means that they are globally unique. They also do not depend on individual OBA region servers, which means that the iOS app doesn't need region server information hardcoded into it. 3. People with OneBusAway for iOS are taken to the trip itself when they tap on one of these links. 4. People without OBA for iOS are taken first to http://onebusaway.co, and then redirected to the appropriate region server's web page for that trip. ------- Fixes: * Fixes #833 - 'Follow My Trip' Feature * Fixes #840 - Implement Deep Linking * Fixes #847 - Add option to delete individual recent stops ------- Deep Links/Shared Trips: * Deep link router class * Create OBATripDeepLink model object * Shared Trip infrastructure for model DAO and the user defaults-based persistence layer * Display shared trips on the Recent tab * Delete shared trips older than 24 hours * Make it possible to render the ArrivalAndDeparture controller from a Trip Deep Link object * Start overhauling OBANavigationTarget * Wire up navigation target stuff for OBARecentStopsViewController * Shoehorn in a way to launch differently in response to deep links. * Unify navigation target, deep link, and 3D Touch quick action navigation systems Miscellaneous: * Move -escapePathVariable into OBAURLHelpers * Fix credits - turns out that I didn't end up adding the credits.html file back to the project when I did the big project reorg last month. Oops. Cell Swiping: * Add third party library YMSwipeTableViewCell to allow us to display icons on swiped cells (only on the stop view controller for now!) * Improved swipe menu for departure rows on the stops controller Icons: * New bookmark icons * Massively improve tab bar icons * Update launch storyboard - remove text and ensure that the icons are the correct, new ones * Add full sized icons from Noun Project to the Resources folder
- Loading branch information
1 parent
924cfc7
commit 899d29f
Showing
97 changed files
with
2,714 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// NSURLQueryItem+OBAAdditions.h | ||
// OBAKit | ||
// | ||
// Created by Aaron Brethorst on 10/30/16. | ||
// Copyright © 2016 OneBusAway. All rights reserved. | ||
// | ||
|
||
@import Foundation; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NSURLQueryItem (OBAAdditions) | ||
+ (NSDictionary*)oba_dictionaryFromQueryItems:(nullable NSArray<NSURLQueryItem*>*)queryItems; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// NSURLQueryItem+OBAAdditions.m | ||
// OBAKit | ||
// | ||
// Created by Aaron Brethorst on 10/30/16. | ||
// Copyright © 2016 OneBusAway. All rights reserved. | ||
// | ||
|
||
#import <OBAKit/NSURLQueryItem+OBAAdditions.h> | ||
|
||
@implementation NSURLQueryItem (OBAAdditions) | ||
|
||
+ (NSDictionary*)oba_dictionaryFromQueryItems:(NSArray<NSURLQueryItem*>*)queryItems { | ||
if (queryItems.count == 0) { | ||
return @{}; | ||
} | ||
|
||
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; | ||
|
||
for (NSURLQueryItem *item in queryItems) { | ||
if (item.value) { | ||
dictionary[item.name] = item.value; | ||
} | ||
} | ||
|
||
return [NSDictionary dictionaryWithDictionary:dictionary]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// OBADeepLinkRouter.h | ||
// OBAKit | ||
// | ||
// Created by Aaron Brethorst on 10/28/16. | ||
// Copyright © 2016 OneBusAway. All rights reserved. | ||
// | ||
|
||
@import Foundation; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef void(^OBADeepLinkAction)(NSArray<NSString*> *matchGroupResults, NSURLComponents *URLComponents); | ||
|
||
@interface OBADeepLinkRouter : NSObject | ||
|
||
- (void)routePattern:(NSString*)pattern toAction:(OBADeepLinkAction)action; | ||
- (BOOL)performActionForURL:(NSURL*)URL; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// OBADeepLinkRouter.m | ||
// OBAKit | ||
// | ||
// Created by Aaron Brethorst on 10/28/16. | ||
// Copyright © 2016 OneBusAway. All rights reserved. | ||
// | ||
|
||
#import "OBADeepLinkRouter.h" | ||
|
||
@interface OBADeepLinkRouter () | ||
@property(nonatomic,strong) NSMutableDictionary *routes; | ||
@end | ||
|
||
@implementation OBADeepLinkRouter | ||
|
||
- (instancetype)init { | ||
self = [super init]; | ||
if (self) { | ||
_routes = [[NSMutableDictionary alloc] init]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)routePattern:(NSString*)pattern toAction:(OBADeepLinkAction)action { | ||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil]; | ||
self.routes[regex] = [action copy]; | ||
} | ||
|
||
- (BOOL)performActionForURL:(NSURL*)URL { | ||
NSArray *keys = [self.routes.allKeys copy]; | ||
NSURLComponents *URLComponents = [NSURLComponents componentsWithURL:URL resolvingAgainstBaseURL:NO]; | ||
NSString *path = URLComponents.path; | ||
|
||
for (NSRegularExpression *regex in keys) { | ||
NSTextCheckingResult *result = [regex firstMatchInString:path options:(NSMatchingOptions)0 range:NSMakeRange(0, path.length)]; | ||
|
||
if (result) { | ||
NSMutableArray *matchValues = [NSMutableArray new]; | ||
|
||
for (NSUInteger i=1; i<result.numberOfRanges; i++) { | ||
NSString *value = [path substringWithRange:[result rangeAtIndex:i]]; | ||
[matchValues addObject:value]; | ||
} | ||
|
||
OBADeepLinkAction action = self.routes[regex]; | ||
action([matchValues copy], URLComponents); | ||
|
||
return YES; | ||
} | ||
} | ||
|
||
return NO; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.