Skip to content

Commit

Permalink
Merge 4ea21cf into 3e4de95
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob271 committed May 28, 2022
2 parents 3e4de95 + 4ea21cf commit 1f7b235
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultSelectedReplyToMessageId

^ 0
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ initialize
infoLoaded: false;
isChannel: false;
position: self class defaultUnknownPosition;
numberOfRequestedMessages: self class defaultNumberOfRequestedMessages.
numberOfRequestedMessages: self class defaultNumberOfRequestedMessages;
selectedReplyToMessageId: self class defaultSelectedReplyToMessageId.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accessing
selectedReplyToMessageId: aNumber

aNumber = selectedReplyToMessageId
ifTrue: [selectedReplyToMessageId := self class defaultSelectedReplyToMessageId]
ifFalse: [selectedReplyToMessageId := aNumber].

self triggerEvent: #updateReplyToMessageId
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
selectedReplyToMessageId

^ selectedReplyToMessageId
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sending
sendMessage: aString

self core send: (TCCRequest newSendMessage: aString to: self id).
self core send: (TCCRequest newSendMessage: aString to: self id asReplyTo: self selectedReplyToMessageId).
self selectedReplyToMessageId: self class defaultSelectedReplyToMessageId.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"defaultLastMessageId" : "JB 8/4/2021 00:10",
"defaultMessageLimit" : "RS 7/17/2021 11:45",
"defaultNumberOfRequestedMessages" : "js 8/1/2020 18:52",
"defaultSelectedReplyToMessageId" : "JS 5/20/2022 09:51",
"defaultUnknownPosition" : "RS 8/6/2021 10:38",
"newFromChatEvent:" : "RS 7/17/2021 17:07" },
"instance" : {
Expand All @@ -19,7 +20,7 @@
"ifNotWaitingForUpdate:" : "js 8/2/2020 13:17",
"infoLoaded" : "per 6/4/2021 15:59",
"infoLoaded:" : "per 6/4/2021 15:51",
"initialize" : "RS 8/6/2021 10:39",
"initialize" : "JS 5/20/2022 09:51",
"initializeFromChatEvent:" : "pk 8/5/2021 15:48",
"isBasicGroup" : "per 6/15/2021 08:08",
"isChannel" : "per 7/17/2021 15:51",
Expand All @@ -39,12 +40,14 @@
"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",
"numberOfRequestedMessages:" : "JS 5/20/2022 11:34",
"position" : "RS 5/10/2021 21:11",
"position:" : "pk 8/6/2021 18:59",
"positionKnown" : "pk 8/6/2021 18:25",
"requestMessages:" : "RS 7/31/2021 15:28",
"sendMessage:" : "RS 7/17/2021 11:58",
"selectedReplyToMessageId" : "JS 5/20/2022 09:50",
"selectedReplyToMessageId:" : "JS 5/20/2022 11:38",
"sendMessage:" : "JS 5/20/2022 10:06",
"stillRequestedMessages" : "js 8/1/2020 18:05",
"title" : "rs 6/7/2020 22:24",
"title:" : "5/11/2021 10:09:15",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"core",
"infoLoaded",
"muted",
"isChannel" ],
"isChannel",
"selectedReplyToMessageId" ],
"name" : "TCCChat",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
instance creation
newSendMessage: aString to: aChatId asReplyTo: aMessageId

