-
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 replyToMessageId to TCCMessage * Add replyText to TCCMessage * Add reply snippet to UI * Make UI look even prettier by using the correct colors and slicing replySnippets * Add class comment * Use proper category for TCCCore>>getMessageById * Adapt screenshot tests to new UI * Make linter happy
- Loading branch information
1 parent
2f551d2
commit e6d70d1
Showing
42 changed files
with
205 additions
and
26 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/TelegramClient-Core.package/TCCChat.class/instance/getMessageById..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,6 @@ | ||
accessing | ||
getMessageById: aNumber | ||
|
||
^ self messages | ||
detect: [:aMessage | aMessage id = aNumber] | ||
ifNone: TCCNotLoadedMessage new |
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
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCMessage.class/class/maxReplySnippetSize.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 @@ | ||
as yet unclassified | ||
maxReplySnippetSize | ||
|
||
^ 25 |
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
7 changes: 7 additions & 0 deletions
7
packages/TelegramClient-Core.package/TCCMessage.class/instance/asReplySnippet.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,7 @@ | ||
accessing | ||
asReplySnippet | ||
|
||
| snippet | | ||
snippet := self asSnippet. | ||
snippet size > self class maxReplySnippetSize ifTrue: [snippet := (snippet copyFrom: 1 to: self class maxReplySnippetSize) , '...']. | ||
^ self senderName , String cr , snippet |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCMessage.class/instance/isReply.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 | ||
isReply | ||
|
||
^ self replyToMessageId ~= 0 |
7 changes: 7 additions & 0 deletions
7
packages/TelegramClient-Core.package/TCCMessage.class/instance/replyText.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,7 @@ | ||
accessing | ||
replyText | ||
|
||
| message | | ||
message := self chat getMessageById: self replyToMessageId. | ||
|
||
^ message asReplySnippet |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCMessage.class/instance/replyToMessageId..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 | ||
replyToMessageId: aNumber | ||
|
||
replyToMessageId := aNumber |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCMessage.class/instance/replyToMessageId.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 | ||
replyToMessageId | ||
|
||
^ replyToMessageId |
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
1 change: 1 addition & 0 deletions
1
packages/TelegramClient-Core.package/TCCNotLoadedMessage.class/README.md
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 @@ | ||
Message that is not loaded, but used in some way, e.g. for a reply |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCNotLoadedMessage.class/class/infoText.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 | ||
infoText | ||
|
||
^ 'Message not loaded' |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCNotLoadedMessage.class/instance/asReplySnippet.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 | ||
asReplySnippet | ||
|
||
^ self class infoText |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClient-Core.package/TCCNotLoadedMessage.class/methodProperties.json
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 @@ | ||
{ | ||
"class" : { | ||
"infoText" : "rgw 5/12/2022 14:39" }, | ||
"instance" : { | ||
"asReplySnippet" : "rgw 5/12/2022 15:34" } } |
14 changes: 14 additions & 0 deletions
14
packages/TelegramClient-Core.package/TCCNotLoadedMessage.class/properties.json
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,14 @@ | ||
{ | ||
"category" : "TelegramClient-Core", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "TCCNotLoadedMessage", | ||
"pools" : [ | ||
], | ||
"super" : "TCCMessage", | ||
"type" : "normal" } |
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
20 changes: 20 additions & 0 deletions
20
packages/TelegramClient-UI.package/TCUMessage.class/instance/addReplySnippet.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,20 @@ | ||
constructing | ||
addReplySnippet | ||
|
||
self addMorphBack: (self class defaultTextMorph | ||
contents: self messageModel replyText; | ||
hResizing: #spaceFill; | ||
color: TCUDefaultValues colorLightGray; | ||
yourself). | ||
self addMorphBack: (RectangleMorph new | ||
color: self messageColor; | ||
borderWidth: 0; | ||
height: 5). | ||
self addMorphBack: (RectangleMorph new | ||
color: self secondaryColor; | ||
borderWidth: 0; | ||
height: 2). | ||
self addMorphBack: (RectangleMorph new | ||
color: self messageColor; | ||
borderWidth: 0; | ||
height: 5) |
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
2 changes: 1 addition & 1 deletion
2
...ge/TCUMessage.class/instance/dateColor.st → ...UMessage.class/instance/secondaryColor.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,5 +1,5 @@ | ||
drawing | ||
dateColor | ||
secondaryColor | ||
|
||
^ self isOutgoing | ||
ifTrue: [TCUDefaultValues colorPottersClay] | ||
|
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
packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testGetMessageById.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 | ||
testGetMessageById | ||
|
||
| message | | ||
|
||
message := self chat getMessageById: 16. | ||
self assert: '4' equals: message asText. | ||
|
||
message := self chat getMessageById: 17. | ||
self assert: 'Message not loaded' equals: message asReplySnippet. |
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
10 changes: 10 additions & 0 deletions
10
...es/TelegramClientTests-Core.package/TCTCMessageTests.class/instance/testMessageIsReply.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 | ||
testMessageIsReply | ||
|
||
| chat replyMessage originalMessage | | ||
chat := TCTMMocks mockPrivateChat. | ||
originalMessage := TCTMMocks mockTextMessageWith: self core inChat: chat. | ||
replyMessage := TCTMMocks mockTextReplyMessageWith: self core inChat: chat. | ||
|
||
self assert: originalMessage isReply not. | ||
self assert: replyMessage isReply |
8 changes: 8 additions & 0 deletions
8
...entTests-Core.package/TCTCMessageTests.class/instance/testMessageReplySnippetTruncates.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 @@ | ||
testing | ||
testMessageReplySnippetTruncates | ||
|
||
| message | | ||
message := TCTMMocks mockTextMessageWith: self core. | ||
message text: ((String new: 250) atAllPut: $A). | ||
|
||
self assert: message asReplySnippet size - message senderName size - 4 <= (TCCMessage maxReplySnippetSize) |
14 changes: 14 additions & 0 deletions
14
.../TelegramClientTests-Core.package/TCTCMessageTests.class/instance/testMessageReplyText.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,14 @@ | ||
testing | ||
testMessageReplyText | ||
|
||
| chat replyMessage originalMessage | | ||
chat := TCTMMocks mockPrivateChat. | ||
originalMessage := TCTMMocks mockTextMessageWith: self core inChat: chat. | ||
replyMessage := TCTMMocks mockTextReplyMessageWith: self core inChat: chat. | ||
chat addNewestMessage: replyMessage. | ||
|
||
self assert: TCCNotLoadedMessage infoText equals: replyMessage replyText. | ||
|
||
chat addNewestMessage: originalMessage. | ||
|
||
self assert: replyMessage replyText equals: originalMessage asReplySnippet. |
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/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessageReplyMessageId.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 @@ | ||
message | ||
mockMessageReplyMessageId | ||
|
||
^ 42 |
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
13 changes: 13 additions & 0 deletions
13
...ges/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.inChat..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,13 @@ | ||
message | ||
mockTextMessageWith: aCore inChat: aChat | ||
|
||
^ TCCTextMessage new | ||
chat: aChat; | ||
core: aCore; | ||
userId: self mockUser1 id; | ||
isOutgoing: false; | ||
senderType: #messageSenderUser; | ||
date: self mockMessageDate; | ||
id: self mockMessageId; | ||
text: self mockText; | ||
replyToMessageId: 0 |
13 changes: 13 additions & 0 deletions
13
...elegramClientTests-Misc.package/TCTMMocks.class/class/mockTextReplyMessageWith.inChat..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,13 @@ | ||
message | ||
mockTextReplyMessageWith: aCore inChat: aChat | ||
|
||
^ TCCTextMessage new | ||
chat: aChat; | ||
core: aCore; | ||
userId: self mockUser1 id; | ||
isOutgoing: false; | ||
senderType: #messageSenderUser; | ||
date: self mockMessageDate; | ||
id: self mockMessageReplyMessageId; | ||
text: self mockText; | ||
replyToMessageId: self mockMessageId |
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
Oops, something went wrong.