-
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.
Feature/add chat member count in title bar (#381)
* fix spacing in TitleBar * fix linter * member count is now displayed when it finished loading, basicGroup member count is now correct * ui test for chat member count * test all chats in lists * Removed the need for shrinkWrap by manually implementing the same thing * Removed Vivide from baseline * Updating screenshot test hash * fixed merge * Removing cellGap for Squeak 5.2 * hide after addMorphFront to stay compatible with 5.2 * fix formatting, remove unused code * fix MockData and tests * remove TCTMockCore * merge user count * manually fix some squeak auto merging errors * fix linter and add extended linter failure info * Adding newline for linter Co-authored-by: Paul Ermler <[email protected]> Co-authored-by: Jannis Berndt <[email protected]> Co-authored-by: rsommerfeld <[email protected]>
- Loading branch information
1 parent
89884b0
commit a167fe3
Showing
62 changed files
with
214 additions
and
88 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/isNotPrivate.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 @@ | ||
initialization | ||
isNotPrivate | ||
|
||
^ self isPrivate not |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/memberCount..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 | ||
memberCount: aNumber | ||
|
||
memberCount := aNumber |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Core.package/TCCChat.class/instance/memberCount.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 | ||
memberCount | ||
|
||
^ memberCount |
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
11 changes: 10 additions & 1 deletion
11
packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addChat..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,15 @@ | ||
events | ||
addChat: aChatEvent | ||
|
||
| chat | | ||
chat := TCCChat newFromChatEvent: aChatEvent. | ||
(chat type = 'chatTypeSupergroup') ifTrue: [ | ||
self loadSuperGroupChatMemberCountFor: chat with: (((aChatEvent at: 'chat') at: 'type') at: 'supergroup_id'). | ||
]. | ||
(chat type = 'chatTypeBasicGroup') ifTrue: [ | ||
self loadBasicGroupChatMemberCountFor: chat with: (((aChatEvent at: 'chat') at: 'type') at: 'basic_group_id'). | ||
]. | ||
|
||
self app chats | ||
add: (TCCChat newFromChatEvent: aChatEvent); | ||
add: chat; | ||
notify. |
10 changes: 10 additions & 0 deletions
10
...ent-Core.package/TCCChatsHandler.class/instance/loadBasicGroupChatMemberCountFor.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,10 @@ | ||
events | ||
loadBasicGroupChatMemberCountFor: aChat with: aBasicGroupId | ||
|
||
self client send: (TCCRequest | ||
newWithType: 'getBasicGroupFullInfo' | ||
from: { | ||
'basic_group_id'->aBasicGroupId. | ||
'@extra'->aBasicGroupId}). | ||
self app pendingRequests at: aBasicGroupId put: [:aBasicGroupFullInfoEvent | | ||
aChat memberCount: ((aBasicGroupFullInfoEvent at: 'members') size).] |
10 changes: 10 additions & 0 deletions
10
...ent-Core.package/TCCChatsHandler.class/instance/loadSuperGroupChatMemberCountFor.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,10 @@ | ||
events | ||
loadSuperGroupChatMemberCountFor: aChat with: aSupergroupId | ||
|
||
self client send: (TCCRequest | ||
newWithType: 'getSupergroupFullInfo' | ||
from: { | ||
'supergroup_id'->aSupergroupId. | ||
'@extra'->aSupergroupId}). | ||
self app pendingRequests at: aSupergroupId put: [:aSupergroupFullInfoEvent | | ||
aChat memberCount: (aSupergroupFullInfoEvent at: 'member_count').]. |
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
6 changes: 3 additions & 3 deletions
6
...CCCore.class/instance/handleUserEvent..st → ...ore.class/instance/handlePendingEvent..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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/app..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 | ||
app: aMorph | ||
|
||
app := aMorph |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/app.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 | ||
app | ||
|
||
^ app |
4 changes: 0 additions & 4 deletions
4
packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/defaultTimeout.st
This file was deleted.
Oops, something went wrong.
File renamed without changes.
9 changes: 4 additions & 5 deletions
9
packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/setUp.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,8 +1,7 @@ | ||
running | ||
setUp | ||
|
||
self core: TCTTestCore new. | ||
20 seconds wait. | ||
self core authHandler isAuthorizationStateReady ifFalse: [ | ||
self core loginWithTestData. | ||
20 seconds wait]. | ||
self core: TCTNoTDLibCore new. | ||
self core chats: TCTMocks mockChats. | ||
self app: (TCUMain newWithCore: self core). | ||
self wantsToTest: self app. |
3 changes: 1 addition & 2 deletions
3
packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/tearDown.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
running | ||
tearDown | ||
|
||
super tearDown. | ||
self core client specificClient isNil ifFalse: [self core client free]. | ||
super tearDown. |
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
3 changes: 0 additions & 3 deletions
3
...elegramClient-Tests.package/TCTAcceptanceTests.class/instance/testChatInfoPageIsHidden.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,8 +1,5 @@ | ||
testing | ||
testChatInfoPageIsHidden | ||
|
||
self wantsToTest: (TCUMain newWithCore: self core). | ||
self slowTestBy: 1000. | ||
|
||
(self subject findByClass: TCUChatListItem) click. | ||
self assert: (self subject findByClass: TCUChatInfoPage) visible not. |
14 changes: 14 additions & 0 deletions
14
...ges/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testChatMemberCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
testing | ||
testChatMemberCount | ||
|
||
((self subject findByClass: TCUChatListItem)morphs) do: [ | ||
:chatListItem | | chatWindowWrapper | | ||
chatWindowWrapper := self subject createWrapperFor: {self app chatWindow}. | ||
(MTFMorphWrapper newWith: {chatListItem}) click. | ||
chatListItem chat isPrivate | ||
ifTrue: [ | ||
self assertNotReading: 'Members: ' in: chatWindowWrapper. | ||
] ifFalse: [ | ||
self assertReading: ('Members: ', chatListItem chat memberCount asString) in: chatWindowWrapper. | ||
] | ||
] |
11 changes: 4 additions & 7 deletions
11
...ages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testMessageAuthors.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
File renamed without changes.
File renamed without changes.
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
23 changes: 12 additions & 11 deletions
23
...s/TelegramClient-Tests.package/TCTLinterTests.class/instance/arbitraryCodeRule.plugIn..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,15 +1,16 @@ | ||
private | ||
arbitraryCodeRule: aRule plugIn: aPlugIn | ||
|
||
| failures result | | ||
| failures failingTestObjects result | | ||
|
||
failures := ((SLTestRunner new | ||
environment: (self environmentFor: aPlugIn withRule: aRule)) | ||
runOnTests: {aRule} andTestObjects: self classTestObjects) | ||
select: [:testObject | | ||
result := (testObject resultOf: aRule). | ||
result isSummary | ||
ifTrue: [result > 0] | ||
ifFalse: [result isNegative]]. | ||
|
||
self assert: failures isEmpty description: 'Failures in: ', failures asString. | ||
failingTestObjects := OrderedCollection new. | ||
failures := ((SLTestRunner new environment: (self environmentFor: aPlugIn withRule: aRule)) | ||
runOnTests: {aRule} | ||
andTestObjects: self classTestObjects) select: [:testObject | | ||
result := testObject resultOf: aRule. | ||
result isSummary | ||
ifTrue: [ | ||
failingTestObjects addAll: (testObject methods select: [:each | result summarizingCondition value: (each resultOf: result summarizedTest)]). | ||
result > 0] | ||
ifFalse: [result isNegative]]. | ||
self assert: failures isEmpty description: 'Failures in: ', failures asString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
chat | ||
mockBasicGroupChat | ||
|
||
^ TCCChat new | ||
id: 2; | ||
title: 'GroupMockChat'; | ||
type: 'chatTypeBasicGroup'; | ||
lastMessage: 'lastBasicGroupMessage'; | ||
canSendMessages: true; | ||
memberCount: 5 |
10 changes: 10 additions & 0 deletions
10
packages/TelegramClient-Tests.package/TCTMocks.class/class/mockChats.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
chat | ||
mockChats | ||
|
||
|chats| | ||
chats := TCCChats newWithDefaultSorting. | ||
chats | ||
add: self mockBasicGroupChat; | ||
add: self mockPrivateChat; | ||
add: self mockSupergroupChat. | ||
^chats |
9 changes: 9 additions & 0 deletions
9
packages/TelegramClient-Tests.package/TCTMocks.class/class/mockPrivateChat.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,9 @@ | ||
chat | ||
mockPrivateChat | ||
|
||
^ TCCChat new | ||
id: 1; | ||
title: 'PrivateMockChat'; | ||
type: 'chatTypePrivate'; | ||
lastMessage: 'lastPrivateMessage'; | ||
canSendMessages: true |
10 changes: 10 additions & 0 deletions
10
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
chat | ||
mockSupergroupChat | ||
|
||
^ TCCChat new | ||
id: 3; | ||
title: 'SupergroupMockChat'; | ||
type: 'chatTypeSupergroup'; | ||
lastMessage: 'lastSupergroupMessage'; | ||
canSendMessages: true; | ||
memberCount: 8972981 |
Oops, something went wrong.