From 5e88a9a91bc1da81cd0b68318fcc83810ddfc827 Mon Sep 17 00:00:00 2001 From: Alexandra Betouni <31625338+alexandraB99@users.noreply.github.com> Date: Mon, 29 Nov 2021 11:28:06 +0100 Subject: [PATCH] refactor(desktop): Removed all timeline related code Removed all timeline associated code from base_bc. This feature is deprecated and shall be removed Closes #4064 --- .gitignore | 3 +- src/app/chat/event_handling.nim | 14 +- src/app/chat/view.nim | 18 -- src/app/chat/views/channels_list.nim | 5 - src/app/chat/views/chat_item.nim | 5 - src/app/chat/views/messages.nim | 21 +- src/app/chat/views/reactions.nim | 5 - .../core/local_account_sensitive_settings.nim | 16 -- src/app/modules/main/item.nim | 2 +- src/app/modules/main/module.nim | 4 +- src/app_service/service/chat/dto/chat.nim | 4 +- .../Chat/popups/PinnedMessagesPopup.qml | 1 - .../Timeline/panels/EmptyTimelinePanel.qml | 56 ----- .../AppLayouts/Timeline/stores/RootStore.qml | 28 --- ui/app/AppLayouts/stores/MessageStore.qml | 1 - ui/app/AppMain.qml | 18 -- ui/imports/assets/images/timeline.svg | 3 - ui/imports/shared/status/StatusChatInput.qml | 113 +++------- .../shared/views/chat/CompactMessageView.qml | 1 - .../views/chat/MessageContextMenuView.qml | 1 - ui/imports/shared/views/chat/MessageView.qml | 32 +-- .../shared/views/chat/StatusUpdateView.qml | 205 ------------------ ui/imports/utils/Constants.qml | 2 - ui/main.qml | 2 +- ui/nim-status-client.pro | 1 - vendor/status-lib | 2 +- 26 files changed, 44 insertions(+), 519 deletions(-) delete mode 100644 ui/app/AppLayouts/Timeline/panels/EmptyTimelinePanel.qml delete mode 100644 ui/app/AppLayouts/Timeline/stores/RootStore.qml delete mode 100644 ui/imports/assets/images/timeline.svg delete mode 100644 ui/imports/shared/views/chat/StatusUpdateView.qml diff --git a/.gitignore b/.gitignore index 4ce6f44dd..349fc816a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ noBackup/ *.pro.user *.pro.autosave *.qml.autosave +*.log .update.timestamp .vscode bin/ @@ -29,4 +30,4 @@ resources.qrc status-react-translations/ /.update.timestamp notarization.log -status-desktop.log \ No newline at end of file +status-desktop.log diff --git a/src/app/chat/event_handling.nim b/src/app/chat/event_handling.nim index cd80610eb..21fe51398 100644 --- a/src/app/chat/event_handling.nim +++ b/src/app/chat/event_handling.nim @@ -104,10 +104,8 @@ proc handleChatEvents(self: ChatController) = self.status.events.on("channelLoaded") do(e: Args): var channel = ChannelArgs(e) - if channel.chat.chatType == ChatType.Timeline: - self.view.setTimelineChat(channel.chat) # Do not add community chats to the normal chat list - elif channel.chat.chatType != ChatType.Profile and channel.chat.chatType != status_chat.ChatType.CommunityChat: + if channel.chat.chatType != status_chat.ChatType.CommunityChat: discard self.view.channelView.chats.addChatItemToList(channel.chat) self.view.messageView.upsertChannel(channel.chat.id) self.view.messageView.messageList[channel.chat.id].addChatMembers(channel.chat.members) @@ -133,11 +131,8 @@ proc handleChatEvents(self: ChatController) = self.status.events.on("channelJoined") do(e: Args): var channel = ChannelArgs(e) - if channel.chat.chatType == ChatType.Timeline: - self.view.setTimelineChat(channel.chat) - elif channel.chat.chatType != ChatType.Profile: - discard self.view.channelView.chats.addChatItemToList(channel.chat) - self.view.setActiveChannel(channel.chat.id) + discard self.view.channelView.chats.addChatItemToList(channel.chat) + self.view.setActiveChannel(channel.chat.id) self.loadInitialMessagesForChannel(channel.chat.id) self.status.chat.statusUpdates() @@ -146,7 +141,6 @@ proc handleChatEvents(self: ChatController) = let chatId = ChatIdArg(e).chatId self.view.removeChat(chatId) self.view.calculateUnreadMessages() - self.view.removeMessagesFromTimeline(chatId) self.status.events.on("activeChannelChanged") do(e: Args): self.view.setActiveChannel(ChatIdArg(e).chatId) @@ -201,4 +195,4 @@ proc handleMailserverEvents(self: ChatController) = proc handleSystemEvents(self: ChatController) = self.status.events.on("osNotificationClicked") do(e:Args): let arg = OsNotificationsArgs(e) - self.view.onOsNotificationClicked(arg.details) \ No newline at end of file + self.view.onOsNotificationClicked(arg.details) diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index 72a89e651..d663583b6 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -89,7 +89,6 @@ QtObject: communities*: CommunitiesView replyTo: string connected: bool - timelineChat: Chat pubKey*: string proc setup(self: ChatsView) = self.QAbstractListModel.setup @@ -244,12 +243,6 @@ QtObject: self.activityNotificationList.addActivityNotificationItemToList(activityCenterNotification) self.activityNotificationsChanged() - proc setActiveChannelToTimeline*(self: ChatsView) {.slot.} = - if not self.channelView.activeChannel.chatItem.isNil: - self.channelView.previousActiveChannelIndex = self.channelView.chats.chats.findIndexById(self.channelView.activeChannel.id) - self.channelView.activeChannel.setChatItem(self.timelineChat) - self.activeChannelChanged() - proc updateUsernames*(self:ChatsView, contacts: seq[Profile]) = if contacts.len > 0: # Updating usernames for all the messages list @@ -278,9 +271,6 @@ QtObject: discard self.channelView.chats.addChatItemToList(chatItem) self.messageView.messagePushed(self.messageView.messageList[chatItem.id].count - 1) - proc setTimelineChat*(self: ChatsView, chatItem: Chat) = - self.timelineChat = chatItem - proc copyToClipboard*(self: ChatsView, content: string) {.slot.} = setClipBoardText(content) @@ -320,16 +310,8 @@ QtObject: self.messageView.removeChat(chatId) proc toggleReaction*(self: ChatsView, messageId: string, emojiId: int) {.slot.} = - if self.channelView.activeChannel.id == status_utils.getTimelineChatId(): - let message = self.messageView.messageList[status_utils.getTimelineChatId()].getMessageById(messageId) - self.reactions.toggle(messageId, message.chatId, emojiId) - else: self.reactions.toggle(messageId, self.channelView.activeChannel.id, emojiId) - proc removeMessagesFromTimeline*(self: ChatsView, chatId: string) = - self.messageView.messageList[status_utils.getTimelineChatId()].deleteMessagesByChatId(chatId) - self.channelView.activeChannelChanged() - proc updateChats*(self: ChatsView, chats: seq[Chat]) = for chat in chats: if (chat.communityId != ""): diff --git a/src/app/chat/views/channels_list.nim b/src/app/chat/views/channels_list.nim index 37949b333..7514ad926 100644 --- a/src/app/chat/views/channels_list.nim +++ b/src/app/chat/views/channels_list.nim @@ -151,12 +151,7 @@ QtObject: proc upsertChannel(self: ChannelsList, channel: Chat): int = let idx = self.chats.findIndexById(channel.id) if idx == -1: - if channel.isActive and channel.chatType != ChatType.Profile and channel.chatType != ChatType.Timeline: - # We only want to add a channel to the list if it is active - # otherwise, we'll end up with zombie channels on the list result = self.addChatItemToList(channel) - else: - result = -1 else: result = idx diff --git a/src/app/chat/views/chat_item.nim b/src/app/chat/views/chat_item.nim index 32b825b6a..a3b4aeff3 100644 --- a/src/app/chat/views/chat_item.nim +++ b/src/app/chat/views/chat_item.nim @@ -143,11 +143,6 @@ QtObject: read = getMembers notify = membershipChanged - proc isTimelineChat*(self: ChatItemView): bool {.slot.} = result = ?.self.chatItem.id == status_utils.getTimelineChatId() - - QtProperty[bool] isTimelineChat: - read = isTimelineChat - proc mentionsCount*(self: ChatItemView): int {.slot.} = result = ?.self.chatItem.mentionsCount diff --git a/src/app/chat/views/messages.nim b/src/app/chat/views/messages.nim index 9b12c097b..28adda296 100644 --- a/src/app/chat/views/messages.nim +++ b/src/app/chat/views/messages.nim @@ -54,7 +54,6 @@ QtObject: result.communities = communitiesView result.messageList = initOrderedTable[string, ChatMessageList]() result.pinnedMessagesList = initOrderedTable[string, ChatMessageList]() - result.messageList[status_utils.getTimelineChatId()] = newChatMessageList(status_utils.getTimelineChatId(), result.status, false) result.loadingMessages = false result.unreadMessageCnt = 0 result.unreadDirectMessagesAndMentionsCount = 0 @@ -168,7 +167,7 @@ QtObject: let channel = self.channelView.getChannelById(id) if (channel == nil): return - self.messageList[id].clear(not channel.isNil and channel.chatType != ChatType.Profile) + self.messageList[id].clear(not channel.isNil) self.messagesCleared() proc getBlockedContacts*(self: MessageView): seq[string] = @@ -189,7 +188,7 @@ QtObject: if not self.messageList.hasKey(channel): self.beginInsertRows(newQModelIndex(), self.messageList.len, self.messageList.len) - self.messageList[channel] = newChatMessageList(channel, self.status, not chat.isNil and chat.chatType != ChatType.Profile, blockedContacts) + self.messageList[channel] = newChatMessageList(channel, self.status, not chat.isNil, blockedContacts) self.channelOpenTime[channel] = now().toTime.toUnix * 1000 self.endInsertRows(); if not self.pinnedMessagesList.hasKey(channel): @@ -226,19 +225,11 @@ QtObject: msg.userName = self.status.chat.getUserName(msg.fromAuthor, msg.alias) var msgIndex:int; if self.status.chat.channels.hasKey(msg.chatId): - let chat = self.status.chat.channels[msg.chatId] - if (chat.chatType == ChatType.Profile): - let timelineChatId = status_utils.getTimelineChatId() - self.messageList[timelineChatId].add(msg) + self.messageList[msg.chatId].add(msg) + if self.pinnedMessagesList[msg.chatId].contains(msg): + self.pinnedMessagesList[msg.chatId].add(msg) - if self.channelView.activeChannel.id == timelineChatId: self.channelView.activeChannelChanged() - msgIndex = self.messageList[timelineChatId].count - 1 - else: - self.messageList[msg.chatId].add(msg) - if self.pinnedMessagesList[msg.chatId].contains(msg): - self.pinnedMessagesList[msg.chatId].add(msg) - - msgIndex = self.messageList[msg.chatId].count - 1 + msgIndex = self.messageList[msg.chatId].count - 1 self.messagePushed(msgIndex) if self.channelOpenTime.getOrDefault(msg.chatId, high(int64)) < msg.timestamp.parseFloat.fromUnixFloat.toUnix: diff --git a/src/app/chat/views/reactions.nim b/src/app/chat/views/reactions.nim index fd3f0e938..ec700774a 100644 --- a/src/app/chat/views/reactions.nim +++ b/src/app/chat/views/reactions.nim @@ -36,8 +36,6 @@ QtObject: proc messageEmojiReactionId(self: ReactionView, chatId: string, messageId: string, emojiId: int): string = let chat = self.status.chat.channels[chatId] var chatId = chatId - if chat.chatType == ChatType.Profile: - chatId = status_utils.getTimelineChatId() if (self.messageList[][chatId].getReactions(messageId) == "") : return "" @@ -69,9 +67,6 @@ QtObject: let chat = self.status.chat.channels[chatId] var messageList = self.messageList[][chatId] - if chat.chatType == ChatType.Profile: - messageList = self.messageList[][status_utils.getTimelineChatId()] - var emojiReactions = messageList.getReactions(reaction.messageId) var oldReactions: JsonNode if (emojiReactions == "") : diff --git a/src/app/core/local_account_sensitive_settings.nim b/src/app/core/local_account_sensitive_settings.nim index 98daa1d8a..8f41e4343 100644 --- a/src/app/core/local_account_sensitive_settings.nim +++ b/src/app/core/local_account_sensitive_settings.nim @@ -30,8 +30,6 @@ const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages" const DEFAULT_DISPLAY_CHAT_IMAGES = false const LSS_KEY_USE_COMPACT_MODE* = "useCompactMode" const DEFAULT_USE_COMPACT_MODE = true -const LSS_KEY_TIMELINE_ENABLED* = "timelineEnabled" -const DEFAULT_TIMELINE_ENABLED = true const LSS_KEY_RECENT_EMOJIS* = "recentEmojis" const DEFAULT_RECENT_EMOJIS = "" const LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS* = "hiddenCommunityWelcomeBanners" @@ -361,19 +359,6 @@ QtObject: notify = useCompactModeChanged - proc timelineEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.} - proc getTimelineEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} = - getSettingsProp[bool](self, LSS_KEY_TIMELINE_ENABLED, newQVariant(DEFAULT_TIMELINE_ENABLED)) - proc setTimelineEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} = - setSettingsProp(self, LSS_KEY_TIMELINE_ENABLED, newQVariant(value)): - self.timelineEnabledChanged() - - QtProperty[bool] timelineEnabled: - read = getTimelineEnabled - write = setTimelineEnabled - notify = timelineEnabledChanged - - proc recentEmojisChanged*(self: LocalAccountSensitiveSettings) {.signal.} proc getRecentEmojis*(self: LocalAccountSensitiveSettings): QVariant {.slot.} = getSettingsPropQVariant(self, LSS_KEY_RECENT_EMOJIS, newQVariant(DEFAULT_RECENT_EMOJIS)) @@ -888,7 +873,6 @@ QtObject: of LSS_KEY_IS_TENOR_WARNING_ACCEPTED: self.isTenorWarningAcceptedChanged() of LSS_KEY_DISPLAY_CHAT_IMAGES: self.displayChatImagesChanged() of LSS_KEY_USE_COMPACT_MODE: self.useCompactModeChanged() - of LSS_KEY_TIMELINE_ENABLED: self.timelineEnabledChanged() of LSS_KEY_RECENT_EMOJIS: self.recentEmojisChanged() of LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS: self.hiddenCommunityWelcomeBannersChanged() of LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS: self.hiddenCommunityBackUpBannersChanged() diff --git a/src/app/modules/main/item.nim b/src/app/modules/main/item.nim index b90f020d7..67f2ae1cc 100644 --- a/src/app/modules/main/item.nim +++ b/src/app/modules/main/item.nim @@ -56,4 +56,4 @@ proc getMentionsCount*(self: Item): int = return self.mentionsCount proc getUnviewedMessagesCount*(self: Item): int = - return self.unviewedMessagesCount \ No newline at end of file + return self.unviewedMessagesCount diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 12db4e35a..2dd716c80 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -39,7 +39,6 @@ type Community, Wallet, Browser, - Timeline, NodeManagement, ProfileSettings @@ -145,7 +144,6 @@ method load*[T](self: Module[T]) = "wallet", "", 0, 0) self.view.addItem(chatSectionItem) self.walletSectionModule.load() - self.browserSectionModule.load() let browserSectionItem = initItem("browser", SectionType.Browser.int, "Browser") @@ -210,4 +208,4 @@ method emitStoringPasswordSuccess*[T](self: Module[T]) = self.view.emitStoringPasswordSuccess() method setUserStatus*[T](self: Module[T], status: bool) = - self.controller.setUserStatus(status) \ No newline at end of file + self.controller.setUserStatus(status) diff --git a/src/app_service/service/chat/dto/chat.nim b/src/app_service/service/chat/dto/chat.nim index 5e5c19b02..52de41611 100644 --- a/src/app_service/service/chat/dto/chat.nim +++ b/src/app_service/service/chat/dto/chat.nim @@ -9,8 +9,6 @@ type ChatType* {.pure.}= enum OneToOne = 1, Public = 2, PrivateGroupChat = 3, - Profile = 4, - Timeline = 5 CommunityChat = 6 type ChatDto* = object @@ -92,4 +90,4 @@ proc toChatDto*(jsonObj: JsonNode): ChatDto = discard jsonObj.getProp("profile", result.profile) discard jsonObj.getProp("joined", result.joined) discard jsonObj.getProp("syncedTo", result.syncedTo) - discard jsonObj.getProp("syncedFrom", result.syncedFrom) \ No newline at end of file + discard jsonObj.getProp("syncedFrom", result.syncedFrom) diff --git a/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml b/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml index 347d61fe2..3dd31d85d 100644 --- a/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml @@ -22,7 +22,6 @@ ModalPopup { property bool userCanPin: { switch (popup.rootStore.chatsModelInst.channelView.activeChannel.chatType) { case Constants.chatTypePublic: return false - case Constants.chatTypeStatusUpdate: return false case Constants.chatTypeOneToOne: return true case Constants.chatTypePrivateGroupChat: return popup.rootStore.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) case Constants.chatTypeCommunity: return popup.rootStore.chatsModelInst.communities.activeCommunity.admin diff --git a/ui/app/AppLayouts/Timeline/panels/EmptyTimelinePanel.qml b/ui/app/AppLayouts/Timeline/panels/EmptyTimelinePanel.qml deleted file mode 100644 index f91d48be6..000000000 --- a/ui/app/AppLayouts/Timeline/panels/EmptyTimelinePanel.qml +++ /dev/null @@ -1,56 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import QtQuick.Layouts 1.13 - -import StatusQ.Core 0.1 -import StatusQ.Core.Theme 0.1 - -import utils 1.0 -import shared 1.0 -import shared.panels 1.0 - -Rectangle { - id: root - height: visible ? childrenRect.height : 0 - width: 375 - color: "transparent" - - SVGImage { - id: sticker - anchors.top: parent.top - width: 140 - height: 140 - source: Style.png("think-sticker") - anchors.horizontalCenter: parent.horizontalCenter - } - - Rectangle { - anchors.top: sticker.bottom - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 60 - anchors.right: parent.right - anchors.rightMargin: 60 - border.color: Style.current.border - border.width: 1 - radius: Style.current.padding - width: 255 - height: shareYourMindText.height + Style.current.padding - - StatusBaseText { - id: shareYourMindText - horizontalAlignment: Text.AlignHCenter - anchors.left: parent.left - anchors.leftMargin: Style.current.halfPadding - anchors.right: parent.right - anchors.rightMargin: Style.current.halfPadding - anchors.verticalCenter: parent.verticalCenter - //% "Share what's on your mind and stay updated with your contacts" - text: qsTrId("share-what-s-on-your-mind-and-stay-updated-with-your-contacts") - font.pixelSize: 15 - color: Theme.palette.directColor7 - wrapMode: Text.WordWrap - } - } -} - diff --git a/ui/app/AppLayouts/Timeline/stores/RootStore.qml b/ui/app/AppLayouts/Timeline/stores/RootStore.qml deleted file mode 100644 index 8beeb6bd0..000000000 --- a/ui/app/AppLayouts/Timeline/stores/RootStore.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Dialogs 1.3 - -import utils 1.0 - -QtObject { - id: root - - property var chatsModelInst: chatsModel - property var profileModelInst: profileModel - - function setActiveChannelToTimeline() { - chatsModelInst.setActiveChannelToTimeline() - } - - function getPlainTextFromRichText(text) { - return chatsModelInst.plainText(text) - } - - function sendMessage(message, contentType) { - chatsModelInst.messageView.sendMessage(message, "", contentType, true) - } - - function sendImage(url) { - chatsModelInst.sendImage(url, true) - } - -} diff --git a/ui/app/AppLayouts/stores/MessageStore.qml b/ui/app/AppLayouts/stores/MessageStore.qml index 81a3a583b..7d5364953 100644 --- a/ui/app/AppLayouts/stores/MessageStore.qml +++ b/ui/app/AppLayouts/stores/MessageStore.qml @@ -76,7 +76,6 @@ QtObject { || contentType === Constants.communityInviteType || contentType === Constants.transactionType property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now()) - property bool isStatusUpdate: false property int statusAgeEpoch: 0 // property int replyMessageIndex: chatsModel.messageView.messageList.getMessageIndex(responseTo); diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 9530c2b1c..1b249e523 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -9,7 +9,6 @@ import shared.panels 1.0 import shared.popups 1.0 import shared.status 1.0 import "./AppLayouts" -import "./AppLayouts/Timeline" import "./AppLayouts/Wallet" import "./AppLayouts/WalletV2" import "./AppLayouts/Chat/popups" @@ -406,8 +405,6 @@ Item { browserLayoutContainer.active = true; } - timelineLayoutContainer.active = obj === timelineLayoutContainer - if(obj === walletLayoutContainer){ walletLayoutContainer.showSigningPhrasePopup(); } @@ -458,21 +455,6 @@ Item { property var _web3Provider: web3Provider } - Loader { - id: timelineLayoutContainer - sourceComponent: Component { - TimelineLayout { - messageStore: appMain.rootStore.messageStore - rootStore: appMain.rootStore - } - } - onLoaded: timelineLayoutContainer.item.onActivated() - active: false - Layout.fillWidth: true - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Layout.fillHeight: true - } - ProfileLayout { id: profileLayoutContainer Layout.fillWidth: true diff --git a/ui/imports/assets/images/timeline.svg b/ui/imports/assets/images/timeline.svg deleted file mode 100644 index 9ca485179..000000000 --- a/ui/imports/assets/images/timeline.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index 85572b8b6..e65605813 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -40,8 +40,8 @@ Rectangle { property var stickerPackList property int extraHeightFactor: calculateExtraHeightFactor() - property int messageLimit: control.isStatusUpdateInput ? 300 : 2000 - property int messageLimitVisible: control.isStatusUpdateInput ? 50 : 200 + property int messageLimit: 2000 + property int messageLimitVisible: 200 property int chatType @@ -49,7 +49,6 @@ Rectangle { property string chatInputPlaceholder: qsTrId("type-a-message-") property alias textInput: messageInputField - property bool isStatusUpdateInput: chatType === Constants.chatTypeStatusUpdate property var fileUrls: [] @@ -64,15 +63,15 @@ Rectangle { height: { if (extendedArea.visible) { - return messageInput.height + extendedArea.height + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding) + return messageInput.height + extendedArea.height + Style.current.bigPadding } if (messageInput.height > messageInput.defaultInputFieldHeight) { if (messageInput.height >= messageInput.maxInputFieldHeight) { - return messageInput.maxInputFieldHeight + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding) + return (messageInput.maxInputFieldHeight + Style.current.bigPadding) } - return messageInput.height + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding) + return (messageInput.height + Style.current.bigPadding) } - return control.isStatusUpdateInput ? 56 : 64 + return 64 } anchors.left: parent.left anchors.right: parent.right @@ -160,10 +159,6 @@ Rectangle { event.accepted = true; return } - - if (control.isStatusUpdateInput) { - return // Status update require the send button to be clicked - } if (messageInputField.length < messageLimit) { control.sendMessage(event) control.hideExtendedArea(); @@ -581,7 +576,6 @@ Rectangle { ] onAccepted: { imageBtn.highlighted = false - imageBtn2.highlighted = false let validImages = validateImages(imageDialog.fileUrls) if (validImages.length > 0) { control.showImageArea(validImages) @@ -590,7 +584,6 @@ Rectangle { } onRejected: { imageBtn.highlighted = false - imageBtn2.highlighted = false } } @@ -713,7 +706,7 @@ Rectangle { anchors.bottomMargin: 16 icon.name: "chat-commands" type: StatusQ.StatusFlatRoundButton.Type.Tertiary - visible: !isEdit && control.chatType === Constants.chatTypeOneToOne && !control.isStatusUpdateInput + visible: !isEdit && control.chatType === Constants.chatTypeOneToOne enabled: !control.isContactBlocked onClicked: { chatCommandsPopup.opened ? @@ -732,7 +725,7 @@ Rectangle { anchors.bottomMargin: 16 icon.name: "image" type: StatusQ.StatusFlatRoundButton.Type.Tertiary - visible: !isEdit && control.chatType !== Constants.chatTypePublic && !control.isStatusUpdateInput + visible: !isEdit && control.chatType !== Constants.chatTypePublic enabled: !control.isContactBlocked onClicked: { highlighted = true @@ -743,13 +736,12 @@ Rectangle { Rectangle { id: messageInput enabled: !control.isContactBlocked - property int maxInputFieldHeight: control.isStatusUpdateInput ? 124 : 112 - property int defaultInputFieldHeight: control.isStatusUpdateInput ? 56 : 40 + property int maxInputFieldHeight: 112 + property int defaultInputFieldHeight: 40 anchors.left: imageBtn.visible ? imageBtn.right : parent.left anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding - anchors.top: control.isStatusUpdateInput ? parent.top : undefined - anchors.bottom: !control.isStatusUpdateInput ? parent.bottom : undefined - anchors.bottomMargin: control.isStatusUpdateInput ? 0 : 12 + anchors.bottom: parent.bottom + anchors.bottomMargin: 12 anchors.right: unblockBtn.visible ? unblockBtn.left : parent.right anchors.rightMargin: Style.current.smallPadding height: { @@ -763,8 +755,7 @@ Rectangle { } color: isEdit ? Theme.palette.statusChatInput.secondaryBackgroundColor : Style.current.inputBackground - radius: control.isStatusUpdateInput ? 36 : - height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32 + radius: height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32 ColumnLayout { id: validators @@ -803,29 +794,25 @@ Rectangle { } anchors.left: messageInput.left anchors.right: messageInput.right - anchors.bottom: control.isStatusUpdateInput ? undefined : messageInput.top - anchors.top: control.isStatusUpdateInput ? messageInput.bottom : undefined - anchors.topMargin: control.isStatusUpdateInput ? -Style.current.halfPadding : 0 + anchors.bottom: messageInput.top color: isEdit ? Style.current.secondaryInputBackground : Style.current.inputBackground - radius: control.isStatusUpdateInput ? 36 : 16 + radius: 16 Rectangle { color: parent.color anchors.right: parent.right anchors.left: parent.left - height: control.isStatusUpdateInput ? 64 : 30 - anchors.top: control.isStatusUpdateInput ? parent.top : undefined - anchors.topMargin: control.isStatusUpdateInput ? -24 : 0 - anchors.bottom: control.isStatusUpdateInput ? undefined : parent.bottom - anchors.bottomMargin: control.isStatusUpdateInput ? 0 : -height/2 + height: 30 + anchors.bottom: parent.bottom + anchors.bottomMargin: -height/2 } StatusChatInputImageArea { id: imageArea anchors.left: parent.left - anchors.leftMargin: control.isStatusUpdateInput ? profileImage.width + Style.current.padding : Style.current.halfPadding + anchors.leftMargin: Style.current.halfPadding anchors.right: parent.right - anchors.rightMargin: control.isStatusUpdateInput ? actions.width + 2* Style.current.padding : Style.current.halfPadding + anchors.rightMargin: Style.current.halfPadding anchors.top: parent.top anchors.topMargin: Style.current.halfPadding visible: isImage @@ -855,17 +842,6 @@ Rectangle { } } - StatusSmartIdenticon { - id: profileImage - anchors.left: parent.left - anchors.leftMargin: Style.current.smallPadding - anchors.top: parent.top - anchors.topMargin: Style.current.halfPadding - image.source: userProfile.thumbnailImage - image.isIdenticon: true - visible: control.isStatusUpdateInput - } - ScrollView { id: scrollView anchors.top: parent.top @@ -887,8 +863,8 @@ Rectangle { placeholderTextColor: Style.current.secondaryText selectByMouse: true color: isEdit ? Theme.palette.directColor1 : Style.current.textColor - topPadding: control.isStatusUpdateInput ? 18 : Style.current.smallPadding - bottomPadding: control.isStatusUpdateInput ? 14 : 12 + topPadding: Style.current.smallPadding + bottomPadding: 12 Keys.onPressed: onKeyPress(event) Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event) @@ -1032,7 +1008,6 @@ Rectangle { color: parent.color anchors.bottom: parent.bottom anchors.right: parent.right - visible: !control.isStatusUpdateInput height: parent.height / 2 width: 32 radius: Style.current.radius @@ -1046,62 +1021,26 @@ Rectangle { color: (remainingChars <= 0) ? Style.current.danger : Style.current.textColor anchors.right: parent.right anchors.bottom: actions.top - anchors.rightMargin: control.isStatusUpdateInput ? Style.current.padding : Style.current.radius + anchors.rightMargin: Style.current.radius leftPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding } Item { id: actions - width: control.isStatusUpdateInput ? - imageBtn2.width + sendBtn.anchors.leftMargin + sendBtn.width : - emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width - anchors.bottom: control.isStatusUpdateInput && extendedArea.visible ? extendedArea.bottom : parent.bottom - anchors.bottomMargin: control.isStatusUpdateInput ? Style.current.smallPadding+2: 4 + width: emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width + anchors.bottom: parent.bottom + anchors.bottomMargin: 4 anchors.right: parent.right anchors.rightMargin: Style.current.radius height: emojiBtn.height - StatusQ.StatusFlatRoundButton { - id: imageBtn2 - implicitHeight: 32 - implicitWidth: 32 - anchors.right: sendBtn.left - anchors.rightMargin: 2 - anchors.bottom: parent.bottom - icon.name: "image" - type: StatusQ.StatusFlatRoundButton.Type.Tertiary - visible: control.isStatusUpdateInput - - onClicked: { - highlighted = true - imageDialog.open() - } - } - - StatusQ.StatusFlatButton { - id: sendBtn - icon.name: "send" - text: qsTr("Send") - size: StatusQ.StatusBaseButton.Size.Small - anchors.right: parent.right - anchors.rightMargin: Style.current.halfPadding - anchors.verticalCenter: parent.verticalCenter - visible: imageBtn2.visible - enabled: (chatsModel.plainText(Emoji.deparse(messageInputField.text)).length > 0 || isImage) && messageInputField.length < messageLimit - onClicked: function (event) { - control.sendMessage(event) - control.hideExtendedArea(); - } - } - StatusQ.StatusFlatRoundButton { id: emojiBtn implicitHeight: 32 implicitWidth: 32 anchors.left: parent.left anchors.bottom: parent.bottom - visible: !imageBtn2.visible icon.name: "emojis" type: StatusQ.StatusFlatRoundButton.Type.Tertiary color: "transparent" diff --git a/ui/imports/shared/views/chat/CompactMessageView.qml b/ui/imports/shared/views/chat/CompactMessageView.qml index 9646e72b4..6e87f4c02 100644 --- a/ui/imports/shared/views/chat/CompactMessageView.qml +++ b/ui/imports/shared/views/chat/CompactMessageView.qml @@ -32,7 +32,6 @@ Item { case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) ? true : isCurrentUser case Constants.chatTypePublic: return isCurrentUser case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin ? true : isCurrentUser - case Constants.chatTypeStatusUpdate: return false default: return false } } diff --git a/ui/imports/shared/views/chat/MessageContextMenuView.qml b/ui/imports/shared/views/chat/MessageContextMenuView.qml index b87b0a2f1..10da41177 100644 --- a/ui/imports/shared/views/chat/MessageContextMenuView.qml +++ b/ui/imports/shared/views/chat/MessageContextMenuView.qml @@ -321,7 +321,6 @@ StatusPopupMenu { switch (root.store.chatsModelInst.channelView.activeChannel.chatType) { case Constants.chatTypePublic: return false - case Constants.chatTypeStatusUpdate: return false case Constants.chatTypeOneToOne: return true case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 8823a0276..a2d108fe1 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -92,7 +92,6 @@ Column { || contentType === Constants.communityInviteType || contentType === Constants.transactionType property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now()) - property bool isStatusUpdate: false property int statusAgeEpoch: 0 property int replyMessageIndex: !!root.chatsModel ? root.chatsModel.messageView.messageList.getMessageIndex(responseTo) : -1 @@ -241,8 +240,7 @@ Column { case Constants.gapType: return gapComponent default: - return isStatusUpdate ? statusUpdateComponent : - (localAccountSensitiveSettings.useCompactMode ? compactMessageComponent : messageComponent) + return localAccountSensitiveSettings.useCompactMode ? compactMessageComponent : messageComponent } } @@ -327,34 +325,6 @@ Column { } } - Component { - id: statusUpdateComponent - StatusUpdateView { - statusAgeEpoch: root.statusAgeEpoch - container: root - store: root.rootStore - messageContextMenu: root.messageContextMenu - onAddEmoji: { - root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker); - } - onChatImageClicked: { - messageStore.imageClick(image); - } - onUserNameClicked: { - root.parent.clickMessage(isProfileClick); - } - onEmojiBtnClicked: { - root.parent.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly); - } - onClickMessage: { - root.parent.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply); - } - onSetMessageActive: { - root.messageStore.setMessageActive(messageId, active);; - } - } - } - Component { id: compactMessageComponent CompactMessageView { diff --git a/ui/imports/shared/views/chat/StatusUpdateView.qml b/ui/imports/shared/views/chat/StatusUpdateView.qml deleted file mode 100644 index 27c423fa5..000000000 --- a/ui/imports/shared/views/chat/StatusUpdateView.qml +++ /dev/null @@ -1,205 +0,0 @@ -import QtQuick 2.3 -import QtGraphicalEffects 1.13 - -import utils 1.0 -import shared 1.0 -import shared.panels 1.0 -import shared.status 1.0 -import shared.panels.chat 1.0 -import shared.controls.chat 1.0 - -import StatusQ.Controls 0.1 - -MouseArea { - id: root - property var store - property bool hovered: containsMouse - property var container - property int statusAgeEpoch: 0 - property var messageContextMenu - - signal userNameClicked(bool isProfileClick) - signal setMessageActive(string messageId, bool active) - signal emojiBtnClicked(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly) - signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply) - -// TODO bring those back and remove dynamic scoping -// property var emojiReactionsModel -// property string timestamp: "" -// property bool isCurrentUser: false -// property bool isMessageActive: false -// property string userName: "" -// property string localName: "" -// property string displayUserName: "" -// property bool isImage: false -// property bool isMessage: false -// property string profileImageSource: "" -// property string userIdenticon: "" - - anchors.top: parent.top - anchors.topMargin: 0 - height: (isImage ? chatImageContent.height : chatText.height) + chatName.height + 2* Style.current.padding + (emojiReactionsModel.length ? 20 : 0) - width: parent.width - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - propagateComposedEvents: true - - signal chatImageClicked(string image) - signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker) - - onClicked: { - mouse.accepted = false - } - - Rectangle { - id: rootRect - anchors.fill: parent - radius: Style.current.radius - color: root.hovered ? Style.current.border : Style.current.background - - UserImage { - id: chatImage - active: isMessage || isImage - anchors.left: parent.left - anchors.leftMargin: Style.current.padding - anchors.top: parent.top - anchors.topMargin: Style.current.halfPadding -// messageContextMenu: root.messageContextMenu -// profileImage: root.profileImageSource -// isMessage: root.isMessage -// identiconImageSource: root.userIdenticon - onClickMessage: { - root.clickMessage(true, false, false, null, false, false, isReplyImage) - } - } - - UsernameLabel { - id: chatName - z: 51 - visible: chatImage.visible - anchors.leftMargin: Style.current.halfPadding - anchors.top: chatImage.top - anchors.left: chatImage.right - label.font.pixelSize: Style.current.primaryTextFontSize -// messageContextMenu: root.messageContextMenu -// isCurrentUser: root.isCurrentUser -// userName: root.userName -// localName: root.localName -// displayUserName: root.displayUserName - onClickMessage: { - root.userNameClicked(true); - } - } - - ChatTimePanel { - id: chatTime - // statusAgeEpoch is used to trigger Qt property update - // since the returned string will be the same in 99% cases, this should not trigger ChatTime re-rendering - text: Utils.formatAgeFromTime(timestamp, statusAgeEpoch) - visible: chatName.visible - anchors.verticalCenter: chatName.verticalCenter - anchors.left: chatName.right - anchors.leftMargin: Style.current.halfPadding - //timestamp: timestamp - } - - ChatTextView { - id: chatText - anchors.top: chatName.visible ? chatName.bottom : chatImage.top - anchors.topMargin: chatName.visible ? 6 : 0 - anchors.left: chatImage.right - anchors.leftMargin: Style.current.halfPadding - anchors.right: parent.right - anchors.rightMargin: Style.current.padding - store: root.store - } - - Loader { - id: chatImageContent - active: isImage - anchors.left: chatImage.right - anchors.leftMargin: Style.current.halfPadding - anchors.top: chatText.bottom - z: 51 - - sourceComponent: Component { - StatusChatImage { - imageSource: image - imageWidth: 200 - container: root.container - onClicked: { - root.chatImageClicked(image); - } - } - } - } - - StatusFlatRoundButton { - id: emojiBtn - width: 32 - height: 32 - anchors.top: rootRect.top - anchors.topMargin: -height / 4 - anchors.right: rootRect.right - anchors.rightMargin: Style.current.halfPadding - visible: root.hovered - icon.name: "reaction-b" - icon.width: 20 - icon.height: 20 - type: StatusFlatRoundButton.Type.Tertiary - backgroundHoverColor: Style.current.background - onClicked: { - // Set parent, X & Y positions for the messageContextMenu - messageContextMenu.parent = emojiBtn - messageContextMenu.setXPosition = function() { return -messageContextMenu.width + emojiBtn.width} - messageContextMenu.setYPosition = function() { return -messageContextMenu.height - 4} - root.emojiBtnClicked(false, false, false, null, true) - } - } - - DropShadow { - anchors.fill: emojiBtn - horizontalOffset: 0 - verticalOffset: 2 - radius: 10 - samples: 12 - color: "#22000000" - source: emojiBtn - } - - Loader { - id: emojiReactionLoader - active: emojiReactionsModel.length - sourceComponent: emojiReactionsComponent - anchors.left: chatImage.right - anchors.leftMargin: Style.current.halfPadding - anchors.top: isImage ? chatImageContent.bottom : chatText.bottom - anchors.topMargin: Style.current.halfPadding - } - - Component { - id: emojiReactionsComponent - EmojiReactionsPanel { -// isMessageActive: root.isMessageActive -// emojiReactionsModel: root.emojiReactionsModel - onAddEmojiClicked: { - root.addEmoji(false, false, false, null, true, false); - // Set parent, X & Y positions for the messageContextMenu - messageContextMenu.parent = emojiReactionLoader - messageContextMenu.setXPosition = function() { return (messageContextMenu.parent.x + 4)} - messageContextMenu.setYPosition = function() { return (-messageContextMenu.height - 4)} - } - onToggleReaction: chatsModel.toggleReaction(messageId, emojiID) - -// onSetMessageActive: { -// root.setMessageActive(messageId, active);; -// } - } - } - - Separator { - anchors.bottom: parent.bottom - visible: !root.hovered - } - } -} diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index 31962ba3d..4d729775a 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -16,7 +16,6 @@ QtObject { readonly property int chatTypeOneToOne: 1 readonly property int chatTypePublic: 2 readonly property int chatTypePrivateGroupChat: 3 - readonly property int chatTypeStatusUpdate: 4 readonly property int chatTypeCommunity: 6 readonly property int communityChatPublicAccess: 1 @@ -48,7 +47,6 @@ QtObject { readonly property string chat: "chat" readonly property string wallet: "wallet" readonly property string walletv2: "walletV2" - readonly property string timeline: "timeline" readonly property string browser: "browser" readonly property string profile: "profile" readonly property string node: "node" diff --git a/ui/main.qml b/ui/main.qml index eeb666e92..7601568e6 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -436,7 +436,7 @@ StatusWindow { // in timeline view loader.item.appLayout.appView.currentIndex === timelineView || // In community section - chatsModel.communities.activeCommunity.active + loader.item.appLayout.appView.currentIndex === chatsModel.communities.activeCommunity.active ) width: applicationWindow.width diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 38f36d5cc..957b59d08 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -43,7 +43,6 @@ SOURCES = *.qml \ app/AppLayouts/Profile/Sections/Data/*.qml \ app/AppLayouts/Profile/Sections/Ens/*.qml \ app/AppLayouts/Profile/Sections/Privileges/*.qml \ - app/AppLayouts/Timeline/*.qml\ app/AppLayouts/Wallet/*.qml \ app/AppLayouts/Wallet/components/*.qml \ app/AppLayouts/Wallet/components/collectiblesComponents/*.qml \ diff --git a/vendor/status-lib b/vendor/status-lib index 6d0e5ccf6..29e2859aa 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit 6d0e5ccf6232003231e7a83f52ffaaa85469e7bd +Subproject commit 29e2859aaa60691b68dbde81f3087fa659a59b08