Skip to content

Commit

Permalink
Merge pull request #7 from square/federman/nullable_xcode64_support
Browse files Browse the repository at this point in the history
Add support for nullable and nonnull for better Swift interoperability
  • Loading branch information
dfed committed Jul 23, 2015
2 parents 08e2c59 + de1c145 commit 267c76e
Show file tree
Hide file tree
Showing 42 changed files with 247 additions and 125 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: objective-c
osx_image: xcode6.4
before_script:
- brew update && brew upgrade xctool
- bundle install
script:
- xctool test -project Aardvark.xcodeproj -scheme Aardvark -sdk iphonesimulator
- xcodebuild -project Aardvark.xcodeproj -scheme Aardvark -sdk iphonesimulator -configuration Debug -PBXBuildsContinueAfterErrors=0 ACTIVE_ARCH_ONLY=0 build test
- pod lib lint --verbose --fail-fast
2 changes: 1 addition & 1 deletion Aardvark.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Aardvark'
s.version = '1.0.2'
s.version = '1.1'
s.license = 'Apache License, Version 2.0'
s.summary = 'Aardvark is a library that makes it dead simple to create actionable bug reports.'
s.homepage = 'https://github.com/square/Aardvark'
Expand Down
12 changes: 9 additions & 3 deletions Aardvark/Aardvark.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#import <Aardvark/ARKEmailBugReporter.h>


NS_ASSUME_NONNULL_BEGIN


typedef NS_ENUM(NSUInteger, ARKLogType) {
/// Default log type.
ARKLogTypeDefault,
Expand All @@ -38,7 +41,7 @@ typedef NS_ENUM(NSUInteger, ARKLogType) {
OBJC_EXTERN void ARKLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);

/// Logs a log with customized type and userInfo to the default log distributor.
OBJC_EXTERN void ARKLogWithType(ARKLogType type, NSDictionary *userInfo, NSString *format, ...) NS_FORMAT_FUNCTION(3,4);
OBJC_EXTERN void ARKLogWithType(ARKLogType type, NSDictionary * __nullable userInfo, NSString *format, ...) NS_FORMAT_FUNCTION(3,4);

/// Logs a screenshot to the default log distributor.
OBJC_EXTERN void ARKLogScreenshot();
Expand All @@ -47,9 +50,12 @@ OBJC_EXTERN void ARKLogScreenshot();
@interface Aardvark : NSObject

/// Sets up a two finger press-and-hold gesture recognizer to trigger email bug reports that will be sent to emailAddress. Returns the created bug reporter for convenience.
+ (ARKEmailBugReporter *)addDefaultBugReportingGestureWithEmailBugReporterWithRecipient:(NSString *)emailAddress;
+ (nullable ARKEmailBugReporter *)addDefaultBugReportingGestureWithEmailBugReporterWithRecipient:(NSString *)emailAddress;

/// Creates and returns a gesture recognizer that when triggered will call [bugReporter composeBugReport].
+ (id)addBugReporter:(id <ARKBugReporter>)bugReporter triggeringGestureRecognizerClass:(Class)gestureRecognizerClass;
+ (nullable id)addBugReporter:(id <ARKBugReporter>)bugReporter triggeringGestureRecognizerClass:(Class)gestureRecognizerClass;

@end


NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions AardvarkSample/AardvarkSample/SampleAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

@interface SampleAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic, readwrite) UIWindow *window;
@property (nonatomic) UIWindow *window;

@property (strong, nonatomic, readwrite) ARKEmailBugReporter *bugReporter;
@property (nonatomic) ARKEmailBugReporter *bugReporter;

@end

4 changes: 2 additions & 2 deletions AardvarkSample/AardvarkSample/SampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

@interface SampleViewController ()

@property (nonatomic, readwrite, strong) ARKLogStore *tapGestureLogStore;
@property (nonatomic, strong, readwrite) UITapGestureRecognizer *tapRecognizer;
@property (nonatomic) ARKLogStore *tapGestureLogStore;
@property (nonatomic) UITapGestureRecognizer *tapRecognizer;

@end

