diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage..st similarity index 79% rename from packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st rename to packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage..st index 32e5022ea..126708a80 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage..st @@ -1,9 +1,9 @@ events -addNewMessage: aMessageJSONObject from: aUser +addNewMessage: aMessageJSONObject | chat message | chat := self core chats getChat: (aMessageJSONObject at: 'chat_id'). - message := TCCMessage newFromMessageEvent: aMessageJSONObject in: chat from: aUser. + message := TCCMessage newFromMessageEvent: aMessageJSONObject in: chat with: self core. chat addNewestMessage: message. self core triggerEvent: #newMessageReceived with: message. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/chatHistoryReceived..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/chatHistoryReceived..st index 73763b85b..b0988f0c2 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/chatHistoryReceived..st +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/chatHistoryReceived..st @@ -7,7 +7,7 @@ chatHistoryReceived: aChatHistory chatID := (aChatHistory at: 'messages') first at: 'chat_id'. chat := self core chats getChat: chatID. - (aChatHistory at: 'messages') do: [:message | chat addOldestMessage: (TCCMessage newFromMessageEvent: message in: chat)]. + (aChatHistory at: 'messages') do: [:message | chat addOldestMessage: (TCCMessage newFromMessageEvent: message in: chat with: self core)]. chat waitingForUpdate: false. diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage..st new file mode 100644 index 000000000..b5a52877b --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage..st @@ -0,0 +1,4 @@ +event handling +handleNewMessage: aMessageJSONObject + + self addNewMessage: aMessageJSONObject \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st deleted file mode 100644 index 319a01f23..000000000 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st +++ /dev/null @@ -1,4 +0,0 @@ -event handling -handleNewMessage: aMessageJSONObject from: aUser - - self addNewMessage: aMessageJSONObject from: aUser diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json index 138420cd8..bced1df2b 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json @@ -3,15 +3,15 @@ }, "instance" : { "addChat:" : "JB 6/4/2021 21:34", - "addNewMessage:from:" : "per 5/21/2021 16:55", - "chatHistoryReceived:" : "JB 6/4/2021 21:35", + "addNewMessage:" : "pk 6/8/2021 09:31", + "chatHistoryReceived:" : "JB 6/13/2021 10:59", "client" : "per 5/21/2021 16:55", "core" : "per 5/21/2021 16:55", "core:" : "per 5/21/2021 16:55", "defaultMessageLimit" : "js 8/1/2020 18:24", "getChatHistoryFrom:with:limit:" : "per 5/21/2021 16:55", "getChats" : "js 7/31/2020 22:50", - "handleNewMessage:from:" : "pk 5/17/2021 18:28", + "handleNewMessage:" : "pk 6/8/2021 09:32", "loadBasicGroupInfoFor:with:" : "TR 6/2/2021 13:59", "loadSuperGroupInfoFor:with:" : "TR 6/2/2021 13:58", "openNewChat:" : "pk 5/13/2021 12:45", diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st index 0f0fa2def..47a742b6f 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st @@ -1,7 +1,6 @@ events handleMessageEvent: anEvent - | message userID | + | message | message := anEvent at: 'message'. - userID := (message at: 'sender') at: 'user_id'. - [self chatsHandler handleNewMessage: message from: (self users getUserFor: userID)] fork + self chatsHandler handleNewMessage: message diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/update.st b/packages/TelegramClient-Core.package/TCCCore.class/instance/update.st index c3c4283e0..2c3deccb4 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/update.st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/update.st @@ -4,4 +4,6 @@ update | event | event := self client receive: 0.05. - event ifNotNil: [self handleEvent: (TCCEvent newFromTDLibEvent: event)]. \ No newline at end of file + event ifNotNil: [ + [self handleEvent: (TCCEvent newFromTDLibEvent: event)] fork + ]. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st index 694250ea0..848da1081 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st @@ -1,4 +1,5 @@ accessing users: aDictionary - users := aDictionary \ No newline at end of file + users := aDictionary. + self users core: self. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json index 6c8154c45..bfff79ba9 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json @@ -16,7 +16,7 @@ "getChatHistoryFrom:" : "js 8/1/2020 18:19", "getOwnProfile" : "pk 5/13/2021 09:44", "handleEvent:" : "per 5/26/2021 14:04", - "handleMessageEvent:" : "pk 5/19/2021 11:29", + "handleMessageEvent:" : "pk 6/11/2021 10:20", "handlePendingEvent:" : "per 5/26/2021 14:03", "initialize" : "JB 6/10/2021 22:29", "initializeHandlers" : "per 5/21/2021 16:55", @@ -33,6 +33,6 @@ "sendPhoneNumber:" : "js 6/13/2020 15:35", "setUserID:" : "per 5/13/2021 08:22", "tryHandleError:" : "JB 6/4/2021 17:28", - "update" : "RS 6/3/2021 12:09", + "update" : "pk 6/8/2021 09:22", "users" : "RK 5/19/2021 09:56", - "users:" : "RK 5/19/2021 09:56" } } + "users:" : "pk 6/13/2021 10:09" } } diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.from..st b/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.from..st deleted file mode 100644 index 638825bc8..000000000 --- a/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.from..st +++ /dev/null @@ -1,6 +0,0 @@ -instance creation -newFromMessageEvent: aMessageEvent in: aChat from: aUser - - ^ (self newFromMessageEvent: aMessageEvent in: aChat) - sender: aUser; - yourself \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in..st b/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.with..st similarity index 86% rename from packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in..st rename to packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.with..st index 21ccef8db..7e16f6cbb 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in..st +++ b/packages/TelegramClient-Core.package/TCCMessage.class/class/newFromMessageEvent.in.with..st @@ -1,5 +1,5 @@ instance creation -newFromMessageEvent: aMessageEvent in: aChat +newFromMessageEvent: aMessageEvent in: aChat with: aCore ^ self new message: (((aMessageEvent at: 'content') at: '@type') = 'messageText' @@ -10,4 +10,5 @@ newFromMessageEvent: aMessageEvent in: aChat id: (aMessageEvent at: 'id'); isOutgoing: (aMessageEvent at: 'is_outgoing'); date: (self timeStampToDateAndTime: (aMessageEvent at: 'date')); + core: aCore; yourself \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/core..st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/core..st new file mode 100644 index 000000000..bd19251b0 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/core..st @@ -0,0 +1,4 @@ +accessing +core: aCore + + core := aCore \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/core.st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/core.st new file mode 100644 index 000000000..7652dd8d1 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/core.st @@ -0,0 +1,4 @@ +accessing +core + + ^ core \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender.st b/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender.st index 1377bd6ed..48635de21 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender.st +++ b/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender.st @@ -1,4 +1,4 @@ accessing sender - ^ sender \ No newline at end of file + ^ self core users getUserFor: self senderID \ 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 2f3e8ca40..4ea5bf0e1 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCMessage.class/methodProperties.json @@ -1,12 +1,13 @@ { "class" : { - "newFromMessageEvent:in:" : "JB 6/4/2021 21:14", - "newFromMessageEvent:in:from:" : "JB 6/4/2021 21:14", + "newFromMessageEvent:in:with:" : "JB 6/13/2021 10:51", "timeStampToDateAndTime:" : "JB 5/16/2021 09:42" }, "instance" : { "chat" : "pk 5/7/2021 12:06", "chat:" : "per 5/13/2021 09:20", "chatID" : "pk 5/13/2021 09:48", + "core" : "pk 6/8/2021 09:24", + "core:" : "pk 6/8/2021 09:25", "date" : "RK 5/7/2021 10:02", "date:" : "RK 5/7/2021 10:02", "id" : "js 8/1/2020 18:20", @@ -16,7 +17,6 @@ "isOutgoing:" : "js 8/2/2020 22:00", "message" : "rs 6/29/2020 17:13", "message:" : "js 8/2/2020 22:01", - "sender" : "pk 5/9/2021 16:47", - "sender:" : "pk 5/9/2021 16:47", + "sender" : "pk 6/11/2021 10:21", "senderID" : "per 5/13/2021 08:49", "senderID:" : "js 8/2/2020 22:00" } } diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/properties.json b/packages/TelegramClient-Core.package/TCCMessage.class/properties.json index b19e2daf4..c0b9de3c1 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/properties.json +++ b/packages/TelegramClient-Core.package/TCCMessage.class/properties.json @@ -10,9 +10,9 @@ "chat", "id", "isOutgoing", - "sender", "senderID", - "date" ], + "date", + "core" ], "name" : "TCCMessage", "pools" : [ ], diff --git a/packages/TelegramClient-Core.package/TCCUser.class/instance/^equals.st b/packages/TelegramClient-Core.package/TCCUser.class/instance/^equals.st new file mode 100644 index 000000000..a4cf89afa --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUser.class/instance/^equals.st @@ -0,0 +1,8 @@ +comparing += aUser + + ^ self species = aUser species + and: [self firstName = aUser firstName] + and: [self lastName = aUser lastName] + and: [self id = aUser id] + and: [self username = aUser username] \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUser.class/instance/fullName.st b/packages/TelegramClient-Core.package/TCCUser.class/instance/fullName.st index c286e78d4..4c30f3b17 100644 --- a/packages/TelegramClient-Core.package/TCCUser.class/instance/fullName.st +++ b/packages/TelegramClient-Core.package/TCCUser.class/instance/fullName.st @@ -1,4 +1,4 @@ accessing fullName - ^ (self firstName) , ' ' , (self lastName) \ No newline at end of file + ^ self firstName , ' ' , self lastName \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUser.class/instance/hash.st b/packages/TelegramClient-Core.package/TCCUser.class/instance/hash.st new file mode 100644 index 000000000..65c9d02a3 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUser.class/instance/hash.st @@ -0,0 +1,7 @@ +comparing +hash + + ^ ((self firstName hash + bitXor: self lastName hash) + bitXor: self id hash) + bitXor: self username hash diff --git a/packages/TelegramClient-Core.package/TCCUser.class/instance/initialize.st b/packages/TelegramClient-Core.package/TCCUser.class/instance/initialize.st index 94de443fc..f068a9ee8 100644 --- a/packages/TelegramClient-Core.package/TCCUser.class/instance/initialize.st +++ b/packages/TelegramClient-Core.package/TCCUser.class/instance/initialize.st @@ -5,4 +5,4 @@ initialize username: ''; firstName: ''; lastName: ''; - id: -1 \ No newline at end of file + id: -1. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUser.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCUser.class/methodProperties.json index 7366d2329..affee7c83 100644 --- a/packages/TelegramClient-Core.package/TCCUser.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCUser.class/methodProperties.json @@ -2,12 +2,14 @@ "class" : { "newFrom:" : "per 5/15/2021 12:03" }, "instance" : { + "=" : "pk 6/13/2021 12:52", "firstName" : "per 5/15/2021 12:03", "firstName:" : "per 5/15/2021 12:03", - "fullName" : "per 5/15/2021 12:03", + "fullName" : "JB 6/13/2021 10:28", + "hash" : "JB 6/13/2021 14:01", "id" : "pk 5/9/2021 16:33", "id:" : "per 5/13/2021 09:18", - "initialize" : "JB 6/4/2021 17:29", + "initialize" : "JB 6/13/2021 10:52", "lastName" : "per 5/15/2021 12:03", "lastName:" : "per 5/15/2021 12:03", "username" : "pk 5/9/2021 16:33", diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/class/newFromTCCMessage..st b/packages/TelegramClient-UI.package/TCUMessage.class/class/newFromTCCMessage..st index 1bdcc7476..4def88748 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/class/newFromTCCMessage..st +++ b/packages/TelegramClient-UI.package/TCUMessage.class/class/newFromTCCMessage..st @@ -6,4 +6,5 @@ newFromTCCMessage: aMessage senderID: aMessage senderID; isOutgoing: aMessage isOutgoing; date: aMessage date; + sender: aMessage sender; initialize \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/addSender.st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/addSender.st new file mode 100644 index 000000000..1d031b55b --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/addSender.st @@ -0,0 +1,8 @@ +drawing +addSender + + self addMorphFront: (self defaultTextMorph + contents: self sender fullName; + color: self dateColor; + margins: self defaultMargins; + yourself). \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/initialize.st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/initialize.st index a23d31160..7239744a9 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/instance/initialize.st +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/initialize.st @@ -7,4 +7,5 @@ initialize initializeDefaults; addText; addDate; + addSender; shrinkToContent. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender..st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/sender..st similarity index 59% rename from packages/TelegramClient-Core.package/TCCMessage.class/instance/sender..st rename to packages/TelegramClient-UI.package/TCUMessage.class/instance/sender..st index 4c4c25724..459c9fa5e 100644 --- a/packages/TelegramClient-Core.package/TCCMessage.class/instance/sender..st +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/sender..st @@ -1,4 +1,4 @@ accessing sender: aUser - sender := aUser. \ No newline at end of file + sender := aUser \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/instance/sender.st b/packages/TelegramClient-UI.package/TCUMessage.class/instance/sender.st new file mode 100644 index 000000000..1377bd6ed --- /dev/null +++ b/packages/TelegramClient-UI.package/TCUMessage.class/instance/sender.st @@ -0,0 +1,4 @@ +accessing +sender + + ^ sender \ 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 f9decd58e..087758196 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUMessage.class/methodProperties.json @@ -1,8 +1,9 @@ { "class" : { - "newFromTCCMessage:" : "RK 5/7/2021 10:11" }, + "newFromTCCMessage:" : "pk 6/8/2021 09:36" }, "instance" : { "addDate" : "JB 5/29/2021 21:05", + "addSender" : "pk 6/13/2021 12:57", "addText" : "JB 5/30/2021 11:24", "date" : "RK 5/7/2021 10:11", "date:" : "RK 5/7/2021 10:12", @@ -13,13 +14,15 @@ "defaultMargins" : "JB 6/4/2021 21:38", "defaultTextMorph" : "JB 6/4/2021 21:38", "defaultWidth" : "r.s 7/31/2020 14:19", - "initialize" : "JB 5/29/2021 21:07", + "initialize" : "pk 6/8/2021 09:34", "initializeDefaults" : "JB 5/30/2021 11:23", "isOutgoing" : "js 8/2/2020 22:02", "isOutgoing:" : "js 8/2/2020 22:02", "maxContentWidth" : "JB 5/29/2021 20:32", "messageColor" : "JB 5/29/2021 21:06", "messageDateText" : "JB 5/17/2021 10:04", + "sender" : "pk 6/8/2021 09:36", + "sender:" : "pk 6/8/2021 09:36", "senderID" : "js 7/31/2020 16:11", "senderID:" : "js 7/31/2020 16:10", "shrinkToContent" : "JB 5/30/2021 11:27", diff --git a/packages/TelegramClient-UI.package/TCUMessage.class/properties.json b/packages/TelegramClient-UI.package/TCUMessage.class/properties.json index 1cb2366cd..9a54e125f 100644 --- a/packages/TelegramClient-UI.package/TCUMessage.class/properties.json +++ b/packages/TelegramClient-UI.package/TCUMessage.class/properties.json @@ -9,7 +9,8 @@ "text", "senderID", "isOutgoing", - "date" ], + "date", + "sender" ], "name" : "TCUMessage", "pools" : [ ], diff --git a/packages/TelegramClient-UI.package/TCUNotification.class/instance/calculatePosition.st b/packages/TelegramClient-UI.package/TCUNotification.class/instance/calculatePosition.st index adff4b806..48f94c3a4 100644 --- a/packages/TelegramClient-UI.package/TCUNotification.class/instance/calculatePosition.st +++ b/packages/TelegramClient-UI.package/TCUNotification.class/instance/calculatePosition.st @@ -1,4 +1,4 @@ accessing calculatePosition - ^ self currentWorld bottomRight - (self defaultWidth @ self defaultHeight) - (self defaultOffset) \ No newline at end of file + ^ self currentWorld bottomRight - (self defaultWidth @ self defaultHeight) - self defaultOffset \ No newline at end of file diff --git a/packages/TelegramClient-UI.package/TCUNotification.class/methodProperties.json b/packages/TelegramClient-UI.package/TCUNotification.class/methodProperties.json index f5e531c4d..444ae30fd 100644 --- a/packages/TelegramClient-UI.package/TCUNotification.class/methodProperties.json +++ b/packages/TelegramClient-UI.package/TCUNotification.class/methodProperties.json @@ -3,7 +3,7 @@ "newWithMessage:" : "JB 6/4/2021 21:48" }, "instance" : { "addContent" : "per 5/16/2021 15:20", - "calculatePosition" : "rs 7/5/2020 14:42", + "calculatePosition" : "JB 6/13/2021 10:42", "chat" : "per 5/13/2021 08:50", "chat:" : "per 5/13/2021 09:21", "chatID" : "rs 7/5/2020 14:31", diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testMessage.st b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testMessage.st index 962e14622..8923397c7 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testMessage.st +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/instance/testMessage.st @@ -2,7 +2,7 @@ testing testMessage | message | - message := TCCMessage newFromMessageEvent: (TCTMMocks mockMessageJsonFrom: self chat id) in: self chat. + message := TCCMessage newFromMessageEvent: (TCTMMocks mockMessageJsonFrom: self chat id) in: self chat with: nil. self assert: TCTMMocks mockUser id equals: message senderID. self assert: TCTMMocks mockMessageID equals: message id. diff --git a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json index 97c5b32d7..acbcbde79 100644 --- a/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCChatTests.class/methodProperties.json @@ -9,7 +9,7 @@ "testAddOldestMessage" : "per 5/21/2021 16:32", "testID" : "per 5/21/2021 16:32", "testLastMessage" : "per 5/21/2021 16:31", - "testMessage" : "JB 6/7/2021 09:27", + "testMessage" : "pk 6/11/2021 10:35", "testMessages" : "per 5/21/2021 16:30", "testMessagesSize" : "per 5/21/2021 16:30", "testNullID" : "js 8/2/2020 21:15", diff --git a/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageSenderTriggersUserRequest.st b/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageSenderTriggersUserRequest.st new file mode 100644 index 000000000..ff986d0e3 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageSenderTriggersUserRequest.st @@ -0,0 +1,20 @@ +testing +testMessageSenderTriggersUserRequest + + | messageEvent userJson | + self core when: #newMessageReceived send: #newMessageReceived: to: self. + self core chats add: TCTMMocks mockPrivateChat. + + self receivedMessage: nil. + messageEvent := TCTMMocks mockMessageEventFrom: TCTMMocks mockPrivateChat id. + + self core handleEvent: messageEvent. + 1 seconds wait. + + userJson := TCTMMocks mockUserJson. + self core client onRequestType: 'getUser' respond: userJson. + + self assert: self receivedMessage notNil. + self assert: TCTMMocks mockUser fullName equals: self receivedMessage sender fullName. + self assert: TCTMMocks mockPrivateChat id equals: self receivedMessage chat id. + self assert: TCTMMocks mockMessageText equals: self receivedMessage message. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageTriggersUserRequest.st b/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageTriggersUserRequest.st deleted file mode 100644 index 984009c23..000000000 --- a/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/instance/testMessageTriggersUserRequest.st +++ /dev/null @@ -1,21 +0,0 @@ -testing -testMessageTriggersUserRequest - - | message user | - self core when: #newMessageReceived send: #newMessageReceived: to: self. - self core chats add: TCTMMocks mockPrivateChat. - - self receivedMessage: nil. - message := TCTMMocks mockMessageEventFrom: TCTMMocks mockPrivateChat id. - - self core handleEvent: message. - 1 seconds wait. - - user := TCTMMocks mockUserEvent. - self core handleEvent: user. - 1 seconds wait. - - self assert: self receivedMessage notNil. - self assert: (TCTMMocks mockUser fullName) equals: (self receivedMessage sender fullName). - self assert: (TCTMMocks mockPrivateChat id) equals: (self receivedMessage chat id). - self assert: (TCTMMocks mockMessageText) equals: (self receivedMessage message) \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/methodProperties.json b/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/methodProperties.json index 34b10dacd..ddc186c4f 100644 --- a/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCCoreTests.class/methodProperties.json @@ -11,4 +11,4 @@ "testChatsHandler" : "per 5/21/2021 16:28", "testErrorConstants" : "js 8/2/2020 21:23", "testLoggedInUserID" : "JB 6/7/2021 09:28", - "testMessageTriggersUserRequest" : "JB 6/7/2021 09:28" } } + "testMessageSenderTriggersUserRequest" : "JB 6/13/2021 10:49" } } diff --git a/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserEquality.st b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserEquality.st new file mode 100644 index 000000000..291ea9d5c --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserEquality.st @@ -0,0 +1,8 @@ +testing +testUserEquality + + | user1 user2 | + user1 := TCTMMocks mockUser. + user2 := TCTMMocks mockUser. + + self assert: user1 equals: user2. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserHash.st b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserHash.st new file mode 100644 index 000000000..fe24be645 --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserHash.st @@ -0,0 +1,8 @@ +testing +testUserHash + + | user1 user2 | + user1 := TCTMMocks mockUser. + user2 := TCTMMocks mockUser. + + self assert: user1 hash equals: user2 hash. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserInequality.st b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserInequality.st new file mode 100644 index 000000000..ac0bef95f --- /dev/null +++ b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/instance/testUserInequality.st @@ -0,0 +1,9 @@ +testing +testUserInequality + + | user1 user2 | + user1 := TCTMMocks mockUser. + user2 := TCTMMocks mockUser. + user2 id: user2 id + 1. + + self deny: user1 = user2. \ No newline at end of file diff --git a/packages/TelegramClientTests-Core.package/TCTCUserTest.class/methodProperties.json b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/methodProperties.json index 8d091e927..df77e1e3b 100644 --- a/packages/TelegramClientTests-Core.package/TCTCUserTest.class/methodProperties.json +++ b/packages/TelegramClientTests-Core.package/TCTCUserTest.class/methodProperties.json @@ -2,4 +2,7 @@ "class" : { }, "instance" : { - "testUserConstructor" : "JB 6/10/2021 22:44" } } + "testUserConstructor" : "JB 6/10/2021 22:44", + "testUserEquality" : "pk 6/13/2021 11:12", + "testUserHash" : "pk 6/13/2021 11:13", + "testUserInequality" : "pk 6/13/2021 11:13" } } diff --git a/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/instance/testMethodNameIsLowerCase.st b/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/instance/testMethodNameIsLowerCase.st index 49d270b14..145023a57 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/instance/testMethodNameIsLowerCase.st +++ b/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/instance/testMethodNameIsLowerCase.st @@ -1,4 +1,9 @@ tests testMethodNameIsLowerCase - self methodsLinesDo: [:lines | self assert: lines first first isLowercase]. \ No newline at end of file + self methodsLinesDo: [:lines | + | firstChar | + firstChar := lines first first. + firstChar isLetter + ifTrue: [self assert: firstChar isLowercase] + ]. \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/methodProperties.json b/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/methodProperties.json index 2e99ec126..dedaa6601 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/methodProperties.json +++ b/packages/TelegramClientTests-Misc.package/TCTMLinterTests.class/methodProperties.json @@ -21,7 +21,7 @@ "testInstanceVarAccess" : "js 6/13/2020 16:54", "testLongMethods" : "JB 6/10/2021 22:45", "testMethodHasEmptyLine" : "j 7/16/2020 12:29", - "testMethodNameIsLowerCase" : "js 6/13/2020 18:05", + "testMethodNameIsLowerCase" : "JB 6/13/2021 10:53", "testMethodNoEmptyLineAtEnd" : "j 7/16/2020 12:32", "testMethodNoTrailingWhitespaces" : "JB 6/10/2021 22:45", "testMethodNoTwoWhitespacesNextToEachOther" : "js 6/13/2020 18:56", @@ -47,7 +47,7 @@ "testsmallLintModifiesCollection" : "js 6/13/2020 18:38", "testsmallLintOnlyReadOrWrittenTemporary" : "js 6/13/2020 19:21", "testsmallLintReturnsBooleanAndOther" : "js 6/13/2020 18:38", - "testsmallLintSendsUnknownMessageToGlobal" : "js 6/13/2020 18:38", + "testsmallLintSendsUnknownMessageToGlobal" : "pk 6/13/2021 11:07", "testsmallLintSizeCheck" : "js 6/13/2020 18:38", "testsmallLintStringConcatenation" : "js 6/13/2020 18:38", "testsmallLintTempVarOverridesInstVar" : "js 6/13/2020 18:38", diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockCore.st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockCore.st new file mode 100644 index 000000000..014399b50 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockCore.st @@ -0,0 +1,6 @@ +core +mockCore + + ^ (TCCCore newWithTeleClient: TCTMMockTeleClient new) + users: self mockUsers; + yourself \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessage.st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessage.st index cc4e839f3..0e8a1c78a 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessage.st +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessage.st @@ -1,4 +1,4 @@ message mockMessage - ^ TCCMessage newFromMessageEvent: (self mockMessageJsonFrom: self mockPrivateChat id) in: self mockPrivateChat from: self mockUser \ No newline at end of file + ^ self mockMessageWith: self mockCore diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessageWith..st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessageWith..st new file mode 100644 index 000000000..e9b2809f6 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockMessageWith..st @@ -0,0 +1,6 @@ +message +mockMessageWith: aCore + + ^ TCCMessage newFromMessageEvent: (self mockMessageJsonFrom: self mockPrivateChat id) + in: self mockPrivateChat + with: aCore \ No newline at end of file diff --git a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockUsers.st b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockUsers.st new file mode 100644 index 000000000..1c6489f73 --- /dev/null +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockUsers.st @@ -0,0 +1,9 @@ +user +mockUsers + + | promise users | + promise := Promise new. + promise resolveWith: (TCCUser newFrom: self mockUserEvent). + users := TCCUsers new. + users at: self mockUser id put: promise. + ^ users \ 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 53285b9e4..938f9cabc 100644 --- a/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json +++ b/packages/TelegramClientTests-Misc.package/TCTMMocks.class/methodProperties.json @@ -2,16 +2,19 @@ "class" : { "mockBasicGroupChat" : "JB 6/10/2021 22:46", "mockChats" : "JB 6/10/2021 22:52", - "mockMessage" : "RS 6/6/2021 13:11", + "mockCore" : "pk 6/13/2021 12:59", + "mockMessage" : "pk 6/13/2021 13:02", "mockMessageDate" : "RS 6/6/2021 11:42", "mockMessageEventFrom:" : "RS 5/23/2021 17:56", "mockMessageID" : "pk 5/19/2021 11:36", "mockMessageJsonFrom:" : "RS 6/6/2021 12:05", "mockMessageText" : "pk 5/19/2021 11:38", + "mockMessageWith:" : "pk 6/13/2021 13:07", "mockPrivateChat" : "JB 6/10/2021 22:47", "mockSupergroupChat" : "JB 6/10/2021 22:46", "mockUser" : "RS 6/6/2021 12:05", "mockUserEvent" : "RS 6/6/2021 12:36", - "mockUserJson" : "JB 6/7/2021 09:22" }, + "mockUserJson" : "JB 6/7/2021 09:22", + "mockUsers" : "JB 6/13/2021 10:42" }, "instance" : { } } diff --git a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageContainsMessageSender.st b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageContainsMessageSender.st new file mode 100644 index 000000000..de6bc2376 --- /dev/null +++ b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageContainsMessageSender.st @@ -0,0 +1,5 @@ +testing +testMessageContainsMessageSender + + self wantsToTest: (TCUMessage newFromTCCMessage: TCTMMocks mockMessage). + self assertReading: TCTMMocks mockUser fullName in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageShrinksCorrectly.st b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageShrinksCorrectly.st index 22f4443c4..22ed81c8a 100644 --- a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageShrinksCorrectly.st +++ b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/instance/testMessageShrinksCorrectly.st @@ -7,4 +7,4 @@ testMessageShrinksCorrectly messageMorph := TCUMessage newFromTCCMessage: message. self forceSaveScreenshotOf: messageMorph as: 'testMessageShrinksCorrectly' in: self class defaultTestResultPath. - self assert: 116327780 equals: (self computeHashOf: (self takeScreenshotOf: messageMorph)). \ No newline at end of file + self assert: 153740059 equals: (self computeHashOf: (self takeScreenshotOf: messageMorph)). \ 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 cd973bc38..9c9890c26 100644 --- a/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUMessageTests.class/methodProperties.json @@ -3,7 +3,8 @@ }, "instance" : { "expectedSqueak5_2Failures" : "RS 6/6/2021 15:43", - "testMessageColorsDifferentForIncomingOutgoing" : "JB 6/7/2021 09:42", - "testMessageContainsDate" : "JB 6/7/2021 09:28", - "testMessageContainsMessageText" : "JB 6/7/2021 09:28", - "testMessageShrinksCorrectly" : "RS 6/7/2021 10:49" } } + "testMessageColorsDifferentForIncomingOutgoing" : "pk 6/11/2021 10:28", + "testMessageContainsDate" : "pk 6/11/2021 10:28", + "testMessageContainsMessageSender" : "pk 6/13/2021 10:42", + "testMessageContainsMessageText" : "pk 6/11/2021 10:28", + "testMessageShrinksCorrectly" : "pk 6/13/2021 11:04" } } diff --git a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationConstructor.st b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationConstructor.st index b33422b9c..8f1566211 100644 --- a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationConstructor.st +++ b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationConstructor.st @@ -1,13 +1,16 @@ testing testNotificationConstructor - | chat message sender notification | + | chat message notification | - chat := TCCChat new type: 'chatTypePrivate'; title: 'chat'. - sender := TCCUser new firstName: 'Test'; lastName: 'User'. - message := TCCMessage new sender: sender; chat: chat; message: 'm'. + chat := TCTMMocks mockPrivateChat. + message := TCCMessage new + chat: chat; + core: self core; + senderID: TCTMMocks mockUser id; + message: 'm'. notification := TCUNotification newWithMessage: message. - self assert: sender equals: notification sender. + self assert: TCTMMocks mockUser equals: notification sender. self assert: chat equals: notification chat. self assert: message equals: notification message. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationContainsMessage.st b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationContainsMessage.st index 3ac0f0538..9c447910d 100644 --- a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationContainsMessage.st +++ b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationContainsMessage.st @@ -1,5 +1,5 @@ testing testNotificationContainsMessage - self wantsToTest: (TCUNotification newWithMessage: TCTMMocks mockMessage). + self wantsToTest: (TCUNotification newWithMessage: (TCTMMocks mockMessageWith: self core)). self assertReading: TCTMMocks mockMessageText in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationHidesPrivateChatTitle.st b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationHidesPrivateChatTitle.st index e0bdc348a..4a5edfb3a 100644 --- a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationHidesPrivateChatTitle.st +++ b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationHidesPrivateChatTitle.st @@ -1,11 +1,13 @@ testing testNotificationHidesPrivateChatTitle - | chat message sender | + | chat message | chat := TCTMMocks mockPrivateChat. - sender := TCCUser new. - message := TCCMessage new sender: sender; chat: chat. + message := TCCMessage new + chat: chat; + core: self core; + senderID: TCTMMocks mockUser id. self wantsToTest: (TCUNotification newWithMessage: message). self assertNotReading: TCTMMocks mockPrivateChat title in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationShowsGroupChatTitle.st b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationShowsGroupChatTitle.st index 0bc80c9c4..d97046897 100644 --- a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationShowsGroupChatTitle.st +++ b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/instance/testNotificationShowsGroupChatTitle.st @@ -1,11 +1,13 @@ testing testNotificationShowsGroupChatTitle - | chat message sender | + | chat message | chat := TCTMMocks mockBasicGroupChat. - sender := TCCUser new. - message := TCCMessage new sender: sender; chat: chat. + message := TCCMessage new + chat: chat; + core: self core; + senderID: TCTMMocks mockUser id. self wantsToTest: (TCUNotification newWithMessage: message). self assertReading: TCTMMocks mockBasicGroupChat title in: self subject. \ No newline at end of file diff --git a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/methodProperties.json b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/methodProperties.json index 7997db124..d096fc86f 100644 --- a/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUNotificationTests.class/methodProperties.json @@ -2,8 +2,8 @@ "class" : { }, "instance" : { - "testNotificationConstructor" : "RS 6/6/2021 13:09", - "testNotificationContainsMessage" : "JB 6/7/2021 09:28", - "testNotificationContainsSender" : "JB 6/7/2021 09:28", - "testNotificationHidesPrivateChatTitle" : "JB 6/7/2021 09:28", - "testNotificationShowsGroupChatTitle" : "JB 6/7/2021 09:29" } } + "testNotificationConstructor" : "JB 6/13/2021 10:50", + "testNotificationContainsMessage" : "pk 6/11/2021 10:23", + "testNotificationContainsSender" : "pk 6/11/2021 10:28", + "testNotificationHidesPrivateChatTitle" : "JB 6/13/2021 10:50", + "testNotificationShowsGroupChatTitle" : "JB 6/13/2021 10:51" } } diff --git a/packages/TelegramClientTests-UI.package/TCTUTestCase.class/instance/setUp.st b/packages/TelegramClientTests-UI.package/TCTUTestCase.class/instance/setUp.st index d99f2bf07..fab571700 100644 --- a/packages/TelegramClientTests-UI.package/TCTUTestCase.class/instance/setUp.st +++ b/packages/TelegramClientTests-UI.package/TCTUTestCase.class/instance/setUp.st @@ -3,4 +3,5 @@ setUp self core: (TCTUMockCore newWithTeleClient: TCTMMockTeleClient new). self core chats: TCTMMocks mockChats. + self core users: TCTMMocks mockUsers. self wantsToTest: (TCUMain newWithCore: self core). diff --git a/packages/TelegramClientTests-UI.package/TCTUTestCase.class/methodProperties.json b/packages/TelegramClientTests-UI.package/TCTUTestCase.class/methodProperties.json index eefee256c..427fce66f 100644 --- a/packages/TelegramClientTests-UI.package/TCTUTestCase.class/methodProperties.json +++ b/packages/TelegramClientTests-UI.package/TCTUTestCase.class/methodProperties.json @@ -16,7 +16,7 @@ "expectedSqueak5_2Failures" : "JB 6/10/2021 22:49", "findByTextContent:in:" : "RS 5/31/2021 07:55", "forceSaveScreenshotOf:as:in:" : "RS 5/26/2021 13:29", - "setUp" : "JB 6/7/2021 11:36", + "setUp" : "pk 6/11/2021 10:22", "takeScreenshotOf:" : "JB 5/24/2021 16:21", "tearDown" : "JB 5/24/2021 17:42", "waitUntil:" : "RS 6/6/2021 13:00" } }