dummy commit

This commit is contained in:
shimon
2024-04-07 18:15:46 +03:00
parent ad44c7a430
commit fcba25d004
3 changed files with 247 additions and 196 deletions
+10 -17
View File
@@ -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