summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Beharry <justin.beharry@livio.io>2022-08-30 13:50:44 -0400
committerJustin Beharry <justin.beharry@livio.io>2022-08-30 13:50:44 -0400
commit3bf1448dddaaacc5d32612b3b06ab66a64e7b576 (patch)
tree2708c40f755cbbc400a41a79c05814ab2698737b
parent494784242cc4b8422785cee59e49b0f3ee805990 (diff)
downloadsdl_ios-3bf1448dddaaacc5d32612b3b06ab66a64e7b576.tar.gz
Refactor and rename from revisions
-rw-r--r--SmartDeviceLink/private/SDLTextAndGraphicManager.m25
-rw-r--r--SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.h2
-rw-r--r--SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m13
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m8
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m68
5 files changed, 65 insertions, 51 deletions
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicManager.m b/SmartDeviceLink/private/SDLTextAndGraphicManager.m
index 9d6ec1585..a49400b95 100644
--- a/SmartDeviceLink/private/SDLTextAndGraphicManager.m
+++ b/SmartDeviceLink/private/SDLTextAndGraphicManager.m
@@ -157,7 +157,7 @@ NS_ASSUME_NONNULL_BEGIN
}
} else if (self.isDirty) {
self.isDirty = NO;
- [self sdl_updateAndCancelPreviousOperations:YES completionHandler:handler];
+ [self sdl_createOperationWithCompletionHandler:handler];
} else {
if (handler != nil) {
handler([NSError sdl_textAndGraphicManager_nothingToUpdate]);
@@ -165,20 +165,20 @@ NS_ASSUME_NONNULL_BEGIN
}
}
-- (void)sdl_updateAndCancelPreviousOperations:(BOOL)supersedePreviousOperations completionHandler:(nullable SDLTextAndGraphicUpdateCompletionHandler)handler {
+- (void)sdl_createOperationWithCompletionHandler:(nullable SDLTextAndGraphicUpdateCompletionHandler)handler {
SDLLogD(@"Updating text and graphics");
__weak typeof(self) weakSelf = self;
- SDLTextAndGraphicUpdateOperation *updateOperation = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:self.connectionManager fileManager:self.fileManager currentCapabilities:self.windowCapability currentScreenData:self.currentScreenData newState:[self currentState] currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState *_Nullable newScreenData, NSError *_Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ SDLTextAndGraphicUpdateOperation *updateOperation = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:self.connectionManager fileManager:self.fileManager currentCapabilities:self.windowCapability currentScreenData:self.currentScreenData newState:[self currentState] currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState *_Nullable newScreenData, NSError *_Nullable error) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (newScreenData != nil) {
// Update our current screen data
strongSelf.currentScreenData = newScreenData;
- [strongSelf sdl_updatePendingOperationsWithNewScreenData:newScreenData errorState:nil];
+ [strongSelf sdl_updatePendingOperationsWithNewScreenData:newScreenData];
} else if (error != nil) {
// Invalidate data that's different from our current screen data if a Show or SetDisplayLayout fails. This will prevent subsequent `Show`s from failing if the request failed due to the developer setting invalid data or subsequent `SetDisplayLayout`s from failing if the template is not supported on the module.
[strongSelf sdl_resetFieldsToCurrentScreenData];
- [strongSelf sdl_updatePendingOperationsWithNewScreenData:strongSelf.currentScreenData errorState:errorScreenData];
+ [strongSelf sdl_updatePendingOperationsWithFailedScreenState:error.userInfo[@"failedScreenState"]];
}
} updateCompletionHandler:handler];
@@ -191,16 +191,21 @@ NS_ASSUME_NONNULL_BEGIN
[self.transactionQueue addOperation:updateOperation];
}
-- (void)sdl_updatePendingOperationsWithNewScreenData:(SDLTextAndGraphicState *)newScreenData errorState:(SDLTextAndGraphicState *_Nullable)errorData {
+- (void)sdl_updatePendingOperationsWithNewScreenData:(SDLTextAndGraphicState *)newScreenData {
for (NSOperation *operation in self.transactionQueue.operations) {
if (operation.isExecuting) { continue; }
SDLTextAndGraphicUpdateOperation *updateOp = (SDLTextAndGraphicUpdateOperation *)operation;
updateOp.currentScreenData = newScreenData;
+ }
+}
- if (errorData != nil) {
- [updateOp updateStateDataWithErrorData:errorData];
- }
+- (void)sdl_updatePendingOperationsWithFailedScreenState:(SDLTextAndGraphicState *)errorState {
+ for (NSOperation *operation in self.transactionQueue.operations) {
+ if (operation.isExecuting) { continue; }
+ SDLTextAndGraphicUpdateOperation *updateOp = (SDLTextAndGraphicUpdateOperation *)operation;
+
+ [updateOp updateStateDataWithErrorData:errorState];
}
}
@@ -394,7 +399,7 @@ NS_ASSUME_NONNULL_BEGIN
// Auto-send an updated show
if ([self sdl_hasData]) {
// TODO: HAX: Capability updates cannot supersede earlier updates because of the case where a developer batched a `changeLayout` call w/ T&G changes on <6.0 systems could cause this to come in before the operation completes. That would cause the operation to report a "failure" (because it was superseded by this call) when in fact the operation didn't fail at all and is just being adjusted. Even though iOS is able to tell the developer that it was superseded, Java Suite cannot, and therefore we are matching functionality with their library.
- [self sdl_updateAndCancelPreviousOperations:NO completionHandler:nil];
+ [self sdl_createOperationWithCompletionHandler:nil];
}
}
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.h b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.h
index 00227db65..6273dd8b6 100644
--- a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.h
+++ b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.h
@@ -22,7 +22,7 @@
NS_ASSUME_NONNULL_BEGIN
typedef void(^SDLTextAndGraphicUpdateCompletionHandler)(NSError *__nullable error);
-typedef void(^CurrentDataUpdatedHandler)(SDLTextAndGraphicState *__nullable newScreenData, NSError *__nullable error, SDLTextAndGraphicState *__nullable errorScreenData);
+typedef void(^CurrentDataUpdatedHandler)(SDLTextAndGraphicState *__nullable newScreenData, NSError *__nullable error);
@interface SDLTextAndGraphicUpdateOperation : SDLAsynchronousOperation
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
index a623ad8ad..2bce0d7d3 100644
--- a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
+++ b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
@@ -176,7 +176,12 @@ NS_ASSUME_NONNULL_BEGIN
[strongSelf sdl_updateCurrentScreenDataFromShow:request];
} else {
SDLLogD(@"Text and Graphic Show failed");
- self.currentDataUpdatedHandler(nil, error, self.updatedState);
+ NSDictionary *newUserInfo = @{
+ @"NSUnderlyingErrorKey": error.userInfo,
+ @"failedScreenState": self.updatedState
+ };
+ NSError *updateError = [NSError errorWithDomain:error.domain code:error.code userInfo:newUserInfo];
+ self.currentDataUpdatedHandler(nil, updateError);
}
handler(error);
@@ -199,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
[strongSelf sdl_updateCurrentScreenDataFromSetDisplayLayout:request];
} else {
SDLLogD(@"Text and Graphic SetDisplayLayout failed to change to new layout: %@", setLayout.displayLayout);
- self.currentDataUpdatedHandler(nil, error, nil);
+ self.currentDataUpdatedHandler(nil, error);
}
handler(error);
@@ -515,7 +520,7 @@ NS_ASSUME_NONNULL_BEGIN
self.currentScreenData.templateConfig = show.templateConfiguration ? self.updatedState.templateConfig : self.currentScreenData.templateConfig;
if (self.currentDataUpdatedHandler != nil) {
- self.currentDataUpdatedHandler(self.currentScreenData, nil, nil);
+ self.currentDataUpdatedHandler(self.currentScreenData, nil);
}
}
@@ -526,7 +531,7 @@ NS_ASSUME_NONNULL_BEGIN
self.currentScreenData.templateConfig = [[SDLTemplateConfiguration alloc] initWithTemplate:setDisplayLayout.displayLayout dayColorScheme:setDisplayLayout.dayColorScheme nightColorScheme:setDisplayLayout.nightColorScheme];
if (self.currentDataUpdatedHandler != nil) {
- self.currentDataUpdatedHandler(self.currentScreenData, nil, nil);
+ self.currentDataUpdatedHandler(self.currentScreenData, nil);
}
}
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
index 89aec0e09..18ac8e32f 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
@@ -466,7 +466,7 @@ describe(@"text and graphic manager", ^{
// with good data
context(@"with good data", ^{
beforeEach(^{
- testOperation.currentDataUpdatedHandler(testOperation.updatedState, nil, nil);
+ testOperation.currentDataUpdatedHandler(testOperation.updatedState, nil);
});
it(@"should update the manager's and pending operations' current screen data", ^{
@@ -486,7 +486,11 @@ describe(@"text and graphic manager", ^{
testManager.textField1 = errorState.textField1;
testManager.textField4 = @"Good Data";
testOperation3 = testManager.transactionQueue.operations[3];
- testOperation.currentDataUpdatedHandler(nil, [NSError errorWithDomain:@"any" code:1 userInfo:nil], errorState);
+
+ NSDictionary *userInfo = @{
+ @"failedScreenState": errorState
+ };
+ testOperation.currentDataUpdatedHandler(nil, [NSError errorWithDomain:@"any" code:1 userInfo:userInfo]);
});
it(@"should reset the manager's data and update other operations updated state", ^{
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
index 81bca428e..4a3ace47d 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
@@ -120,7 +120,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -163,7 +163,7 @@ describe(@"the text and graphic operation", ^{
});
it(@"should send the media track and title", ^{
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
SDLShow *sentShow = testConnectionManager.receivedRequests.firstObject;
@@ -179,7 +179,7 @@ describe(@"the text and graphic operation", ^{
});
it(@"should not send the media track and title", ^{
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
SDLShow *sentShow = testConnectionManager.receivedRequests.firstObject;
@@ -201,7 +201,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -233,7 +233,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField1 = field1String;
updatedState.textField2 = field2String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -266,7 +266,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField2 = field2String;
updatedState.textField3 = field3String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -300,7 +300,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -339,7 +339,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -371,7 +371,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField1 = field1String;
updatedState.textField2 = field2String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -404,7 +404,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField2 = field2String;
updatedState.textField3 = field3String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -438,7 +438,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -477,7 +477,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -509,7 +509,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField1 = field1String;
updatedState.textField2 = field2String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -542,7 +542,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField2 = field2String;
updatedState.textField3 = field3String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -576,7 +576,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -615,7 +615,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -647,7 +647,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField1 = field1String;
updatedState.textField2 = field2String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -680,7 +680,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField2 = field2String;
updatedState.textField3 = field3String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -714,7 +714,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -754,7 +754,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:^(NSError * _Nullable error) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:^(NSError * _Nullable error) {
didCallHandler = YES;
}];
[testOp start];
@@ -780,7 +780,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField3 = field3String;
updatedState.textField4 = field4String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
updatedData = newScreenData;
} updateCompletionHandler:nil];
[testOp start];
@@ -823,7 +823,7 @@ describe(@"the text and graphic operation", ^{
});
it(@"should send a show and not upload any artworks", ^{
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
expect(testConnectionManager.receivedRequests).to(haveCount(1));
@@ -845,7 +845,7 @@ describe(@"the text and graphic operation", ^{
updatedState2.primaryGraphic = testArtwork3;
updatedState2.secondaryGraphic = testArtwork2;
- SDLTextAndGraphicUpdateOperation *testOp2 = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:updatedState newState:updatedState2 currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ SDLTextAndGraphicUpdateOperation *testOp2 = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:updatedState newState:updatedState2 currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp2 start];
[testConnectionManager respondToLastRequestWithResponse:successShowResponse];
@@ -862,7 +862,7 @@ describe(@"the text and graphic operation", ^{
updatedState.primaryGraphic = testArtwork;
updatedState.secondaryGraphic = testArtwork2;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
});
@@ -892,7 +892,7 @@ describe(@"the text and graphic operation", ^{
updatedState.textField1 = field1String;
updatedState.primaryGraphic = testArtwork;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
receivedState = newScreenData;
receivedError = error;
} updateCompletionHandler:^(NSError * _Nullable error) {
@@ -967,7 +967,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.primaryGraphic = testArtwork;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
});
@@ -997,7 +997,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.primaryGraphic = testStaticIcon;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
});
@@ -1032,7 +1032,7 @@ describe(@"the text and graphic operation", ^{
updatedState.primaryGraphic = testArtwork;
updatedState.secondaryGraphic = testArtwork2;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
});
@@ -1059,7 +1059,7 @@ describe(@"the text and graphic operation", ^{
updatedState.primaryGraphic = testArtwork;
updatedState.secondaryGraphic = testArtwork2;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
expect(testConnectionManager.receivedRequests).to(haveCount(1));
@@ -1088,7 +1088,7 @@ describe(@"the text and graphic operation", ^{
updatedState.primaryGraphic = testArtwork;
updatedState.secondaryGraphic = testArtwork2;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil];
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil];
[testOp start];
expect(testConnectionManager.receivedRequests).to(haveCount(1));
@@ -1121,7 +1121,7 @@ describe(@"the text and graphic operation", ^{
beforeEach(^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.templateConfig = newConfiguration;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
receivedState = newScreenData;
receivedError = error;
} updateCompletionHandler:nil];
@@ -1153,7 +1153,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.templateConfig = newConfiguration;
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
receivedState = newScreenData;
receivedError = error;
} updateCompletionHandler:^(NSError * _Nullable error) {
@@ -1240,7 +1240,7 @@ describe(@"the text and graphic operation", ^{
beforeEach(^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.templateConfig = newConfiguration;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
receivedState = newScreenData;
receivedError = error;
} updateCompletionHandler:nil];
@@ -1266,7 +1266,7 @@ describe(@"the text and graphic operation", ^{
updatedState = [[SDLTextAndGraphicState alloc] init];
updatedState.templateConfig = newConfiguration;
updatedState.textField1 = field1String;
- testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {
+ testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {
receivedState = newScreenData;
receivedError = error;
} updateCompletionHandler:nil];