File tree 2 files changed +18
-1
lines changed 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -415,7 +415,7 @@ + (void)handlePush:(NSDictionary *)userInfo {
415
415
416
416
NSString *soundName = aps[@" sound" ];
417
417
418
- if (soundName.length == 0 || [soundName isEqualToString: @" default" ]) {
418
+ if (( id )soundName == [ NSNull null ] || soundName.length == 0 || [soundName isEqualToString: @" default" ]) {
419
419
[[self pushInternalUtilClass ] playVibrate ];
420
420
} else {
421
421
[[self pushInternalUtilClass ] playAudioWithName: soundName];
Original file line number Diff line number Diff line change @@ -54,4 +54,21 @@ - (void)testHandlePushDictionaryAlert {
54
54
OCMVerifyAll (mockedUtils);
55
55
}
56
56
57
+ - (void )testHandlePushWithNullSound {
58
+ id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
59
+ OCMExpect ([mockedUtils showAlertViewWithTitle: [OCMArg isNil ] message: @" hello" ]);
60
+ OCMExpect ([mockedUtils playVibrate ]);
61
+
62
+ // NOTE: Async parse preload step may call this selector.
63
+ // Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
64
+ OCMStub ([mockedUtils getDeviceTokenFromKeychain ]).andReturn (nil );
65
+
66
+ [PFPush setPushInternalUtilClass: mockedUtils];
67
+ [PFPush handlePush: @{ @" aps" : @{@" alert" : @" hello" , @" sound" : [NSNull null ]} }];
68
+
69
+ OCMVerifyAll (mockedUtils);
70
+
71
+ [PFPush setPushInternalUtilClass: nil ];
72
+ }
73
+
57
74
@end
You can’t perform that action at this time.
0 commit comments