summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlapinskijw <jlapinski.dev@gmail.com>2020-06-09 11:28:09 -0400
committerlapinskijw <jlapinski.dev@gmail.com>2020-06-09 11:28:09 -0400
commit92fb57785d5a0e69319fc893406ac0b192c9b5cd (patch)
tree26290b03423b7881fe8265de0410b6003d6e63cb
parentca7fbbe31cf6117e3e0d52cdc7705b310885cae6 (diff)
downloadsdl_ios-92fb57785d5a0e69319fc893406ac0b192c9b5cd.tar.gz
finished addressing PR comments and updated tests
-rw-r--r--Example Apps/Example ObjC/RPCPermissionsManager.m6
-rw-r--r--Example Apps/Example ObjC/VehicleDataManager.m2
-rw-r--r--Example Apps/Example Swift/RPCPermissionsManager.swift6
-rw-r--r--Example Apps/Example Swift/VehicleDataManager.swift2
-rw-r--r--SmartDeviceLink/SDLPermissionConstants.h2
-rw-r--r--SmartDeviceLink/SDLPermissionManager.h10
-rw-r--r--SmartDeviceLink/SDLPermissionManager.m43
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m36
8 files changed, 47 insertions, 60 deletions
diff --git a/Example Apps/Example ObjC/RPCPermissionsManager.m b/Example Apps/Example ObjC/RPCPermissionsManager.m
index cb45ab76d..d79bde3e2 100644
--- a/Example Apps/Example ObjC/RPCPermissionsManager.m
+++ b/Example Apps/Example ObjC/RPCPermissionsManager.m
@@ -61,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN
* @return True if the RPC can be sent to Core right now, false if not
*/
+ (BOOL)sdlex_checkCurrentPermissionWithManager:(SDLManager *)manager rpcName:(SDLRPCFunctionName)rpcName {
- BOOL isRPCAllowed = [manager.permissionManager isRPCPermitted:rpcName];
+ BOOL isRPCAllowed = [manager.permissionManager isRPCNameAllowed:rpcName];
[self sdlex_logRPCPermission:rpcName isRPCAllowed:isRPCAllowed];
return isRPCAllowed;
}
@@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (SDLPermissionGroupStatus)sdlex_checkCurrentGroupPermissionsWithManager:(SDLManager *)manager rpcNames:(NSArray<SDLRPCFunctionName> *)rpcNames {
SDLPermissionGroupStatus groupPermissionStatus = [manager.permissionManager groupStatusOfRPCNames:rpcNames];
- NSDictionary<NSString *, NSNumber *> *individualPermissionStatuses = [manager.permissionManager statusOfRPCNames:rpcNames];
+ NSDictionary<NSString *, NSNumber *> *individualPermissionStatuses = [manager.permissionManager statusesOfRPCNames:rpcNames];
[self sdlex_logRPCGroupPermissions:rpcNames groupPermissionStatus:groupPermissionStatus individualPermissionStatuses:individualPermissionStatuses];
return groupPermissionStatus;
}
@@ -91,7 +91,7 @@ NS_ASSUME_NONNULL_BEGIN
* @return A unique identifier for the subscription. This can be used to later to unsubscribe from the notifications.
*/
+ (SDLPermissionObserverIdentifier)sdlex_subscribeGroupPermissionsWithManager:(SDLManager *)manager rpcNames:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType {
- SDLPermissionObserverIdentifier observerId = [manager.permissionManager subscribeToRPCs:rpcNames groupType:groupType withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber<SDLBool> *> * _Nonnull change, SDLPermissionGroupStatus status) {
+ SDLPermissionObserverIdentifier observerId = [manager.permissionManager subscribeToRPCNames:rpcNames groupType:groupType withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber<SDLBool> *> * _Nonnull change, SDLPermissionGroupStatus status) {
[self sdlex_logRPCGroupPermissions:rpcNames groupPermissionStatus:status individualPermissionStatuses:change];
}];
return observerId;
diff --git a/Example Apps/Example ObjC/VehicleDataManager.m b/Example Apps/Example ObjC/VehicleDataManager.m
index 2b9f05a04..5c2d3bac2 100644
--- a/Example Apps/Example ObjC/VehicleDataManager.m
+++ b/Example Apps/Example ObjC/VehicleDataManager.m
@@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)getAllVehicleDataWithManager:(SDLManager *)manager triggerSource:(SDLTriggerSource)triggerSource vehicleDataType:(NSString *)vehicleDataType {
SDLLogD(@"Checking if app has permission to access vehicle data...");
- if (![manager.permissionManager isRPCPermitted:SDLRPCFunctionNameGetVehicleData]) {
+ if (![manager.permissionManager isRPCNameAllowed:SDLRPCFunctionNameGetVehicleData]) {
[manager sendRequest:[AlertManager alertWithMessageAndCloseButton:@"This app does not have the required permissions to access vehicle data" textField2:nil iconName:nil]];
return;
}
diff --git a/Example Apps/Example Swift/RPCPermissionsManager.swift b/Example Apps/Example Swift/RPCPermissionsManager.swift
index 0e1efefa0..a7568b162 100644
--- a/Example Apps/Example Swift/RPCPermissionsManager.swift
+++ b/Example Apps/Example Swift/RPCPermissionsManager.swift
@@ -52,7 +52,7 @@ private extension RPCPermissionsManager {
/// - Parameter manager: The SDL Manager
/// - Returns: true if allowed, false if not
class func checkCurrentPermission(with manager: SDLManager, rpcName: SDLRPCFunctionName) -> Bool {
- let isRPCAllowed = manager.permissionManager.isRPCPermitted(rpcName)
+ let isRPCAllowed = manager.permissionManager.isRPCNameAllowed(rpcName)
logRPCPermission(rpcName: rpcName, isRPCAllowed: isRPCAllowed)
return isRPCAllowed
}
@@ -63,7 +63,7 @@ private extension RPCPermissionsManager {
/// - Returns: The rpc names, the group permission status and the permission status for each rpc in the group
class func checkCurrentGroupPermissions(with manager: SDLManager, rpcNames: [SDLRPCFunctionName]) -> SDLPermissionGroupStatus {
let groupPermissionStatus = manager.permissionManager.groupStatus(ofRPCNames: rpcNames)
- let individualPermissionStatuses = manager.permissionManager.status(ofRPCNames: rpcNames)
+ let individualPermissionStatuses = manager.permissionManager.statuses(ofRPCNames: rpcNames)
logRPCGroupPermissions(rpcNames: rpcNames, groupPermissionStatus: groupPermissionStatus, individualPermissionStatuses: individualPermissionStatuses)
return groupPermissionStatus
}
@@ -75,7 +75,7 @@ private extension RPCPermissionsManager {
/// - groupType: The type of changes to get notified about
/// - Returns: A unique id assigned to observer. Use the id to unsubscribe to notifications
class func subscribeGroupPermissions(with manager: SDLManager, rpcNames: [SDLRPCFunctionName], groupType: SDLPermissionGroupType) -> UUID {
- let permissionAllAllowedObserverId = manager.permissionManager.subscribe(toRPCs: rpcNames, groupType: groupType, withHandler: { (individualStatuses, groupStatus) in
+ let permissionAllAllowedObserverId = manager.permissionManager.subscribe(toRPCNames: rpcNames, groupType: groupType, withHandler: { (individualStatuses, groupStatus) in
self.logRPCGroupPermissions(rpcNames: rpcNames, groupPermissionStatus: groupStatus, individualPermissionStatuses: individualStatuses)
})
diff --git a/Example Apps/Example Swift/VehicleDataManager.swift b/Example Apps/Example Swift/VehicleDataManager.swift
index cae87ecf2..c0f6e59dc 100644
--- a/Example Apps/Example Swift/VehicleDataManager.swift
+++ b/Example Apps/Example Swift/VehicleDataManager.swift
@@ -232,7 +232,7 @@ extension VehicleDataManager {
class func hasPermissionToAccessVehicleData(with manager: SDLManager) -> Bool {
SDLLog.d("Checking if app has permission to access vehicle data...")
- guard manager.permissionManager.isRPCPermitted(SDLRPCFunctionName.getVehicleData) else {
+ guard manager.permissionManager.isRPCNameAllowed(SDLRPCFunctionName.getVehicleData) else {
let alert = AlertManager.alertWithMessageAndCloseButton("This app does not have the required permissions to access vehicle data")
manager.send(request: alert)
return false
diff --git a/SmartDeviceLink/SDLPermissionConstants.h b/SmartDeviceLink/SDLPermissionConstants.h
index e20c49366..8fd9c588a 100644
--- a/SmartDeviceLink/SDLPermissionConstants.h
+++ b/SmartDeviceLink/SDLPermissionConstants.h
@@ -68,7 +68,7 @@ typedef NS_ENUM(NSUInteger, SDLPermissionGroupStatus) {
typedef void (^SDLPermissionsChangedHandler)(NSDictionary<SDLPermissionRPCName, NSNumber *> *_Nonnull change, SDLPermissionGroupStatus status);
/**
-* The SDLObservedPermissionsChangedHandler is a block that is passed in to subscribeToRPCs:groupType:withHandler: that will be stored and called when specified permissions change.
+* The SDLObservedPermissionsChangedHandler is a block that is passed in to subscribeToRPCNames:groupType:withHandler: that will be stored and called when specified permissions change.
*
* @param change A dictionary of permission changes containing <key(SDLRPCFunctionName): RPC Name, object(BOOL): YES if the RPC is allowed, NO if it is not allowed>
* @param status The change made to all of the RPCs in the changedDict. Allowed, if all RPCs are now allowed, Disallowed if all RPCs are now disallowed, or Mixed if some are allowed, and some are disallowed
diff --git a/SmartDeviceLink/SDLPermissionManager.h b/SmartDeviceLink/SDLPermissionManager.h
index 06d77a7ab..abcee0c95 100644
--- a/SmartDeviceLink/SDLPermissionManager.h
+++ b/SmartDeviceLink/SDLPermissionManager.h
@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return YES if the RPC is allowed at the current HMI level, NO if not
*/
-- (BOOL)isRPCAllowed:(SDLPermissionRPCName)rpcName __deprecated_msg(("Use isRPCPermitted: instead"));
+- (BOOL)isRPCAllowed:(SDLPermissionRPCName)rpcName __deprecated_msg(("Use isRPCNameAllowed: instead"));
/**
* Determine if an individual RPC is allowed for the current HMI level
@@ -80,7 +80,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A dictionary specifying if the passed in RPC names are currently allowed or not
*/
-- (NSDictionary<SDLPermissionRPCName, NSNumber *> *)statusOfRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames __deprecated_msg(("Use statusOfRPCNames: instead"));
+- (NSDictionary<SDLPermissionRPCName, NSNumber *> *)statusOfRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames __deprecated_msg(("Use statusesOfRPCNames: instead"));
/**
* Retrieve a dictionary with keys that are the passed in RPC names, and objects of an NSNumber<BOOL> specifying if that RPC is currently allowed
@@ -104,10 +104,10 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An identifier that can be passed to removeObserverForIdentifer: to remove the observer
*/
-- (SDLPermissionObserverIdentifier)addObserverForRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLPermissionsChangedHandler)handler __deprecated_msg(("Use subscribeToRPCs:groupType:withHandler: instead"));
+- (SDLPermissionObserverIdentifier)addObserverForRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLPermissionsChangedHandler)handler __deprecated_msg(("Use subscribeToRPCNames:groupType:withHandler: instead"));
/**
- * Subscribe to specified RPC names, with a callback that will be called whenever the value changes. Unlike addObserverForRPCs:groupType:withHandler:, the callback will not return immediately with the current status and will wait for the permissions changes specified in the groupType param.
+ * Subscribe to specified RPC names, with a callback that will be called whenever the value changes. Unlike addObserverForRPCs:groupType:withHandler:, the callback will only return immediately if the groupType is set to SDLPermissionGroupTypeAny or if the groupType is set to SDLPermissionGroupTypeAllAllowed and all RPCs in the rpcNames parameter are allowed.
*
* @warning The observer may be called before this method returns, do not attempt to remove the observer from within the observer. That could send `nil` to removeObserverForIdentifier:. If you want functionality like that, call groupStatusOfRPCs: instead.
*
@@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An identifier that can be passed to removeObserverForIdentifer: to remove the observer
*/
-- (SDLPermissionObserverIdentifier)subscribeToRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLObservedPermissionsChangedHandler)handler;
+- (SDLPermissionObserverIdentifier)subscribeToRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLSubscribedPermissionsChangedHandler)handler;
/**
* Remove every current observer
diff --git a/SmartDeviceLink/SDLPermissionManager.m b/SmartDeviceLink/SDLPermissionManager.m
index 9b361684a..310dca0b2 100644
--- a/SmartDeviceLink/SDLPermissionManager.m
+++ b/SmartDeviceLink/SDLPermissionManager.m
@@ -66,15 +66,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Permissions available
- (BOOL)isRPCAllowed:(NSString *)rpcName {
- if (self.permissions[rpcName] == nil || self.currentHMILevel == nil) {
- return NO;
- }
-
- SDLPermissionItem *item = self.permissions[rpcName];
- return [item.hmiPermissions.allowed containsObject:self.currentHMILevel];
+ return [self isRPCNameAllowed:rpcName];
}
-- (BOOL)isRPCPermitted:(SDLRPCFunctionName)rpcName {
+- (BOOL)isRPCNameAllowed:(SDLRPCFunctionName)rpcName {
if (self.permissions[rpcName] == nil || self.currentHMILevel == nil) {
return NO;
}
@@ -84,11 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (SDLPermissionGroupStatus)groupStatusOfRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames {
- if (self.currentHMILevel == nil) {
- return SDLPermissionGroupStatusUnknown;
- }
-
- return [self.class sdl_groupStatusOfRPCs:rpcNames withPermissions:[self.permissions copy] hmiLevel:self.currentHMILevel];
+ return [self groupStatusOfRPCNames:rpcNames];
}
- (SDLPermissionGroupStatus)groupStatusOfRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames {
@@ -139,21 +130,14 @@ NS_ASSUME_NONNULL_BEGIN
}
- (NSDictionary<SDLPermissionRPCName, NSNumber *> *)statusOfRPCs:(NSArray<SDLPermissionRPCName> *)rpcNames {
- NSMutableDictionary<SDLPermissionRPCName, NSNumber *> *permissionAllowedDict = [NSMutableDictionary dictionary];
-
- for (NSString *rpcName in rpcNames) {
- BOOL allowed = [self isRPCAllowed:rpcName];
- permissionAllowedDict[rpcName] = @(allowed);
- }
-
- return [permissionAllowedDict copy];
+ return [self statusesOfRPCNames:rpcNames];
}
-- (NSDictionary<SDLRPCFunctionName,NSNumber *> *)statusOfRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames {
+- (NSDictionary<SDLRPCFunctionName,NSNumber *> *)statusesOfRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames {
NSMutableDictionary<SDLRPCFunctionName, NSNumber *> *permissionAllowedDict = [NSMutableDictionary dictionary];
for (SDLRPCFunctionName rpcName in rpcNames) {
- BOOL allowed = [self isRPCPermitted:rpcName];
+ BOOL allowed = [self isRPCNameAllowed:rpcName];
permissionAllowedDict[rpcName] = @(allowed);
}
@@ -177,18 +161,24 @@ NS_ASSUME_NONNULL_BEGIN
return filter.identifier;
}
-- (SDLPermissionObserverIdentifier)subscribeToRPCs:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLPermissionsChangedHandler)handler {
+- (SDLPermissionObserverIdentifier)subscribeToRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLPermissionsChangedHandler)handler {
SDLPermissionFilter *filter = [SDLPermissionFilter filterWithRPCNames:rpcNames groupType:groupType observer:handler];
// Store the filter for later use
[self.filters addObject:filter];
+ // Check permission status and group type to see if we need to call handler immediately after setting the observer
+ SDLPermissionGroupStatus permissionStatus = [self groupStatusOfRPCNames:filter.rpcNames];
+ if ((groupType == SDLPermissionGroupTypeAny) || (groupType == SDLPermissionGroupTypeAllAllowed && permissionStatus == SDLPermissionGroupStatusAllowed)) {
+ [self sdl_callFilterObserver:filter];
+ }
+
return filter.identifier;
}
- (void)sdl_callFilterObserver:(SDLPermissionFilter *)filter {
SDLPermissionGroupStatus permissionStatus = [self groupStatusOfRPCNames:filter.rpcNames];
- NSDictionary<SDLPermissionRPCName, NSNumber *> *allowedDict = [self statusOfRPCNames:filter.rpcNames];
+ NSDictionary<SDLPermissionRPCName, NSNumber *> *allowedDict = [self statusesOfRPCNames:filter.rpcNames];
filter.handler(allowedDict, permissionStatus);
}
@@ -405,10 +395,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (BOOL)rpcRequiresEncryption:(SDLPermissionRPCName)rpcName {
- if (self.permissions[rpcName].requireEncryption != nil) {
- return self.permissions[rpcName].requireEncryption.boolValue;
- }
- return NO;
+ return [self rpcNameRequiresEncryption:rpcName];
}
- (BOOL)rpcNameRequiresEncryption:(SDLRPCFunctionName)rpcName {
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
index a4bdedb0c..bee6548c2 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
@@ -153,10 +153,10 @@ describe(@"SDLPermissionsManager", ^{
});
});
- context(@"isRPCPermitted: method", ^{
+ context(@"isRPCNameAllowed: method", ^{
beforeEach(^{
someRPCFunctionName = @"SomeRPCFunctionName";
- testResultBOOL = [testPermissionsManager isRPCPermitted:someRPCName];
+ testResultBOOL = [testPermissionsManager isRPCNameAllowed:someRPCName];
});
it(@"should not be allowed", ^{
@@ -180,10 +180,10 @@ describe(@"SDLPermissionsManager", ^{
});
});
- context(@"isRPCPermitted: method", ^{
+ context(@"isRPCNameAllowed: method", ^{
beforeEach(^{
[[NSNotificationCenter defaultCenter] postNotification:testPermissionsNotification];
- testResultBOOL = [testPermissionsManager isRPCPermitted:someRPCName];
+ testResultBOOL = [testPermissionsManager isRPCNameAllowed:someRPCName];
});
it(@"should not be allowed", ^{
@@ -225,13 +225,13 @@ describe(@"SDLPermissionsManager", ^{
});
});
- context(@"isRPCPermitted: method", ^{
+ context(@"isRPCNameAllowed: method", ^{
context(@"and the permission is allowed", ^{
beforeEach(^{
[[NSNotificationCenter defaultCenter] postNotification:limitedHMINotification];
[[NSNotificationCenter defaultCenter] postNotification:testPermissionsNotification];
- testResultBOOL = [testPermissionsManager isRPCPermitted:testRPCNameAllAllowed];
+ testResultBOOL = [testPermissionsManager isRPCNameAllowed:testRPCNameAllAllowed];
});
it(@"should be allowed", ^{
@@ -244,7 +244,7 @@ describe(@"SDLPermissionsManager", ^{
[[NSNotificationCenter defaultCenter] postNotification:limitedHMINotification];
[[NSNotificationCenter defaultCenter] postNotification:testPermissionsNotification];
- testResultBOOL = [testPermissionsManager isRPCPermitted:testRPCNameAllDisallowed];
+ testResultBOOL = [testPermissionsManager isRPCNameAllowed:testRPCNameAllDisallowed];
});
it(@"should be denied", ^{
@@ -391,9 +391,9 @@ describe(@"SDLPermissionsManager", ^{
});
});
- context(@"statusOfRPCNames: method", ^{
+ context(@"statusesOfRPCNames: method", ^{
beforeEach(^{
- testResultPermissionStatusDict = [testPermissionsManager statusOfRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed]];
+ testResultPermissionStatusDict = [testPermissionsManager statusesOfRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed]];
});
it(@"should return correct permission statuses", ^{
@@ -420,12 +420,12 @@ describe(@"SDLPermissionsManager", ^{
});
});
- context(@"statusOfRPCNames: method", ^{
+ context(@"statusesOfRPCNames: method", ^{
beforeEach(^{
[[NSNotificationCenter defaultCenter] postNotification:limitedHMINotification];
[[NSNotificationCenter defaultCenter] postNotification:testPermissionsNotification];
- testResultPermissionStatusDict = [testPermissionsManager statusOfRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed]];
+ testResultPermissionStatusDict = [testPermissionsManager statusesOfRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed]];
});
it(@"should return correct permission statuses", ^{
@@ -558,19 +558,19 @@ describe(@"SDLPermissionsManager", ^{
});
});
- describe(@"adding a new observer with subscribeToRPC:", ^{
+ describe(@"adding a new observer with subscribeToRPCNames:groupType:Handler", ^{
context(@"when no data is present", ^{
__block BOOL testObserverCalled = NO;
beforeEach(^{
testObserverCalled = NO;
- [testPermissionsManager subscribeToRPCs:@[testRPCNameAllAllowed, testRPCNameAllDisallowed] groupType:SDLPermissionGroupTypeAny withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber *> * _Nonnull change, SDLPermissionGroupStatus status) {
+ [testPermissionsManager subscribeToRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed] groupType:SDLPermissionGroupTypeAny withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber *> * _Nonnull change, SDLPermissionGroupStatus status) {
testObserverCalled = YES;
}];
});
- it(@"should not be called", ^{
- expect(testObserverCalled).to(beFalse());
+ it(@"should be called", ^{
+ expect(testObserverCalled).to(beTrue());
});
});
@@ -586,13 +586,13 @@ describe(@"SDLPermissionsManager", ^{
[[NSNotificationCenter defaultCenter] postNotification:testPermissionsNotification];
// This should not be called even with data currently present, the handler will only be called when an permissions update occurs after the RPC is subscribed to
- [testPermissionsManager subscribeToRPCs:@[testRPCNameAllAllowed, testRPCNameAllDisallowed] groupType:SDLPermissionGroupTypeAny withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber *> * _Nonnull change, SDLPermissionGroupStatus status) {
+ [testPermissionsManager subscribeToRPCNames:@[testRPCNameAllAllowed, testRPCNameAllDisallowed] groupType:SDLPermissionGroupTypeAny withHandler:^(NSDictionary<SDLPermissionRPCName,NSNumber *> * _Nonnull change, SDLPermissionGroupStatus status) {
testObserverCalled = YES;
}];
});
- it(@"should not be called", ^{
- expect(@(testObserverCalled)).to(equal(@NO));
+ it(@"should be called", ^{
+ expect(@(testObserverCalled)).to(beTrue());
});
});
});