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
This commit is contained in:
Alexandra Betouni 2021-11-29 11:28:06 +01:00
parent 8621eb009b
commit 5e88a9a91b
26 changed files with 44 additions and 519 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ noBackup/
*.pro.user *.pro.user
*.pro.autosave *.pro.autosave
*.qml.autosave *.qml.autosave
*.log
.update.timestamp .update.timestamp
.vscode .vscode
bin/ bin/

View File

@ -104,10 +104,8 @@ proc handleChatEvents(self: ChatController) =
self.status.events.on("channelLoaded") do(e: Args): self.status.events.on("channelLoaded") do(e: Args):
var channel = ChannelArgs(e) 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 # 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) discard self.view.channelView.chats.addChatItemToList(channel.chat)
self.view.messageView.upsertChannel(channel.chat.id) self.view.messageView.upsertChannel(channel.chat.id)
self.view.messageView.messageList[channel.chat.id].addChatMembers(channel.chat.members) self.view.messageView.messageList[channel.chat.id].addChatMembers(channel.chat.members)
@ -133,9 +131,6 @@ proc handleChatEvents(self: ChatController) =
self.status.events.on("channelJoined") do(e: Args): self.status.events.on("channelJoined") do(e: Args):
var channel = ChannelArgs(e) 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) discard self.view.channelView.chats.addChatItemToList(channel.chat)
self.view.setActiveChannel(channel.chat.id) self.view.setActiveChannel(channel.chat.id)
@ -146,7 +141,6 @@ proc handleChatEvents(self: ChatController) =
let chatId = ChatIdArg(e).chatId let chatId = ChatIdArg(e).chatId
self.view.removeChat(chatId) self.view.removeChat(chatId)
self.view.calculateUnreadMessages() self.view.calculateUnreadMessages()
self.view.removeMessagesFromTimeline(chatId)
self.status.events.on("activeChannelChanged") do(e: Args): self.status.events.on("activeChannelChanged") do(e: Args):
self.view.setActiveChannel(ChatIdArg(e).chatId) self.view.setActiveChannel(ChatIdArg(e).chatId)

View File

@ -89,7 +89,6 @@ QtObject:
communities*: CommunitiesView communities*: CommunitiesView
replyTo: string replyTo: string
connected: bool connected: bool
timelineChat: Chat
pubKey*: string pubKey*: string
proc setup(self: ChatsView) = self.QAbstractListModel.setup proc setup(self: ChatsView) = self.QAbstractListModel.setup
@ -244,12 +243,6 @@ QtObject:
self.activityNotificationList.addActivityNotificationItemToList(activityCenterNotification) self.activityNotificationList.addActivityNotificationItemToList(activityCenterNotification)
self.activityNotificationsChanged() 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]) = proc updateUsernames*(self:ChatsView, contacts: seq[Profile]) =
if contacts.len > 0: if contacts.len > 0:
# Updating usernames for all the messages list # Updating usernames for all the messages list
@ -278,9 +271,6 @@ QtObject:
discard self.channelView.chats.addChatItemToList(chatItem) discard self.channelView.chats.addChatItemToList(chatItem)
self.messageView.messagePushed(self.messageView.messageList[chatItem.id].count - 1) 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.} = proc copyToClipboard*(self: ChatsView, content: string) {.slot.} =
setClipBoardText(content) setClipBoardText(content)
@ -320,16 +310,8 @@ QtObject:
self.messageView.removeChat(chatId) self.messageView.removeChat(chatId)
proc toggleReaction*(self: ChatsView, messageId: string, emojiId: int) {.slot.} = 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) 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]) = proc updateChats*(self: ChatsView, chats: seq[Chat]) =
for chat in chats: for chat in chats:
if (chat.communityId != ""): if (chat.communityId != ""):

View File

@ -151,12 +151,7 @@ QtObject:
proc upsertChannel(self: ChannelsList, channel: Chat): int = proc upsertChannel(self: ChannelsList, channel: Chat): int =
let idx = self.chats.findIndexById(channel.id) let idx = self.chats.findIndexById(channel.id)
if idx == -1: 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) result = self.addChatItemToList(channel)
else:
result = -1
else: else:
result = idx result = idx

View File

