Compare commits

..

4 Commits

Author SHA1 Message Date
Alex affe904bed tag 1.5.1 2026-03-07 09:47:01 +03:00
Alex 6c4e0c8ca7 Merge pull request #24 from imperiumbee/master
Added payload param to openAppButton
2026-03-07 09:25:53 +03:00
imperiumbee 3eb3e07bfa Added payload param to openAppButton 2026-03-06 11:12:20 +03:00
Alex ab7ea25796 Месседжер MAX следит за пользователями VPN 2026-03-05 15:24:24 +03:00
4 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -9,7 +9,8 @@
> [!CAUTION] > [!CAUTION]
> На мой взгляд `Max Messenger` является ни чем иным как малварью, созданной для слежки за гражданами РФ. Настоятельно > На мой взгляд `Max Messenger` является ни чем иным как малварью, созданной для слежки за гражданами РФ. Настоятельно
> не рекомендую использовать его на реальных устройствах, с настоящим номером телефона, и для личной переписки. > не рекомендую использовать его на реальных устройствах, с настоящим номером телефона, и для личной переписки.
> Обязательно к прочтению - [Месседжер MAX следит за пользователями VPN](https://habr.com/ru/articles/1006666/)
## Быстрый старт ## Быстрый старт
+1 -1
View File
@@ -48,7 +48,7 @@ use RuntimeException;
*/ */
class Api class Api
{ {
public const string LIBRARY_VERSION = '1.5.0'; public const string LIBRARY_VERSION = '1.5.1';
public const string API_VERSION = '1.2.5'; public const string API_VERSION = '1.2.5';
@@ -13,17 +13,20 @@ final readonly class OpenAppButton extends AbstractInlineButton
{ {
public ?string $webApp; public ?string $webApp;
public ?int $contactId; public ?int $contactId;
public ?string $payload;
/** /**
* @param string $text Visible button text (1 to 128 characters). * @param string $text Visible button text (1 to 128 characters).
* @param string|null $webApp The public name (username) of the bot or a link to it, whose mini-application should be launched. * @param string|null $webApp The public name (username) of the bot or a link to it, whose mini-application should be launched.
* @param int|null $contactId The ID of the bot whose mini-app should be launched. * @param int|null $contactId The ID of the bot whose mini-app should be launched.
* @param string|null $payload Init param which would be passed in mini-application initData (1 to 512 characters, allowed A-Z, a-z, 0-9, _(underscore) , - (minus) ).
*/ */
public function __construct(string $text, ?string $webApp = null, ?int $contactId = null) public function __construct(string $text, ?string $webApp = null, ?int $contactId = null, ?string $payload = null)
{ {
parent::__construct(InlineButtonType::OpenApp, $text); parent::__construct(InlineButtonType::OpenApp, $text);
$this->webApp = $webApp; $this->webApp = $webApp;
$this->contactId = $contactId; $this->contactId = $contactId;
$this->payload = $payload;
} }
} }
@@ -16,11 +16,12 @@ final class OpenAppButtonTest extends TestCase
#[Test] #[Test]
public function toArraySerializesCorrectly(): void public function toArraySerializesCorrectly(): void
{ {
$button = new OpenAppButton('Test Button', 'MyWebApp', 123); $button = new OpenAppButton('Test Button', 'MyWebApp', 123, 'somePayload');
$expectedArray = [ $expectedArray = [
'web_app' => 'MyWebApp', 'web_app' => 'MyWebApp',
'contact_id' => 123, 'contact_id' => 123,
'payload' => 'somePayload',
'type' => InlineButtonType::OpenApp->value, 'type' => InlineButtonType::OpenApp->value,
'text' => 'Test Button', 'text' => 'Test Button',
]; ];
@@ -38,6 +39,7 @@ final class OpenAppButtonTest extends TestCase
'text' => 'Launch', 'text' => 'Launch',
'web_app' => 'SomeApp', 'web_app' => 'SomeApp',
'contact_id' => 456, 'contact_id' => 456,
'payload' => 'somePayload'
]; ];
$button = OpenAppButton::fromArray($data); $button = OpenAppButton::fromArray($data);
@@ -47,5 +49,6 @@ final class OpenAppButtonTest extends TestCase
$this->assertSame('Launch', $button->text); $this->assertSame('Launch', $button->text);
$this->assertSame('SomeApp', $button->webApp); $this->assertSame('SomeApp', $button->webApp);
$this->assertSame(456, $button->contactId); $this->assertSame(456, $button->contactId);
$this->assertSame('somePayload', $button->payload);
} }
} }