Skip to content

Commit

Permalink
Merge 0660e3b into a4f5415
Browse files Browse the repository at this point in the history
  • Loading branch information
rsommerfeld committed Aug 4, 2021
2 parents a4f5415 + 0660e3b commit 3c62b82
Show file tree
Hide file tree
Showing 198 changed files with 316 additions and 353 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.DS_STORE
/.idea
/.idea
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"instvars" : [
"authState",
"core" ],
"name" : "TCCAuthHandler",
"name" : "TCCAuthenticationHandler",
"pools" : [
],
"super" : "Object",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
loading
loadInfo

| callbackId |
callbackId := self core registerCallback: [:aBasicGroupFullInfoEvent |
self
memberCount: (aBasicGroupFullInfoEvent at: 'members') size;
description: (aBasicGroupFullInfoEvent at: 'description');
addMembersFrom: (aBasicGroupFullInfoEvent at: 'members').
].
self core send: (TCCRequest newGetBasicGroupFullInfoOf: self groupId with: callbackId).
self core
send: (TCCRequest newGetBasicGroupFullInfoOf: self groupId)
thenDo: [:aBasicGroupFullInfoEvent |
self
memberCount: (aBasicGroupFullInfoEvent at: 'members') size;
description: (aBasicGroupFullInfoEvent at: 'description');
addMembersFrom: (aBasicGroupFullInfoEvent at: 'members').
].
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"instance" : {
"groupKey" : "7/25/2021 12:12:21",
"isBasicGroup" : "per 6/15/2021 08:41",
"loadInfo" : "RS 6/24/2021 09:22" } }
"loadInfo" : "JB 8/1/2021 18:17" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultLastMessageId

^ 0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
adding
addNewestMessage: aMessage

self messages add: aMessage afterIndex: 1.
self messages addFirst: aMessage.
self triggerEvent: #newMessage with: aMessage.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
canSendMessages: aBoolean

canSendMessages := aBoolean
canSendMessages := aBoolean.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ initialize

self
title: '';
messages: (OrderedCollection newFrom: {TCCNullMessage new});
messages: (OrderedCollection new);
waitingForUpdate: false;
positionKnown: false;
infoLoaded: false;
isChannel: false;
numberOfRequestedMessages: self class defaultNumberOfRequestedMessages.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ initializeFromChatEvent: anEvent
title: (anEvent at: 'title');
id: (anEvent at: 'id');
canSendMessages: ((anEvent at: 'permissions') at: 'can_send_messages');
type: ((anEvent at: 'type') at: '@type');
muted: ((anEvent at: 'notification_settings') at: 'mute_for') > 0;
lastMessage: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
lastMessageId

