blob: 0d2d9f03e807ea9d80b51231b37fdf2a0c7a8732 (
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
|
//
// SDLMenuCell.m
// SmartDeviceLink
//
// Created by Joel Fischer on 4/9/18.
// Copyright © 2018 smartdevicelink. All rights reserved.
//
#import "SDLMenuCell.h"
#import "SDLArtwork.h"
NS_ASSUME_NONNULL_BEGIN
@interface SDLMenuCell()
@property (assign, nonatomic) UInt32 parentCellId;
@property (assign, nonatomic) UInt32 cellId;
@end
@implementation SDLMenuCell
- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler {
self = [super init];
if (!self) { return nil; }
_title = title;
_icon = icon;
_voiceCommands = voiceCommands;
_handler = handler;
_cellId = UINT32_MAX;
_parentCellId = UINT32_MAX;
return self;
}
- (instancetype)initWithTitle:(NSString *)title subCells:(NSArray<SDLMenuCell *> *)subCells {
self = [super init];
if (!self) { return nil; }
_title = title;
_subCells = subCells;
_cellId = UINT32_MAX;
_parentCellId = UINT32_MAX;
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:@"SDLMenuCell: %u-\"%@\", artworkName: %@, voice commands: %lu, isSubcell: %@, hasSubcells: %@", (unsigned int)_cellId, _title, _icon.name, (unsigned long)_voiceCommands.count, (_parentCellId != UINT32_MAX ? @"YES" : @"NO"), (_subCells.count > 0 ? @"YES" : @"NO")];
}
@end
NS_ASSUME_NONNULL_END
|