Add warnings to docs for threading, properly dispatch internally

This commit is contained in:
Lukas Spieß
2015-10-05 13:52:24 +02:00
parent 44b231225c
commit bccfc61a42
7 changed files with 23 additions and 12 deletions

View File

@@ -313,7 +313,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
* @see authenticateInstallation * @see authenticateInstallation
* @see validateWithCompletion: * @see validateWithCompletion:
* *
* @param completion Block being executed once identification completed * @param completion Block being executed once identification completed. Be sure to properly dispatch code to the main queue if necessary.
*/ */
- (void) identifyWithCompletion:(void(^)(BOOL identified, NSError *error)) completion; - (void) identifyWithCompletion:(void(^)(BOOL identified, NSError *error)) completion;
@@ -342,7 +342,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
* @see authenticateInstallation * @see authenticateInstallation
* @see identifyWithCompletion: * @see identifyWithCompletion:
* *
* @param completion Block being executed once validation completed * @param completion Block being executed once validation completed. Be sure to properly dispatch code to the main queue if necessary.
*/ */
- (void) validateWithCompletion:(void(^)(BOOL validated, NSError *error)) completion; - (void) validateWithCompletion:(void(^)(BOOL validated, NSError *error)) completion;

View File

@@ -246,7 +246,9 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
viewController.email = [self stringValueFromKeychainForKey:kBITAuthenticatorUserEmailKey]; viewController.email = [self stringValueFromKeychainForKey:kBITAuthenticatorUserEmailKey];
_authenticationController = viewController; _authenticationController = viewController;
_identificationCompletion = completion; _identificationCompletion = completion;
dispatch_async(dispatch_get_main_queue(), ^{
[self showView:viewController]; [self showView:viewController];
});
} }
#pragma mark - Validation #pragma mark - Validation

View File

@@ -287,6 +287,8 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
/** /**
Present the modal feedback list user interface. Present the modal feedback list user interface.
@warning This methods needs to be called on the main thread!
*/ */
- (void)showFeedbackListView; - (void)showFeedbackListView;
@@ -303,6 +305,8 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
/** /**
Present the modal feedback compose message user interface. Present the modal feedback compose message user interface.
@warning This methods needs to be called on the main thread!
*/ */
- (void)showFeedbackComposeView; - (void)showFeedbackComposeView;
@@ -314,6 +318,7 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
@param items an NSArray with objects that should be attached @param items an NSArray with objects that should be attached
@see `[BITFeedbackComposeViewController prepareWithItems:]` @see `[BITFeedbackComposeViewController prepareWithItems:]`
@warning This methods needs to be called on the main thread!
*/ */
- (void)showFeedbackComposeViewWithPreparedItems:(NSArray *)items; - (void)showFeedbackComposeViewWithPreparedItems:(NSArray *)items;
@@ -325,6 +330,7 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
[[BITHockeyManager sharedHockeyManager].feedbackManager showFeedbackComposeViewWithGeneratedScreenshot]; [[BITHockeyManager sharedHockeyManager].feedbackManager showFeedbackComposeViewWithGeneratedScreenshot];
@see feedbackObservationMode @see feedbackObservationMode
@warning This methods needs to be called on the main thread!
*/ */
- (void)showFeedbackComposeViewWithGeneratedScreenshot; - (void)showFeedbackComposeViewWithGeneratedScreenshot;

View File

@@ -220,8 +220,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac
BITHockeyLog(@"INFO: update view already visible, aborting"); BITHockeyLog(@"INFO: update view already visible, aborting");
return; return;
} }
dispatch_async(dispatch_get_main_queue(), ^{
[self showView:[self feedbackListViewController:YES]]; [self showView:[self feedbackListViewController:YES]];
});
} }
@@ -246,9 +247,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac
} }
BITFeedbackComposeViewController *composeView = [self feedbackComposeViewController]; BITFeedbackComposeViewController *composeView = [self feedbackComposeViewController];
[composeView prepareWithItems:items]; [composeView prepareWithItems:items];
dispatch_async(dispatch_get_main_queue(), ^{
[self showView:composeView]; [self showView:composeView];
});
} }
- (void)showFeedbackComposeViewWithGeneratedScreenshot { - (void)showFeedbackComposeViewWithGeneratedScreenshot {

View File

@@ -258,7 +258,6 @@
// if we compile Crash only, then BITHockeyBaseViewController is not included // if we compile Crash only, then BITHockeyBaseViewController is not included
// in the headers and will cause a warning with the modulemap file // in the headers and will cause a warning with the modulemap file
#if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK #if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK
dispatch_async(dispatch_get_main_queue(), ^{
UIViewController *parentViewController = [self visibleWindowRootViewController]; UIViewController *parentViewController = [self visibleWindowRootViewController];
// as per documentation this only works if called from within viewWillAppear: or viewDidAppear: // as per documentation this only works if called from within viewWillAppear: or viewDidAppear:
@@ -295,7 +294,6 @@
[(BITHockeyBaseViewController *)viewController setModalAnimated:NO]; [(BITHockeyBaseViewController *)viewController setModalAnimated:NO];
[visibleWindow addSubview:_navController.view]; [visibleWindow addSubview:_navController.view];
} }
});
#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */ #endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */
} }
#endif // HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions && HOCKEYSDK_CONFIGURATION_RelaseCrashOnlyWatchOS #endif // HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions && HOCKEYSDK_CONFIGURATION_RelaseCrashOnlyWatchOS

View File

@@ -220,6 +220,8 @@ typedef NS_ENUM (NSUInteger, BITUpdateSetting) {
/** /**
Present the modal update user interface. Present the modal update user interface.
@warning Make sure to call this method from the main thread!
*/ */
- (void)showUpdateView; - (void)showUpdateView;

View File

@@ -545,7 +545,9 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
if ([self hasNewerMandatoryVersion] || [self expiryDateReached]) { if ([self hasNewerMandatoryVersion] || [self expiryDateReached]) {
[updateViewController setMandatoryUpdate: YES]; [updateViewController setMandatoryUpdate: YES];
} }
dispatch_async(dispatch_get_main_queue(), ^{
[self showView:updateViewController]; [self showView:updateViewController];
});
} }