^ self messages
ifEmpty: [ self class defaultLastMessageId ]
ifNotEmpty: [ self messages last id ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
muted: aBoolean

muted := aBoolean
muted := aBoolean.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
numberOfMessages

^ self messages size - 1
^ self messages size
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
position: aNumber

position := aNumber
position := aNumber.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
positionKnown

^ positionKnown
^ self position notNil
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
loading
requestMessages: aLimit

self core send: (TCCRequest newGetChatHistoryOf: self id from: self messages last id until: aLimit).
self core send: (TCCRequest newGetChatHistoryOf: self id from: self lastMessageId until: aLimit).
self numberOfRequestedMessages: self numberOfMessages + aLimit.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"class" : {
"defaultLastMessageId" : "JB 8/4/2021 00:10",
"defaultMessageLimit" : "RS 7/17/2021 11:45",
"defaultNumberOfRequestedMessages" : "js 8/1/2020 18:52",
"newFromChatEvent:" : "RS 7/17/2021 17:07" },
"instance" : {
"addNewestMessage:" : "js 8/2/2020 12:58",
"addNewestMessage:" : "RS 7/31/2021 15:45",
"addOldestMessage:" : "JB 6/28/2021 09:31",
"canSendMessages" : "5/11/2021 10:09:15",
"canSendMessages:" : "TR 5/5/2021 16:31",
"canSendMessages:" : "JB 8/4/2021 00:08",
"chatHistoryReceived:" : "JB 7/19/2021 12:39",
"core" : "per 6/4/2021 16:00",
"core:" : "per 6/4/2021 15:58",
Expand All @@ -16,8 +17,8 @@
"ifNotWaitingForUpdate:" : "js 8/2/2020 13:17",
"infoLoaded" : "per 6/4/2021 15:59",
"infoLoaded:" : "per 6/4/2021 15:51",
"initialize" : "per 7/17/2021 15:51",
"initializeFromChatEvent:" : "per 6/16/2021 17:51",
"initialize" : "RS 7/31/2021 16:34",
"initializeFromChatEvent:" : "JB 8/4/2021 00:21",
"isBasicGroup" : "per 6/15/2021 08:08",
"isChannel" : "per 7/17/2021 15:51",
"isChannel:" : "per 7/17/2021 15:50",
Expand All @@ -26,26 +27,24 @@
"isSuperGroup" : "per 6/15/2021 08:09",
"lastMessage" : "rs 6/19/2020 17:33",
"lastMessage:" : "5/11/2021 10:09:15",
"lastMessageId" : "JB 8/4/2021 00:10",
"loadChatHistory" : "RS 7/17/2021 11:49",
"loadInfo" : "per 6/15/2021 09:49",
"loadInfoIfNotLoaded" : "TR 6/13/2021 15:54",
"messages" : "R.S 6/1/2020 15:37",
"messages:" : "5/11/2021 10:09:15",
"muted" : "per 6/16/2021 17:34",
"muted:" : "per 6/16/2021 17:35",
"numberOfMessages" : "js 8/1/2020 18:04",
"muted:" : "JB 8/4/2021 00:07",
"numberOfMessages" : "RS 7/31/2021 15:19",
"numberOfRequestedMessages" : "js 8/1/2020 17:43",
"numberOfRequestedMessages:" : "5/11/2021 10:09:15",
"position" : "RS 5/10/2021 21:11",
"position:" : "5/11/2021 10:09:15",
"positionKnown" : "RS 5/10/2021 21:11",
"positionKnown:" : "5/11/2021 10:09:15",
"requestMessages:" : "RS 7/17/2021 11:47",
"position:" : "JB 8/4/2021 00:08",
"positionKnown" : "RS 7/31/2021 16:36",
"requestMessages:" : "RS 7/31/2021 15:28",
"sendMessage:" : "RS 7/17/2021 11:58",
"stillRequestedMessages" : "js 8/1/2020 18:05",
"title" : "rs 6/7/2020 22:24",
"title:" : "5/11/2021 10:09:15",
"type" : "pk 5/9/2021 16:58",
"type:" : "5/11/2021 10:09:15",
"waitingForUpdate" : "5/11/2021 10:09:15",
"waitingForUpdate:" : "js 8/1/2020 17:00" } }
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
"instvars" : [
"messages",
"position",
"positionKnown",
"id",
"title",
"lastMessage",
"waitingForUpdate",
"numberOfRequestedMessages",
"type",
"canSendMessages",
"core",
"infoLoaded",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ addChat: aChatEvent
chat := TCCChat newFromChatEvent: (aChatEvent at: 'chat').
chat core: self core.

self core chats add: chat.
self chats add: chat.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ events
addNewMessage: aMessageJSONObject

| chat message |
chat := self core chats getChat: (aMessageJSONObject at: 'chat_id').
chat := self chats getChat: (aMessageJSONObject at: 'chat_id').
message := TCCMessage newFromMessageEvent: aMessageJSONObject in: chat with: self core.

chat addNewestMessage: message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ chatHistoryReceived: aChatHistory

(aChatHistory at: 'messages') ifNotEmpty: [
chatID := (aChatHistory at: 'messages') first at: 'chat_id'.
(self core chats getChat: chatID) chatHistoryReceived: aChatHistory].
(self chats getChat: chatID) chatHistoryReceived: aChatHistory].
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
chats: aCollection

