diff --git a/packages/TelegramClient-Core.package/TCCChat.class/class/defaultLastMessageDate.st b/packages/TelegramClient-Core.package/TCCChat.class/class/defaultLastMessageDate.st new file mode 100644 index 000000000..f52262dab --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/class/defaultLastMessageDate.st @@ -0,0 +1,4 @@ +default values +defaultLastMessageDate + + ^ DateAndTime fromUnixTime: 0 \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/addNewestMessage..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/addNewestMessage..st index ebd316db9..97c4ca9c8 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/instance/addNewestMessage..st +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/addNewestMessage..st @@ -1,6 +1,13 @@ adding addNewestMessage: aMessage + | newDate oldDate | + newDate := aMessage date asDate. + oldDate := self lastMessageDate asDate. + (newDate > oldDate) ifTrue: [ + aMessage isFirstMessageOfDay: true. + self lastMessage isLastMessageOfDay: true. + ]. self messageIds addFirst: aMessage id. self messageDictionary at: aMessage id put: aMessage. self triggerEvent: #newMessage with: aMessage. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/addOldestMessage..st b/packages/TelegramClient-Core.package/TCCChat.class/instance/addOldestMessage..st index 71bca4ef5..ff74a9263 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/instance/addOldestMessage..st +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/addOldestMessage..st @@ -1,6 +1,12 @@ adding addOldestMessage: aMessage + | newDate oldDate | + newDate := aMessage date asDate. + oldDate := self oldestLoadedMessageDate asDate. + (newDate < oldDate) ifTrue: [ + self oldestLoadedMessage isFirstMessageOfDay: true. + aMessage isLastMessageOfDay: true]. self messageIds add: aMessage id. self messageDictionary at: aMessage id put: aMessage. self triggerEvent: #loadedMessage with: aMessage. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessage.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessage.st new file mode 100644 index 000000000..e0d5736b2 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessage.st @@ -0,0 +1,7 @@ +accessing +lastMessage + + ^ self messages + ifEmpty: [ TCCNotLoadedMessage new + date: self class defaultLastMessageDate] + ifNotEmpty: [ self messages first ] \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessageDate.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessageDate.st new file mode 100644 index 000000000..20331d4d7 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/lastMessageDate.st @@ -0,0 +1,6 @@ +accessing +lastMessageDate + + "Date of the latest received message." + + ^ self lastMessage date \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessage.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessage.st new file mode 100644 index 000000000..7ce1bf02e --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessage.st @@ -0,0 +1,7 @@ +accessing +oldestLoadedMessage + + ^ self messages + ifEmpty: [ TCCNotLoadedMessage new + date: self class defaultLastMessageDate] + ifNotEmpty: [ self messages last ] \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessageDate.st b/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessageDate.st new file mode 100644 index 000000000..1f62e024f --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChat.class/instance/oldestLoadedMessageDate.st @@ -0,0 +1,4 @@ +accessing +oldestLoadedMessageDate + + ^ self oldestLoadedMessage date \ 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 ddade49ab..76eaff6a1 100644 --- a/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCChat.class/methodProperties.json @@ -1,5 +1,6 @@ { "class" : { + "defaultLastMessageDate" : "aka 7/10/2022 11:25", "defaultLastMessageId" : "JB 8/4/2021 00:10", "defaultLastMessageSenderId" : "LR 7/14/2022 11:50", "defaultMessageLimit" : "RS 7/17/2021 11:45", @@ -9,8 +10,8 @@ "newFromChatEvent:" : "RS 7/17/2021 17:07" }, "instance" : { "addAnsweredMessage:" : "JS 5/26/2022 16:41", - "addNewestMessage:" : "JS 5/26/2022 14:22", - "addOldestMessage:" : "LR 6/11/2022 16:17", + "addNewestMessage:" : "aka 7/14/2022 14:29", + "addOldestMessage:" : "aka 7/14/2022 14:26", "canSendMessages" : "5/11/2021 10:09:15", "canSendMessages:" : "JB 8/4/2021 00:08", "chatHistoryReceived:" : "aka 7/14/2022 16:38", @@ -36,6 +37,8 @@ "isPinned:" : "js 6/18/2022 10:19", "isPrivate" : "per 6/4/2021 14:42", "isSuperGroup" : "per 6/15/2021 08:09", + "lastMessage" : "aka 7/14/2022 14:28", + "lastMessageDate" : " 7/22/2022 10:40:18", "lastMessageId" : "JB 8/4/2021 00:10", "lastMessageSenderId" : "LR 7/14/2022 12:16", "lastMessageSenderId:" : "LR 7/14/2022 15:11", @@ -56,6 +59,8 @@ "numberOfMessages" : "RS 7/31/2021 15:19", "numberOfRequestedMessages" : "js 8/1/2020 17:43", "numberOfRequestedMessages:" : "JS 5/20/2022 11:34", + "oldestLoadedMessage" : "aka 7/14/2022 13:46", + "oldestLoadedMessageDate" : "aka 7/14/2022 13:46", "photoId" : "rgw 6/2/2022 11:51", "photoId:" : "rgw 6/2/2022 11:51", "position" : "RS 5/10/2021 21:11", diff --git a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json index 84b57e271..687ef1e6b 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:" : "LR 6/12/2022 14:28", + "handleEvent:" : "aka 7/10/2022 10: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/TCCMessage.class/instance/initialize.st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/initialize.st new file mode 100644 index 000000000..932941397 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/initialize.st @@ -0,0 +1,8 @@ +accessing +initialize + + super initialize. + + self + isFirstMessageOfDay: false; + isLastMessageOfDay: false \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay..st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay..st new file mode 100644 index 000000000..52f8e0b9f --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay..st @@ -0,0 +1,4 @@ +accessing +isFirstMessageOfDay: aBool + + isFirstMessageOfDay := aBool \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay.st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay.st new file mode 100644 index 000000000..ea0e5f018 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isFirstMessageOfDay.st @@ -0,0 +1,4 @@ +accessing +isFirstMessageOfDay + + ^ isFirstMessageOfDay \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay..st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay..st new file mode 100644 index 000000000..56132f711 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay..st @@ -0,0 +1,4 @@ +accessing +isLastMessageOfDay: aBool + + isLastMessageOfDay := aBool \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay.st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay.st new file mode 100644 index 000000000..7fd58d558 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/isLastMessageOfDay.st @@ -0,0 +1,4 @@ +accessing +isLastMessageOfDay + + ^ isLastMessageOfDay \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json index 031a65770..33eb3e83f 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json @@ -10,4 +10,9 @@ "date" : "aka 7/14/2022 16:40", "date:" : "aka 7/14/2022 16:40", "id" : "aka 7/14/2022 16:40", - "id:" : "aka 7/14/2022 16:40" } } + "id:" : "aka 7/14/2022 16:40", + "initialize" : " 7/22/2022 10:40:18", + "isFirstMessageOfDay" : " 7/22/2022 10:40:18", + "isFirstMessageOfDay:" : " 7/22/2022 10:40:18", + "isLastMessageOfDay" : " 7/22/2022 10:40:18", + "isLastMessageOfDay:" : " 7/22/2022 10:40:18" } } diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/properties.json b/packages/TelegramClient-Core.package/TCCMessage.class/properties.json index c2a9ebfeb..8821fdb22 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/properties.json +++ b/packages/TelegramClient-Core.package/TCCMessage.class/properties.json @@ -9,7 +9,9 @@ "chat", "id", "date", - "core" ], + "core", + "isFirstMessageOfDay", + "isLastMessageOfDay" ], "name" : "TCCMessage", "pools" : [ ], diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st index 0b6fe6323..dc4428524 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtBottom..st @@ -5,6 +5,9 @@ addAtBottom: aCoreMessage (self isFromCurrentChat: aCoreMessage) ifFalse: [ ^ self ]. + + (aCoreMessage isFirstMessageOfDay) ifTrue: [self addBottomDayDividerForDate: aCoreMessage date asDate]. + wasFullyScrolledDown := self isFullyScrolledDown. messageItem := TCUUserMessage newFrom: aCoreMessage. messageItem when: #requestScroll send: #requestScrollToMessage: to: self with: (aCoreMessage replyToMessageId). diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st index 555eccc59..e6453b08c 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addAtTop..st @@ -1,9 +1,14 @@ messages addAtTop: aCoreMessage - | wrapper messageItem | + | wrapper messageItem lastMessage | (self isFromCurrentChat: aCoreMessage) ifFalse: [^ self]. + (aCoreMessage isLastMessageOfDay and: self items isEmpty not) ifTrue: [ + lastMessage := self items first message messageModel. + self addTopDayDividerForDate: (lastMessage date asDate) + ]. + messageItem := TCUUserMessage newFrom: aCoreMessage. messageItem when: #requestScroll send: #requestScrollToMessage: to: self with: (aCoreMessage replyToMessageId). wrapper := TCUMessageWrapper newFromMessage: messageItem withWidth: self scroller width. diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addBottomDayDividerForDate..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addBottomDayDividerForDate..st new file mode 100644 index 000000000..ad7fa4ddf --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addBottomDayDividerForDate..st @@ -0,0 +1,10 @@ +stepping and presenter +addBottomDayDividerForDate: aDate + + | divider wasFullyScrolledDown | + wasFullyScrolledDown := self isFullyScrolledDown. + divider := self createDayDividerForDate: aDate. + self scroller addMorphBack: divider. + self items addLast: divider. + wasFullyScrolledDown + ifTrue: [ self scrollToNewestMessage ] \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addTopDayDividerForDate..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addTopDayDividerForDate..st new file mode 100644 index 000000000..c35a89354 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/addTopDayDividerForDate..st @@ -0,0 +1,10 @@ +stepping and presenter +addTopDayDividerForDate: aDate + + | divider | + divider := self createDayDividerForDate: aDate. + self scroller addMorphFront: divider. + self items addFirst: divider. + self isFullyScrolledDown + ifTrue: [self scrollToNewestMessage]. + self scrollBy: 0 @ (divider height negated). \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/createDayDividerForDate..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/createDayDividerForDate..st new file mode 100644 index 000000000..d3f20f162 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/createDayDividerForDate..st @@ -0,0 +1,12 @@ +stepping and presenter +createDayDividerForDate: aDate + + | messageItem | + messageItem := TCUDayDividerMessage newFromDate: aDate. + ^ RectangleMorph new + color: Color transparent; + width: self scroller width; + height: messageItem height; + borderWidth: 0; + addMorphCentered: messageItem; + yourself \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/displayChat..st b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/displayChat..st index 0d56b2f20..3e3dc4a87 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/displayChat..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/displayChat..st @@ -4,6 +4,7 @@ displayChat: aChat self chat removeActionsWithReceiver: self. aChat when: #newMessage send: #addAtBottom: to: self. aChat when: #loadedMessage send: #addAtTop: to: self. + self chat: aChat; showMessages. \ 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 index f498efcb9..4d990f457 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/scrollToMessage..st +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/instance/scrollToMessage..st @@ -1,7 +1,6 @@ drawing scrollToMessage: aMessageId - | messageItem messageIndex | - messageIndex := self chat messageIds reversed indexOf: aMessageId. - messageItem := self items at: messageIndex. + | messageItem | + messageItem := self items detect: [:item | ((item isKindOf: TCUMessageWrapper)) and: [item messageId = aMessageId]]. 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 876ac0603..3cdb8474f 100644 --- a/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUChatMessageList.class/methodProperties.json @@ -3,18 +3,21 @@ "defaultScrollOffsetBeforeLoading" : "JB 6/26/2021 10:15", "defaultWidth" : "rgw 6/2/2022 15:39" }, "instance" : { - "addAtBottom:" : "aka 7/14/2022 16:13", - "addAtTop:" : "aka 7/14/2022 16:13", + "addAtBottom:" : "aka 7/14/2022 14:58", + "addAtTop:" : "aka 7/14/2022 15:18", + "addBottomDayDividerForDate:" : "js 7/18/2022 07:29", "addMessages" : "RS 7/17/2021 17:40", + "addTopDayDividerForDate:" : "js 7/18/2022 07:30", "chat" : "js 7/31/2020 16:39", "chat:" : "js 7/31/2020 16:39", "core" : "JB 6/26/2021 10:22", - "displayChat:" : "RS 7/17/2021 11:54", + "createDayDividerForDate:" : "aka 7/22/2022 09:29", + "displayChat:" : "aka 7/14/2022 13:50", "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", + "scrollToMessage:" : "aka 7/22/2022 09:34", "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/TCUDayDividerMessage.class/README.md b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/README.md new file mode 100644 index 000000000..91da5abc5 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/README.md @@ -0,0 +1 @@ +class for automatic generated info messages. \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/defaultMargin.st b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/defaultMargin.st new file mode 100644 index 000000000..b565d736e --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/defaultMargin.st @@ -0,0 +1,4 @@ +defaults +defaultMargin + + ^ 20 \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/newFromDate..st b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/newFromDate..st new file mode 100644 index 000000000..878923e5c --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/class/newFromDate..st @@ -0,0 +1,7 @@ +instance creation +newFromDate: aDate + + ^ self basicNew + content: aDate mmddyyyy; + initialize; + yourself diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content..st b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content..st new file mode 100644 index 000000000..056343ec1 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content..st @@ -0,0 +1,4 @@ +accessing +content: aString + + content := aString \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content.st b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content.st new file mode 100644 index 000000000..a5f2cf173 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/content.st @@ -0,0 +1,4 @@ +accessing +content + + ^ content \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/initialize.st b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/initialize.st new file mode 100644 index 000000000..e2c778771 --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/instance/initialize.st @@ -0,0 +1,14 @@ +initialization +initialize + + | textMorph | + super initialize. + + textMorph := TextMorph new + contents: self content; + lock. + self color: Color gray; + width: textMorph width + self class defaultMargin; + addMorphCentered: textMorph; + useRoundedCorners; + borderWidth: 0. \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/methodProperties.json new file mode 100644 index 000000000..3a5601a8c --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "defaultMargin" : "aka 7/14/2022 15:15", + "newFromDate:" : "aka 7/14/2022 15:14" }, + "instance" : { + "content" : "aka 7/10/2022 12:37", + "content:" : "aka 7/10/2022 12:37", + "initialize" : "aka 7/14/2022 15:16" } } diff --git a/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/properties.json b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/properties.json new file mode 100644 index 000000000..ad647b1eb --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUDayDividerMessage.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "TelegramClient-UI", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "aka 7/14/2022 15:07", + "instvars" : [ + "content" ], + "name" : "TCUDayDividerMessage", + "pools" : [ + ], + "super" : "RectangleMorph", + "type" : "normal" } diff --git a/packages/TelegramClient-UI.package/TCUMessageWrapper.class/instance/messageId.st b/packages/TelegramClient-UI.package/TCUMessageWrapper.class/instance/messageId.st new file mode 100644 index 000000000..829a6720d --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUMessageWrapper.class/instance/messageId.st @@ -0,0 +1,4 @@ +accessing +messageId + + ^ self message messageModel id \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessageWrapper.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUMessageWrapper.class/methodProperties.json index e72dc7018..38e9e12ba 100644 --- a/packages/TelegramClient-UI.package/TCUMessageWrapper.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUMessageWrapper.class/methodProperties.json @@ -7,4 +7,5 @@ "addProfilePhoto" : "js 6/13/2022 18:09", "initialize" : "JS 6/11/2022 11:40", "message" : "JS 6/11/2022 11:12", - "message:" : "JS 6/11/2022 11:13" } } + "message:" : "JS 6/11/2022 11:13", + "messageId" : "aka 7/22/2022 09:30" } } diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st index 1ba9b5a95..bf22bf2c2 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/setUp.st @@ -17,5 +17,4 @@ setUp userId: aNumber * 3; id: aNumber * 4; date: (DateAndTime fromUnixTime: aNumber * 60)). - self chat messageIds add: message id. - self chat messageDictionary at: message id put: message] \ No newline at end of file + self chat addNewestMessage: message.] \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddNewestMessage.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddNewestMessage.st index 7f9f3cb7b..89b78652e 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddNewestMessage.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddNewestMessage.st @@ -1,5 +1,7 @@ testing testAddNewestMessage - self chat addNewestMessage: (TCCTextMessage new text: 'test'). + self chat addNewestMessage: (TCCTextMessage new + text: 'test'; + date: DateAndTime today). self assert: 'test' equals: self chat messages first asText. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddOldestMessage.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddOldestMessage.st index d5e80954c..3caa817dc 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddOldestMessage.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testAddOldestMessage.st @@ -1,5 +1,8 @@ testing testAddOldestMessage - self chat addOldestMessage: (TCCTextMessage new text: 'test'). + self chat addOldestMessage: (TCCTextMessage new + text: 'test'; + date: (DateAndTime fromUnixTime: 0) + ). self assert: 'test' equals: self chat messages last asText. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsFirstMessageOfDay.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsFirstMessageOfDay.st new file mode 100644 index 000000000..e70967a78 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsFirstMessageOfDay.st @@ -0,0 +1,10 @@ +testing +testIsFirstMessageOfDay + + | messageYesterday messageToday | + messageYesterday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime yesterday). + messageToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today). + self chat addNewestMessage: messageYesterday. + self chat addNewestMessage: messageToday. + self assert: messageToday isFirstMessageOfDay. + self assert: messageYesterday isLastMessageOfDay. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsLastMessageOfDay.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsLastMessageOfDay.st new file mode 100644 index 000000000..a651ddbf3 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsLastMessageOfDay.st @@ -0,0 +1,10 @@ +testing +testIsLastMessageOfDay + + | messageYesterday messageToday | + messageYesterday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime yesterday). + messageToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today). + self chat addOldestMessage: messageToday. + self chat addOldestMessage: messageYesterday. + self assert: messageYesterday isLastMessageOfDay. + self assert: messageToday isFirstMessageOfDay. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotFirstMessageOfDay.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotFirstMessageOfDay.st new file mode 100644 index 000000000..8685b2600 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotFirstMessageOfDay.st @@ -0,0 +1,10 @@ +testing +testIsNotFirstMessageOfDay + + | messageLaterToday messageToday | + messageToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today). + messageLaterToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today + 1). + self chat addNewestMessage: messageToday. + self chat addNewestMessage: messageLaterToday. + self assert: messageLaterToday isFirstMessageOfDay not. + self assert: messageToday isLastMessageOfDay not. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotLastMessageOfDay.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotLastMessageOfDay.st new file mode 100644 index 000000000..db66955d2 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testIsNotLastMessageOfDay.st @@ -0,0 +1,10 @@ +testing +testIsNotLastMessageOfDay + + | messageLaterToday messageToday | + messageToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today). + messageLaterToday := TCTMMocks mockTextMessageWith: self core withDate: (DateAndTime today + 1). + self chat addOldestMessage: messageLaterToday. + self chat addOldestMessage: messageToday. + self assert: messageToday isLastMessageOfDay not. + self assert: messageLaterToday isFirstMessageOfDay not. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessage.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessage.st index 16aa7d49d..93798e31b 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessage.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessage.st @@ -2,4 +2,4 @@ testing testLastMessage self chat lastMessageText: 'test'. - self assert: 'test' equals: self chat lastMessageText. \ No newline at end of file + self assert: 'test' equals: self chat lastMessageText. diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessageDate.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessageDate.st new file mode 100644 index 000000000..6e5802b72 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testLastMessageDate.st @@ -0,0 +1,6 @@ +testing +testLastMessageDate + + | lastMessageDate | + lastMessageDate := self chat lastMessageDate. + self assert: (DateAndTime fromUnixTime: 5 * 60) equals: lastMessageDate. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testOldestLoadedMessageDate.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testOldestLoadedMessageDate.st new file mode 100644 index 000000000..eb5126181 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testOldestLoadedMessageDate.st @@ -0,0 +1,6 @@ +testing +testOldestLoadedMessageDate + + | oldestMessageDate | + oldestMessageDate := self chat oldestLoadedMessageDate. + self assert: (DateAndTime fromUnixTime: 60) equals: oldestMessageDate. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testStillRequestedMessages.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testStillRequestedMessages.st index eda441857..2dacd5d7c 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testStillRequestedMessages.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testStillRequestedMessages.st @@ -8,5 +8,5 @@ testStillRequestedMessages self chat requestMessages: 20. self assert: 20 equals: self chat stillRequestedMessages. - self chat addOldestMessage: TCCMessage new. + self chat addOldestMessage: (TCCMessage new date: (DateAndTime fromUnixTime: 0)). self assert: 19 equals: self chat stillRequestedMessages. \ 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 08cff81d0..42a5f7751 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json @@ -4,23 +4,29 @@ "instance" : { "chat" : "LL 8/2/2020 20:25", "chat:" : "LL 8/2/2020 20:26", - "setUp" : "LR 6/15/2022 09:41", + "setUp" : "aka 7/10/2022 12:22", "testAddAnsweredMessage" : "JS 5/26/2022 15:05", - "testAddNewestMessage" : "RS 7/31/2021 15:45", - "testAddOldestMessage" : "TR 6/22/2021 09:49", + "testAddNewestMessage" : "aka 7/10/2022 12:30", + "testAddOldestMessage" : "aka 7/10/2022 12:31", "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" : "LR 7/14/2022 10:24", - "testMessage" : "aka 7/14/2022 16:57", + "testIsFirstMessageOfDay" : "aka 7/14/2022 15:51", + "testIsLastMessageOfDay" : "aka 7/14/2022 15:52", + "testIsNotFirstMessageOfDay" : "aka 7/14/2022 15:52", + "testIsNotLastMessageOfDay" : "aka 7/14/2022 15:53", + "testLastMessage" : "aka 7/10/2022 11:12", + "testLastMessageDate" : "aka 7/10/2022 11:42", + "testMessage" : "pk 8/5/2021 17:06", "testMessages" : "JS 5/26/2022 14:37", "testMessagesSize" : "per 5/21/2021 16:30", "testNullId" : "pk 8/5/2021 17:13", "testNullMessages" : "js 8/2/2020 21:17", + "testOldestLoadedMessageDate" : "aka 7/10/2022 11:40", "testPosition" : "per 5/21/2021 16:30", - "testStillRequestedMessages" : "per 5/21/2021 16:29", + "testStillRequestedMessages" : "aka 7/10/2022 12:32", "testTitle" : "per 5/21/2021 16:29", "testWaitingForUpdate" : "js 8/2/2020 20:58" } } diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withDate..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withDate..st new file mode 100644 index 000000000..0cac9ea2a --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withDate..st @@ -0,0 +1,5 @@ +message +mockTextMessageWith: aCore withDate: aDateAndTime + + "DateAndTime fromUnixTime:" + ^ (TCTMMocks mockTextMessageWith: aCore) date: aDateAndTime \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withUnixDate..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withUnixDate..st new file mode 100644 index 000000000..3d67fd873 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockTextMessageWith.withUnixDate..st @@ -0,0 +1,5 @@ +message +mockTextMessageWith: aCore withUnixDate: aUnixDate + + "DateAndTime fromUnixTime:" + ^ TCTMMocks mockTextMessageWith: aCore withDate: (DateAndTime fromUnixTime: aUnixDate) \ 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 472c22001..36329aedc 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json @@ -51,11 +51,13 @@ "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:withDate:" : "aka 7/14/2022 15:48", "mockTextMessageWith:withId:" : "aka 6/15/2022 12:04", "mockTextMessageWith:withId:replyTo:" : "aka 6/15/2022 12:04", + "mockTextMessageWith:withUnixDate:" : "aka 7/14/2022 15:49", "mockTextReplyMessageWith:inChat:" : "aka 6/15/2022 12:04", - "mockUnloadedBasicGroupChat" : "LR 7/16/2022 12:06", - "mockUnloadedSuperGroupChat" : "LR 7/16/2022 12:08", + "mockUnloadedBasicGroupChat" : "aka 7/10/2022 11:14", + "mockUnloadedSuperGroupChat" : "aka 7/10/2022 11:14", "mockUpdateChatPositionEventForNotPinnedChatWithId:" : "js 6/18/2022 11:03", "mockUpdateChatPositionEventForPinnedChatWithId:" : "js 6/18/2022 11:04", "mockUpdateNewMessageJsonEventFrom:" : "7/25/2021 12:12:21", diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtBottom.st b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtBottom.st new file mode 100644 index 000000000..40cd7697e --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtBottom.st @@ -0,0 +1,12 @@ +testing +testAddDateDividerAtBottom + + | oldMessage newMessage oldDate newDate | + oldDate := 1376462359. "14.8.13" + newDate := 1376548759. "15.8.13" + oldMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: oldDate. + newMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: newDate. + self core chatsHandler chats first addNewestMessage: oldMessage. + self core chatsHandler chats first addNewestMessage: newMessage. + + self assertReading: '8/15/2013' in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtTop.st b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtTop.st new file mode 100644 index 000000000..08a5c515d --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testAddDateDividerAtTop.st @@ -0,0 +1,12 @@ +testing +testAddDateDividerAtTop + + | oldMessage newMessage oldDate newDate | + oldDate := 1376462359. "14.8.13" + newDate := 1376548759. "15.8.13" + oldMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: oldDate. + newMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: newDate. + self core chatsHandler chats first addOldestMessage: newMessage. + self core chatsHandler chats first addOldestMessage: oldMessage. + + self assertReading: '8/15/2013' in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testDoNotShowDateDivider.st b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testDoNotShowDateDivider.st new file mode 100644 index 000000000..1e0f448ab --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/instance/testDoNotShowDateDivider.st @@ -0,0 +1,12 @@ +testing +testDoNotShowDateDivider + + | oldMessage newMessage oldDate newDate | + oldDate := 1376462359. "14.8.13" + newDate := 1376462360. "14.8.13" + oldMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: oldDate. + newMessage := TCTMMocks mockTextMessageWith: self core withUnixDate: newDate. + self core chatsHandler chats first addNewestMessage: oldMessage. + self core chatsHandler chats first addNewestMessage: newMessage. + + self assertNotReading: '8/15/2013' in: self subject. \ 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 879ebf6b1..1b274da17 100644 --- a/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUChatMessageListTests.class/methodProperties.json @@ -4,8 +4,11 @@ "instance" : { "fillWithMessages" : "LR 6/15/2022 11:30", "setUp" : "RS 8/1/2021 12:57", - "testAddingOldMessagesDoesNotScroll" : "per 6/28/2021 16:23", + "testAddDateDividerAtBottom" : "js 7/22/2022 15:15", + "testAddDateDividerAtTop" : "js 7/22/2022 15:14", + "testAddingOldMessagesDoesNotScroll" : "aka 7/14/2022 15:30", "testChatDoesNotDisplayMessagesFromOtherChats" : "RS 8/1/2021 12:57", "testDisplayedChatLoadsOldMessage" : "per 6/28/2021 16:23", "testDisplayedChatReceivesNewMessage" : "per 6/28/2021 16:23", + "testDoNotShowDateDivider" : "aka 7/14/2022 15:48", "testScrollToReferencedMessage" : "aka 6/15/2022 12:28" } } diff --git a/packages/TelegramClientTests-UI.package/TCTUChatsListTests.class/methodProperties.json b/packages/TelegramClientTests-UI.package/TCTUChatsListTests.class/methodProperties.json index 42b02fc47..6eb1ea5fa 100644 --- a/packages/TelegramClientTests-UI.package/TCTUChatsListTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUChatsListTests.class/methodProperties.json @@ -4,4 +4,4 @@ "instance" : { "testChatOrderUpdatesIfPositionChanges" : "pk 8/6/2021 18:57", "testChatTitleVisible" : "JB 8/6/2021 15:52", - "testLastMessageVisible" : "LR 7/14/2022 10:25" } } + "testLastMessageVisible" : "aka 7/10/2022 11:13" } }