Skip to content

Commit

Permalink
Added TestFligt SDK with crash reporting and checkpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Sutula committed Nov 3, 2012
1 parent f1b94db commit e3296bc
Show file tree
Hide file tree
Showing 14 changed files with 600 additions and 9 deletions.
32 changes: 29 additions & 3 deletions OpenTripPlanner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
93B179C0162BBAB400F09EC6 /* OTPUnitFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B179BF162BBAB400F09EC6 /* OTPUnitFormatter.m */; };
93B179C3162BC69C00F09EC6 /* OTPUnitData.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B179C2162BC69C00F09EC6 /* OTPUnitData.m */; };
93B179C6162D253000F09EC6 /* OTPStepCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B179C5162D252F00F09EC6 /* OTPStepCell.m */; };
93EA08D3164582A500705096 /* libTestFlight.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 93EA08CF164582A500705096 /* libTestFlight.a */; };
93EA08D4164582A500705096 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 93EA08D0164582A500705096 /* README.md */; };
93EA08D5164582A500705096 /* release_notes.md in Resources */ = {isa = PBXBuildFile; fileRef = 93EA08D1164582A500705096 /* release_notes.md */; };
CC088DE915F6A3B400C6F372 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC088DE815F6A3B400C6F372 /* MapKit.framework */; };
CC0A1F6416038F6B003085B2 /* FacingView.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0A1F5516038F6B003085B2 /* FacingView.m */; };
CC0A1F6516038F6B003085B2 /* FoldView.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0A1F5716038F6B003085B2 /* FoldView.m */; };
Expand Down Expand Up @@ -388,6 +391,10 @@
93B179C2162BC69C00F09EC6 /* OTPUnitData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTPUnitData.m; sourceTree = "<group>"; };
93B179C4162D252F00F09EC6 /* OTPStepCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTPStepCell.h; sourceTree = "<group>"; };
93B179C5162D252F00F09EC6 /* OTPStepCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTPStepCell.m; sourceTree = "<group>"; };
93EA08CF164582A500705096 /* libTestFlight.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTestFlight.a; sourceTree = "<group>"; };
93EA08D0164582A500705096 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
93EA08D1164582A500705096 /* release_notes.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = release_notes.md; sourceTree = "<group>"; };
93EA08D2164582A500705096 /* TestFlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestFlight.h; sourceTree = "<group>"; };
CC088DE215F6932500C6F372 /* RoutingCoverage.geojson */ = {isa = PBXFileReference; lastKnownFileType = text; path = RoutingCoverage.geojson; sourceTree = "<group>"; };
CC088DE815F6A3B400C6F372 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
CC0A1F5416038F6B003085B2 /* FacingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacingView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -667,6 +674,7 @@
CCCDFB6815EEAAC600B26133 /* UIKit.framework in Frameworks */,
CCCDFB6A15EEAAC600B26133 /* Foundation.framework in Frameworks */,
CCCDFB6C15EEAAC600B26133 /* CoreGraphics.framework in Frameworks */,
93EA08D3164582A500705096 /* libTestFlight.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -709,8 +717,6 @@
CC0A1F761603AB3C003085B2 /* OTPItineraryViewController.m */,
CCF66A3A1631CAC3007A9634 /* OTPItineraryDurationView.h */,
CCF66A3B1631CAC3007A9634 /* OTPItineraryDurationView.m */,
1CE5C57C162C672E001E83D3 /* OTPItineraryCollectionView.h */,
1CE5C57D162C672E001E83D3 /* OTPItineraryCollectionView.m */,
0D8259AD164431FD00D5F446 /* Cells */,
CC231798162F628D00EE0F48 /* PPRevealSideViewController.h */,
CC231799162F628D00EE0F48 /* PPRevealSideViewController.m */,
Expand Down Expand Up @@ -818,6 +824,17 @@
name = Products;
sourceTree = "<group>";
};
93EA08CE164582A500705096 /* TestFlightSDK1 */ = {
isa = PBXGroup;
children = (
93EA08CF164582A500705096 /* libTestFlight.a */,
93EA08D0164582A500705096 /* README.md */,
93EA08D1164582A500705096 /* release_notes.md */,
93EA08D2164582A500705096 /* TestFlight.h */,
);
path = TestFlightSDK1;
sourceTree = "<group>";
};
CC0A1F5316038F6A003085B2 /* PaperFold */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1072,6 +1089,8 @@
CCBCD5251639BE8C00037B29 /* Itinerary List View */ = {
isa = PBXGroup;
children = (
1CE5C57C162C672E001E83D3 /* OTPItineraryCollectionView.h */,
1CE5C57D162C672E001E83D3 /* OTPItineraryCollectionView.m */,
CC8D354015F922E500CA158D /* OTPTransitTimesViewController.h */,
CC8D354115F922E500CA158D /* OTPTransitTimesViewController.m */,
);
Expand All @@ -1081,6 +1100,7 @@
CCCDFB5815EEAAC600B26133 = {
isa = PBXGroup;
children = (
93EA08CE164582A500705096 /* TestFlightSDK1 */,
9378876A16154AF2007CF24C /* MapView.xcodeproj */,
9378874416154865007CF24C /* RestKit.xcodeproj */,
CC0A1F781603B47A003085B2 /* XYOrigami */,
Expand Down Expand Up @@ -1489,6 +1509,8 @@
0D4553E516432356006D4A3B /* popup-walk.png in Resources */,
0D4553E616432356006D4A3B /* [email protected] in Resources */,
0D4553E716432356006D4A3B /* transfer_walk.png in Resources */,
93EA08D4164582A500705096 /* README.md in Resources */,
93EA08D5164582A500705096 /* release_notes.md in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1648,6 +1670,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1661,7 +1684,7 @@
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand All @@ -1670,6 +1693,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -1690,6 +1714,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SDKROOT)/usr/lib/system\"",
"\"$(SRCROOT)/TestFlightSDK1\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1717,6 +1742,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SDKROOT)/usr/lib/system\"",
"\"$(SRCROOT)/TestFlightSDK1\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down
2 changes: 2 additions & 0 deletions OpenTripPlanner/OTPAboutViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ @implementation OTPAboutViewController

- (void)viewDidLoad
{
[TestFlight passCheckpoint:@"ABOUT"];

[super viewDidLoad];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: @"http://www.joyrideit.com/THANKS.txt"]
Expand Down
8 changes: 8 additions & 0 deletions OpenTripPlanner/OTPAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ @implementation OTPAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#define TESTING 1
#ifdef TESTING
[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
#endif
[TestFlight takeOff:@"b6cabd426fa7b67e7671bfb043872d5f_MTI1NzEzMjAxMi0wOC0yNyAxNDo1NToyNy43MjE2MDk"];

// RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace);
// RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);

Expand Down Expand Up @@ -108,6 +114,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

if ([MKDirectionsRequest isDirectionsRequestURL:url]) {
[TestFlight passCheckpoint:@"LAUNCHED_BY_URL"];

MKDirectionsRequest* directionsInfo = [[MKDirectionsRequest alloc] initWithContentsOfURL:url];
// TO DO: Plot and display the route using the
// source and destination properties of directionsInfo.
Expand Down
19 changes: 16 additions & 3 deletions OpenTripPlanner/OTPDirectionsInputViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ - (void)viewDidLoad

- (void)go:(id)sender
{
[TestFlight passCheckpoint:@"DIRECTIONS_GO"];
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.labelText = @"Routing";
Expand Down Expand Up @@ -306,6 +307,8 @@ - (void)geocodeStringInTextField:(OTPGeocodedTextField *)textField

- (void)switchFromAndTo:(id)sender
{
[TestFlight passCheckpoint:@"DIRECTIONS_SWITCH_FROM_TO"];

[self.fromTextField switchValuesWithOther];

RMAnnotation *tmpAnnotation = _fromAnnotation;
Expand All @@ -319,6 +322,7 @@ - (void)switchFromAndTo:(id)sender
}

- (IBAction)modeChanged:(id)sender {
[TestFlight passCheckpoint:@"DIRECTIONS_CHANGE_MODE"];
if (((UISegmentedControl *)sender).selectedSegmentIndex < 2) {
self.timeButton.enabled = YES;
} else {
Expand All @@ -328,6 +332,7 @@ - (IBAction)modeChanged:(id)sender {

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[TestFlight passCheckpoint:@"DIRECTIONS_DID_TYPE_INTO_TEXTFIELD"];
[self panMapToCurrentGeocodedTextField];
}

Expand Down Expand Up @@ -366,6 +371,7 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField

- (void)panToUserLocation:(id)sender
{
[TestFlight passCheckpoint:@"DIRECTIONS_PAN_TO_USER_LOCATION"];
self.needsPanToUserLocation = YES;
[self enableUserLocation];
}
Expand Down Expand Up @@ -430,6 +436,7 @@ - (void)mapView:(RMMapView *)mapView didUpdateUserLocation:(RMUserLocation *)use
- (void)mapView:(RMMapView *)mapView didFailToLocateUserWithError:(NSError *)error
{
// Alert user that location couldn't be detirmined.
[TestFlight passCheckpoint:@"DIRECTIONS_FAILED_TO_LOCATE_USER"];
}

- (void)singleTapOnMap:(RMMapView *)map at:(CGPoint)point
Expand All @@ -451,8 +458,10 @@ - (void)longSingleTapOnMap:(RMMapView *)map at:(CGPoint)point
} else if (!self.toTextField.isGeocoded) {
textField = self.toTextField;
} else {
[TestFlight passCheckpoint:@"DIRECTIONS_LONG_TAP_NO_PIN_ALLOWED"];
return;
}
[TestFlight passCheckpoint:@"DIRECTIONS_LONG_TAP_DROP_PIN"];
[self updateTextField:textField withText:@"Dropped Pin" andLocation:location];
}

Expand Down Expand Up @@ -502,6 +511,7 @@ - (void)mapView:(RMMapView *)map didDragAnnotation:(RMAnnotation *)annotation wi

- (void)mapView:(RMMapView *)map didEndDragAnnotation:(RMAnnotation *)annotation
{
[TestFlight passCheckpoint:@"DIRECTIONS_DRAGGED_PIN"];
annotation.coordinate = [map pixelToCoordinate:annotation.position];
_dragOffset = 0;

Expand Down Expand Up @@ -545,13 +555,15 @@ - (void)transitTimeViewController:(OTPTransitTimeViewController *)transitTimeVie

- (void)request:(RKRequest*)request didLoadResponse:(RKResponse*)response
{
NSLog(@"Loaded payload: %@", [response bodyAsString]);
[TestFlight passCheckpoint:@"DIRECTIONS_RECEIVED_RESPONSE_FROM_API"];
//NSLog(@"Loaded payload: %@", [response bodyAsString]);
_OTPResponse = response;
}

- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects
{
NSLog(@"Loaded plan: %@", objects);
[TestFlight passCheckpoint:@"DIRECTIONS_LOADED_PLAN_FROM_API_RESPONSE"];
//NSLog(@"Loaded plan: %@", objects);
[HUD hide:YES];

currentPlan = (Plan*)[objects objectAtIndex:0];
Expand All @@ -560,7 +572,8 @@ - (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)obje

- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error
{
NSLog(@"Hit error: %@", error);
//NSLog(@"Hit error: %@", error);
[TestFlight passCheckpoint:@"DIRECTIONS_RECEIVED_ERROR_FROM_API"];
[HUD hide:YES];

if(_OTPResponse != nil) {
Expand Down
1 change: 1 addition & 0 deletions OpenTripPlanner/OTPItineraryMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ - (void)viewDidLoad

- (void)panToUserLocation:(id)sender
{
[TestFlight passCheckpoint:@"ITINERARY_PAN_TO_USER_LOCATION"];
self.needsPanToUserLocation = YES;
[self enableUserLocation];
}
Expand Down
9 changes: 8 additions & 1 deletion OpenTripPlanner/OTPItineraryTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}

if (indexPath.row == 0) {
[TestFlight passCheckpoint:@"ITINERARY_DISPLAY_OVERVIEW"];
[UIView animateWithDuration:0.3 animations:^{
self.itineraryMapViewController.instructionLabel.center = CGPointMake(self.itineraryMapViewController.instructionLabel.center.x, self.itineraryMapViewController.instructionLabel.center.y - self.itineraryMapViewController.instructionLabel.bounds.size.height);
} completion:^(BOOL finished) {
Expand All @@ -436,12 +437,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[self displayItineraryOverview];

} else if (self.itinerary.legs.count != 1 && indexPath.row == self.itinerary.legs.count + 1) {
[TestFlight passCheckpoint:@"ITINERARY_DISPLAY_ARRIVAL"];
[self displayItineraryOverview]; // for final arrival info cell

//TODO: change to center to final destination point

} else if (self.itinerary.legs.count == 1 && ((Leg *)[self.itinerary.legs objectAtIndex:0]).steps.count > 0) {

[TestFlight passCheckpoint:@"ITINERARY_DISPLAY_STEP"];
if (indexPath.row == ((Leg *)[self.itinerary.legs objectAtIndex:0]).steps.count + 1) {
// for final arrival info cell
[self displayItineraryOverview];
Expand Down Expand Up @@ -482,6 +484,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[self.itineraryMapViewController.mapView setCenterCoordinate:CLLocationCoordinate2DMake(step.lat.doubleValue, step.lon.doubleValue) animated:YES];
}
} else {
[TestFlight passCheckpoint:@"ITINERARY_DISPLAY_LEG"];
[self resetLegsWithColor:[UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5]];
RMShape *shape = [_shapesForLegs objectAtIndex:indexPath.row - 1];
shape.lineColor = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];
Expand Down Expand Up @@ -518,13 +521,17 @@ - (void)pprevealSideViewController:(PPRevealSideViewController *)controller didP
{
mapShowing = YES;
if (_selectedIndexPath == nil) {
[TestFlight passCheckpoint:@"ITINERARY_SHOW_MAP_WITH_SWIPE"];
_selectedIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
} else {
[TestFlight passCheckpoint:@"ITINERARY_SHOW_MAP_FROM_TAP"];
}
[self.tableView selectRowAtIndexPath:_selectedIndexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
}

- (void)pprevealSideViewController:(PPRevealSideViewController *)controller didPopToController:(UIViewController *)centerController
{
[TestFlight passCheckpoint:@"ITINERARY_HIDE_MAP_WITH_SWIPE"];
mapShowing = NO;
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
Expand Down
6 changes: 4 additions & 2 deletions OpenTripPlanner/OTPItineraryViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ - (void)didReceiveMemoryWarning
// Dispose of any resources that can be recreated.
}

- (IBAction)done:(UIBarButtonItem *)sender {
- (IBAction)done:(UIBarButtonItem *)sender
{
[TestFlight passCheckpoint:@"ITINERARY_DONE"];
[self dismissModalViewControllerAnimated:YES];
}
}

@end
3 changes: 3 additions & 0 deletions OpenTripPlanner/OTPTransitTimeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

- (void)viewDidLoad
{
[TestFlight passCheckpoint:@"PARAMS_OPEN"];
[super viewDidLoad];
// Do any additional setup after loading the view.
self.datePicker.date = self.date;
Expand All @@ -39,11 +40,13 @@ - (void)didReceiveMemoryWarning

- (void)cancel:(id)sender
{
[TestFlight passCheckpoint:@"PARAMS_CANCEL"];
[self dismissModalViewControllerAnimated:YES];
}

- (void)done:(id)sender
{
[TestFlight passCheckpoint:@"PARAMS_DONE"];
if ([self.delegate conformsToProtocol:@protocol(OTPTransitTimeViewControllerDelegate)]) {
[self.delegate transitTimeViewController:self
didChooseArrivingOrDepartingIndex:[NSNumber numberWithInt:self.arrivingOrDepartingControl.selectedSegmentIndex]
Expand Down
3 changes: 3 additions & 0 deletions OpenTripPlanner/OTPTransitTimesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ - (id)initWithStyle:(UITableViewStyle)style

- (void)viewDidLoad
{
[TestFlight passCheckpoint:@"ITINERARIES_VIEW"];
[super viewDidLoad];

_modeIcons = @{
Expand Down Expand Up @@ -243,6 +244,7 @@ - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[TestFlight passCheckpoint:@"ITINERARIES_SELECTED_ONE"];
NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];

OTPItineraryViewController *vc = (OTPItineraryViewController *)((UINavigationController *)segue.destinationViewController);
Expand All @@ -255,6 +257,7 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

- (void)dismiss:(id)sender
{
[TestFlight passCheckpoint:@"ITINERARIES_DONE"];
[self dismissModalViewControllerAnimated:YES];
}

Expand Down
1 change: 1 addition & 0 deletions OpenTripPlanner/OpenTripPlanner-Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "TestFlight.h"
#endif
Loading

0 comments on commit e3296bc

Please sign in to comment.