mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
dummy commit
This commit is contained in:
@@ -3,22 +3,20 @@
|
||||
namespace Appwrite\Platform\Workers;
|
||||
|
||||
use Exception;
|
||||
use libphonenumber\NumberParseException;
|
||||
use Utopia\App;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\DSN\DSN;
|
||||
use Utopia\Messaging\Messages\SMS;
|
||||
use Utopia\Messaging\Adapters\SMS\Mock;
|
||||
use Utopia\Messaging\Adapters\SMS\Msg91;
|
||||
use Utopia\Messaging\Adapters\SMS\Telesign;
|
||||
use Utopia\Messaging\Adapters\SMS\TextMagic;
|
||||
use Utopia\Messaging\Adapters\SMS\Twilio;
|
||||
use Utopia\Messaging\Adapters\SMS\Vonage;
|
||||
use Utopia\Messaging\Adapter\SMS\Mock;
|
||||
use Utopia\Messaging\Adapter\SMS\Msg91;
|
||||
use Utopia\Messaging\Adapter\SMS\Telesign;
|
||||
use Utopia\Messaging\Adapter\SMS\TextMagic;
|
||||
use Utopia\Messaging\Adapter\SMS\Twilio;
|
||||
use Utopia\Messaging\Adapter\SMS\Vonage;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Queue\Message;
|
||||
use Appwrite\Event\Usage;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Messaging extends Action
|
||||
{
|
||||
@@ -121,16 +119,11 @@ class Messaging extends Action
|
||||
try {
|
||||
$sms->send($message);
|
||||
|
||||
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||
$countryCode = $sms->getCountryCode($payload['recipient']);
|
||||
|
||||
try {
|
||||
$countryCode = $phoneUtil
|
||||
->parse($payload['recipient'])
|
||||
->getCountryCode();
|
||||
|
||||
$queueForUsage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_MESSAGES_COUNTRY_CODE), 1);
|
||||
} catch (NumberParseException $e) {
|
||||
Console::error("Error parsing number: " . $e->getMessage());
|
||||
if (!empty($countryCode)) {
|
||||
$queueForUsage
|
||||
->addMetric(str_replace('{countryCode}', $countryCode, METRIC_MESSAGES_COUNTRY_CODE), 1);
|
||||
}
|
||||
|
||||
$queueForUsage
|
||||
|
||||
Reference in New Issue
Block a user