@@ -11,6 +11,7 @@ typedef NS_ENUM(NSInteger, CTNotificationContentType) {
1111 CTNotificationContentTypeAutoCarousel = 3 ,
1212 CTNotificationContentTypeManualCarousel = 4 ,
1313 CTNotificationContentTypeTimerTemplate = 5 ,
14+ CTNotificationContentTypeZeroBezel = 6
1415};
1516
1617static NSString * const kTemplateId = @" pt_id" ;
@@ -23,12 +24,15 @@ typedef NS_ENUM(NSInteger, CTNotificationContentType) {
2324static NSString * const kSingleMediaURL = @" ct_mediaUrl" ;
2425static NSString * const kJSON = @" pt_json" ;
2526static NSString * const kDeeplinkURL = @" wzrk_dl" ;
27+ static NSString * const kTemplateZeroBezel = @" pt_zero_bezel" ;
2628
2729@interface CTNotificationViewController () <UNNotificationContentExtension>
2830
2931@property (nonatomic , assign ) CTNotificationContentType contentType;
3032@property (nonatomic , strong , readwrite ) BaseCTNotificationContentViewController *contentViewController;
3133@property (nonatomic ) NSString *jsonString;
34+ @property (nonatomic ) NSDictionary *content;
35+ @property (nonatomic ) UNNotification *notification;
3236
3337@end
3438
@@ -41,17 +45,19 @@ - (void)viewDidLoad {
4145}
4246
4347- (void )didReceiveNotification : (UNNotification *)notification {
44- NSDictionary *content = notification.request .content .userInfo ;
45- [self updateContentType: content];
48+ _content = notification.request .content .userInfo ;
49+ _notification = notification;
50+
51+ [self updateContentType: _content];
4652
4753 switch (self.contentType ) {
4854 case CTNotificationContentTypeContentSlider: {
4955 CTContentSliderController *contentController = [[CTContentSliderController alloc ] init ];
50- [contentController setData: content [kContentSlider ]];
56+ [contentController setData: _content [kContentSlider ]];
5157 [contentController setTemplateCaption: notification.request.content.title];
5258 [contentController setTemplateSubcaption: notification.request.content.body];
53- if (content [kDeeplinkURL ] != nil ) {
54- [contentController setDeeplinkURL: content [kDeeplinkURL ]];
59+ if (_content [kDeeplinkURL ] != nil ) {
60+ [contentController setDeeplinkURL: _content [kDeeplinkURL ]];
5561 }
5662 [self addChildViewController: contentController];
5763 contentController.view .frame = self.view .frame ;
@@ -63,10 +69,10 @@ - (void)didReceiveNotification:(UNNotification *)notification {
6369 CTSingleMediaController *contentController = [[CTSingleMediaController alloc ] init ];
6470 [contentController setCaption: notification.request.content.title];
6571 [contentController setSubCaption: notification.request.content.body];
66- [contentController setMediaType: content [kSingleMediaType ]];
67- [contentController setMediaURL: content [kSingleMediaURL ]];
68- if (content [kDeeplinkURL ] != nil ) {
69- [contentController setDeeplinkURL: content [kDeeplinkURL ]];
72+ [contentController setMediaType: _content [kSingleMediaType ]];
73+ [contentController setMediaURL: _content [kSingleMediaURL ]];
74+ if (_content [kDeeplinkURL ] != nil ) {
75+ [contentController setDeeplinkURL: _content [kDeeplinkURL ]];
7076 }
7177 [self addChildViewController: contentController];
7278 contentController.view .frame = self.view .frame ;
@@ -76,61 +82,30 @@ - (void)didReceiveNotification:(UNNotification *)notification {
7682 break ;
7783 case CTNotificationContentTypeBasicTemplate: {
7884 CTCarouselController *contentController = [[CTCarouselController alloc ] init ];
79- [contentController setData: self .jsonString];
80- [contentController setTemplateCaption: notification.request.content.title];
81- [contentController setTemplateSubcaption: notification.request.content.body];
82- if (content[kDeeplinkURL ] != nil ) {
83- [contentController setDeeplinkURL: content[kDeeplinkURL ]];
84- }
8585 [contentController setTemplateType: kTemplateBasic ];
86- [self addChildViewController: contentController];
87- contentController.view .frame = self.view .frame ;
88- [self .view addSubview: contentController.view];
89- self.contentViewController = contentController;
86+ [self setupContentController: contentController];
9087 }
9188 break ;
9289 case CTNotificationContentTypeAutoCarousel: {
9390 CTCarouselController *contentController = [[CTCarouselController alloc ] init ];
94- [contentController setData: self .jsonString];
95- [contentController setTemplateCaption: notification.request.content.title];
96- [contentController setTemplateSubcaption: notification.request.content.body];
97- if (content[kDeeplinkURL ] != nil ) {
98- [contentController setDeeplinkURL: content[kDeeplinkURL ]];
99- }
10091 [contentController setTemplateType: kTemplateAutoCarousel ];
101- [self addChildViewController: contentController];
102- contentController.view .frame = self.view .frame ;
103- [self .view addSubview: contentController.view];
104- self.contentViewController = contentController;
92+ [self setupContentController: contentController];
10593 }
10694 break ;
10795 case CTNotificationContentTypeManualCarousel: {
10896 CTCarouselController *contentController = [[CTCarouselController alloc ] init ];
109- [contentController setData: self .jsonString];
110- [contentController setTemplateCaption: notification.request.content.title];
111- [contentController setTemplateSubcaption: notification.request.content.body];
112- if (content[kDeeplinkURL ] != nil ) {
113- [contentController setDeeplinkURL: content[kDeeplinkURL ]];
114- }
11597 [contentController setTemplateType: kTemplateManualCarousel ];
116- [self addChildViewController: contentController];
117- contentController.view .frame = self.view .frame ;
118- [self .view addSubview: contentController.view];
119- self.contentViewController = contentController;
98+ [self setupContentController: contentController];
12099 }
121100 break ;
122101 case CTNotificationContentTypeTimerTemplate: {
123102 CTTimerTemplateController *contentController = [[CTTimerTemplateController alloc ] init ];
124- [contentController setData: self .jsonString];
125- [contentController setTemplateCaption: notification.request.content.title];
126- [contentController setTemplateSubcaption: notification.request.content.body];
127- if (content[kDeeplinkURL ] != nil ) {
128- [contentController setDeeplinkURL: content[kDeeplinkURL ]];
129- }
130- [self addChildViewController: contentController];
131- contentController.view .frame = self.view .frame ;
132- [self .view addSubview: contentController.view];
133- self.contentViewController = contentController;
103+ [self setupContentController: contentController];
104+ }
105+ break ;
106+ case CTNotificationContentTypeZeroBezel: {
107+ CTZeroBezelController *contentController = [[CTZeroBezelController alloc ] init ];
108+ [self setupContentController: contentController];
134109 }
135110 break ;
136111
@@ -142,6 +117,19 @@ - (void)didReceiveNotification:(UNNotification *)notification {
142117 self.preferredContentSize = self.contentViewController .preferredContentSize ;
143118}
144119
120+ - (void )setupContentController : (id )contentController {
121+ [contentController setData: self .jsonString];
122+ [contentController setTemplateCaption: _notification.request.content.title];
123+ [contentController setTemplateSubcaption: _notification.request.content.body];
124+ if (self.content [kDeeplinkURL ] != nil ) {
125+ [contentController setDeeplinkURL: self .content[kDeeplinkURL ]];
126+ }
127+ [self addChildViewController: contentController];
128+ [contentController view ].frame = self.view .frame ;
129+ [self .view addSubview: [contentController view ]];
130+ self.contentViewController = contentController;
131+ }
132+
145133- (void )updateContentType : (NSDictionary *)content {
146134 if (content[kContentSlider ] != nil ) {
147135 self.contentType = CTNotificationContentTypeContentSlider;
@@ -161,6 +149,8 @@ - (void)updateContentType:(NSDictionary *)content {
161149 self.contentType = CTNotificationContentTypeManualCarousel;
162150 } else if ([content[kTemplateId ] isEqualToString: kTemplateTimer ]) {
163151 self.contentType = CTNotificationContentTypeTimerTemplate;
152+ }else if ([content[kTemplateId ] isEqualToString: kTemplateZeroBezel ]) {
153+ self.contentType = CTNotificationContentTypeZeroBezel;
164154 } else {
165155 // Invalid pt_id value fallback to basic.
166156 self.contentType = CTNotificationContentTypeBasicTemplate;
0 commit comments