^ TCCRequest
newWithType: 'sendMessage'
from: {
'chat_id' -> aChatId.
'reply_to_message_id' -> aMessageId.
'input_message_content' -> (Dictionary newFrom: {
'@type' -> 'inputMessageText'.
'text' -> (Dictionary newFrom: {
'@type' -> 'formattedText'.
'text' -> aString asString squeakToUtf8
})
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"newRequestFile:" : "JB 8/1/2021 11:35",
"newSearchChatFrom:" : "RS 6/23/2021 16:38",
"newSendMessage:to:" : "RS 6/23/2021 16:41",
"newSendMessage:to:asReplyTo:" : "JS 5/20/2022 10:02",
"newSendPhoneNumber:" : "RS 6/23/2021 16:34",
"newUser:" : "JB 8/1/2021 11:55",
"newWithType:from:" : "rs 6/6/2020 16:21" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultInputfieldHeight

^ 70
^ 120
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
drawing
addReplyMessage

| message |
message := self selectedChat getMessageById: self selectedChat selectedReplyToMessageId.

self inputBar addMorphFront: (TextMorph new
contentsWrapped: 'Reply to: ' , message asReplySnippet asText;
extent: ((self inputBar width - 200) @ self class defaultInputfieldHeight);
lock;
yourself).
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ createInputBar
bottomLeft: (self bottomLeft);
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
wrapDirection: #topToBottom;
wrapCentering: #topLeft;
layoutInset: 2;
vResizing: #shrinkWrap;
cellInset: 12;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ event handling
newChatSelected: aChat

self welcomeMessage hide.
self inputBar submorphsDo: #abandon.
self addSendButton.
self addTextInputField.
self inputBar show.
self titleBar delete.
self infoPage delete.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accessing
selectedChat: aChat

selectedChat := aChat.
selectedChat := aChat.
selectedChat when: #updateReplyToMessageId send: #updateReplyMessage to: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
accessing
updateReplyMessage

self inputBar submorphsDo: #abandon.
self addSendButton.
self addTextInputField.
self selectedChat selectedReplyToMessageId == self selectedChat class defaultSelectedReplyToMessageId ifFalse: [
self addReplyMessage.
].
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"defaultInputfieldHeight" : "rs 6/12/2020 20:03",
"defaultInputfieldHeight" : "JS 5/20/2022 11:08",
"defaultTitleBarHeight" : "JB 6/28/2021 09:42",
"newWithHeight:width:" : "JB 7/6/2021 14:03" },
"instance" : {
Expand All @@ -9,6 +9,7 @@
"addHiddenInfoPage" : "per 6/15/2021 09:02",
"addInputBar" : "js 6/13/2020 17:59",
"addMemberCount" : "RK 8/4/2021 12:06",
"addReplyMessage" : "JS 5/22/2022 19:39",
"addSendButton" : "RK 8/4/2021 12:13",
"addTextInputField" : "RK 8/4/2021 12:06",
"addTitleBar" : "RS 5/29/2021 18:12",
Expand All @@ -18,20 +19,21 @@
"chatMessageList:" : "JB 7/6/2021 14:02",
"clear" : "JB 7/31/2021 15:24",
"core" : "js 8/2/2020 22:11",
"createInputBar" : "RK 8/4/2021 12:07",
"createInputBar" : "JS 5/20/2022 11:45",
"createTitleBar" : "JB 6/28/2021 09:42",
"infoPage" : "RS 5/20/2021 21:14",
"infoPage:" : "RS 5/20/2021 21:14",
"initialize" : "RS 5/20/2021 19:29",
"inputBar" : "rs 6/13/2020 10:38",
"inputBar:" : "RK 8/4/2021 10:48",
"newChatSelected:" : "JB 7/6/2021 14:01",
"newChatSelected:" : "JS 5/20/2022 11:55",
"selectedChat" : "rs 6/13/2020 09:11",
"selectedChat:" : "rs 6/13/2020 09:11",
"selectedChat:" : "JS 5/20/2022 10:42",
"showInfoPage" : "per 5/30/2021 11:51",
"textInputField" : "rs 6/13/2020 10:41",
"textInputField:" : "rs 6/13/2020 10:42",
"titleBar" : "sp 8/2/2020 15:04",
"titleBar:" : "sp 8/2/2020 15:04",
"updateReplyMessage" : "JS 5/22/2022 18:19",
"welcomeMessage" : "rs 6/13/2020 09:36",
"welcomeMessage:" : "RK 8/4/2021 10:49" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
mouseDown: anEvent

^ self messageModel chat selectedReplyToMessageId: self messageModel id
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"messageDateText" : "JB 5/17/2021 10:04",
"messageModel" : "TR 6/20/2021 11:00",
"messageModel:" : "RK 8/4/2021 11:16",
"mouseDown:" : "JS 5/20/2022 09:52",
"secondaryColor" : "rgw 5/12/2022 15:54",
"sender" : "TR 6/20/2021 10:59",
"senderId" : "8/5/2021 21:14:18",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
testing
testSelectAndDeselectMessageToReplyTo

| newMessage chatWindow |

self openChatWithId: 1.
chatWindow := self subject chatWindow.
newMessage := (TCTMMocks mockTextMessageWith: self core) text: 'New message'.
chatWindow selectedChat addNewestMessage: newMessage.

self assertNotReading: newMessage text inMorph: chatWindow inputBar.
chatWindow selectedChat selectedReplyToMessageId: newMessage id.
self assertReading: newMessage text inMorph: chatWindow inputBar.
chatWindow selectedChat selectedReplyToMessageId: newMessage id.
self assertNotReading: newMessage text inMorph: chatWindow inputBar.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
"instance" : {
"messageInputField" : "JB 7/19/2021 12:41",
"sendButton" : "JB 7/19/2021 12:44",
"testSelectAndDeselectMessageToReplyTo" : "JS 5/22/2022 19:23",
"testSentMessageAppearsInList" : "JB 7/18/2021 13:19" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
testing
testMouseDownOnMessage

| message messageMorph |

message := (TCTMMocks mockTextMessageWith: self core).
messageMorph := TCUMessage newFrom: message.
messageMorph mouseDown: EventMorph new.

self assert: message chat selectedReplyToMessageId == messageMorph messageModel id.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"testMessageContainsMessageText" : "tom.richter 6/26/2021 17:25",
"testMessageDisplaysEmojis" : "RK 7/6/2021 11:04",
"testMessageShrinksCorrectly" : "tom.richter 6/26/2021 21:04",
"testMouseDownOnMessage" : "JS 5/22/2022 18:54",
"testTextAndPhotoScaleCorrectlyLongCaption" : "rgw 5/12/2022 16:30",
"testTextAndPhotoScaleCorrectlyLongUserName" : "rgw 5/12/2022 16:30",
"testTextAndPhotoScaleCorrectlyNoCaption" : "rgw 5/12/2022 16:31",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
asserting
assertNotReading: aString inMorph: aMorph

self assertNotReading: aString in: (MTFMorphWrapper newWith: {aMorph}).
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"defaultTestResultPath" : "RS 5/23/2021 17:12" },
"instance" : {
"assertNotReading:in:" : "RS 5/31/2021 07:54",
"assertNotReading:inMorph:" : "JS 5/22/2022 19:17",
"assertReading:in:" : "TR 6/9/2021 14:55",
"assertReading:inMorph:" : "JB 6/26/2021 10:02",
"computeHashOf:" : "RS 5/23/2021 16:19",
Expand Down

0 comments on commit 1f7b235

Please sign in to comment.