Skip to content

Commit

Permalink
Release 8.5.3 (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski authored Aug 23, 2017
1 parent a7ad6a9 commit d887c62
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 69 deletions.
2 changes: 1 addition & 1 deletion AirshipKit/AirshipConfig.xcconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2017 Urban Airship and Contributors

CURRENT_PROJECT_VERSION = 8.5.2
CURRENT_PROJECT_VERSION = 8.5.3

// Uncomment to include the preview build warning
// OTHER_CFLAGS = $(inherited) -DUA_PREVIEW=1
34 changes: 25 additions & 9 deletions AirshipKit/AirshipKit/common/UAPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ - (void)updateChannelRegistrationForcefully:(BOOL)forcefully {
UA_STRONGIFY(self);
[self updateChannelRegistrationForcefully:forcefully];
});
return;
}

// Only cancel in flight requests if the channel is already created
Expand All @@ -778,6 +779,14 @@ - (void)updateChannelRegistrationForcefully:(BOOL)forcefully {
}

- (void)updateChannelTagGroups {
if (![NSThread isMainThread]) {
UA_WEAKIFY(self);
dispatch_async(dispatch_get_main_queue(), ^{
UA_STRONGIFY(self);
[self updateChannelTagGroups];
});
return;
}

if (!self.channelID) {
return;
Expand All @@ -789,7 +798,11 @@ - (void)updateChannelTagGroups {
return;
}

UA_WEAKIFY(self);

__block UIBackgroundTaskIdentifier backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
UA_STRONGIFY(self);

UA_LTRACE(@"Tag groups background task expired.");
[self.tagGroupsAPIClient cancelAllRequests];
[self.dataStore addTagGroupsMutation:mutation atBeginning:YES forKey:UAPushTagGroupsMutationsKey];
Expand All @@ -809,15 +822,18 @@ - (void)updateChannelTagGroups {
[self.tagGroupsAPIClient updateChannel:self.channelID
tagGroupsMutation:mutation
completionHandler:^(NSUInteger status) {

if (status >= 200 && status <= 299) {
[self updateChannelTagGroups];
} else if (status != 400 && status != 403) {
[self.dataStore addTagGroupsMutation:mutation atBeginning:YES forKey:UAPushTagGroupsMutationsKey];
}

[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
dispatch_async(dispatch_get_main_queue(), ^{
UA_STRONGIFY(self);

if (status >= 200 && status <= 299) {
[self updateChannelTagGroups];
} else if (status != 400 && status != 403) {
[self.dataStore addTagGroupsMutation:mutation atBeginning:YES forKey:UAPushTagGroupsMutationsKey];
}

[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
});
}];
}

Expand Down
9 changes: 0 additions & 9 deletions AirshipKit/AirshipKit/common/UAUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (NSString *)deviceTokenStringFromDeviceToken:(NSData *)deviceToken;

///---------------------------------------------------------------------------------------
/// @name Thread management
///---------------------------------------------------------------------------------------

/**
* A utility method to evaluate a block synchronously on the main thread.
*/
+ (id)evaluateOnMainThread:(id (^__nonnull)(void))block;

@end

NS_ASSUME_NONNULL_END
17 changes: 0 additions & 17 deletions AirshipKit/AirshipKit/common/UAUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -348,21 +348,4 @@ + (NSString *)deviceTokenStringFromDeviceToken:(NSData *)deviceToken {
return [deviceTokenString lowercaseString];
}

/**
* A utility method to evaluate a block synchronously on the main thread.
*/
+ (id)evaluateOnMainThread:(id (^__nonnull)(void))block {
__block id result;

if ([NSThread isMainThread]) {
result = block();
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
result = block();
});
}

return result;
}

@end
2 changes: 1 addition & 1 deletion AirshipKit/AirshipKit/common/UAirshipVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#import "UAirshipVersion.h"

NSString *const versionString = @"8.5.2";
NSString *const versionString = @"8.5.3";

@implementation UAirshipVersion

Expand Down
5 changes: 5 additions & 0 deletions AirshipKit/AirshipKitTests/UALegacyPushTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@ - (void)testUpdateTagGroups {
self.push.channelID = @"someChannelID";
self.push.channelLocation = @"someChannelLocation";

XCTestExpectation *expectation = [self expectationWithDescription:@"Async update channel tag groups call"];

// Expect a set mutation, return 200
[[[self.mockTagGroupsAPIClient expect] andDo:^(NSInvocation *invocation) {
Expand All @@ -2376,6 +2377,8 @@ - (void)testUpdateTagGroups {
void *arg;
[invocation getArgument:&arg atIndex:4];

[expectation fulfill];

void (^completionHandler)(NSUInteger) = (__bridge void (^)(NSUInteger))arg;
completionHandler(200);
}] updateChannel:@"someChannelID"
Expand All @@ -2391,6 +2394,8 @@ - (void)testUpdateTagGroups {

[self.push updateRegistration];

[self waitForExpectationsWithTimeout:1 handler:nil];

[self.mockTagGroupsAPIClient verify];
}

Expand Down
5 changes: 5 additions & 0 deletions AirshipKit/AirshipKitTests/UAPushTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,7 @@ - (void)testUpdateTagGroups {
self.push.channelID = @"someChannelID";
self.push.channelLocation = @"someChannelLocation";

XCTestExpectation *expectation = [self expectationWithDescription:@"Async update channel tag groups call"];

// Expect a set mutation, return 200
[[[self.mockTagGroupsAPIClient expect] andDo:^(NSInvocation *invocation) {
Expand All @@ -2526,6 +2527,8 @@ - (void)testUpdateTagGroups {
void *arg;
[invocation getArgument:&arg atIndex:4];

[expectation fulfill];

void (^completionHandler)(NSUInteger) = (__bridge void (^)(NSUInteger))arg;
completionHandler(200);
}] updateChannel:@"someChannelID"
Expand All @@ -2541,6 +2544,8 @@ - (void)testUpdateTagGroups {

[self.push updateRegistration];

[self waitForExpectationsWithTimeout:1 handler:nil];

[self.mockTagGroupsAPIClient verify];
}

Expand Down
30 changes: 0 additions & 30 deletions AirshipKit/AirshipKitTests/UAUtilsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,34 +322,4 @@ - (void)testIsAlertingPushNo {
XCTAssertFalse([UAUtils isAlertingPush:soundNotification]);
}

- (void)testEvaluateOnMainThreadWhenOnMainThread {
XCTAssertTrue([NSThread isMainThread],@"Tests are expected to run on the main thread");
NSNumber *returnValue = @NO;
returnValue = [UAUtils evaluateOnMainThread:^id{
XCTAssertTrue([NSThread isMainThread],@"should run on the main thread");
return @YES;
}];

XCTAssertTrue([returnValue boolValue]);
}

- (void)testEvaluateOnMainThreadWhenNotOnMainThread {
XCTAssertTrue([NSThread isMainThread],@"Tests are expected to run on the main thread");
XCTestExpectation *blockRan = [self expectationWithDescription:@"Block ran"];

__block NSNumber *returnValue = @NO;
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
XCTAssertFalse([NSThread isMainThread],@"should not run on the main thread");
returnValue = [UAUtils evaluateOnMainThread:^id{
XCTAssertTrue([NSThread isMainThread],@"should run on the main thread");
[blockRan fulfill];
return @YES;
}];
XCTAssertTrue([returnValue boolValue]);
});

[self waitForExpectationsWithTimeout:10 handler:nil];

}

@end
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ iOS Changelog

Migration Guides: Documentation/Migration

Version 8.5.3 - August 22, 2017
===============================
Patch release that fixes missing symbol issues for the static library and removes
the use of `dispatch_sync` when calling UIKit from a background thread. Applications
that use the static library or have had concerns about the use of `dispatch_sync`
should update.

Bug fixes
---------
- Fixed missing symbols for StoreKit and WebKit when using the static library.

Behavior Changes
----------------
- Removed use of `dispatch_sync` within the push module.

Version 8.5.2 - August 9, 2017
==============================
Patch release that fixes issues with message center, applications that use
Expand Down
2 changes: 1 addition & 1 deletion UrbanAirship-iOS-AppExtensions.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pod::Spec.new do |s|
s.version = "8.5.2"
s.version = "8.5.3"

s.name = "UrbanAirship-iOS-AppExtensions"
s.summary = "Urban Airship iOS App Extensions"
Expand Down
2 changes: 1 addition & 1 deletion UrbanAirship-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pod::Spec.new do |s|
s.version = "8.5.2"
s.version = "8.5.3"
s.name = "UrbanAirship-iOS-SDK"
s.summary = "Urban Airship iOS SDK"

Expand Down

0 comments on commit d887c62

Please sign in to comment.