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 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;
@@ -342,7 +342,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
* @see authenticateInstallation
* @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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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