-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add initial version of Group description (cherry-picked from commit f741db6) * refactor info page description (cherry-picked from commit ad3d81f) * Solving merge conflicts * Fixing formatting and corrected screenshot hash * Adding screenshot test to expectedFailures for Squeak5.2 * Making TCCChat constructor better Co-authored-by: Jannis Berndt <[email protected]>
- Loading branch information
1 parent
a167fe3
commit 34e76c1
Showing
54 changed files
with
281 additions
and
66 deletions.
There are no files selected for viewing
17 changes: 8 additions & 9 deletions
17
packages/TelegramClient-Core.package/TCCChat.class/class/newFromChatEvent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
instance creation | ||
newFromChatEvent: anEvent | ||
|
||
| chat | | ||
chat := anEvent at: 'chat'. | ||
^ self new | ||
title: (chat at: 'title'); | ||
id: (chat at: 'id'); | ||
canSendMessages: ((chat at: 'permissions') at: 'can_send_messages'); | ||
type: ((chat at: 'type') at: '@type'); | ||
lastMessage: ''; | ||
yourself | ||
| type | | ||
type := ((anEvent at: 'chat') at: 'type') at: '@type'. | ||
|
||
^ (((type = 'chatTypeSupergroup') or: (type = 'chatTypeBasicGroup')) | ||
ifTrue: [TCCGroup new] | ||
ifFalse: [self new]) | ||
initializeFromChatEvent: anEvent; | ||
yourself |
11 changes: 11 additions & 0 deletions
11
packages/TelegramClient-Core.package/TCCChat.class/instance/initializeFromChatEvent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
initialization | ||
initializeFromChatEvent: anEvent | ||
|
||
| chat | | ||
chat := anEvent at: 'chat'. | ||
self | ||
title: (chat at: 'title'); | ||
id: (chat at: 'id'); | ||
canSendMessages: ((chat at: 'permissions') at: 'can_send_messages'); | ||
type: ((chat at: 'type') at: '@type'); | ||
lastMessage: '' |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/isGroup.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
isGroup | ||
|
||
^ false |
4 changes: 0 additions & 4 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/isNotPrivate.st
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Core.package/TCCChat.class/instance/isPrivate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
initialization | ||
accessing | ||
isPrivate | ||
|
||
^ (self type = 'chatTypePrivate') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...ent-Core.package/TCCChatsHandler.class/instance/loadBasicGroupChatMemberCountFor.with..st
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...TelegramClient-Core.package/TCCChatsHandler.class/instance/loadBasicGroupInfoFor.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
events | ||
loadBasicGroupInfoFor: aChat with: aBasicGroupId | ||
|
||
self client send: (TCCRequest | ||
newWithType: 'getBasicGroupFullInfo' | ||
from: { | ||
'basic_group_id'->aBasicGroupId. | ||
'@extra'->aBasicGroupId}). | ||
|
||
self app | ||
registerCallback: [:aBasicGroupFullInfoEvent | | ||
aChat | ||
memberCount: (aBasicGroupFullInfoEvent at: 'members') size; | ||
description: (aBasicGroupFullInfoEvent at: 'description').] | ||
with: aBasicGroupId. |
10 changes: 0 additions & 10 deletions
10
...ent-Core.package/TCCChatsHandler.class/instance/loadSuperGroupChatMemberCountFor.with..st
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...TelegramClient-Core.package/TCCChatsHandler.class/instance/loadSuperGroupInfoFor.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
events | ||
loadSuperGroupInfoFor: aChat with: aSupergroupId | ||
|
||
self client send: (TCCRequest | ||
newWithType: 'getSupergroupFullInfo' | ||
from: { | ||
'supergroup_id'->aSupergroupId. | ||
'@extra'->aSupergroupId}). | ||
|
||
self app | ||
registerCallback: [:aSupergroupFullInfoEvent | | ||
aChat | ||
memberCount: (aSupergroupFullInfoEvent at: 'member_count'); | ||
description: (aSupergroupFullInfoEvent at: 'description').] | ||
with: aSupergroupId. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
representing a Telegram superGroup or basicGroup |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCGroup.class/instance/description..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
description: aString | ||
|
||
description := aString |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCGroup.class/instance/description.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
description | ||
|
||
^ description |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClient-Core.package/TCCGroup.class/instance/initialize.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
initialization | ||
initialize | ||
|
||
super initialize. | ||
self description: ''. |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCGroup.class/instance/isGroup.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
isGroup | ||
|
||
^ true |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCGroup.class/instance/isPrivate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
isPrivate | ||
|
||
^ false |
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
packages/TelegramClient-Core.package/TCCGroup.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"description" : "RS 5/29/2021 18:44", | ||
"description:" : "RS 5/29/2021 18:44", | ||
"initialize" : "RS 5/29/2021 18:44", | ||
"isGroup" : "RS 5/29/2021 18:13", | ||
"isPrivate" : "RS 5/29/2021 17:38", | ||
"memberCount" : "RS 5/29/2021 18:44", | ||
"memberCount:" : "RS 5/29/2021 18:44" } } |
15 changes: 15 additions & 0 deletions
15
packages/TelegramClient-Core.package/TCCGroup.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"category" : "TelegramClient-Core", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "RS 5/29/2021 18:45", | ||
"instvars" : [ | ||
"description", | ||
"memberCount" ], | ||
"name" : "TCCGroup", | ||
"pools" : [ | ||
], | ||
"super" : "TCCChat", | ||
"type" : "normal" } |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCNullChat.class/instance/isPrivate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
isPrivate | ||
|
||
^ false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...Client-Tests.package/TCTAcceptanceTests.class/instance/testDoesDisplayGroupDescription.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
testing | ||
testDoesDisplayGroupDescription | ||
|
||
| titleBar groupChat | | ||
self wantsToTest: (TCUMain newWithCore: self core). | ||
|
||
[self core chats anySatisfy: [:c | c isGroup]] | ||
whileFalse: [6 seconds wait.]. | ||
groupChat := (self core chats detect: [:chat | chat isGroup]). | ||
groupChat description: TCTMocks mockDescription. | ||
|
||
(self subject findByCriteria: [ :morph | (morph respondsTo: #chatID) and: [morph chatID = groupChat id]]) click. | ||
titleBar := (self subject findByClass: TCUChatWindow) morphs collect: [:chatWindow | chatWindow titleBar]. | ||
(self subject createWrapperFor: titleBar) click. | ||
|
||
self assertReading: groupChat description in: (self subject findByClass: TCUChatInfoPage). |
17 changes: 17 additions & 0 deletions
17
...Client-Tests.package/TCTAcceptanceTests.class/instance/testPrivateChatHasNoDescription.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
testing | ||
testPrivateChatHasNoDescription | ||
|
||
| titleBar groupChat chatInfoPage | | ||
self wantsToTest: (TCUMain newWithCore: self core). | ||
|
||
[self core chats anySatisfy: [:c | c isPrivate]] | ||
whileFalse: [6 seconds wait.]. | ||
groupChat := (self core chats detect: [:chat | chat isPrivate]). | ||
|
||
(self subject findByCriteria: [ :morph | (morph respondsTo: #chatID) and: [morph chatID = groupChat id]]) click. | ||
titleBar := (self subject findByClass: TCUChatWindow) morphs collect: [:chatWindow | chatWindow titleBar]. | ||
(self subject createWrapperFor: titleBar) click. | ||
|
||
chatInfoPage := (self subject findByClass: TCUChatInfoPage) morphs anyOne. | ||
self forceSaveScreenshotOf: chatInfoPage as: 'testPrivateChatHasNoDescription' in: self class defaultTestResultPath. | ||
self assert: 236496437 equals: (self computeHashOf: (self takeScreenshotOf: chatInfoPage)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Tests.package/TCTMocks.class/class/mockBasicGroupChat.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
chat | ||
mockBasicGroupChat | ||
|
||
^ TCCChat new | ||
^ TCCGroup new | ||
id: 2; | ||
title: 'GroupMockChat'; | ||
type: 'chatTypeBasicGroup'; | ||
|
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Tests.package/TCTMocks.class/class/mockDescription.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
chat | ||
mockDescription | ||
|
||
^ 'A very random demo description' |
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Tests.package/TCTMocks.class/class/mockSupergroupChat.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
packages/TelegramClient-Tests.package/TCTMocks.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...TCUChatInfoPage.class/class/newBounds..st → ...nfoPage.class/class/newFor.withBounds..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
instance creation | ||
newBounds: bounds | ||
newFor: aChat withBounds: bounds | ||
|
||
^ (super newBounds: bounds) | ||
chat: aChat; | ||
addInfoBar; | ||
addContent; | ||
yourself |
Oops, something went wrong.