summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLRPCNotificationNotification.m
blob: 78645c6954af3c4ddc004d3bb8ecabd0f2507ade (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
//
//  SDLRPCNotificationNotification.m
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 8/25/16.
//  Copyright © 2016 smartdevicelink. All rights reserved.
//

#import "SDLRPCNotificationNotification.h"

#import "SDLNotificationConstants.h"
#import "SDLRPCNotification.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SDLRPCNotificationNotification

@synthesize name = _name;
@synthesize object = _object;
@synthesize userInfo = _userInfo;

- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcNotification:(SDLRPCNotification *)notification {
    _name = name;
    _object = object;
    _userInfo = @{SDLNotificationUserInfoObject: notification};

    return self;
}

- (__kindof SDLRPCNotification *)notification {
    return _userInfo[SDLNotificationUserInfoObject];
}

- (BOOL)isNotificationMemberOfClass:(Class)aClass {
    NSAssert([self.notification isMemberOfClass:aClass], @"A notification was sent with an unanticipated object");
    return [self.notification isMemberOfClass:aClass];
}

- (BOOL)isNotificationKindOfClass:(Class)aClass {
    NSAssert([self.notification isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
    return [self.notification isKindOfClass:aClass];
}

@end

NS_ASSUME_NONNULL_END