Skip to content

Commit

Permalink
fixed to work voice/video/location
Browse files Browse the repository at this point in the history
  • Loading branch information
kenyasue committed Dec 23, 2013
1 parent aa19e84 commit 09d2638
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/Spika/Controller/MessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ function (Request $request)use($app,$self) {
}

$messageDataArray=json_decode($messageData,true);


$app['monolog']->addDebug("message json " . $messageData);

$fromUserId = $currentUser['_id'];
$toUserId = trim($messageDataArray['to_user_id']);

Expand Down Expand Up @@ -186,9 +188,27 @@ function (Request $request)use($app,$self) {
$additionalParams['picture_thumb_file_id'] = $messageDataArray['picture_thumb_file_id'];
}

// voice message
if(isset($messageDataArray['voice_file_id'])){
$additionalParams['voice_file_id'] = $messageDataArray['voice_file_id'];
}

// video message
if(isset($messageDataArray['video_file_id'])){
$additionalParams['video_file_id'] = $messageDataArray['video_file_id'];
}

// location message
if(isset($messageDataArray['longitude'])){
$additionalParams['longitude'] = $messageDataArray['longitude'];
}
if(isset($messageDataArray['latitude'])){
$additionalParams['latitude'] = $messageDataArray['latitude'];
}


$result = $app['spikadb']->addNewUserMessage($messageType,$fromUserId,$toUserId,$message,$additionalParams);
$app['monolog']->addDebug("SendMessage API called from user: \n {$fromUserId} \n");
$app['monolog']->addDebug("send message API params " . print_r($additionalParams,true));

if($result == null)
return $self->returnErrorResponse("failed to send message");
Expand Down

0 comments on commit 09d2638

Please sign in to comment.