OCA\OcSms\Controller\SmsController::checkNewMessages PHP Method

checkNewMessages() public method

public checkNewMessages ( $lastDate ) : OCP\AppFramework\Http\JSONResponse
$lastDate
return OCP\AppFramework\Http\JSONResponse
    public function checkNewMessages($lastDate)
    {
        $phoneList = $this->smsMapper->getNewMessagesCountForAllPhonesNumbers($this->userId, $lastDate);
        $contactsSrc = $this->contactCache->getContacts();
        $photosSrc = $this->contactCache->getContactPhotos();
        $contacts = array();
        $photos = array();
        foreach ($phoneList as $number => $ts) {
            $fmtPN = preg_replace("#[ ]#", "", $number);
            if (isset($contactsSrc[$fmtPN])) {
                $contacts[$fmtPN] = $contactsSrc[$fmtPN];
                if (isset($photosSrc[$contacts[$fmtPN]])) {
                    $photos[$contacts[$fmtPN]] = $photosSrc[$contacts[$fmtPN]];
                }
            }
        }
        return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts, "photos" => $photos));
    }