-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic support for selecting and sending photos. Videos and other …
…documents broken
- Loading branch information
Elia Doumerc
committed
Jun 19, 2024
1 parent
972abbf
commit 58570e6
Showing
179 changed files
with
135 additions
and
1,379 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
packages/TelegramClient-Core.package/TCCChat.class/instance/sendDocumentMessage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sending | ||
sendDocumentMessage: aDocumentPath | ||
|
||
self core send: (TCCRequest newSendDocumentMessage: aDocumentPath to: self id). | ||
self selectedReplyToMessageId: self class defaultSelectedReplyToMessageId. |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClient-Core.package/TCCChat.class/instance/sendPhotoMessage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sending | ||
sendPhotoMessage: aPhotoPath | ||
|
||
self core send: (TCCRequest newSendPhotoMessage: aPhotoPath to: self id). | ||
self selectedReplyToMessageId: self class defaultSelectedReplyToMessageId. |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClient-Core.package/TCCChat.class/instance/sendVideoMessage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sending | ||
sendVideoMessage: aVideoPath | ||
|
||
self core send: (TCCRequest newSendVideoMessage: aVideoPath to: self id). | ||
self selectedReplyToMessageId: self class defaultSelectedReplyToMessageId. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/TelegramClient-Core.package/TCCRequest.class/class/newSendDocumentMessage.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
instance creation | ||
newSendDocumentMessage: aDocumentPath to: aChatId | ||
|
||
^ TCCRequest | ||
newWithType: 'sendMessage' | ||
from: { | ||
'chat_id' -> aChatId. | ||
'input_message_content' -> (Dictionary newFrom: { | ||
'@type' -> 'inputMessageDocument'. | ||
'photo' -> (Dictionary newFrom: { | ||
'@type' -> 'inputFileLocal'. | ||
'path' -> aDocumentPath. | ||
}) | ||
}) | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/TelegramClient-Core.package/TCCRequest.class/class/newSendFileMessage.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
instance creation | ||
newSendFileMessage: aPhotoPath to: aChatId | ||
|
||
^ TCCRequest | ||
newWithType: 'sendMessage' | ||
from: { | ||
'chat_id' -> aChatId. | ||
'input_message_content' -> (Dictionary newFrom: { | ||
'@type' -> 'inputMessagePhoto'. | ||
'photo' -> (Dictionary newFrom: { | ||
'@type' -> 'inputFileLocal'. | ||
'path' -> aPhotoPath. | ||
}) | ||
}) | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/TelegramClient-Core.package/TCCRequest.class/class/newSendPhotoMessage.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
instance creation | ||
newSendPhotoMessage: aPhotoPath to: aChatId | ||
|
||
^ TCCRequest | ||
newWithType: 'sendMessage' | ||
from: { | ||
'chat_id' -> aChatId. | ||
'input_message_content' -> (Dictionary newFrom: { | ||
'@type' -> 'inputMessagePhoto'. | ||
'photo' -> (Dictionary newFrom: { | ||
'@type' -> 'inputFileLocal'. | ||
'path' -> aPhotoPath. | ||
}) | ||
}) | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/TelegramClient-Core.package/TCCRequest.class/class/newSendVideoMessage.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
instance creation | ||
newSendVideoMessage: aVideoPath to: aChatId | ||
|
||
^ TCCRequest | ||
newWithType: 'sendMessage' | ||
from: { | ||
'chat_id' -> aChatId. | ||
'input_message_content' -> (Dictionary newFrom: { | ||
'@type' -> 'inputMessageVideo'. | ||
'video' -> (Dictionary newFrom: { | ||
'@type' -> 'inputFileLocal'. | ||
'path' -> aVideoPath. | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/addFileButton.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
drawing | ||
addFileButton | ||
|
||
self fileButton: (TCUButton new | ||
text: 'Select File'; | ||
on: #mouseUp send: #buttonFileSelectPressed to: self; | ||
name: 'selectFile'; | ||
yourself). | ||
self inputBar addMorph: self fileButton. |
22 changes: 22 additions & 0 deletions
22
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/buttonFileSelectPressed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
event handling | ||
buttonFileSelectPressed | ||
|
||
| fileEnding fileObject videoEndings photoEndings| | ||
|
||
photoEndings := #('jpg' 'jpeg' 'png' 'webp' 'gif' 'bmp'). | ||
videoEndings := #('mp4' 'webm' 'mov' 'avi'). | ||
|
||
fileObject := (FileChooser new initializeAsDialogBox open). | ||
fileObject isNil ifFalse: [ | ||
fileEnding := fileObject fullName. | ||
(fileObject fullName endsWithAnyOf: photoEndings) ifTrue: [ | ||
self selectedChat sendPhotoMessage: (fileObject fullName) | ||
] ifFalse: [ | ||
(fileObject fullName endsWithAnyOf: videoEndings) ifTrue: [ | ||
self selectedChat sendVideoMessage: (fileObject fullName). | ||
] ifFalse: [ | ||
self selectedChat sendDocumentMessage: (fileObject fullName). | ||
] | ||
] | ||
|
||
]. |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/fileButton..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
fileButton: aTelegramButton | ||
|
||
fileButton := aTelegramButton |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/fileButton.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
fileButton | ||
|
||
^ fileButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/TelegramClientTests-UI.package/TCTUAuthenticationTests.class/README.md
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/TelegramClientTests-UI.package/TCTUAuthenticationTests.class/instance/setUp.st
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...tTests-UI.package/TCTUAuthenticationTests.class/instance/testEnteringCodeOpensTelegram.st
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...ts-UI.package/TCTUAuthenticationTests.class/instance/testEnteringPasswordOpensTelegram.st
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...s-UI.package/TCTUAuthenticationTests.class/instance/testEnteringPhoneNumberAsksForCode.st
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...lientTests-UI.package/TCTUAuthenticationTests.class/instance/testPressCancelOnAuthCode.st
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...tTests-UI.package/TCTUAuthenticationTests.class/instance/testPressCancelOnAuthPassword.st
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...ests-UI.package/TCTUAuthenticationTests.class/instance/testTelegramOpensAuthentication.st
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
packages/TelegramClientTests-UI.package/TCTUAuthenticationTests.class/methodProperties.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/TelegramClientTests-UI.package/TCTUAuthenticationTests.class/properties.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/TelegramClientTests-UI.package/TCTUButtonTests.class/README.md
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...ages/TelegramClientTests-UI.package/TCTUButtonTests.class/instance/testHoverOnTitleBar.st
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.