blob: 81a025614a2a8fc454add3ddbe6a786864c8ed57 (
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
|
// SDLOnPermissionsChange.m
//
#import "SDLOnPermissionsChange.h"
#import "SDLNames.h"
#import "SDLPermissionItem.h"
@implementation SDLOnPermissionsChange
- (instancetype)init {
if (self = [super initWithName:SDLNameOnPermissionsChange]) {
}
return self;
}
- (void)setPermissionItem:(NSMutableArray<SDLPermissionItem *> *)permissionItem {
if (permissionItem != nil) {
[parameters setObject:permissionItem forKey:SDLNamePermissionItem];
} else {
[parameters removeObjectForKey:SDLNamePermissionItem];
}
}
- (NSMutableArray<SDLPermissionItem *> *)permissionItem {
NSMutableArray<SDLPermissionItem *> *array = [parameters objectForKey:SDLNamePermissionItem];
if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLPermissionItem.class]) {
return array;
} else {
NSMutableArray<SDLPermissionItem *> *newList = [NSMutableArray arrayWithCapacity:[array count]];
for (NSDictionary<NSString *, id> *dict in array) {
[newList addObject:[[SDLPermissionItem alloc] initWithDictionary:(NSDictionary *)dict]];
}
return newList;
}
}
@end
|