From d43b1eb25c9f42ab8d74eb120e0a4261e9e5ced3 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Fri, 4 Feb 2022 13:54:28 +0100 Subject: [PATCH] chore(@desktop/general): remove all timeline related code Fixes #4709 --- .../local_account_sensitive_settings.nim | 16 -- src/app/modules/main/controller.nim | 2 +- src/app/modules/main/module.nim | 1 - src/app_service/service/chat/dto/chat.nim | 1 - src/app_service/service/eth/utils.nim | 6 - ui/app/AppLayouts/Timeline/TimelineLayout.qml | 227 ------------------ .../AppLayouts/Timeline/stores/RootStore.qml | 34 --- ui/imports/utils/Constants.qml | 1 - 8 files changed, 1 insertion(+), 287 deletions(-) delete mode 100644 ui/app/AppLayouts/Timeline/TimelineLayout.qml delete mode 100644 ui/app/AppLayouts/Timeline/stores/RootStore.qml diff --git a/src/app/global/local_account_sensitive_settings.nim b/src/app/global/local_account_sensitive_settings.nim index b49ae0468f..01b23473d1 100644 --- a/src/app/global/local_account_sensitive_settings.nim +++ b/src/app/global/local_account_sensitive_settings.nim @@ -28,8 +28,6 @@ const LSS_KEY_IS_TENOR_WARNING_ACCEPTED* = "isTenorWarningAccepted" const DEFAULT_IS_TENOR_WARNING_ACCEPTED = false const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages" const DEFAULT_DISPLAY_CHAT_IMAGES = false -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" @@ -344,19 +342,6 @@ QtObject: notify = displayChatImagesChanged - 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)) @@ -859,7 +844,6 @@ QtObject: of LSS_KEY_IS_GIF_WIDGET_ENABLED: self.isGifWidgetEnabledChanged() of LSS_KEY_IS_TENOR_WARNING_ACCEPTED: self.isTenorWarningAcceptedChanged() of LSS_KEY_DISPLAY_CHAT_IMAGES: self.displayChatImagesChanged() - 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/controller.nim b/src/app/modules/main/controller.nim index 7508ac5cc6..6192f66e69 100644 --- a/src/app/modules/main/controller.nim +++ b/src/app/modules/main/controller.nim @@ -217,7 +217,7 @@ method getNumOfNotificaitonsForChat*(self: Controller): tuple[unviewed:int, ment result.mentions = 0 let chats = self.chatService.getAllChats() for chat in chats: - if(chat.chatType == ChatType.Timeline or chat.chatType == ChatType.CommunityChat): + if(chat.chatType == ChatType.CommunityChat): continue result.unviewed += chat.unviewedMessagesCount diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 260be45ceb..2aebb4da6a 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -343,7 +343,6 @@ method load*[T]( self.walletSectionModule.load() # self.walletV2SectionModule.load() self.browserSectionModule.load() - # self.timelineSectionModule.load() # self.nodeManagementSectionModule.load() self.profileSectionModule.load() self.stickersModule.load() diff --git a/src/app_service/service/chat/dto/chat.nim b/src/app_service/service/chat/dto/chat.nim index 78156daaab..3cdb4bb8b6 100644 --- a/src/app_service/service/chat/dto/chat.nim +++ b/src/app_service/service/chat/dto/chat.nim @@ -10,7 +10,6 @@ type ChatType* {.pure.}= enum Public = 2, PrivateGroupChat = 3, Profile = 4, - Timeline = 5 CommunityChat = 6 type ChatMember* = object diff --git a/src/app_service/service/eth/utils.nim b/src/app_service/service/eth/utils.nim index 94d2efc145..c3e4ff9266 100644 --- a/src/app_service/service/eth/utils.nim +++ b/src/app_service/service/eth/utils.nim @@ -62,12 +62,6 @@ proc decodeContentHash*(value: string): string = error "Error decoding sticker", hash=value, exception=e.msg raise -proc getTimelineChatId*(pubKey: string = ""): string = - if pubKey == "": - return "@timeline70bd746ddcc12beb96b2c9d572d0784ab137ffc774f5383e50585a932080b57cca0484b259e61cecbaa33a4c98a300a" - else: - return "@" & pubKey - proc isWakuEnabled(): bool = true # TODO: diff --git a/ui/app/AppLayouts/Timeline/TimelineLayout.qml b/ui/app/AppLayouts/Timeline/TimelineLayout.qml deleted file mode 100644 index 413c2ddb09..0000000000 --- a/ui/app/AppLayouts/Timeline/TimelineLayout.qml +++ /dev/null @@ -1,227 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import QtGraphicalEffects 1.13 -import QtQml.Models 2.13 -import QtQuick.Layouts 1.13 - -import utils 1.0 -import shared 1.0 -import shared.views 1.0 -import shared.status 1.0 -import shared.popups 1.0 -import shared.controls 1.0 -import shared.views.chat 1.0 - -import "../Chat/stores" -import "../Chat/popups" - -import "stores" -import "panels" - -ScrollView { - id: root - - property RootStore store: RootStore { } - property var chatSectionModule - - Layout.fillWidth: true - Layout.fillHeight: true - contentHeight: chatLogView.contentHeight + 140 - clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - property var rootStore - property var messageStore - property var onActivated: function () { - store.setActiveChannelToTimeline() - statusUpdateInput.textInput.forceActiveFocus(Qt.MouseFocusReason) - } - - Component.onCompleted: { - statusUpdateInput.textInput.forceActiveFocus(Qt.MouseFocusReason) - } - - function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){ - Global.openProfilePopup(fromAuthorParam) - } - - StatusImageModal { - id: imagePopup - onClicked: { - close() - } - } - - Item { - id: timelineContainer - width: 624 - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - - // TODO: Replace this with StatusQ component once it lives there. - StatusChatInput { - id: statusUpdateInput - anchors.top: parent.top - anchors.topMargin: 40 - chatType: Constants.chatType.profile - imageErrorMessageLocation: StatusChatInput.ImageErrorMessageLocation.Bottom - z: 1 - onSendMessage: { - if (statusUpdateInput.fileUrls.length > 0){ - statusUpdateInput.fileUrls.forEach(url => { - root.store.sendImage(url); - }) - } - var msg = root.store.getPlainTextFromRichText(Emoji.deparse(statusUpdateInput.textInput.text)) - if (msg.length > 0){ - msg = statusUpdateInput.interpretMessage(msg) - root.store.sendMessage(msg, Utils.isOnlyEmoji(msg) ? Constants.messageContentType.emojiType : Constants.messageContentType.messageType); - statusUpdateInput.textInput.text = ""; - if(event) event.accepted = true - sendMessageSound.stop() - Qt.callLater(sendMessageSound.play); - } - } - } - - EmptyTimelinePanel { - id: emptyTimeline - anchors.top: statusUpdateInput.bottom - anchors.topMargin: 40 - anchors.horizontalCenter: parent.horizontalCenter - visible: chatLogView.count === 0 - } - - ListView { - id: chatLogView - anchors.top: statusUpdateInput.bottom - anchors.topMargin: Style.current.bigPadding - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - spacing: Style.current.halfPadding - flickDeceleration: 10000 - interactive: false - - model: messageListDelegate - section.property: "sectionIdentifier" - section.criteria: ViewSection.FullString - - // Not Refactored Yet -// Connections { -// target: root.store.chatsModelInst.messageView -// onMessagesLoaded: { -// Qt.callLater(chatLogView.positionViewAtBeginning) -// } -// } - } - - Timer { - id: ageUpdateTimer - property int epoch: 0 - running: true - repeat: true - interval: 60000 // 1 min - onTriggered: epoch = epoch + 1 - } - - DelegateModelGeneralized { - id: messageListDelegate - lessThan: [ - function(left, right) { return left.clock > right.clock } - ] - // Not Refactored Yet -// model: root.store.chatsModelInst.messageView.messageList - // TODO: Replace with StatusQ component once it lives there. - delegate: MessageView { - id: msgDelegate - // Not Refactored Yet - -// rootStore: root.rootStore -// messageStore: root.messageStore -// fromAuthor: model.fromAuthor -// chatId: model.chatId -// userName: model.userName -// alias: model.alias -// localName: model.localName -// message: model.message -// plainText: model.plainText -// identicon: model.identicon -// isCurrentUser: model.isCurrentUser -// timestamp: model.timestamp -// sticker: model.sticker -// contentType: model.contentType -// outgoingStatus: model.outgoingStatus -// responseTo: model.responseTo -// authorCurrentMsg: msgDelegate.ListView.section -// authorPrevMsg: msgDelegate.ListView.previousSection -// imageClick: imagePopup.openPopup.bind(imagePopup) -// messageId: model.messageId -// emojiReactions: model.emojiReactions -// isStatusUpdate: true -// statusAgeEpoch: ageUpdateTimer.epoch -// // This is used in order to have access to the previous message and determine the timestamp -// // we can't rely on the index because the sequence of messages is not ordered on the nim side -// prevMessageIndex: { -// // This is used in order to have access to the previous message and determine the timestamp -// // we can't rely on the index because the sequence of messages is not ordered on the nim side -// if(msgDelegate.DelegateModel.itemsIndex > 0){ -// return messageListDelegate.items.get(msgDelegate.DelegateModel.itemsIndex - 1).model.index -// } -// return -1; -// } -// timeout: model.timeout -// messageContextMenu: msgCntxtMenu -// Component.onCompleted: { -// messageStore.fromAuthor = model.fromAuthor; -// messageStore.chatId = model.chatId; -// messageStore.userName = model.userName; -// messageStore.alias = model.alias; -// messageStore.localName = model.localName; -// messageStore.message = model.message; -// messageStore.plainText = model.plainText; -// messageStore.identicon = model.identicon; -// messageStore.isCurrentUser = model.isCurrentUser; -// messageStore.timestamp = model.timestamp; -// messageStore.sticker = model.sticker; -// messageStore.contentType = model.contentType; -// messageStore.outgoingStatus = model.outgoingStatus; -// messageStore.responseTo = model.responseTo; -// messageStore.authorCurrentMsg = msgDelegate.ListView.section; -// messageStore.authorPrevMsg = msgDelegate.ListView.previousSection; -// messageStore.imageClick = imagePopup.openPopup.bind(imagePopup); -// messageStore.messageId = model.messageId; -// messageStore.emojiReactions = model.emojiReactions; -// messageStore.isStatusUpdate = true; -// messageStore.statusAgeEpoch = ageUpdateTimer.epoch; -// // This is used in order to have access to the previous message and determine the timestamp -// // we can't rely on the index because the sequence of messages is not ordered on the nim side -// messageStore.prevMessageIndex = -// // This is used in order to have access to the previous message and determine the timestamp -// // we can't rely on the index because the sequence of messages is not ordered on the nim side -// (msgDelegate.DelegateModel.itemsIndex > 0) ? -// messageListDelegate.items.get(msgDelegate.DelegateModel.itemsIndex - 1).model.index : -1; -// messageStore.timeout = model.timeout; -// messageStore.messageContextMenu = msgCntxtMenu; -// } -// MessageContextMenuView { -// id: msgCntxtMenu -// store: root.store -// chatSectionModule: root.chatSectionModule -// reactionModel: EmojiReactions { } -// } - } - } - - Loader { - active: root.store.chatsModelInst.messageView.loadingMessages - // TODO: replace with StatusLoadingIndicator - sourceComponent: LoadingAnimation {} - anchors.right: timelineContainer.right - anchors.top: statusUpdateInput.bottom - anchors.rightMargin: Style.current.padding - anchors.topMargin: Style.current.padding - } - } -} diff --git a/ui/app/AppLayouts/Timeline/stores/RootStore.qml b/ui/app/AppLayouts/Timeline/stores/RootStore.qml deleted file mode 100644 index 0594e5a483..0000000000 --- a/ui/app/AppLayouts/Timeline/stores/RootStore.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Dialogs 1.3 - -import utils 1.0 - -QtObject { - id: root - - // Not Refactored Yet -// property var chatsModelInst: chatsModel - // Not Refactored Yet -// property var profileModelInst: profileModel - - function setActiveChannelToTimeline() { - // Not Refactored Yet -// chatsModelInst.setActiveChannelToTimeline() - } - - function getPlainTextFromRichText(text) { - // Not Refactored Yet -// return chatsModelInst.plainText(text) - } - - function sendMessage(message, contentType) { - // Not Refactored Yet -// chatsModelInst.messageView.sendMessage(message, "", contentType, true) - } - - function sendImage(url) { - // Not Refactored Yet -// chatsModelInst.sendImage(url, true) - } - -} diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index 1f34b491ea..f0ea4f71af 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -51,7 +51,6 @@ QtObject { readonly property int publicChat: 2 readonly property int privateGroupChat: 3 readonly property int profile: 4 - readonly property int timeline: 5 readonly property int communityChat: 6 }