parent
f21c6eda45
commit
d43b1eb25c
|
@ -28,8 +28,6 @@ const LSS_KEY_IS_TENOR_WARNING_ACCEPTED* = "isTenorWarningAccepted"
|
||||||
const DEFAULT_IS_TENOR_WARNING_ACCEPTED = false
|
const DEFAULT_IS_TENOR_WARNING_ACCEPTED = false
|
||||||
const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages"
|
const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages"
|
||||||
const DEFAULT_DISPLAY_CHAT_IMAGES = false
|
const DEFAULT_DISPLAY_CHAT_IMAGES = false
|
||||||
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"
|
||||||
|
@ -344,19 +342,6 @@ QtObject:
|
||||||
notify = displayChatImagesChanged
|
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 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))
|
||||||
|
@ -859,7 +844,6 @@ QtObject:
|
||||||
of LSS_KEY_IS_GIF_WIDGET_ENABLED: self.isGifWidgetEnabledChanged()
|
of LSS_KEY_IS_GIF_WIDGET_ENABLED: self.isGifWidgetEnabledChanged()
|
||||||
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_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()
|
||||||
|
|
|
@ -217,7 +217,7 @@ method getNumOfNotificaitonsForChat*(self: Controller): tuple[unviewed:int, ment
|
||||||
result.mentions = 0
|
result.mentions = 0
|
||||||
let chats = self.chatService.getAllChats()
|
let chats = self.chatService.getAllChats()
|
||||||
for chat in chats:
|
for chat in chats:
|
||||||
if(chat.chatType == ChatType.Timeline or chat.chatType == ChatType.CommunityChat):
|
if(chat.chatType == ChatType.CommunityChat):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result.unviewed += chat.unviewedMessagesCount
|
result.unviewed += chat.unviewedMessagesCount
|
||||||
|
|
|
@ -343,7 +343,6 @@ method load*[T](
|
||||||
self.walletSectionModule.load()
|
self.walletSectionModule.load()
|
||||||
# self.walletV2SectionModule.load()
|
# self.walletV2SectionModule.load()
|
||||||
self.browserSectionModule.load()
|
self.browserSectionModule.load()
|
||||||
# self.timelineSectionModule.load()
|
|
||||||
# self.nodeManagementSectionModule.load()
|
# self.nodeManagementSectionModule.load()
|
||||||
self.profileSectionModule.load()
|
self.profileSectionModule.load()
|
||||||
self.stickersModule.load()
|
self.stickersModule.load()
|
||||||
|
|
|
@ -10,7 +10,6 @@ type ChatType* {.pure.}= enum
|
||||||
Public = 2,
|
Public = 2,
|
||||||
PrivateGroupChat = 3,
|
PrivateGroupChat = 3,
|
||||||
Profile = 4,
|
Profile = 4,
|
||||||
Timeline = 5
|
|
||||||
CommunityChat = 6
|
CommunityChat = 6
|
||||||
|
|
||||||
type ChatMember* = object
|
type ChatMember* = object
|
||||||
|
|
|
@ -62,12 +62,6 @@ proc decodeContentHash*(value: string): string =
|
||||||
error "Error decoding sticker", hash=value, exception=e.msg
|
error "Error decoding sticker", hash=value, exception=e.msg
|
||||||
raise
|
raise
|
||||||
|
|
||||||
proc getTimelineChatId*(pubKey: string = ""): string =
|
|
||||||
if pubKey == "":
|
|
||||||
return "@timeline70bd746ddcc12beb96b2c9d572d0784ab137ffc774f5383e50585a932080b57cca0484b259e61cecbaa33a4c98a300a"
|
|
||||||
else:
|
|
||||||
return "@" & pubKey
|
|
||||||
|
|
||||||
proc isWakuEnabled(): bool =
|
proc isWakuEnabled(): bool =
|
||||||
true # TODO:
|
true # TODO:
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -51,7 +51,6 @@ QtObject {
|
||||||
readonly property int publicChat: 2
|
readonly property int publicChat: 2
|
||||||
readonly property int privateGroupChat: 3
|
readonly property int privateGroupChat: 3
|
||||||
readonly property int profile: 4
|
readonly property int profile: 4
|
||||||
readonly property int timeline: 5
|
|
||||||
readonly property int communityChat: 6
|
readonly property int communityChat: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue