blob: b8f25b5c8d2bcc6058a63231a5ef12b94614a263 (
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
|
// SDLSubscribeButton.m
//
#import "SDLSubscribeButton.h"
#import "NSMutableDictionary+Store.h"
#import "SDLRPCParameterNames.h"
#import "SDLRPCFunctionNames.h"
NS_ASSUME_NONNULL_BEGIN
@implementation SDLSubscribeButton
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (instancetype)init {
if (self = [super initWithName:SDLRPCFunctionNameSubscribeButton]) {
}
return self;
}
#pragma clang diagnostic pop
- (instancetype)initWithHandler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
}
_handler = handler;
return self;
}
- (instancetype)initWithButtonName:(SDLButtonName)buttonName handler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
}
self.buttonName = buttonName;
self.handler = handler;
return self;
}
- (void)setButtonName:(SDLButtonName)buttonName {
[self.parameters sdl_setObject:buttonName forName:SDLRPCParameterNameButtonName];
}
- (SDLButtonName)buttonName {
NSError *error = nil;
return [self.parameters sdl_enumForName:SDLRPCParameterNameButtonName error:&error];
}
-(id)copyWithZone:(nullable NSZone *)zone {
SDLSubscribeButton *newButton = [super copyWithZone:zone];
newButton->_handler = self.handler;
return newButton;
}
@end
NS_ASSUME_NONNULL_END
|