fix(@deaktop/chat): drag & drop to upload a file/picture is not working

Also checked and updated drag and drop feature to work in commmunities

fixes #3495
This commit is contained in:
Khushboo Mehta 2021-09-15 13:40:07 +02:00 committed by Iuri Matias
parent d8222a49de
commit d8e669d013
2 changed files with 8 additions and 7 deletions

View File

@ -28,6 +28,7 @@ Item {
anchors.fill: parent
property alias appSettings: appSettings
property alias appLayout: appLayout
property var newVersionJSON: JSON.parse(utilsModel.newVersion)
property bool profilePopupOpened: false
property bool networkGuarded: profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && appSettings.stickersEnsRopsten)
@ -254,6 +255,8 @@ Item {
}
StatusAppLayout {
id: appLayout
width: parent.width
anchors.top: parent.top
anchors.topMargin: (versionWarning.visible || mnemonicBackupWarning.visible) ? 32 : 0

View File

@ -320,12 +320,10 @@ StatusWindow {
property alias droppedUrls: rptDraggedPreviews.model
readonly property int chatView: Utils.getAppSectionIndex(Constants.chat)
readonly property int timelineView: Utils.getAppSectionIndex(Constants.timeline)
property bool enabled: containsDrag &&
drag.source.objectName !== "chatItem" &&
drag.source.objectName !== "chatListCategory" && loader.item &&
property bool enabled: !drag.source && !!loader.item && !!loader.item.appLayout &&
(
// in chat view
(loader.item.currentView === chatView &&
(loader.item.appLayout.appView.currentIndex === chatView &&
(
// in a one-to-one chat
chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne ||
@ -334,7 +332,7 @@ StatusWindow {
)
) ||
// in timeline view
loader.item.currentView === timelineView ||
loader.item.appLayout.appView.currentIndex === timelineView ||
// In community section
chatsModel.communities.activeCommunity.active
)
@ -355,7 +353,7 @@ StatusWindow {
cleanup()
}
onEntered: {
if (!enabled) {
if (!enabled || !!drag.source) {
drag.accepted = false
return
}
@ -378,7 +376,7 @@ StatusWindow {
states: [
State {
when: dragTarget.enabled
when: dragTarget.enabled && dragTarget.containsDrag
PropertyChanges {
target: dropRectangle
color: Style.current.background