@ -143,11 +143,6 @@ QtObject:
read = getMembers read = getMembers
notify = membershipChanged 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 proc mentionsCount*(self: ChatItemView): int {.slot.} = result = ?.self.chatItem.mentionsCount

View File

@ -54,7 +54,6 @@ QtObject:
result.communities = communitiesView result.communities = communitiesView
result.messageList = initOrderedTable[string, ChatMessageList]() result.messageList = initOrderedTable[string, ChatMessageList]()
result.pinnedMessagesList = initOrderedTable[string, ChatMessageList]() result.pinnedMessagesList = initOrderedTable[string, ChatMessageList]()
result.messageList[status_utils.getTimelineChatId()] = newChatMessageList(status_utils.getTimelineChatId(), result.status, false)
result.loadingMessages = false result.loadingMessages = false
result.unreadMessageCnt = 0 result.unreadMessageCnt = 0
result.unreadDirectMessagesAndMentionsCount = 0 result.unreadDirectMessagesAndMentionsCount = 0
@ -168,7 +167,7 @@ QtObject:
let channel = self.channelView.getChannelById(id) let channel = self.channelView.getChannelById(id)
if (channel == nil): if (channel == nil):
return return
self.messageList[id].clear(not channel.isNil and channel.chatType != ChatType.Profile) self.messageList[id].clear(not channel.isNil)
self.messagesCleared() self.messagesCleared()
proc getBlockedContacts*(self: MessageView): seq[string] = proc getBlockedContacts*(self: MessageView): seq[string] =
@ -189,7 +188,7 @@ QtObject:
if not self.messageList.hasKey(channel): if not self.messageList.hasKey(channel):
self.beginInsertRows(newQModelIndex(), self.messageList.len, self.messageList.len) 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.channelOpenTime[channel] = now().toTime.toUnix * 1000
self.endInsertRows(); self.endInsertRows();
if not self.pinnedMessagesList.hasKey(channel): if not self.pinnedMessagesList.hasKey(channel):
@ -226,14 +225,6 @@ QtObject:
msg.userName = self.status.chat.getUserName(msg.fromAuthor, msg.alias) msg.userName = self.status.chat.getUserName(msg.fromAuthor, msg.alias)
var msgIndex:int; var msgIndex:int;
if self.status.chat.channels.hasKey(msg.chatId): 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)
if self.channelView.activeChannel.id == timelineChatId: self.channelView.activeChannelChanged()
msgIndex = self.messageList[timelineChatId].count - 1
else:
self.messageList[msg.chatId].add(msg) self.messageList[msg.chatId].add(msg)
if self.pinnedMessagesList[msg.chatId].contains(msg): if self.pinnedMessagesList[msg.chatId].contains(msg):
self.pinnedMessagesList[msg.chatId].add(msg) self.pinnedMessagesList[msg.chatId].add(msg)

View File

@ -36,8 +36,6 @@ QtObject:
proc messageEmojiReactionId(self: ReactionView, chatId: string, messageId: string, emojiId: int): string = proc messageEmojiReactionId(self: ReactionView, chatId: string, messageId: string, emojiId: int): string =
let chat = self.status.chat.channels[chatId] let chat = self.status.chat.channels[chatId]
var chatId = chatId var chatId = chatId
if chat.chatType == ChatType.Profile:
chatId = status_utils.getTimelineChatId()
if (self.messageList[][chatId].getReactions(messageId) == "") : if (self.messageList[][chatId].getReactions(messageId) == "") :
return "" return ""
@ -69,9 +67,6 @@ QtObject:
let chat = self.status.chat.channels[chatId] let chat = self.status.chat.channels[chatId]
var messageList = self.messageList[][chatId] var messageList = self.messageList[][chatId]
if chat.chatType == ChatType.Profile:
messageList = self.messageList[][status_utils.getTimelineChatId()]
var emojiReactions = messageList.getReactions(reaction.messageId) var emojiReactions = messageList.getReactions(reaction.messageId)
var oldReactions: JsonNode var oldReactions: JsonNode
if (emojiReactions == "") : if (emojiReactions == "") :

View File

