diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/chatHistoryReceived..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/chatHistoryReceived..st index 3e673403d..ad41271c4 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/instance/chatHistoryReceived..st +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/chatHistoryReceived..st @@ -2,7 +2,11 @@ loading chatHistoryReceived: anEvent (anEvent at: 'messages') do: - [:message | self addOldestMessage: (TCCMessage newFromMessageEvent: message in: self with: self core)]. + [:message | self addOldestMessage: (TCCMessage newFromMessageEvent: message in: self with: self core). + self fulfillMessageRequest: (message at: 'id'). + ]. + + (self requestedMessages isEmpty) ifFalse: [self increaseNumberOfRequestedMessages.]. self waitingForUpdate: false. diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/fulfillMessageRequest..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/fulfillMessageRequest..st new file mode 100644 index 000000000..bf0c938ef --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/fulfillMessageRequest..st @@ -0,0 +1,9 @@ +loading +fulfillMessageRequest: aMessageId + + | fulfilledMessageRequests | + + fulfilledMessageRequests := self requestedMessages select: [:req | req messageId = aMessageId]. + fulfilledMessageRequests do: [:messageRequest | messageRequest completeRequest.]. + + self requestedMessages removeAll: fulfilledMessageRequests. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/handleMessageRequest..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/handleMessageRequest..st new file mode 100644 index 000000000..70504e4ed --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/handleMessageRequest..st @@ -0,0 +1,8 @@ +controlling +handleMessageRequest: aMessageRequest + + ((self messageIds occurrencesOf: (aMessageRequest messageId)) ~= 0) ifTrue: + [aMessageRequest completeRequest.] + ifFalse: + [self requestedMessages add: aMessageRequest. + self loadChatHistory.] \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/increaseNumberOfRequestedMessages.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/increaseNumberOfRequestedMessages.st new file mode 100644 index 000000000..b2745826f --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/increaseNumberOfRequestedMessages.st @@ -0,0 +1,4 @@ +loading +increaseNumberOfRequestedMessages + + self numberOfRequestedMessages: self numberOfRequestedMessages + self class defaultMessageLimit. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/initialize.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/initialize.st index cf7847c39..1ef84e635 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/instance/initialize.st +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/initialize.st @@ -11,4 +11,5 @@ initialize position: self class defaultUnknownPosition; numberOfRequestedMessages: self class defaultNumberOfRequestedMessages; selectedReplyToMessageId: self class defaultSelectedReplyToMessageId; - isPinned: false. \ No newline at end of file + requestedMessages: OrderedCollection new; + isPinned: false. diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages..st new file mode 100644 index 000000000..006269949 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages..st @@ -0,0 +1,4 @@ +accessing +requestedMessages: aList + + requestedMessages := aList \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages.st new file mode 100644 index 000000000..7b00f2867 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/requestedMessages.st @@ -0,0 +1,4 @@ +accessing +requestedMessages + + ^ requestedMessages \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/stillRequestedMessages.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/stillRequestedMessages.st index 7f0da8be6..1355abec4 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/instance/stillRequestedMessages.st +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/stillRequestedMessages.st @@ -1,4 +1,4 @@ accessing stillRequestedMessages - + ^ self numberOfRequestedMessages - self numberOfMessages \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json index 26379cbbf..514219923 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json @@ -9,17 +9,20 @@ "instance" : { "addAnsweredMessage:" : "JS 5/26/2022 16:41", "addNewestMessage:" : "JS 5/26/2022 14:22", - "addOldestMessage:" : "JS 5/26/2022 14:23", + "addOldestMessage:" : "LR 6/11/2022 16:17", "canSendMessages" : "5/11/2021 10:09:15", "canSendMessages:" : "JB 8/4/2021 00:08", - "chatHistoryReceived:" : "rgw 5/12/2022 14:04", + "chatHistoryReceived:" : "aka 6/15/2022 11:52", "core" : "per 6/4/2021 16:00", "core:" : "per 6/4/2021 15:58", + "fulfillMessageRequest:" : "LR 6/15/2022 10:11", "getMessageById:" : "JS 5/26/2022 14:49", + "handleMessageRequest:" : "LR 6/15/2022 11:14", "hasPhoto" : "rgw 6/2/2022 15:20", "id" : "rs 6/7/2020 22:20", "id:" : "pk 8/4/2021 11:25", - "ifNotWaitingForUpdate:" : "js 8/2/2020 13:17", + "ifNotWaitingForUpdate:" : "LR 6/15/2022 10:12", + "increaseNumberOfRequestedMessages" : "LR 6/15/2022 10:12", "infoLoaded" : "per 6/4/2021 15:59", "infoLoaded:" : "per 6/4/2021 15:51", "initialize" : "js 6/18/2022 10:48", @@ -35,7 +38,7 @@ "lastMessage" : "rs 6/19/2020 17:33", "lastMessage:" : "pk 8/4/2021 10:56", "lastMessageId" : "JB 8/4/2021 00:10", - "loadChatHistory" : "RS 7/17/2021 11:49", + "loadChatHistory" : "LR 6/12/2022 17:48", "loadInfo" : "per 6/15/2021 09:49", "loadInfoIfNotLoaded" : "TR 6/13/2021 15:54", "messageDictionary" : "JS 5/26/2022 14:19", @@ -54,11 +57,13 @@ "position:" : "pk 8/6/2021 18:59", "positionKnown" : "pk 8/6/2021 18:25", "requestMessage:" : "JS 5/26/2022 14:48", - "requestMessages:" : "RS 7/31/2021 15:28", + "requestMessages:" : "LR 6/15/2022 10:12", + "requestedMessages" : "aka 6/15/2022 11:52", + "requestedMessages:" : "aka 6/15/2022 11:52", "selectedReplyToMessageId" : "JS 5/20/2022 09:50", "selectedReplyToMessageId:" : "JS 5/20/2022 11:38", "sendMessage:" : "JS 5/20/2022 10:06", - "stillRequestedMessages" : "js 8/1/2020 18:05", + "stillRequestedMessages" : "LR 6/15/2022 10:12", "title" : "rs 6/7/2020 22:24", "title:" : "5/11/2021 10:09:15", "waitingForUpdate" : "5/11/2021 10:09:15", diff --git a/packages/TelegramClient-Core.package/TCCChat.class/properties.json b/packages/TelegramClient-Core.package/TCCChat.class/properties.json index 0c4f8eced..30c0de8ff 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/properties.json +++ b/packages/TelegramClient-Core.package/TCCChat.class/properties.json @@ -20,8 +20,9 @@ "messageIds", "messageDictionary", "selectedReplyToMessageId", - "photoId", - "isPinned" ], + "requestedMessages", + "photoId", + "isPinned"], "name" : "TCCChat", "pools" : [ ], diff --git a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json index c6fd928ad..84b57e271 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json @@ -17,7 +17,7 @@ "freeClient" : "6/9/2021 14:12:18", "generateCallbackId" : "pk 8/5/2021 17:04", "getOwnProfile" : "pk 8/5/2021 17:05", - "handleEvent:" : "rgw 6/2/2022 08:57", + "handleEvent:" : "LR 6/12/2022 14:28", "handleMessageEvent:" : "rgw 5/12/2022 13:44", "handlePendingEvent:" : "per 8/2/2021 15:05", "imageStore" : "pk 6/19/2021 17:15", diff --git a/packages/TelegramClient-Core.package/TCCFFIClient.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCFFIClient.class/methodProperties.json index c2aeb075d..9da5e5a04 100644 --- a/packages/TelegramClient-Core.package/TCCFFIClient.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCFFIClient.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { "downloadUrl" : "r.s 7/13/2020 17:05", "fileName" : "r.s 7/13/2020 17:05", - "moduleName" : "pk 8/5/2021 21:31", + "moduleName" : "LR 6/5/2022 11:00", "newForCurrentOs" : "pk 8/5/2021 17:09" }, "instance" : { "create" : "js 6/13/2020 12:53", diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json index 105989cb9..98521a0ca 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json @@ -20,7 +20,7 @@ "isOutgoing" : "js 8/2/2020 22:00", "isOutgoing:" : "pk 8/4/2021 11:42", "isReply" : "rgw 5/12/2022 15:40", - "replyText" : "rgw 5/12/2022 15:35", + "replyText" : "LR 6/5/2022 11:12", "replyToMessageId" : "rgw 5/12/2022 13:43", "replyToMessageId:" : "rgw 5/12/2022 13:43", "senderName" : "JS 6/11/2022 09:50", diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/README.md b/packages/TelegramClient-Core.package/TCCMessageRequest.class/README.md new file mode 100644 index 000000000..b6ce64fdc --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/README.md @@ -0,0 +1 @@ +Class with the id of a requested message. If request is completed, execute the completionMessage on the completionReceiver. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completeRequest.st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completeRequest.st new file mode 100644 index 000000000..037934806 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completeRequest.st @@ -0,0 +1,4 @@ +accessing +completeRequest + + self completionReceiver perform: (self completionMessage) with: (self messageId) \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage..st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage..st new file mode 100644 index 000000000..6898aa679 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage..st @@ -0,0 +1,4 @@ +accessing +completionMessage: aMessage + + completionMessage := aMessage \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage.st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage.st new file mode 100644 index 000000000..d45cab402 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionMessage.st @@ -0,0 +1,4 @@ +accessing +completionMessage + + ^ completionMessage \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver..st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver..st new file mode 100644 index 000000000..7f5b3ed52 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver..st @@ -0,0 +1,4 @@ +accessing +completionReceiver: aReceiver + + completionReceiver := aReceiver \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver.st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver.st new file mode 100644 index 000000000..925e31385 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/completionReceiver.st @@ -0,0 +1,4 @@ +accessing +completionReceiver + + ^ completionReceiver \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId..st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId..st new file mode 100644 index 000000000..9c8eeef2b --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId..st @@ -0,0 +1,4 @@ +accessing +messageId: aNumber + + messageId := aNumber \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId.st b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId.st new file mode 100644 index 000000000..ebe1f169a --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/instance/messageId.st @@ -0,0 +1,4 @@ +accessing +messageId + + ^ messageId \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCMessageRequest.class/methodProperties.json new file mode 100644 index 000000000..7b80182c1 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/methodProperties.json @@ -0,0 +1,11 @@ +{ + "class" : { + }, + "instance" : { + "completeRequest" : "LR 6/5/2022 13:05", + "completionMessage" : "aka 6/15/2022 11:45", + "completionMessage:" : "aka 6/15/2022 11:45", + "completionReceiver" : "aka 6/15/2022 11:46", + "completionReceiver:" : "aka 6/15/2022 11:46", + "messageId" : "aka 6/15/2022 11:47", + "messageId:" : "aka 6/15/2022 11:47" } } diff --git a/packages/TelegramClient-Core.package/TCCMessageRequest.class/properties.json b/packages/TelegramClient-Core.package/TCCMessageRequest.class/properties.json new file mode 100644 index 000000000..c53c87c7e --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessageRequest.class/properties.json @@ -0,0 +1,16 @@ +{ + "category" : "TelegramClient-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "aka 6/15/2022 12:07", + "instvars" : [ + "messageId", + "completionReceiver", + "completionMessage" ], + "name" : "TCCMessageRequest", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/packages/TelegramClient-Core.package/TCCWindowsClient.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCWindowsClient.class/methodProperties.json index e43d42781..6207392df 100644 --- a/packages/TelegramClient-Core.package/TCCWindowsClient.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCWindowsClient.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - "downloadArchive" : "pk 8/6/2021 15:28", + "downloadArchive" : "LR 6/5/2022 11:05", "downloadUrl" : "rgw 6/13/2022 10:35", "fileName" : "f.w. 7/15/2020 22:04", "moduleName" : "js 8/2/2020 13:21" }, diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st index d40708fd3..593bebf25 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st @@ -1,12 +1,14 @@ messages addAtBottom: aCoreMessage - | wrapper wasFullyScrolledDown | - + | wrapper wasFullyScrolledDown messageItem | + (self isFromCurrentChat: aCoreMessage) ifFalse: [ ^ self ]. wasFullyScrolledDown := self isFullyScrolledDown. - wrapper := TCUMessageWrapper newFromMessage: (TCUMessage newFrom: aCoreMessage) withWidth: self scroller width. + messageItem := TCUMessage newFrom: aCoreMessage. + messageItem when: #requestScroll send: #requestScrollToMessage: to: self with: (aCoreMessage replyToMessageId). + wrapper := TCUMessageWrapper newFromMessage: messageItem withWidth: self scroller width. self scroller addMorphBack: wrapper. self items addLast: wrapper. wasFullyScrolledDown diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st index d8bc69b83..12df90f12 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st @@ -1,10 +1,12 @@ messages addAtTop: aCoreMessage - | wrapper | + | wrapper messageItem | (self isFromCurrentChat: aCoreMessage) ifFalse: [^ self]. - wrapper := TCUMessageWrapper newFromMessage: (TCUMessage newFrom: aCoreMessage) withWidth: self scroller width. + messageItem := TCUMessage newFrom: aCoreMessage. + messageItem when: #requestScroll send: #requestScrollToMessage: to: self with: (aCoreMessage replyToMessageId). + wrapper := TCUMessageWrapper newFromMessage: messageItem withWidth: self scroller width. self scroller addMorphFront: wrapper. self items addFirst: wrapper. diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/requestScrollToMessage..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/requestScrollToMessage..st new file mode 100644 index 000000000..85806a2b8 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/requestScrollToMessage..st @@ -0,0 +1,9 @@ +messages +requestScrollToMessage: aMessageId + + | messageRequest | + messageRequest := TCCMessageRequest new messageId: aMessageId; + completionReceiver: self; + completionMessage: #scrollToMessage:; + yourself. + self chat handleMessageRequest: messageRequest \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/scrollToMessage..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/scrollToMessage..st new file mode 100644 index 000000000..f498efcb9 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/scrollToMessage..st @@ -0,0 +1,7 @@ +drawing +scrollToMessage: aMessageId + + | messageItem messageIndex | + messageIndex := self chat messageIds reversed indexOf: aMessageId. + messageItem := self items at: messageIndex. + self scrollToShow: messageItem \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json index 60ac7a59e..3910796e4 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json @@ -3,8 +3,8 @@ "defaultScrollOffsetBeforeLoading" : "JB 6/26/2021 10:15", "defaultWidth" : "rgw 6/2/2022 15:39" }, "instance" : { - "addAtBottom:" : "JS 6/11/2022 11:14", - "addAtTop:" : "JS 6/11/2022 11:15", + "addAtBottom:" : "LR 6/11/2022 10:45", + "addAtTop:" : "LR 6/11/2022 11:00", "addMessages" : "RS 7/17/2021 17:40", "chat" : "js 7/31/2020 16:39", "chat:" : "js 7/31/2020 16:39", @@ -13,6 +13,8 @@ "initialize" : "RS 7/17/2021 17:40", "isFromCurrentChat:" : "pk 8/5/2021 17:07", "isFullyScrolledDown" : "JB 8/4/2021 11:15", + "requestScrollToMessage:" : "aka 6/15/2022 11:56", + "scrollToMessage:" : "aka 6/15/2022 12:01", "scrollToNewestMessage" : "per 6/24/2021 23:14", "showMessages" : "RS 7/17/2021 17:34", "step" : "JB 7/19/2021 12:12" } } diff --git a/packages/TelegramClient-UI.package/TCUEmojiHelper.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUEmojiHelper.class/methodProperties.json index 066ec3b68..c5847fb86 100644 --- a/packages/TelegramClient-UI.package/TCUEmojiHelper.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUEmojiHelper.class/methodProperties.json @@ -10,7 +10,7 @@ "defaultMinimumEmojiAmount" : "pk 7/17/2021 10:18", "defaultOptionalCharacters" : "pk 7/6/2021 09:49", "defaultTextHeight" : "7/17/2021 09:37:29", - "downloadArchive" : "pk 7/17/2021 09:49", + "downloadArchive" : "LR 6/5/2022 11:05", "downloadUrl" : "RK 6/29/2021 11:30", "embedEmojisInto:" : "pk 7/11/2021 19:17", "emojiExists:" : "pk 7/11/2021 19:20", diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/addReplySnippet.st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/addReplySnippet.st index 4856a4ab5..4b4a3d5b7 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/instance/addReplySnippet.st +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/addReplySnippet.st @@ -1,11 +1,12 @@ constructing addReplySnippet - self addMorphBack: (self class defaultTextMorph - contents: self messageModel replyText; - hResizing: #spaceFill; - color: TCUDefaultValues colorLightGray; - yourself). + | replySnippet | + + replySnippet := TCUReplySnippet newWith: (self messageModel replyText) coloredIn: self messageColor. + replySnippet when: #requestScroll send: #triggerRequestScroll to: self. + + self addMorph: (replySnippet). self addMorphBack: (RectangleMorph new color: self messageColor; borderWidth: 0; diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/mouseDown..st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/mouseDown..st index ad8666759..1feddb3e8 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/instance/mouseDown..st +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/mouseDown..st @@ -1,4 +1,4 @@ -accessing +initialization mouseDown: anEvent ^ self messageModel chat selectedReplyToMessageId: self messageModel id \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/triggerRequestScroll.st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/triggerRequestScroll.st new file mode 100644 index 000000000..a6216517f --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/triggerRequestScroll.st @@ -0,0 +1,4 @@ +constructing +triggerRequestScroll + + self triggerEvent: #requestScroll \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json index 1e0809cb6..561230a6c 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { "defaultBottomMargin" : "JB 5/30/2021 11:27", "defaultHeight" : "JB 5/29/2021 20:44", - "defaultLayoutInset" : "JB 5/29/2021 21:08", + "defaultLayoutInset" : "LR 6/11/2022 11:40", "defaultMargins" : "JB 6/11/2021 18:36", "defaultPhotoSize" : "JS 6/11/2022 09:55", "defaultTextMorph" : "rgw 6/16/2022 15:47", @@ -11,12 +11,12 @@ "instance" : { "addContent" : "TR 6/20/2021 11:12", "addDate" : "rgw 5/12/2022 15:54", - "addReplySnippet" : "rgw 5/12/2022 15:54", + "addReplySnippet" : "LR 6/15/2022 11:21", "addSender" : "rgw 5/12/2022 15:54", "addText" : "RK 6/23/2021 11:46", "answeredMessageReceived" : "rgw 6/2/2022 10:29", "date" : "TR 6/20/2021 10:59", - "initialize" : "rgw 6/2/2022 10:45", + "initialize" : "LR 6/11/2022 13:01", "initializeDefaults" : "JS 6/11/2022 11:00", "initializeSubmorphs" : "rgw 6/2/2022 10:26", "isOutgoing" : "TR 6/20/2021 11:37", @@ -24,8 +24,11 @@ "messageDateText" : "JB 5/17/2021 10:04", "messageModel" : "TR 6/20/2021 11:00", "messageModel:" : "JS 5/26/2022 16:40", - "mouseDown:" : "JS 5/20/2022 09:52", + "mouseDown:" : "LR 6/5/2022 10:57", "secondaryColor" : "rgw 5/12/2022 15:54", - "shrinkToContent" : "RK 8/4/2021 11:58", + "sender" : "TR 6/20/2021 10:59", + "senderId" : "8/5/2021 21:14:18", + "shrinkToContent" : "LR 6/11/2022 12:38", "text" : "RK 6/29/2021 11:18", + "triggerRequestScroll" : "LR 6/5/2022 12:45", "updateReplySnippet" : "rgw 6/2/2022 10:29" } } diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/README.md b/packages/TelegramClient-UI.package/TCUReplySnippet.class/README.md new file mode 100644 index 000000000..8ed7bc16e --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/README.md @@ -0,0 +1 @@ +Show the reply snippet on top of a referencing message. \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/class/newWith.coloredIn..st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/class/newWith.coloredIn..st new file mode 100644 index 000000000..33b923deb --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/class/newWith.coloredIn..st @@ -0,0 +1,8 @@ +instance creation +newWith: aReplyText coloredIn: aMessageColor + + ^ self basicNew + replyText: aReplyText; + messageColor: aMessageColor; + initialize; + yourself \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/initialize.st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/initialize.st new file mode 100644 index 000000000..ffa0d570d --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/initialize.st @@ -0,0 +1,20 @@ +initialization +initialize + + | textMorph | + + super initialize. + + textMorph := TextMorph new contents: self replyText; + hResizing: #spaceFill; + color: TCUDefaultValues colorLightGray; + lock. + + self + color: self messageColor; + vResizing: #shrinkWrap; + hResizing: #shrinkWrap; + borderWidth: 0; + width: textMorph width. + + self addMorph: textMorph. \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor..st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor..st new file mode 100644 index 000000000..b3bc49a6f --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor..st @@ -0,0 +1,4 @@ +accessing +messageColor: aColor + + messageColor := aColor \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor.st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor.st new file mode 100644 index 000000000..5f40703e1 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/messageColor.st @@ -0,0 +1,4 @@ +accessing +messageColor + + ^ messageColor \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/mouseDown..st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/mouseDown..st new file mode 100644 index 000000000..041beb06d --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/mouseDown..st @@ -0,0 +1,4 @@ +event handling +mouseDown: anEvent + + self triggerEvent: #requestScroll. \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText..st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText..st new file mode 100644 index 000000000..e3bd4fbf1 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText..st @@ -0,0 +1,4 @@ +accessing +replyText: aString + + replyText := aString \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText.st b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText.st new file mode 100644 index 000000000..767092a33 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/instance/replyText.st @@ -0,0 +1,4 @@ +accessing +replyText + + ^ replyText \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUReplySnippet.class/methodProperties.json new file mode 100644 index 000000000..46f0f764d --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + "newWith:coloredIn:" : "LR 6/11/2022 12:48" }, + "instance" : { + "initialize" : "aka 6/15/2022 11:58", + "messageColor" : "aka 6/15/2022 11:50", + "messageColor:" : "aka 6/15/2022 11:50", + "mouseDown:" : "aka 6/15/2022 11:56", + "replyText" : "aka 6/15/2022 11:49", + "replyText:" : "aka 6/15/2022 11:49" } } diff --git a/packages/TelegramClient-UI.package/TCUReplySnippet.class/properties.json b/packages/TelegramClient-UI.package/TCUReplySnippet.class/properties.json new file mode 100644 index 000000000..d8c46ee04 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUReplySnippet.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "TelegramClient-UI", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "aka 6/15/2022 12:06", + "instvars" : [ + "replyText", + "messageColor" ], + "name" : "TCUReplySnippet", + "pools" : [ + ], + "super" : "RectangleMorph", + "type" : "normal" } diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st index a8b1ce690..1ba9b5a95 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st @@ -8,6 +8,7 @@ setUp id: 1337; core: self core; yourself). + self core chatsHandler chats add: self chat. 1 to: 5 do: [:aNumber | message := (TCCTextMessage new diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequest.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequest.st new file mode 100644 index 000000000..518cff691 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequest.st @@ -0,0 +1,13 @@ +testing +testHandleMessageRequest + + | messageRequest receiver | + self mockTeleClient onRequestType: 'getChatHistory' respond: (TCTMMocks mockChatHistoryJsonContainingMessageId: 1 inChat: self chat id). + receiver := TCTMFunctionCalledVerifier new. + messageRequest := TCCMessageRequest new messageId: 1; + completionReceiver: receiver; + completionMessage: #call:. + self chat handleMessageRequest: messageRequest. + 1 seconds wait. + self assert: (self chat messageIds anySatisfy: [:id| id = 1]). + self assert: receiver isCalled. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequestAlreadyLoaded.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequestAlreadyLoaded.st new file mode 100644 index 000000000..47aa20c04 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testHandleMessageRequestAlreadyLoaded.st @@ -0,0 +1,10 @@ +testing +testHandleMessageRequestAlreadyLoaded + + | messageRequest receiver | + receiver := TCTMFunctionCalledVerifier new. + messageRequest := TCCMessageRequest new messageId: 4; + completionReceiver: receiver; + completionMessage: #call:. + self chat handleMessageRequest: messageRequest. + self assert: receiver isCalled. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json index c521cec7e..117d0b291 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json @@ -4,13 +4,15 @@ "instance" : { "chat" : "LL 8/2/2020 20:25", "chat:" : "LL 8/2/2020 20:26", - "setUp" : "JS 5/26/2022 14:33", + "setUp" : "LR 6/15/2022 09:41", "testAddAnsweredMessage" : "JS 5/26/2022 15:05", "testAddNewestMessage" : "RS 7/31/2021 15:45", "testAddOldestMessage" : "TR 6/22/2021 09:49", "testChatCorrectlyConstructedFromJson" : "js 6/18/2022 10:46", "testChatNoPhotoCorrectlyConstructedFromJson" : "rgw 6/2/2022 16:17", "testGetMessageById" : "JS 5/27/2022 19:32", + "testHandleMessageRequest" : "aka 6/15/2022 11:54", + "testHandleMessageRequestAlreadyLoaded" : "aka 6/15/2022 11:59", "testId" : "pk 8/5/2021 17:13", "testLastMessage" : "per 5/21/2021 16:31", "testMessage" : "pk 8/5/2021 17:06", diff --git a/packages/TelegramClientTests-Core.package/TCTCMessageTests.class/methodProperties.json b/packages/TelegramClientTests-Core.package/TCTCMessageTests.class/methodProperties.json index 0e91c2d93..c5feea059 100644 --- a/packages/TelegramClientTests-Core.package/TCTCMessageTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCMessageTests.class/methodProperties.json @@ -6,7 +6,7 @@ "testMessageHasTextRepresentation" : "tom.richter 6/26/2021 21:06", "testMessageIsReply" : "rgw 5/12/2022 16:40", "testMessageReplySnippetTruncates" : "rgw 5/12/2022 16:39", - "testMessageReplyText" : "JS 5/27/2022 19:27", + "testMessageReplyText" : "LR 6/5/2022 11:14", "testMessageShouldNotNotify" : "RS 7/17/2021 10:53", "testMessageShouldNotify" : "RS 7/17/2021 10:53", "testMessageWithMessageSenderChatCorrectlyConstructedFromJson" : "JS 5/26/2022 15:32", diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/README.md b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/README.md new file mode 100644 index 000000000..037f88bd2 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/README.md @@ -0,0 +1 @@ +Helps you to verify if a function was called on an instance of this class. \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/call..st b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/call..st new file mode 100644 index 000000000..687914849 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/call..st @@ -0,0 +1,4 @@ +initialize-release +call: anArg + + self isCalled: true. \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/initialize.st b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/initialize.st new file mode 100644 index 000000000..96a536967 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/initialize.st @@ -0,0 +1,6 @@ +initialize-release +initialize + + super initialize. + + self isCalled: false. \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled..st b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled..st new file mode 100644 index 000000000..1e74bc49b --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled..st @@ -0,0 +1,4 @@ +accessing +isCalled: aBoolean + + isCalled := aBoolean \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled.st b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled.st new file mode 100644 index 000000000..478c411bb --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/instance/isCalled.st @@ -0,0 +1,4 @@ +accessing +isCalled + + ^ isCalled \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/methodProperties.json b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/methodProperties.json new file mode 100644 index 000000000..c15dfd97f --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + }, + "instance" : { + "call:" : "LR 6/11/2022 15:03", + "initialize" : "LR 6/11/2022 15:01", + "isCalled" : "aka 6/15/2022 11:48", + "isCalled:" : "aka 6/15/2022 11:48" } } diff --git a/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/properties.json b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/properties.json new file mode 100644 index 000000000..c6c060be4 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMFunctionCalledVerifier.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "TelegramClientTests-Misc", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "aka 6/15/2022 12:07", + "instvars" : [ + "isCalled" ], + "name" : "TCTMFunctionCalledVerifier", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/packages/TelegramClientTests-Misc.package/TCTMMockTdlibClient.class/methodProperties.json b/packages/TelegramClientTests-Misc.package/TCTMMockTdlibClient.class/methodProperties.json index 8a79545c3..a4132dcf8 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMockTdlibClient.class/methodProperties.json +++ b/packages/TelegramClientTests-Misc.package/TCTMMockTdlibClient.class/methodProperties.json @@ -3,7 +3,7 @@ "authorizationStateReadyEvent" : "RS 6/3/2021 12:05" }, "instance" : { "addExtraAttribute:to:" : "RS 6/6/2021 12:29", - "appendResponsesToRequest:" : "RS 6/6/2021 12:33", + "appendResponsesToRequest:" : "LR 6/15/2022 10:07", "execute:" : "RS 6/3/2021 11:49", "free" : "RS 6/25/2021 12:30", "freed" : "RS 6/25/2021 12:28", @@ -13,7 +13,7 @@ "logIn" : "JB 6/7/2021 09:13", "onRequestType:respond:" : "RS 6/6/2021 12:20", "onRequestType:respondAll:" : "RS 6/6/2021 12:22", - "receive:" : "JB 6/7/2021 09:13", + "receive:" : "LR 6/15/2022 10:08", "requestResponses" : "JB 6/7/2021 09:12", "requestResponses:" : "JB 6/7/2021 09:12", "responseQueue" : "JB 6/7/2021 09:12", diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockChatHistoryJsonContainingMessageId.inChat..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockChatHistoryJsonContainingMessageId.inChat..st new file mode 100644 index 000000000..918741680 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockChatHistoryJsonContainingMessageId.inChat..st @@ -0,0 +1,10 @@ +message - json +mockChatHistoryJsonContainingMessageId: aMessageId inChat: aChatId + + | messages | + messages := OrderedCollection newFrom: {(self mockTextMessageJsonFrom: aChatId replyingTo: aMessageId with: 1)}. + + 1 to: 19 do: [:anIndex | messages addLast: (self mockTextMessageJsonFrom: aChatId replyingTo: 0 with: (20 + anIndex))]. + ^ (JsonObject newFrom: { + '@type' -> 'messages'. + 'messages'->(messages)}) \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.replyingTo.with..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.replyingTo.with..st new file mode 100644 index 000000000..030877f14 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.replyingTo.with..st @@ -0,0 +1,4 @@ +message - json +mockTextMessageJsonFrom: aChatId replyingTo: aReplyMessageId with: aMessageId + + ^ self mockTextMessageJsonFrom: aChatId with: #messageSenderUser replyingTo: aReplyMessageId with: aMessageId \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo..st index 2894b1a50..c996d50d7 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo..st +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo..st @@ -1,21 +1,4 @@ message - json -mockTextMessageJsonFrom: aChatId with: aSenderType replyingTo: aMessageId +mockTextMessageJsonFrom: aChatId with: aSenderType replyingTo: aReplyMessageId - ^ (JsonObject newFrom: { - '@type' -> 'message'. - 'id' -> self mockMessageId. - 'chat_id' -> aChatId. - 'sender_id' -> (JsonObject newFrom: { - '@type' -> aSenderType asString. - 'user_id' -> self mockUser1 id - }). - 'content' -> (JsonObject newFrom: { - '@type' -> 'messageText'. - 'text' -> (JsonObject newFrom: { - 'text' -> self mockText - }) - }). - 'is_outgoing' -> false. - 'reply_to_message_id' -> aMessageId. - 'date' -> self mockMessageTimestamp - }) + ^ self mockTextMessageJsonFrom: aChatId with: aSenderType replyingTo: aReplyMessageId with: self mockMessageId \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo.with..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo.with..st new file mode 100644 index 000000000..c2d5d3ddb --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageJsonFrom.with.replyingTo.with..st @@ -0,0 +1,21 @@ +message - json +mockTextMessageJsonFrom: aChatId with: aSenderType replyingTo: aReplyMessageId with: aMessageId + + ^ (JsonObject newFrom: { + '@type' -> 'message'. + 'id' -> aMessageId. + 'chat_id' -> aChatId. + 'sender_id' -> (JsonObject newFrom: { + '@type' -> aSenderType asString. + 'user_id' -> self mockUser1 id + }). + 'content' -> (JsonObject newFrom: { + '@type' -> 'messageText'. + 'text' -> (JsonObject newFrom: { + 'text' -> self mockText + }) + }). + 'is_outgoing' -> false. + 'reply_to_message_id' -> aReplyMessageId. + 'date' -> self mockMessageTimestamp + }) \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith..st index 4d9f8575f..b546e5d3e 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith..st +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith..st @@ -1,13 +1,4 @@ message mockTextMessageWith: aCore - ^ TCCTextMessage new - chat: (self mockPrivateChat core: aCore); - core: aCore; - userId: self mockUser1 id; - isOutgoing: false; - senderType: #messageSenderUser; - date: self mockMessageDate; - id: self mockMessageId; - text: self mockText; - replyToMessageId: 0 \ No newline at end of file + ^ self mockTextMessageWith: aCore withId: self mockMessageId \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.inChat..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.inChat..st index 7f41abe1f..3e58e3419 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.inChat..st +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.inChat..st @@ -1,13 +1,4 @@ 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 \ No newline at end of file + ^ self mockTextMessageWith: aCore with: self mockMessageId replyTo: 0 in: aChat \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.with.replyTo.in..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.with.replyTo.in..st new file mode 100644 index 000000000..21d0da274 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.with.replyTo.in..st @@ -0,0 +1,13 @@ +message +mockTextMessageWith: aCore with: aMessageId replyTo: aReplyMessageId in: aChatId + + ^ TCCTextMessage new + chat: aChatId; + core: aCore; + userId: self mockUser1 id; + isOutgoing: false; + senderType: #messageSenderUser; + date: self mockMessageDate; + id: aMessageId; + text: self mockText; + replyToMessageId: aReplyMessageId \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId..st new file mode 100644 index 000000000..fbc9b1e29 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId..st @@ -0,0 +1,4 @@ +message +mockTextMessageWith: aCore withId: aMessageId + + ^ self mockTextMessageWith: aCore withId: aMessageId replyTo: 0 \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId.replyTo..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId.replyTo..st new file mode 100644 index 000000000..855290261 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withId.replyTo..st @@ -0,0 +1,4 @@ +message +mockTextMessageWith: aCore withId: aMessageId replyTo: aReplyMessageId + + ^ self mockTextMessageWith: aCore with: aMessageId replyTo: aReplyMessageId in: (self mockPrivateChat core: aCore) \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextReplyMessageWith.inChat..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextReplyMessageWith.inChat..st index 5d37b7342..9f9927389 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextReplyMessageWith.inChat..st +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextReplyMessageWith.inChat..st @@ -1,13 +1,4 @@ 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 \ No newline at end of file + ^ self mockTextMessageWith: aCore with: self mockMessageReplyMessageId replyTo: self mockMessageId in: aChat \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json index b9e3158a5..14d42b6f5 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json @@ -6,6 +6,7 @@ "mockChatEvent" : "rgw 6/2/2022 15:45", "mockChatEventMutedFor:" : "rgw 6/2/2022 11:48", "mockChatEventNoPhoto" : "rgw 6/2/2022 15:23", + "mockChatHistoryJsonContainingMessageId:inChat:" : "aka 6/15/2022 11:49", "mockChats" : "rgw 6/6/2022 18:02", "mockChatsFor:" : "JB 7/18/2021 13:15", "mockEmojiSequence1" : "pk 7/10/2021 15:22", @@ -42,11 +43,16 @@ "mockSupergroupChat" : "rgw 6/2/2022 12:07", "mockSupergroupMembersJson" : "per 6/10/2021 20:53", "mockText" : "TR 6/25/2021 21:15", - "mockTextMessageJsonFrom:with:" : "JS 5/27/2022 19:17", - "mockTextMessageJsonFrom:with:replyingTo:" : "rgw 6/2/2022 09:32", - "mockTextMessageWith:" : "JS 5/27/2022 11:12", - "mockTextMessageWith:inChat:" : "rgw 5/12/2022 15:43", - "mockTextReplyMessageWith:inChat:" : "rgw 5/12/2022 15:03", + "mockTextMessageJsonFrom:replyingTo:with:" : "aka 6/15/2022 12:03", + "mockTextMessageJsonFrom:with:" : "aka 6/15/2022 12:04", + "mockTextMessageJsonFrom:with:replyingTo:" : "aka 6/15/2022 12:04", + "mockTextMessageJsonFrom:with:replyingTo:with:" : "aka 6/23/2022 13:44", + "mockTextMessageWith:" : "aka 6/15/2022 12:04", + "mockTextMessageWith:inChat:" : "aka 6/15/2022 12:04", + "mockTextMessageWith:with:replyTo:in:" : "aka 6/15/2022 12:04", + "mockTextMessageWith:withId:" : "aka 6/15/2022 12:04", + "mockTextMessageWith:withId:replyTo:" : "aka 6/15/2022 12:04", + "mockTextReplyMessageWith:inChat:" : "aka 6/15/2022 12:04", "mockUnloadedBasicGroupChat" : "rgw 6/6/2022 18:03", "mockUnloadedSuperGroupChat" : "rgw 6/2/2022 12:10", "mockUpdateChatPositionEventForNotPinnedChatWithId:" : "js 6/18/2022 11:03", diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/fillWithMessages.st b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/fillWithMessages.st index f9aae2697..de6257c2d 100644 --- a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/fillWithMessages.st +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/fillWithMessages.st @@ -3,4 +3,4 @@ fillWithMessages self subject addAtBottom: ((TCTMMocks mockTextMessageWith: self core) text: 'First message'). self subject addAtBottom: ((TCTMMocks mockTextMessageWith: self core) text: 'Second message'). - self subject addAtBottom: ((TCTMMocks mockTextMessageWith: self core) text: 'Third message'). \ No newline at end of file + self subject addAtBottom: ((TCTMMocks mockTextMessageWith: self core) text: 'Third message') \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testScrollToReferencedMessage.st b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testScrollToReferencedMessage.st new file mode 100644 index 000000000..a83cc9700 --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testScrollToReferencedMessage.st @@ -0,0 +1,19 @@ +testing +testScrollToReferencedMessage + + | referencedMessage referencingMessage referencedOffset replySnippet referencedTCUMessage | + referencedMessage := (TCTMMocks mockTextMessageWith: self core withId: 1) text: 'Referenced Message'. + referencingMessage := (TCTMMocks mockTextMessageWith: self core withId: 2 replyTo: 1) text: 'Referencing Message'. + self core chatsHandler chats first addOldestMessage: referencedMessage. + self core chatsHandler chats first addNewestMessage: referencingMessage. + + referencedTCUMessage := self subject scroller submorphs first. + + self subject scrollToShow: referencedTCUMessage. + referencedOffset := self subject vScrollBar value. + self subject scrollToNewestMessage. + + replySnippet := self subject findByClass: TCUReplySnippet. + replySnippet click. + + self assert: referencedOffset equals: self subject vScrollBar value. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json index aa2c81e9c..879ebf6b1 100644 --- a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json @@ -2,9 +2,10 @@ "class" : { }, "instance" : { - "fillWithMessages" : "per 6/28/2021 16:22", + "fillWithMessages" : "LR 6/15/2022 11:30", "setUp" : "RS 8/1/2021 12:57", "testAddingOldMessagesDoesNotScroll" : "per 6/28/2021 16:23", "testChatDoesNotDisplayMessagesFromOtherChats" : "RS 8/1/2021 12:57", "testDisplayedChatLoadsOldMessage" : "per 6/28/2021 16:23", - "testDisplayedChatReceivesNewMessage" : "per 6/28/2021 16:23" } } + "testDisplayedChatReceivesNewMessage" : "per 6/28/2021 16:23", + "testScrollToReferencedMessage" : "aka 6/15/2022 12:28" } } diff --git a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageBetweenRequestsAnsweredMessage.st b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageBetweenRequestsAnsweredMessage.st new file mode 100644 index 000000000..5dc6e328a --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageBetweenRequestsAnsweredMessage.st @@ -0,0 +1,19 @@ +testing +testMessageBetweenRequestsAnsweredMessage + + | replyMessage betweenMessage chat | + chat := self core chatsHandler chats first. + self core client onRequestType: 'getMessage' respond: (TCTMMocks mockMessageJsonFrom: chat id). + replyMessage := TCCTextMessage newFromMessageEvent: (TCTMMocks mockTextMessageJsonFrom: chat id with: #messageSenderUser replyingTo: TCTMMocks mockMessageId) in: chat with: self core. + replyMessage text: 'reply message'. + replyMessage id: (TCTMMocks mockMessageId + 2). + + betweenMessage := TCCTextMessage newFromMessageEvent: (TCTMMocks mockTextMessageJsonFrom: chat id with: #messageSenderUser replyingTo: TCTMMocks mockMessageId) in: chat with: self core. + betweenMessage text: 'between message'. + betweenMessage id: (TCTMMocks mockMessageId + 1). + + chat addNewestMessage: replyMessage. + self wantsToTest: (TCUMessage newFrom: replyMessage). + 0.5 seconds wait. + self assertNotReading: 'Message not loaded' in: self subject. + self assertReading: TCTMMocks mockText in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json index 331c412bf..1b6bc3df7 100644 --- a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json @@ -5,6 +5,7 @@ "expectedSqueak5_2Failures" : "pk 7/6/2021 12:25", "handleScreenShotTestFor:with:usedBy:" : "RK 6/26/2021 10:15", "setUp" : "rgw 6/6/2022 18:42", + "testMessageBetweenRequestsAnsweredMessage" : "LR 5/29/2022 17:34", "testMessageColorsDifferentForIncomingOutgoing" : "tom.richter 6/26/2021 17:23", "testMessageContainsDate" : "tom.richter 6/26/2021 17:23", "testMessageContainsMessageSender" : "tom.richter 6/26/2021 17:23",