Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #433 from bitstadium/release/4.1.6
Browse files Browse the repository at this point in the history
Release/4.1.6
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Jun 23, 2017
2 parents ddda084 + d0f2a87 commit ababf15
Show file tree
Hide file tree
Showing 30 changed files with 248 additions and 821 deletions.
24 changes: 12 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ env:
matrix:
- SCHEME="HockeySDK" DESTINATION="OS=8.1,name=iPad Air" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.2,name=iPhone 6 Plus" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.3,name=iPad 2" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.3,name=iPad 2" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.4,name=iPhone 4s" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=9.0,name=iPad Air" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=9.1,name=iPhone 6 Plus" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.2,name=iPad Pro (9.7-inch)" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.3,name=iPhone 6s" RUN_TESTS="YES"
- SCHEME="HockeySDK Framework" DESTINATION="platform=iOS Simulator,OS=10.3,name=iPhone 6" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.2,name=iPad Pro (9.7-inch)" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.3.1,name=iPhone 6s" RUN_TESTS="YES"
- SCHEME="HockeySDK Framework" DESTINATION="platform=iOS Simulator,OS=10.3.1,name=iPhone 6" RUN_TESTS="YES"
- SCHEME="HockeySDK Distribution" RUN_TESTS="NO" LINT="YES"

before_install:
- xcrun simctl list
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- brew unlink carthage
- brew install carthage

script:
- open -b com.apple.iphonesimulator
- set -o pipefail
- COMMAND="env NSUnbufferedIO=YES xcodebuild -project '$PROJECT' -scheme '$SCHEME' -sdk '$SDK' -configuration '$CONFIGURATION'"

# Add xcpretty
- COMMAND_SUFFIX=" | tee xcodebuild.log | xcpretty -f `xcpretty-travis-formatter`"

# Run tests
- if [ $RUN_TESTS == "YES" ]; then
COMMAND+=" -destination '$DESTINATION' XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1" clean test";
COMMAND+=" -destination '$DESTINATION' XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS=\"CI=1\" "
COMMAND="$COMMAND clean build-for-testing $COMMAND_SUFFIX && travis_retry $COMMAND test-without-building $COMMAND_SUFFIX";
else
COMMAND+="$COMMAND_SUFFIX";
fi

- COMMAND+=" | tee xcodebuild.log"

# Add xcpretty
- COMMAND+=" | xcpretty -f `xcpretty-travis-formatter`"

- echo $COMMAND
- eval $COMMAND && rm xcodebuild.log
- if [ $LINT == "YES" ]; then
Expand All @@ -55,4 +55,4 @@ after_failure:
- cat xcodebuild.log
- cat -n $TMPDIR/com.apple.dt.XCTest-status/Session*.log
- cat -n ~/Library/Logs/DiagnosticReports/xctest*.crash
- sleep 5
- sleep 5
48 changes: 47 additions & 1 deletion Classes/BITChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

NS_ASSUME_NONNULL_BEGIN

@implementation BITChannel
@implementation BITChannel {
id _appDidEnterBackgroundObserver;
}

@synthesize persistence = _persistence;
@synthesize channelBlocked = _channelBlocked;
Expand All @@ -47,6 +49,8 @@ - (instancetype)init {
}
dispatch_queue_t serialQueue = dispatch_queue_create(BITDataItemsOperationsQueue, DISPATCH_QUEUE_SERIAL);
_dataItemsOperations = serialQueue;

[self registerObservers];
}
return self;
}
Expand All @@ -59,6 +63,48 @@ - (instancetype)initWithTelemetryContext:(BITTelemetryContext *)telemetryContext
return self;
}

- (void)dealloc {
[self unregisterObservers];
[self invalidateTimer];
}

#pragma mark - Observers

- (void) registerObservers {
__weak typeof(self) weakSelf = self;
if(nil == _appDidEnterBackgroundObserver) {
void (^notificationBlock)(NSNotification *note) = ^(NSNotification *note) {
typeof(self) strongSelf = weakSelf;
if ([strongSelf timerIsRunning]) {
[strongSelf persistDataItemQueue];

/**
* From the documentation for applicationDidEnterBackground:
* It's likely any background tasks you start in applicationDidEnterBackground: will not run until after that method exits,
* you should request additional background execution time before starting those tasks. In other words,
* first call beginBackgroundTaskWithExpirationHandler: and then run the task on a dispatch queue or secondary thread.
*/
UIApplication *sharedApplication = [UIApplication sharedApplication];
__block UIBackgroundTaskIdentifier _backgroundTask = [sharedApplication beginBackgroundTaskWithExpirationHandler:^{
[sharedApplication endBackgroundTask:_backgroundTask];
_backgroundTask = UIBackgroundTaskInvalid;
}];
}
};
_appDidEnterBackgroundObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
object:nil
queue:NSOperationQueue.mainQueue
usingBlock:notificationBlock];
}
}