@ -30,8 +30,6 @@ const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages"
const DEFAULT_DISPLAY_CHAT_IMAGES = false const DEFAULT_DISPLAY_CHAT_IMAGES = false
const LSS_KEY_USE_COMPACT_MODE* = "useCompactMode" const LSS_KEY_USE_COMPACT_MODE* = "useCompactMode"
const DEFAULT_USE_COMPACT_MODE = true const DEFAULT_USE_COMPACT_MODE = true
const LSS_KEY_TIMELINE_ENABLED* = "timelineEnabled"
const DEFAULT_TIMELINE_ENABLED = true
const LSS_KEY_RECENT_EMOJIS* = "recentEmojis" const LSS_KEY_RECENT_EMOJIS* = "recentEmojis"
const DEFAULT_RECENT_EMOJIS = "" const DEFAULT_RECENT_EMOJIS = ""
const LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS* = "hiddenCommunityWelcomeBanners" const LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS* = "hiddenCommunityWelcomeBanners"
@ -361,19 +359,6 @@ QtObject:
notify = useCompactModeChanged 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 recentEmojisChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getRecentEmojis*(self: LocalAccountSensitiveSettings): QVariant {.slot.} = proc getRecentEmojis*(self: LocalAccountSensitiveSettings): QVariant {.slot.} =
getSettingsPropQVariant(self, LSS_KEY_RECENT_EMOJIS, newQVariant(DEFAULT_RECENT_EMOJIS)) 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_IS_TENOR_WARNING_ACCEPTED: self.isTenorWarningAcceptedChanged()
of LSS_KEY_DISPLAY_CHAT_IMAGES: self.displayChatImagesChanged() of LSS_KEY_DISPLAY_CHAT_IMAGES: self.displayChatImagesChanged()
of LSS_KEY_USE_COMPACT_MODE: self.useCompactModeChanged() 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_RECENT_EMOJIS: self.recentEmojisChanged()
of LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS: self.hiddenCommunityWelcomeBannersChanged() of LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS: self.hiddenCommunityWelcomeBannersChanged()
of LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS: self.hiddenCommunityBackUpBannersChanged() of LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS: self.hiddenCommunityBackUpBannersChanged()

View File

@ -39,7 +39,6 @@ type
Community, Community,
Wallet, Wallet,
Browser, Browser,
Timeline,
NodeManagement, NodeManagement,
ProfileSettings ProfileSettings
@ -145,7 +144,6 @@ method load*[T](self: Module[T]) =
"wallet", "", 0, 0) "wallet", "", 0, 0)
self.view.addItem(chatSectionItem) self.view.addItem(chatSectionItem)
self.walletSectionModule.load() self.walletSectionModule.load()
self.browserSectionModule.load() self.browserSectionModule.load()
let browserSectionItem = initItem("browser", SectionType.Browser.int, "Browser") let browserSectionItem = initItem("browser", SectionType.Browser.int, "Browser")

View File

@ -9,8 +9,6 @@ type ChatType* {.pure.}= enum
OneToOne = 1, OneToOne = 1,
Public = 2, Public = 2,
PrivateGroupChat = 3, PrivateGroupChat = 3,
Profile = 4,
Timeline = 5
CommunityChat = 6 CommunityChat = 6
type ChatDto* = object type ChatDto* = object

View File

@ -22,7 +22,6 @@ ModalPopup {
property bool userCanPin: { property bool userCanPin: {
switch (popup.rootStore.chatsModelInst.channelView.activeChannel.chatType) { switch (popup.rootStore.chatsModelInst.channelView.activeChannel.chatType) {
case Constants.chatTypePublic: return false case Constants.chatTypePublic: return false
case Constants.chatTypeStatusUpdate: return false
case Constants.chatTypeOneToOne: return true case Constants.chatTypeOneToOne: return true
case Constants.chatTypePrivateGroupChat: return popup.rootStore.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) case Constants.chatTypePrivateGroupChat: return popup.rootStore.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey)
case Constants.chatTypeCommunity: return popup.rootStore.chatsModelInst.communities.activeCommunity.admin case Constants.chatTypeCommunity: return popup.rootStore.chatsModelInst.communities.activeCommunity.admin

View File

@ -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
}
}
}

View File

@ -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)
}
}

View File

@ -76,7 +76,6 @@ QtObject {
|| contentType === Constants.communityInviteType || contentType === Constants.transactionType || contentType === Constants.communityInviteType || contentType === Constants.transactionType
property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now()) property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now())
property bool isStatusUpdate: false
property int statusAgeEpoch: 0 property int statusAgeEpoch: 0
// property int replyMessageIndex: chatsModel.messageView.messageList.getMessageIndex(responseTo); // property int replyMessageIndex: chatsModel.messageView.messageList.getMessageIndex(responseTo);