Expand Down
18 changes: 9 additions & 9 deletions AardvarkTests/ARKDataArchiveTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (void)test_setUp_providesEmptyArchive;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_dealloc_closesFile;
Expand Down Expand Up @@ -169,7 +169,7 @@ - (void)test_initWithURL_preservesExistingData;
[expectation3 fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_appendArchiveOfObject_trimsArchive;
Expand Down Expand Up @@ -245,7 +245,7 @@ - (void)test_appendArchiveOfObject_trimsArchive;
[expectation5 fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_appendArchiveOfObject_trimsCorruptedArchive;
Expand Down Expand Up @@ -283,7 +283,7 @@ - (void)test_appendArchiveOfObject_trimsCorruptedArchive;
}];


[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_initWithURL_detectsCorruptedArchive;
Expand All @@ -310,7 +310,7 @@ - (void)test_initWithURL_detectsCorruptedArchive;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_initWithURL_detectsPartiallyCorruptedArchive;
Expand Down Expand Up @@ -339,7 +339,7 @@ - (void)test_initWithURL_detectsPartiallyCorruptedArchive;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_readObjectsFromArchive_excludesFaultyUnarchives;
Expand Down Expand Up @@ -381,7 +381,7 @@ - (void)test_readObjectsFromArchive_excludesFaultyUnarchives;
[expectation2 fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_clearArchiveWithCompletionHandler_removesAllDataFromDisk;
Expand All @@ -406,7 +406,7 @@ - (void)test_clearArchiveWithCompletionHandler_removesAllDataFromDisk;
}];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_clearArchiveWithCompletionHandler_completionHandlerCalledOnMainQueue;
Expand All @@ -417,7 +417,7 @@ - (void)test_clearArchiveWithCompletionHandler_completionHandlerCalledOnMainQueu
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

#pragma mark - Performance Tests
Expand Down
28 changes: 14 additions & 14 deletions AardvarkTests/ARKDefaultLogFormatterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

@interface ARKDefaultLogFormatterTests : XCTestCase

@property (nonatomic, strong, readwrite) ARKLogDistributor *defaultLogDistributor;
@property (nonatomic, strong, readwrite) ARKDefaultLogFormatter *logFormatter;
@property (nonatomic, weak, readwrite) ARKLogStore *logStore;
@property (nonatomic) ARKLogDistributor *defaultLogDistributor;
@property (nonatomic) ARKDefaultLogFormatter *logFormatter;
@property (nonatomic, weak) ARKLogStore *logStore;

@end

Expand Down Expand Up @@ -84,7 +84,7 @@ - (void)test_formattedLogMessage_errorLogLineCount;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_separatorLogLineCount;
Expand All @@ -103,7 +103,7 @@ - (void)test_formattedLogMessage_separatorLogLineCount;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_defaultLogLineCount;
Expand All @@ -121,7 +121,7 @@ - (void)test_formattedLogMessage_defaultLogLineCount;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_errorLogContent;
Expand All @@ -142,7 +142,7 @@ - (void)test_formattedLogMessage_errorLogContent;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_separatorLogContent;
Expand All @@ -163,7 +163,7 @@ - (void)test_formattedLogMessage_separatorLogContent;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_defaultLogContent;
Expand All @@ -183,7 +183,7 @@ - (void)test_formattedLogMessage_defaultLogContent;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_errorPrefixChangeRespected;
Expand All @@ -203,7 +203,7 @@ - (void)test_formattedLogMessage_errorPrefixChangeRespected;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_separatorPrefixChangeRespected;
Expand All @@ -223,7 +223,7 @@ - (void)test_formattedLogMessage_separatorPrefixChangeRespected;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_errorPrefixOnSameLineIfLogTextIsEmpty;
Expand All @@ -241,7 +241,7 @@ - (void)test_formattedLogMessage_errorPrefixOnSameLineIfLogTextIsEmpty;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_formattedLogMessage_separatorPrefixOnSameLineIfLogTextIsEmpty;
Expand All @@ -259,7 +259,7 @@ - (void)test_formattedLogMessage_separatorPrefixOnSameLineIfLogTextIsEmpty;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

#pragma mark - Performance Tests
Expand All @@ -286,7 +286,7 @@ - (void)test_formattedLogMessage_performance;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}];
}

