Skip to content

Commit 76f39c0

Browse files
author
ChristineXYS
committed
When App in FG, after showing custom dialog, it should continue to show result dialog. Fix msgID is string instead of int, which cause the type cast failure.
1 parent a1f10ee commit 76f39c0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ios/Streethawk.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,29 +410,29 @@ - (void)sendPushResult:(CDVInvokedUrlCommand *)command
410410
#ifdef SH_FEATURE_NOTIFICATION
411411
if (command.arguments.count == 2)
412412
{
413-
if ([command.arguments[0] isKindOfClass:[NSNumber class]] && [command.arguments[1] isKindOfClass:[NSNumber class]])
413+
if ([command.arguments[0] isKindOfClass:[NSString class]] && [command.arguments[1] isKindOfClass:[NSNumber class]])
414414
{
415-
NSInteger msgId = [command.arguments[0] integerValue];
415+
NSString *msgId = command.arguments[0];
416416
NSInteger pushResult = [command.arguments[1] integerValue];
417417
if (pushResult < -1 || pushResult > 1)
418418
{
419419
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Push result should be: 1 for accept, 0 for postpone, -1 for decline."];
420420
}
421421
else
422422
{
423-
NSAssert([self.dictPushMsgHandler.allKeys containsObject:@(msgId)], @"Cannot find msgid %ld match.", msgId);
424-
if ([self.dictPushMsgHandler.allKeys containsObject:@(msgId)])
423+
NSAssert([self.dictPushMsgHandler.allKeys containsObject:msgId], @"Cannot find msgid %@ match.", msgId);
424+
if ([self.dictPushMsgHandler.allKeys containsObject:msgId])
425425
{
426-
ClickButtonHandler handler = self.dictPushMsgHandler[@(msgId)];
426+
ClickButtonHandler handler = self.dictPushMsgHandler[msgId];
427427
handler((SHResult)pushResult);
428-
[self.dictPushMsgHandler removeObjectForKey:@(msgId)];
428+
[self.dictPushMsgHandler removeObjectForKey:msgId];
429429
}
430430
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
431431
}
432432
}
433433
else
434434
{
435-
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Parameters expect [int_msgid, int_pushresult]."];
435+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Parameters expect [string_msgid, int_pushresult]."];
436436
}
437437
}
438438
else
@@ -1337,7 +1337,7 @@ - (BOOL)onReceive:(PushDataForApplication *)pushData clickButton:(ClickButtonHan
13371337
//insert into memory cache
13381338
if (handler)
13391339
{
1340-
NSAssert(![self.dictPushMsgHandler.allKeys containsObject:pushData.msgID], @"msg id %ld is inside cache.", pushData.msgID);
1340+
NSAssert(![self.dictPushMsgHandler.allKeys containsObject:pushData.msgID], @"msg id %@ is inside cache.", pushData.msgID);
13411341
if (![self.dictPushMsgHandler.allKeys containsObject:pushData.msgID])
13421342
{
13431343
[self.dictPushMsgHandler setObject:handler forKey:pushData.msgID];

0 commit comments

Comments
 (0)