View File

@ -9,7 +9,6 @@ import shared.panels 1.0
import shared.popups 1.0 import shared.popups 1.0
import shared.status 1.0 import shared.status 1.0
import "./AppLayouts" import "./AppLayouts"
import "./AppLayouts/Timeline"
import "./AppLayouts/Wallet" import "./AppLayouts/Wallet"
import "./AppLayouts/WalletV2" import "./AppLayouts/WalletV2"
import "./AppLayouts/Chat/popups" import "./AppLayouts/Chat/popups"
@ -406,8 +405,6 @@ Item {
browserLayoutContainer.active = true; browserLayoutContainer.active = true;
} }
timelineLayoutContainer.active = obj === timelineLayoutContainer
if(obj === walletLayoutContainer){ if(obj === walletLayoutContainer){
walletLayoutContainer.showSigningPhrasePopup(); walletLayoutContainer.showSigningPhrasePopup();
} }
@ -458,21 +455,6 @@ Item {
property var _web3Provider: web3Provider 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 { ProfileLayout {
id: profileLayoutContainer id: profileLayoutContainer
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -1,3 +0,0 @@
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11C22 17.0751 17.0751 22 11 22ZM11 20.5C9.35708 20.5 8.02523 19.1682 8.02523 17.5252C8.02523 15.8823 9.35708 14.5505 11 14.5505C12.6429 14.5505 13.9748 15.8823 13.9748 17.5252C13.9748 19.1682 12.6429 20.5 11 20.5ZM6.11258 17.6751C6.22604 17.8718 6.52523 17.7523 6.52523 17.5252C6.52523 15.0539 8.52865 13.0505 11 13.0505C13.4713 13.0505 15.4748 15.0539 15.4748 17.5252C15.4748 17.7523 15.774 17.8718 15.8874 17.6751C16.3651 16.847 16.6385 15.8862 16.6385 14.8615C16.6385 11.7475 14.114 9.22308 11 9.22308C7.88597 9.22308 5.36154 11.7475 5.36154 14.8615C5.36154 15.8862 5.63487 16.847 6.11258 17.6751ZM18.0483 15.9992C17.9783 16.4359 18.5498 16.784 18.8025 16.421C19.8726 14.8836 20.5 13.0151 20.5 11C20.5 5.75329 16.2467 1.5 11 1.5C5.75329 1.5 1.5 5.75329 1.5 11C1.5 13.0151 2.1274 14.8836 3.19751 16.421C3.45018 16.784 4.02165 16.4359 3.95171 15.9992C3.89237 15.6287 3.86154 15.2487 3.86154 14.8615C3.86154 10.9191 7.05754 7.72308 11 7.72308C14.9425 7.72308 18.1385 10.9191 18.1385 14.8615C18.1385 15.2487 18.1076 15.6287 18.0483 15.9992Z" fill="#939BA1"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -40,8 +40,8 @@ Rectangle {
property var stickerPackList property var stickerPackList
property int extraHeightFactor: calculateExtraHeightFactor() property int extraHeightFactor: calculateExtraHeightFactor()
property int messageLimit: control.isStatusUpdateInput ? 300 : 2000 property int messageLimit: 2000
property int messageLimitVisible: control.isStatusUpdateInput ? 50 : 200 property int messageLimitVisible: 200
property int chatType property int chatType
@ -49,7 +49,6 @@ Rectangle {
property string chatInputPlaceholder: qsTrId("type-a-message-") property string chatInputPlaceholder: qsTrId("type-a-message-")
property alias textInput: messageInputField property alias textInput: messageInputField
property bool isStatusUpdateInput: chatType === Constants.chatTypeStatusUpdate
property var fileUrls: [] property var fileUrls: []
@ -64,15 +63,15 @@ Rectangle {
height: { height: {
if (extendedArea.visible) { 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.defaultInputFieldHeight) {
if (messageInput.height >= messageInput.maxInputFieldHeight) { 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.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -160,10 +159,6 @@ Rectangle {
event.accepted = true; event.accepted = true;
return return
} }
if (control.isStatusUpdateInput) {
return // Status update require the send button to be clicked
}
if (messageInputField.length < messageLimit) { if (messageInputField.length < messageLimit) {
control.sendMessage(event) control.sendMessage(event)
control.hideExtendedArea(); control.hideExtendedArea();
@ -581,7 +576,6 @@ Rectangle {
] ]
onAccepted: { onAccepted: {
imageBtn.highlighted = false imageBtn.highlighted = false
imageBtn2.highlighted = false
let validImages = validateImages(imageDialog.fileUrls) let validImages = validateImages(imageDialog.fileUrls)
if (validImages.length > 0) { if (validImages.length > 0) {
control.showImageArea(validImages) control.showImageArea(validImages)
@ -590,7 +584,6 @@ Rectangle {
} }
onRejected: { onRejected: {
imageBtn.highlighted = false imageBtn.highlighted = false
imageBtn2.highlighted = false
} }
} }
@ -713,7 +706,7 @@ Rectangle {
anchors.bottomMargin: 16 anchors.bottomMargin: 16
icon.name: "chat-commands" icon.name: "chat-commands"
type: StatusQ.StatusFlatRoundButton.Type.Tertiary type: StatusQ.StatusFlatRoundButton.Type.Tertiary
visible: !isEdit && control.chatType === Constants.chatTypeOneToOne && !control.isStatusUpdateInput visible: !isEdit && control.chatType === Constants.chatTypeOneToOne
enabled: !control.isContactBlocked enabled: !control.isContactBlocked
onClicked: { onClicked: {
chatCommandsPopup.opened ? chatCommandsPopup.opened ?
@ -732,7 +725,7 @@ Rectangle {
anchors.bottomMargin: 16 anchors.bottomMargin: 16
icon.name: "image" icon.name: "image"
type: StatusQ.StatusFlatRoundButton.Type.Tertiary type: StatusQ.StatusFlatRoundButton.Type.Tertiary
visible: !isEdit && control.chatType !== Constants.chatTypePublic && !control.isStatusUpdateInput visible: !isEdit && control.chatType !== Constants.chatTypePublic
enabled: !control.isContactBlocked enabled: !control.isContactBlocked
onClicked: { onClicked: {
highlighted = true highlighted = true
@ -743,13 +736,12 @@ Rectangle {
Rectangle { Rectangle {
id: messageInput id: messageInput
enabled: !control.isContactBlocked enabled: !control.isContactBlocked
property int maxInputFieldHeight: control.isStatusUpdateInput ? 124 : 112 property int maxInputFieldHeight: 112
property int defaultInputFieldHeight: control.isStatusUpdateInput ? 56 : 40 property int defaultInputFieldHeight: 40
anchors.left: imageBtn.visible ? imageBtn.right : parent.left anchors.left: imageBtn.visible ? imageBtn.right : parent.left
anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding
anchors.top: control.isStatusUpdateInput ? parent.top : undefined anchors.bottom: parent.bottom
anchors.bottom: !control.isStatusUpdateInput ? parent.bottom : undefined anchors.bottomMargin: 12
anchors.bottomMargin: control.isStatusUpdateInput ? 0 : 12
anchors.right: unblockBtn.visible ? unblockBtn.left : parent.right anchors.right: unblockBtn.visible ? unblockBtn.left : parent.right
anchors.rightMargin: Style.current.smallPadding anchors.rightMargin: Style.current.smallPadding
height: { height: {
@ -763,8 +755,7 @@ Rectangle {
} }
color: isEdit ? Theme.palette.statusChatInput.secondaryBackgroundColor : Style.current.inputBackground color: isEdit ? Theme.palette.statusChatInput.secondaryBackgroundColor : Style.current.inputBackground
radius: control.isStatusUpdateInput ? 36 : radius: height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32
height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32
ColumnLayout { ColumnLayout {
id: validators id: validators
@ -803,29 +794,25 @@ Rectangle {
} }
anchors.left: messageInput.left anchors.left: messageInput.left
anchors.right: messageInput.right anchors.right: messageInput.right
anchors.bottom: control.isStatusUpdateInput ? undefined : messageInput.top anchors.bottom: messageInput.top
anchors.top: control.isStatusUpdateInput ? messageInput.bottom : undefined
anchors.topMargin: control.isStatusUpdateInput ? -Style.current.halfPadding : 0
color: isEdit ? Style.current.secondaryInputBackground : Style.current.inputBackground color: isEdit ? Style.current.secondaryInputBackground : Style.current.inputBackground
radius: control.isStatusUpdateInput ? 36 : 16 radius: 16
Rectangle { Rectangle {
color: parent.color color: parent.color
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
height: control.isStatusUpdateInput ? 64 : 30 height: 30
anchors.top: control.isStatusUpdateInput ? parent.top : undefined anchors.bottom: parent.bottom
anchors.topMargin: control.isStatusUpdateInput ? -24 : 0 anchors.bottomMargin: -height/2
anchors.bottom: control.isStatusUpdateInput ? undefined : parent.bottom
anchors.bottomMargin: control.isStatusUpdateInput ? 0 : -height/2
} }
StatusChatInputImageArea { StatusChatInputImageArea {
id: imageArea id: imageArea
anchors.left: parent.left 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.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.top: parent.top
anchors.topMargin: Style.current.halfPadding anchors.topMargin: Style.current.halfPadding
visible: isImage 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 { ScrollView {
id: scrollView id: scrollView
anchors.top: parent.top anchors.top: parent.top
@ -887,8 +863,8 @@ Rectangle {
placeholderTextColor: Style.current.secondaryText placeholderTextColor: Style.current.secondaryText
selectByMouse: true selectByMouse: true
color: isEdit ? Theme.palette.directColor1 : Style.current.textColor color: isEdit ? Theme.palette.directColor1 : Style.current.textColor
topPadding: control.isStatusUpdateInput ? 18 : Style.current.smallPadding topPadding: Style.current.smallPadding
bottomPadding: control.isStatusUpdateInput ? 14 : 12 bottomPadding: 12
Keys.onPressed: onKeyPress(event) Keys.onPressed: onKeyPress(event)
Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition
Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event) Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event)
@ -1032,7 +1008,6 @@ Rectangle {
color: parent.color color: parent.color
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
visible: !control.isStatusUpdateInput
height: parent.height / 2 height: parent.height / 2
width: 32 width: 32
radius: Style.current.radius radius: Style.current.radius
@ -1046,62 +1021,26 @@ Rectangle {
color: (remainingChars <= 0) ? Style.current.danger : Style.current.textColor color: (remainingChars <= 0) ? Style.current.danger : Style.current.textColor
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: actions.top anchors.bottom: actions.top
anchors.rightMargin: control.isStatusUpdateInput ? Style.current.padding : Style.current.radius anchors.rightMargin: Style.current.radius
leftPadding: Style.current.halfPadding leftPadding: Style.current.halfPadding
rightPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding
} }
Item { Item {
id: actions id: actions
width: control.isStatusUpdateInput ? width: emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width
imageBtn2.width + sendBtn.anchors.leftMargin + sendBtn.width : anchors.bottom: parent.bottom
emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width anchors.bottomMargin: 4
anchors.bottom: control.isStatusUpdateInput && extendedArea.visible ? extendedArea.bottom : parent.bottom
anchors.bottomMargin: control.isStatusUpdateInput ? Style.current.smallPadding+2: 4
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.radius anchors.rightMargin: Style.current.radius
height: emojiBtn.height 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 { StatusQ.StatusFlatRoundButton {
id: emojiBtn id: emojiBtn
implicitHeight: 32 implicitHeight: 32
implicitWidth: 32 implicitWidth: 32
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: !imageBtn2.visible
icon.name: "emojis" icon.name: "emojis"
type: StatusQ.StatusFlatRoundButton.Type.Tertiary type: StatusQ.StatusFlatRoundButton.Type.Tertiary
color: "transparent" color: "transparent"

View File

@ -32,7 +32,6 @@ Item {
case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) ? true : isCurrentUser case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) ? true : isCurrentUser
case Constants.chatTypePublic: return isCurrentUser case Constants.chatTypePublic: return isCurrentUser
case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin ? true : isCurrentUser case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin ? true : isCurrentUser
case Constants.chatTypeStatusUpdate: return false
default: return false default: return false
} }
} }

View File

@ -321,7 +321,6 @@ StatusPopupMenu {
switch (root.store.chatsModelInst.channelView.activeChannel.chatType) { switch (root.store.chatsModelInst.channelView.activeChannel.chatType) {
case Constants.chatTypePublic: return false case Constants.chatTypePublic: return false
case Constants.chatTypeStatusUpdate: return false
case Constants.chatTypeOneToOne: return true case Constants.chatTypeOneToOne: return true
case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey) case Constants.chatTypePrivateGroupChat: return root.store.chatsModelInst.channelView.activeChannel.isAdmin(userProfile.pubKey)
case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin case Constants.chatTypeCommunity: return root.store.chatsModelInst.communities.activeCommunity.admin

View File

@ -92,7 +92,6 @@ Column {
|| contentType === Constants.communityInviteType || contentType === Constants.transactionType || contentType === Constants.communityInviteType || contentType === Constants.transactionType
property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now()) property bool isExpired: (outgoingStatus === "sending" && (Math.floor(timestamp) + 180000) < Date.now())
property bool isStatusUpdate: false
property int statusAgeEpoch: 0 property int statusAgeEpoch: 0
property int replyMessageIndex: !!root.chatsModel ? root.chatsModel.messageView.messageList.getMessageIndex(responseTo) : -1 property int replyMessageIndex: !!root.chatsModel ? root.chatsModel.messageView.messageList.getMessageIndex(responseTo) : -1
@ -241,8 +240,7 @@ Column {
case Constants.gapType: case Constants.gapType:
return gapComponent return gapComponent
default: default:
return isStatusUpdate ? statusUpdateComponent : return localAccountSensitiveSettings.useCompactMode ? compactMessageComponent : messageComponent
(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 { Component {
id: compactMessageComponent id: compactMessageComponent
CompactMessageView { CompactMessageView {

View File

@ -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
}
}
}

View File

@ -16,7 +16,6 @@ QtObject {
readonly property int chatTypeOneToOne: 1 readonly property int chatTypeOneToOne: 1
readonly property int chatTypePublic: 2 readonly property int chatTypePublic: 2
readonly property int chatTypePrivateGroupChat: 3 readonly property int chatTypePrivateGroupChat: 3
readonly property int chatTypeStatusUpdate: 4
readonly property int chatTypeCommunity: 6 readonly property int chatTypeCommunity: 6
readonly property int communityChatPublicAccess: 1 readonly property int communityChatPublicAccess: 1
@ -48,7 +47,6 @@ QtObject {
readonly property string chat: "chat" readonly property string chat: "chat"
readonly property string wallet: "wallet" readonly property string wallet: "wallet"
readonly property string walletv2: "walletV2" readonly property string walletv2: "walletV2"
readonly property string timeline: "timeline"
readonly property string browser: "browser" readonly property string browser: "browser"
readonly property string profile: "profile" readonly property string profile: "profile"
readonly property string node: "node" readonly property string node: "node"

View File

@ -436,7 +436,7 @@ StatusWindow {
// in timeline view // in timeline view
loader.item.appLayout.appView.currentIndex === timelineView || loader.item.appLayout.appView.currentIndex === timelineView ||
// In community section // In community section
chatsModel.communities.activeCommunity.active loader.item.appLayout.appView.currentIndex === chatsModel.communities.activeCommunity.active
) )
width: applicationWindow.width width: applicationWindow.width

View File

@ -43,7 +43,6 @@ SOURCES = *.qml \
app/AppLayouts/Profile/Sections/Data/*.qml \ app/AppLayouts/Profile/Sections/Data/*.qml \
app/AppLayouts/Profile/Sections/Ens/*.qml \ app/AppLayouts/Profile/Sections/Ens/*.qml \
app/AppLayouts/Profile/Sections/Privileges/*.qml \ app/AppLayouts/Profile/Sections/Privileges/*.qml \
app/AppLayouts/Timeline/*.qml\
app/AppLayouts/Wallet/*.qml \ app/AppLayouts/Wallet/*.qml \
app/AppLayouts/Wallet/components/*.qml \ app/AppLayouts/Wallet/components/*.qml \
app/AppLayouts/Wallet/components/collectiblesComponents/*.qml \ app/AppLayouts/Wallet/components/collectiblesComponents/*.qml \

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit 6d0e5ccf6232003231e7a83f52ffaaa85469e7bd Subproject commit 29e2859aaa60691b68dbde81f3087fa659a59b08