chats := aCollection.
chats := aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initialize

self chats: TCCChats newWithDefaultSorting.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ openNewChat: aChatEvent

| newChat |
newChat := TCCChat newFromChatEvent: aChatEvent.
(self core chats hasChat: newChat id)
ifFalse: [self core chats add: newChat.]
(self chats hasChat: newChat id)
ifFalse: [self chats add: newChat.]
ifTrue: [newChat := self core chats getChat: newChat id.].
self core chats triggerEvent: #openNewChat with: newChat.
self chats triggerEvent: #openNewChat with: newChat.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
event handling
updateChatPosition: anEvent

(self core chats getChat: (anEvent at: 'chat_id'))
position: ((anEvent at: 'position') at: 'order');
positionKnown: true.
(self chats getChat: (anEvent at: 'chat_id'))
position: ((anEvent at: 'position') at: 'order').

self core chats notify.
self chats notify.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updateLastMessage: anEvent

(anEvent includesKey: 'last_message') ifTrue: [
messageJson := anEvent at: 'last_message'.
chat := self core chats getChat: (anEvent at: 'chat_id').
chat := self chats getChat: (anEvent at: 'chat_id').

(anEvent at: 'positions') notEmpty
ifTrue: [chat position:
Expand All @@ -15,4 +15,4 @@ updateLastMessage: anEvent

chat lastMessage: (TCCMessage newFromMessageEvent: messageJson in: chat with: self core) asSnippet.

self core chats notify].
self chats notify].
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
"class" : {
},
"instance" : {
"addChat:" : "RS 7/17/2021 11:04",
"addNewMessage:" : "6/13/2021 15:37:32",
"chatHistoryReceived:" : "JB 7/19/2021 12:38",
"addChat:" : "RS 8/1/2021 12:54",
"addNewMessage:" : "RS 8/1/2021 12:54",
"chatHistoryReceived:" : "RS 8/1/2021 12:54",
"chats" : "RS 8/1/2021 12:50",
"chats:" : "RS 8/1/2021 12:51",
"core" : "6/4/2021 16:24:10",
"core:" : "6/4/2021 16:24:10",
"getChats" : "RS 6/23/2021 16:38",
"handleNewMessage:" : "pk 6/8/2021 09:32",
"openNewChat:" : "RS 7/17/2021 11:12",
"initialize" : "RS 8/1/2021 12:51",
"openNewChat:" : "RS 8/1/2021 12:55",
"remainingMessages" : "5/11/2021 10:09:15",
"remainingMessages:" : "js 8/1/2020 16:50",
"searchChat:" : "RS 6/23/2021 16:39",
"updateChatPosition:" : "per 5/21/2021 16:55",
"updateLastMessage:" : "RK 6/26/2021 11:37" } }
"updateChatPosition:" : "RS 8/1/2021 12:55",
"updateLastMessage:" : "RS 8/1/2021 12:55" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"commentStamp" : "js 6/13/2020 16:26",
"instvars" : [
"remainingMessages",
"chats",
"core" ],
"name" : "TCCChatsHandler",
"pools" : [
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
authenticationHandler: anAuthenticationHandler

authenticationHandler := anAuthenticationHandler
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
authenticationHandler

^ authenticationHandler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
handlers
checkAuthenticationCode: aString

self authHandler checkAuthenticationCode: aString.
self authenticationHandler checkAuthenticationCode: aString.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
handlers
freeClient

self client ifNotNil: [self client free].
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
events
getOwnProfile

| callbackId |

callbackId := self registerCallback: [:aUserEvent | self setUserID: aUserEvent].
self send: (TCCRequest newGetMeWith: callbackId).
self
send: TCCRequest newGetMe
thenDo: [:aUserEvent | self setUserID: aUserEvent].
Loading

0 comments on commit 3c62b82

Please sign in to comment.