- (void) unregisterObservers {
if(_appDidEnterBackgroundObserver) {
[[NSNotificationCenter defaultCenter] removeObserver:_appDidEnterBackgroundObserver];
_appDidEnterBackgroundObserver = nil;
}
}

#pragma mark - Queue management

- (BOOL)isQueueBusy {
Expand Down
4 changes: 2 additions & 2 deletions Classes/BITCrashCXXExceptionHandler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

@implementation BITCrashUncaughtCXXExceptionHandlerManager

extern "C" void LIBCXXABI_NORETURN __cxa_throw(void *exception_object, std::type_info *tinfo, void (*dest)(void *))
extern "C" void __attribute__((noreturn)) __cxa_throw(void *exception_object, std::type_info *tinfo, void (*dest)(void *))
{
// Purposely do not take a lock in this function. The aim is to be as fast as
// possible. While we could really use some of the info set up by the real
Expand All @@ -72,7 +72,7 @@ @implementation BITCrashUncaughtCXXExceptionHandlerManager
// implementation changing in a future version. (Or not existing in an earlier
// version).

typedef void (*cxa_throw_func)(void *, std::type_info *, void (*)(void *)) LIBCXXABI_NORETURN;
typedef void (*cxa_throw_func)(void *, std::type_info *, void (*)(void *)) __attribute__((noreturn));
static dispatch_once_t predicate = 0;
static cxa_throw_func __original__cxa_throw = nullptr;
static const void **__real_objc_ehtype_vtable = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions Classes/BITCrashManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@


/**
* Custom block that handles the alert that prompts the user whether he wants to send crash reports
* Custom block that handles the alert that prompts the user whether they want to send crash reports
*/
typedef void(^BITCustomAlertViewHandler)();
typedef void(^BITCustomAlertViewHandler)(void);


/**
Expand Down Expand Up @@ -340,7 +340,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {

/**
Lets you set a custom block which handles showing a custom UI and asking the user
whether he wants to send the crash report.
whether they want to send the crash report.
This replaces the default alert the SDK would show!
Expand All @@ -350,7 +350,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
In addition to this you should always ask your users if they agree to send crash reports, send them
always or not and return the result when calling `handleUserInput:withUserProvidedCrashDescription`.
@param alertViewHandler A block that is responsible for loading, presenting and and dismissing your custom user interface which prompts the user if he wants to send crash reports. The block is also responsible for triggering further processing of the crash reports.
@param alertViewHandler A block that is responsible for loading, presenting and and dismissing your custom user interface which prompts the user if they want to send crash reports. The block is also responsible for triggering further processing of the crash reports.
@warning This is not available when compiled for Watch OS!
Expand Down
34 changes: 8 additions & 26 deletions Classes/BITCrashManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ - (void)invokeDelayedProcessing {
// If the top level error handler differs from our own, then at least another one was added.
// This could cause exception crashes not to be reported to HockeyApp. See log message for details.
if (self.exceptionHandler != currentHandler) {
BITHockeyLogWarning(@"[HockeySDK] WARNING: Another exception handler was added. If this invokes any kind exit() after processing the exception, which causes any subsequent error handler not to be invoked, these crashes will NOT be reported to HockeyApp!");
BITHockeyLogWarning(@"[HockeySDK] WARNING: Another exception handler was added. If this invokes any kind of exit() after processing the exception, which causes any subsequent error handler not to be invoked, these crashes will NOT be reported to HockeyApp!");
}
}

Expand Down Expand Up @@ -1154,18 +1154,10 @@ - (void)invokeDelayedProcessing {
}
}

- (void)startManagerInXamarinEnvironment {
[self startManagerInSdkEnvironment:BITSdkEnvironmentXamarin];
}

- (void)startManager {
[self startManagerInSdkEnvironment:BITSdkEnvironmentNative];
}

/**
* Main startup sequence initializing PLCrashReporter if it wasn't disabled
*/
- (void)startManagerInSdkEnvironment:(BITSdkEnvironment)sdkEnvironment {
- (void)startManager {
if (_crashManagerStatus == BITCrashManagerStatusDisabled) return;

[self registerObservers];
Expand All @@ -1187,21 +1179,8 @@ - (void)startManagerInSdkEnvironment:(BITSdkEnvironment)sdkEnvironment {
symbolicationStrategy = PLCrashReporterSymbolicationStrategyAll;
}

BITPLCrashReporterConfig *config;

switch (sdkEnvironment) {
case BITSdkEnvironmentXamarin:
config = [[BITPLCrashReporterConfig alloc] initWithSignalHandlerType: signalHandlerType
symbolicationStrategy: symbolicationStrategy
shouldRegisterUncaughtExceptionHandler:NO];

break;
default:
config = [[BITPLCrashReporterConfig alloc] initWithSignalHandlerType: signalHandlerType
symbolicationStrategy: symbolicationStrategy];
break;
}

BITPLCrashReporterConfig *config = [[BITPLCrashReporterConfig alloc] initWithSignalHandlerType: signalHandlerType
symbolicationStrategy: symbolicationStrategy];
self.plCrashReporter = [[BITPLCrashReporter alloc] initWithConfiguration: config];

// Check if we previously crashed
Expand Down Expand Up @@ -1261,8 +1240,11 @@ - (void)startManagerInSdkEnvironment:(BITSdkEnvironment)sdkEnvironment {

BITHockeyLogDebug(@"INFO: Exception handler successfully initialized.");
} else {
// this should never happen, theoretically only if NSSetUncaugtExceptionHandler() has some internal issues

// If we're running in a Xamarin Environment, the exception handler will be the one by the xamarin runtime, not ours.
// In other cases, this should never happen, theoretically only if NSSetUncaugtExceptionHandler() has some internal issues
BITHockeyLogError(@"[HockeySDK] ERROR: Exception handler could not be set. Make sure there is no other exception handler set up!");
BITHockeyLogError(@"[HockeySDK] ERROR: If you are using the HockeySDK-Xamarin, this is expected behavior and you can ignore this message");
}

// Add the C++ uncaught exception handler, which is currently not handled by PLCrashReporter internally
Expand Down
2 changes: 0 additions & 2 deletions Classes/BITCrashManagerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@

- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier appEnvironment:(BITEnvironment)environment hockeyAppClient:(BITHockeyAppClient *)hockeyAppClient NS_DESIGNATED_INITIALIZER;

- (void)startManagerInXamarinEnvironment;

- (void)cleanCrashReports;

- (NSString *)userIDForCrashReport;
Expand Down
11 changes: 11 additions & 0 deletions Classes/BITFeedbackListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.textLabel.textAlignment = NSTextAlignmentCenter;
}

cell.textLabel.accessibilityTraits = UIAccessibilityTraitStaticText;
cell.textLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
[self.manager lastCheck] ? [self.lastUpdateDateFormatter stringFromDate:[self.manager lastCheck]] : BITHockeyLocalizedString(@"HockeyFeedbackListNeverUpdated")];

Expand Down Expand Up @@ -545,6 +546,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.selectionStyle = UITableViewCellSelectionStyleGray;
}

// Set accessibilityTraits to UIAccessibilityTraitNone to make sure we're not setting the trait to an incorrect type for recycled cells.
cell.textLabel.accessibilityTraits = UIAccessibilityTraitNone;

// button
NSString *titleString = nil;

Expand All @@ -554,6 +558,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

if (indexPath.section == 0) {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitButton;
if ([self.manager numberOfMessages] == 0) {
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButtonWriteFeedback");
} else {
Expand All @@ -563,17 +568,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if ([self.manager requireUserName] == BITFeedbackUserDataElementRequired ||
([self.manager requireUserName] == BITFeedbackUserDataElementOptional && [self.manager userName] != nil)
) {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitStaticText;
titleString = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButtonUserDataWithName"), [self.manager userName] ?: @"-"];
} else if ([self.manager requireUserEmail] == BITFeedbackUserDataElementRequired ||
([self.manager requireUserEmail] == BITFeedbackUserDataElementOptional && [self.manager userEmail] != nil)
) {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitStaticText;
titleString = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButtonUserDataWithEmail"), [self.manager userEmail] ?: @"-"];
} else if ([self.manager requireUserName] == BITFeedbackUserDataElementOptional) {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitButton;
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButtonUserDataSetName");
} else {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitButton;
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButtonUserDataSetEmail");
}
} else {
cell.textLabel.accessibilityTraits = UIAccessibilityTraitButton;
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButtonDeleteAllMessages");
titleColor = BIT_RGBCOLOR(251, 35, 35);
}
Expand Down Expand Up @@ -652,6 +662,7 @@ - (void)handleResponseForAttachment:(BITFeedbackMessageAttachment *)attachment r
[attachment replaceData:responseData];
[[NSNotificationCenter defaultCenter] postNotificationName:kBITFeedbackUpdateAttachmentThumbnail object:attachment];
[[BITHockeyManager sharedHockeyManager].feedbackManager saveMessages];
[self.tableView reloadData];
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion Classes/BITFeedbackManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ - (void)updateMessageListFromResponse:(NSDictionary *)jsonDictionary {
int attachmentIndex = 0;
for (BITFeedbackMessageAttachment *attachment in matchingSendInProgressOrInConflictMessage.attachments) {
attachment.identifier = feedbackAttachments[attachmentIndex][@"id"];
attachment.sourceURL = feedbackAttachments[attachmentIndex][@"url"];
attachmentIndex++;
}
}
Expand Down Expand Up @@ -822,7 +823,7 @@ - (void)updateMessageListFromResponse:(NSDictionary *)jsonDictionary {

// we got a new incoming message, trigger user notification system
if (newMessage) {
// check if the latest message is from the users own email address, then don't show an alert since he answered using his own email
// check if the latest message is from the users own email address, then don't show an alert since they answered using their own email
BOOL latestMessageFromUser = NO;

BITFeedbackMessage *latestMessage = [self lastMessageHavingID];
Expand Down
7 changes: 7 additions & 0 deletions Classes/BITFeedbackMessageAttachment.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ - (UIImage *)thumbnailWithSize:(CGSize)size {

#pragma mark - Persistence Helpers

- (void)setFilename:(NSString *)filename {
if (filename) {
filename = [_cachePath stringByAppendingPathComponent:[filename lastPathComponent]];
}
_filename = filename;
}

- (NSString *)possibleFilename {
if (_tempFilename) {
return _tempFilename;
Expand Down
13 changes: 0 additions & 13 deletions Classes/BITHockeyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)startManager;

/**
Starts the manager and runs all modules from a Xamarin environment. This is intended to be used by the HockeySDK-Xamarin.
We now need to make a difference as BITCrashManager needs to setup PLCrashReporter differently for Xamarin apps.
@warning Do not use this API from within a native iOS app.
Call this after configuring the manager and setting up all modules.
@see configureWithIdentifier:delegate:
@see configureWithBetaIdentifier:liveIdentifier:delegate:
*/
- (void)startManagerInXamarinEnvironment;

#pragma mark - Public Properties

///-----------------------------------------------------------------------------
Expand Down
19 changes: 1 addition & 18 deletions Classes/BITHockeyManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,6 @@ - (void)configureWithBetaIdentifier:(NSString *)betaIdentifier liveIdentifier:(N
}

- (void)startManager {
[self startManagerWithEnvironment:BITSdkEnvironmentNative];
}

- (void)startManagerInXamarinEnvironment {
[self startManagerWithEnvironment:BITSdkEnvironmentXamarin];
BITHockeyLogVerbose(@"Started the BITHockeyManager with Xamarin Environment.");
}

- (void)startManagerWithEnvironment:(BITSdkEnvironment)sdkEnvironment {
if (!_validAppIdentifier) return;
if (_startManagerIsInvoked) {
BITHockeyLogWarning(@"[HockeySDK] Warning: startManager should only be invoked once! This call is ignored.");
Expand Down Expand Up @@ -262,15 +253,7 @@ - (void)startManagerWithEnvironment:(BITSdkEnvironment)sdkEnvironment {
}
#endif

// Start BITCrashManager with the environment flag to make sure we don't break NSException reporting for Xamarin.
switch (sdkEnvironment) {
case BITSdkEnvironmentXamarin:
[_crashManager startManagerInXamarinEnvironment];
break;
default:
[_crashManager startManager];
break;
}
[_crashManager startManager];
}
#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */

Expand Down
Loading

0 comments on commit ababf15

Please sign in to comment.