summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLPermissionFilter.h
blob: f31666becb80c21032a123b610dcee85568f3dfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
//  SDLPermissionFilter.h
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 11/18/15.
//  Copyright © 2015 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "SDLPermissionConstants.h"


NS_ASSUME_NONNULL_BEGIN

@interface SDLPermissionFilter : NSObject <NSCopying>

/**
 *  An identifier for the permission filter to allow it to be removed at a later time.
 */
@property (copy, nonatomic, readonly) SDLPermissionObserverIdentifier identifier;

/**
 *  All of the RPC names in this filter group.
 */
@property (copy, nonatomic, readonly) NSArray<SDLPermissionRPCName> *rpcNames;

/**
 *  The type of this filter group.
 */
@property (assign, nonatomic, readonly) SDLPermissionGroupType groupType;

/**
 *  The block that will be called on status changes to this filter group.
 */
@property (copy, nonatomic, readonly) SDLPermissionsChangedHandler handler;

/**
 *  Create a new permission filter group.
 *
 *  @param rpcNames  The names of the RPCs to watch permissions of.
 *  @param groupType The type of notifications to be sent for this filter group.
 *  @param handler  The block observer to be called when changes occur.
 *
 *  @return An instance of `SDLPermissionFilter`.
 */
- (instancetype)initWithRPCNames:(NSArray<SDLPermissionRPCName> *)rpcNames groupType:(SDLPermissionGroupType)groupType observer:(SDLPermissionsChangedHandler)handler NS_DESIGNATED_INITIALIZER;

/**
 *  Create a new permission filter group.
 *
 *  @param rpcNames  The names of the RPCs to watch permissions of.
 *  @param groupType The type of notifications to be sent for this filter group.
 *  @param handler  The block observer to be called when changes occur.
 *
 *  @return An instance of `SDLPermissionFilter`.
 */
+ (instancetype)filterWithRPCNames:(NSArray<SDLPermissionRPCName> *)rpcNames groupType:(SDLPermissionGroupType)groupType observer:(SDLPermissionsChangedHandler)handler NS_SWIFT_UNAVAILABLE("Use the initializer");

/**
 *  Whether the current filter is equivalent with another filter or not.
 *
 *  @param otherFilter The other filter to test equivalence with.
 *
 *  @return YES if this filter is equivalent with `otherFilter`, NO otherwise.
 */
- (BOOL)isEqualToFilter:(SDLPermissionFilter *)otherFilter;

@end

NS_ASSUME_NONNULL_END