summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lapinski <43190016+lapinskijw@users.noreply.github.com>2020-06-08 17:35:32 -0400
committerGitHub <noreply@github.com>2020-06-08 17:35:32 -0400
commitca7fbbe31cf6117e3e0d52cdc7705b310885cae6 (patch)
treec2a04725fae99492c890348e27bd36ee1d3a8042
parenta7f6c5dec65fd6e34a5bba0113304585c58dd3fe (diff)
downloadsdl_ios-ca7fbbe31cf6117e3e0d52cdc7705b310885cae6.tar.gz
Apply suggestions from code review
Co-authored-by: Joel Fischer <joeljfischer@gmail.com>
-rw-r--r--SmartDeviceLink/SDLPermissionConstants.h6
-rw-r--r--SmartDeviceLink/SDLPermissionManager.h10
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m18
3 files changed, 16 insertions, 18 deletions
diff --git a/SmartDeviceLink/SDLPermissionConstants.h b/SmartDeviceLink/SDLPermissionConstants.h
index 836423030..e20c49366 100644
--- a/SmartDeviceLink/SDLPermissionConstants.h
+++ b/SmartDeviceLink/SDLPermissionConstants.h
@@ -70,9 +70,9 @@ typedef void (^SDLPermissionsChangedHandler)(NSDictionary<SDLPermissionRPCName,
/**
* The SDLObservedPermissionsChangedHandler is a block that is passed in to subscribeToRPCs: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
+* @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
*/
-typedef void (^SDLObservedPermissionsChangedHandler)(NSDictionary<SDLRPCFunctionName, NSNumber *> *_Nonnull change, SDLPermissionGroupStatus status);
+typedef void (^SDLSubscribedPermissionsChangedHandler)(NSDictionary<SDLRPCFunctionName, NSNumber *> *_Nonnull change, SDLPermissionGroupStatus status);
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLPermissionManager.h b/SmartDeviceLink/SDLPermissionManager.h
index 2f93c368f..06d77a7ab 100644
--- a/SmartDeviceLink/SDLPermissionManager.h
+++ b/SmartDeviceLink/SDLPermissionManager.h
@@ -49,11 +49,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Determine if an individual RPC is allowed for the current HMI level
*
- * @param rpcName The name of the RPC to be tested, for example, SDLRPCFunctionNameShow
+ * @param rpcName The name of the RPC to be tested, for example, SDLRPCFunctionNameShow
*
* @return YES if the RPC is allowed at the current HMI level, NO if not
*/
-- (BOOL)isRPCPermitted:(SDLRPCFunctionName)rpcName;
+- (BOOL)isRPCNameAllowed:(SDLRPCFunctionName)rpcName;
/**
* Determine if all RPCs are allowed for the current HMI level
@@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A dictionary specifying if the passed in RPC names are currently allowed or not
*/
-- (NSDictionary<SDLRPCFunctionName, NSNumber *> *)statusOfRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames;
+- (NSDictionary<SDLRPCFunctionName, NSNumber *> *)statusesOfRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames;
/**
* Add an observer for specified RPC names, with a callback that will be called whenever the value changes, as well as immediately with the current status.
@@ -109,8 +109,6 @@ NS_ASSUME_NONNULL_BEGIN
/**
* 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.
*
- * @warning This block will be captured by the SDLPermissionsManager, be sure to use [weakself/strongself](http://www.logicsector.com/ios/avoiding-objc-retain-cycles-with-weakself-and-strongself-the-easy-way/) if you are referencing self within your observer block.
- *
* @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.
*
* @param rpcNames The RPCs to be observed
@@ -119,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An identifier that can be passed to removeObserverForIdentifer: to remove the observer
*/
-- (SDLPermissionObserverIdentifier)subscribeToRPCs:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLObservedPermissionsChangedHandler)handler;
+- (SDLPermissionObserverIdentifier)subscribeToRPCNames:(NSArray<SDLRPCFunctionName> *)rpcNames groupType:(SDLPermissionGroupType)groupType withHandler:(SDLObservedPermissionsChangedHandler)handler;
/**
* Remove every current observer
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
index 8a74894e7..a4bdedb0c 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
@@ -149,7 +149,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should not be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
@@ -160,7 +160,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should not be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
});
@@ -176,7 +176,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should not be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
@@ -187,7 +187,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should not be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
});
@@ -205,7 +205,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@YES));
+ expect(testResultBOOL).to(beTrue());
});
});
@@ -220,7 +220,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should be denied", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
});
@@ -235,7 +235,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should be allowed", ^{
- expect(@(testResultBOOL)).to(equal(@YES));
+ expect(testResultBOOL).to(beTrue());
});
});
@@ -248,7 +248,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should be denied", ^{
- expect(@(testResultBOOL)).to(equal(@NO));
+ expect(testResultBOOL).to(beFalse());
});
});
});
@@ -570,7 +570,7 @@ describe(@"SDLPermissionsManager", ^{
});
it(@"should not be called", ^{
- expect(@(testObserverCalled)).to(equal(@NO));
+ expect(testObserverCalled).to(beFalse());
});
});