Expand Down
12 changes: 6 additions & 6 deletions AardvarkTests/ARKEmailBugReporterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

@interface ARKEmailBugReporterTests : XCTestCase

@property (nonatomic, strong, readwrite) ARKLogDistributor *defaultLogDistributor;
@property (nonatomic, strong, readwrite) ARKEmailBugReporter *bugReporter;
@property (nonatomic, weak, readwrite) ARKLogStore *logStore;
@property (nonatomic) ARKLogDistributor *defaultLogDistributor;
@property (nonatomic) ARKEmailBugReporter *bugReporter;
@property (nonatomic, weak) ARKLogStore *logStore;

@end

Expand Down Expand Up @@ -91,7 +91,7 @@ - (void)test_recentErrorLogMessagesAsPlainText_countRespected;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_recentErrorLogMessagesAsPlainText_returnsNilIfNoErrorLogsPresent;
Expand All @@ -114,7 +114,7 @@ - (void)test_recentErrorLogMessagesAsPlainText_returnsNilIfNoErrorLogsPresent;
}];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_recentErrorLogMessagesAsPlainText_returnsNilIfRecentErrorLogsIsZero;
Expand All @@ -137,7 +137,7 @@ - (void)test_recentErrorLogMessagesAsPlainText_returnsNilIfRecentErrorLogsIsZero
}];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_addLogStores_enforcesARKLogStoreClass;
Expand Down
8 changes: 1 addition & 7 deletions AardvarkTests/ARKFileHandleAdditionsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ - (void)test_writeDataBlock;
[self.fileHandle ARK_writeDataBlock:self.data_4];
[self _assertFileContentsMatchDataList:@[ self.block_9, self.block_4, self.block_7 ] failureMessage:@"Failed to over-write data in file."];

// Write empty-length data.
[self.fileHandle ARK_writeDataBlock:nil];
[self _assertFileContentsMatchDataList:@[ self.block_9, self.block_4, self.block_7 ] failureMessage:@"Writing nil data shouldn't change the file."];

// Write empty-length data.
[self.fileHandle ARK_writeDataBlock:[NSData data]];
[self _assertFileContentsMatchDataList:@[ self.block_9, self.block_4, self.block_7 ] failureMessage:@"Writing empty data shouldn't change the file."];
}
Expand Down Expand Up @@ -158,9 +155,6 @@ - (void)test_appendDataBlock;
[self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9, self.block_4 ] failureMessage:@"Failed to append to block after seeking to end of file."];

// Append empty data.
[self.fileHandle ARK_appendDataBlock:nil];
[self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9, self.block_4 ] failureMessage:@"Appending nil data shouldn't change the file."];

[self.fileHandle ARK_appendDataBlock:[NSData data]];
[self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9, self.block_4 ] failureMessage:@"Appending empty data shouldn't change the file."];
}
Expand Down
12 changes: 6 additions & 6 deletions AardvarkTests/ARKLogDistributorTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ - (void)test_logMessageClass_defaultsToARKLogMessage;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_setLogMessageClass_appendedLogsAreCorrectClass;
Expand All @@ -137,7 +137,7 @@ - (void)test_setLogMessageClass_appendedLogsAreCorrectClass;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_defaultLogStore_lazilyInitializesOnFirstAccess;
Expand Down Expand Up @@ -176,7 +176,7 @@ - (void)test_addLogObserver_notifiesLogObserverOnARKLog;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];

[[ARKLogDistributor defaultDistributor] removeLogObserver:testLogObserver];
}
Expand All @@ -197,7 +197,7 @@ - (void)test_addLogObserver_notifiesLogObserverOnLogWithFormat;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_removeLogObserver_removesLogObserver;
Expand All @@ -224,7 +224,7 @@ - (void)test_removeLogObserver_removesLogObserver;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)test_distributeAllPendingLogsWithCompletionHandler_informsLogObserversOfAllPendingLogs;
Expand Down Expand Up @@ -257,7 +257,7 @@ - (void)test_distributeAllPendingLogsWithCompletionHandler_informsLogObserversOf
}];
}];

[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

#pragma mark - Performance Tests
Expand Down
Loading

0 comments on commit 267c76e

Please sign in to comment.