-
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.
- Loading branch information
Showing
24 changed files
with
116 additions
and
12 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/class/defaultSelectedReplyToMessageId.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 @@ | ||
default values | ||
defaultSelectedReplyToMessageId | ||
|
||
^ 0 |
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
8 changes: 8 additions & 0 deletions
8
packages/TelegramClient-Core.package/TCCChat.class/instance/selectedReplyToMessageId..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,8 @@ | ||
accessing | ||
selectedReplyToMessageId: aNumber | ||
|
||
aNumber = selectedReplyToMessageId | ||
ifTrue: [selectedReplyToMessageId := self class defaultSelectedReplyToMessageId] | ||
ifFalse: [selectedReplyToMessageId := aNumber]. | ||
|
||
self triggerEvent: #updateReplyToMessageId |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/selectedReplyToMessageId.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 | ||
selectedReplyToMessageId | ||
|
||
^ selectedReplyToMessageId |
3 changes: 2 additions & 1 deletion
3
packages/TelegramClient-Core.package/TCCChat.class/instance/sendMessage..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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
sending | ||
sendMessage: aString | ||
|
||
self core send: (TCCRequest newSendMessage: aString to: self id). | ||
self core send: (TCCRequest newSendMessage: aString to: self id asReplyTo: self selectedReplyToMessageId). | ||
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
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
16 changes: 16 additions & 0 deletions
16
packages/TelegramClient-Core.package/TCCRequest.class/class/newSendMessage.to.asReplyTo..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,16 @@ | ||
instance creation | ||
newSendMessage: aString to: aChatId asReplyTo: aMessageId | ||
|
||
^ TCCRequest | ||
newWithType: 'sendMessage' | ||
from: { | ||
'chat_id' -> aChatId. | ||
'reply_to_message_id' -> aMessageId. | ||
'input_message_content' -> (Dictionary newFrom: { | ||
'@type' -> 'inputMessageText'. | ||
'text' -> (Dictionary newFrom: { | ||
'@type' -> 'formattedText'. | ||
'text' -> aString asString squeakToUtf8 | ||
}) | ||
}) | ||
} |
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
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-UI.package/TCUChatWindow.class/class/defaultInputfieldHeight.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
default values | ||
defaultInputfieldHeight | ||
|
||
^ 70 | ||
^ 120 |
11 changes: 11 additions & 0 deletions
11
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/addReplyMessage.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,11 @@ | ||
drawing | ||
addReplyMessage | ||
|
||
| message | | ||
message := self selectedChat getMessageById: self selectedChat selectedReplyToMessageId. | ||
|
||
self inputBar addMorphFront: (TextMorph new | ||
contentsWrapped: 'Reply to: ' , message asReplySnippet asText; | ||
extent: ((self inputBar width - 200) @ self class defaultInputfieldHeight); | ||
lock; | ||
yourself). |
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
3 changes: 2 additions & 1 deletion
3
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/selectedChat..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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
accessing | ||
selectedChat: aChat | ||
|
||
selectedChat := aChat. | ||
selectedChat := aChat. | ||
selectedChat when: #updateReplyToMessageId send: #updateReplyMessage to: self |
9 changes: 9 additions & 0 deletions
9
packages/TelegramClient-UI.package/TCUChatWindow.class/instance/updateReplyMessage.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 @@ | ||
accessing | ||
updateReplyMessage | ||
|
||
self inputBar submorphsDo: #abandon. | ||
self addSendButton. | ||
self addTextInputField. | ||
self selectedChat selectedReplyToMessageId == self selectedChat class defaultSelectedReplyToMessageId ifFalse: [ | ||
self addReplyMessage. | ||
]. |
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
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-UI.package/TCUMessage.class/instance/mouseDown..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 | ||
mouseDown: anEvent | ||
|
||
^ self messageModel chat selectedReplyToMessageId: self messageModel id |
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
...ts-UI.package/TCTUChatWindowTests.class/instance/testSelectAndDeselectMessageToReplyTo.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 @@ | ||
testing | ||
testSelectAndDeselectMessageToReplyTo | ||
|
||
| newMessage chatWindow | | ||
|
||
self openChatWithId: 1. | ||
chatWindow := self subject chatWindow. | ||
newMessage := (TCTMMocks mockTextMessageWith: self core) text: 'New message'. | ||
chatWindow selectedChat addNewestMessage: newMessage. | ||
|
||
self assertNotReading: newMessage text inMorph: chatWindow inputBar. | ||
chatWindow selectedChat selectedReplyToMessageId: newMessage id. | ||
self assertReading: newMessage text inMorph: chatWindow inputBar. | ||
chatWindow selectedChat selectedReplyToMessageId: newMessage id. | ||
self assertNotReading: newMessage text inMorph: chatWindow inputBar. |
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
10 changes: 10 additions & 0 deletions
10
.../TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMouseDownOnMessage.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,10 @@ | ||
testing | ||
testMouseDownOnMessage | ||
|
||
| message messageMorph | | ||
|
||
message := (TCTMMocks mockTextMessageWith: self core). | ||
messageMorph := TCUMessage newFrom: message. | ||
messageMorph mouseDown: EventMorph new. | ||
|
||
self assert: message chat selectedReplyToMessageId == messageMorph messageModel id. |
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
4 changes: 4 additions & 0 deletions
4
...s/TelegramClientTests-UI.package/TCTUTestCase.class/instance/assertNotReading.inMorph..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 @@ | ||
asserting | ||
assertNotReading: aString inMorph: aMorph | ||
|
||
self assertNotReading: aString in: (MTFMorphWrapper newWith: {aMorph}). |
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