File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 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 {
415415
416416 NSString *soundName = aps[@" sound" ];
417417
418- if (soundName.length == 0 || [soundName isEqualToString: @" default" ]) {
418+ if (( id )soundName == [ NSNull null ] || soundName.length == 0 || [soundName isEqualToString: @" default" ]) {
419419 [[self pushInternalUtilClass ] playVibrate ];
420420 } else {
421421 [[self pushInternalUtilClass ] playAudioWithName: soundName];
Original file line number Diff line number Diff line change @@ -54,4 +54,21 @@ - (void)testHandlePushDictionaryAlert {
5454 OCMVerifyAll (mockedUtils);
5555}
5656
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+
5774@end
You can’t perform that action at this time.
0 commit comments