mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 22:06:25 +00:00
8d90204e0a
There was a requested design change where no longer wanted to have checkboxes to decide which files will be included for a discord import, but rather have an "X" button that enables users to remove items. This commit implements this refactor. In addition, it ensures that the already loaded discord categories and channels that have been extracted from validation, are kept in sync as well. Meaning, if a user removes a file from the file list, the corresponding channel will be removed as well. If there's not channel in a given category, the category will be removed as well. Closes #8125 #8126
159 lines
7.5 KiB
QML
159 lines
7.5 KiB
QML
import QtQuick 2.13
|
|
import QtQml.Models 2.2
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
property var communitiesModuleInst: communitiesModule
|
|
|
|
readonly property var curatedCommunitiesModel: root.communitiesModuleInst.curatedCommunities
|
|
|
|
property var discordFileList: root.communitiesModuleInst.discordFileList
|
|
property var discordCategoriesModel: root.communitiesModuleInst.discordCategories
|
|
property var discordChannelsModel: root.communitiesModuleInst.discordChannels
|
|
property int discordOldestMessageTimestamp: root.communitiesModuleInst.discordOldestMessageTimestamp
|
|
property bool discordDataExtractionInProgress: root.communitiesModuleInst.discordDataExtractionInProgress
|
|
property int discordImportErrorsCount: root.communitiesModuleInst.discordImportErrorsCount
|
|
property int discordImportWarningsCount: root.communitiesModuleInst.discordImportWarningsCount
|
|
property int discordImportProgress: root.communitiesModuleInst.discordImportProgress
|
|
property bool discordImportInProgress: root.communitiesModuleInst.discordImportInProgress
|
|
property bool discordImportCancelled: root.communitiesModuleInst.discordImportCancelled
|
|
property bool discordImportProgressStopped: root.communitiesModuleInst.discordImportProgressStopped
|
|
property string discordImportCommunityId: root.communitiesModuleInst.discordImportCommunityId
|
|
property string discordImportCommunityName: root.communitiesModuleInst.discordImportCommunityName
|
|
property url discordImportCommunityImage: root.communitiesModuleInst.discordImportCommunityImage
|
|
property bool discordImportHasCommunityImage: root.communitiesModuleInst.discordImportHasCommunityImage
|
|
property var discordImportTasks: root.communitiesModuleInst.discordImportTasks
|
|
property string locale: localAppSettings.language
|
|
property var advancedModule: profileSectionModule.advancedModule
|
|
property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false
|
|
|
|
// TODO: Could the backend provide directly 2 filtered models??
|
|
//property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities
|
|
//property var popularCommunitiesModel: root.communitiesModuleInst.curatedPopularCommunities
|
|
property ListModel tagsModel: ListModel {}//root.notionsTagsModel
|
|
|
|
// TO DO: Complete list can be added in backend or here: https://www.notion.so/Category-tags-339b2e699e7c4d36ab0608ab00b99111
|
|
property ListModel notionsTagsModel : ListModel {
|
|
ListElement { name: "gaming"; emoji: "🎮"}
|
|
ListElement { name: "art"; emoji: "🖼️️"}
|
|
ListElement { name: "crypto"; emoji: "💸"}
|
|
ListElement { name: "nsfw"; emoji: "🍆"}
|
|
ListElement { name: "markets"; emoji: "💎"}
|
|
ListElement { name: "defi"; emoji: "📈"}
|
|
ListElement { name: "travel"; emoji: "🚁"}
|
|
ListElement { name: "web3"; emoji: "🗺"}
|
|
ListElement { name: "sport"; emoji: "🎾"}
|
|
ListElement { name: "food"; emoji: "🥑"}
|
|
ListElement { name: "enviroment"; emoji: "☠️"}
|
|
ListElement { name: "privacy"; emoji: "👻"}
|
|
}
|
|
|
|
property string communityTags: communitiesModuleInst.tags
|
|
|
|
function createCommunity(args = {
|
|
name: "",
|
|
description: "",
|
|
introMessage: "",
|
|
outroMessage: "",
|
|
color: "",
|
|
tags: "",
|
|
image: {
|
|
src: "",
|
|
AX: 0,
|
|
AY: 0,
|
|
BX: 0,
|
|
BY: 0,
|
|
},
|
|
options: {
|
|
historyArchiveSupportEnabled: false,
|
|
checkedMembership: false,
|
|
pinMessagesAllowedForMembers: false,
|
|
encrypted: false,
|
|
},
|
|
bannerJsonStr: ""
|
|
}) {
|
|
return communitiesModuleInst.createCommunity(
|
|
args.name, args.description, args.introMessage, args.outroMessage, args.options.checkedMembership,
|
|
args.color, args.tags,
|
|
args.image.src, args.image.AX, args.image.AY, args.image.BX, args.image.BY,
|
|
args.options.historyArchiveSupportEnabled, args.options.pinMessagesAllowedForMembers,
|
|
args.bannerJsonStr, args.options.encrypted);
|
|
}
|
|
|
|
function importCommunity(communityKey) {
|
|
root.communitiesModuleInst.importCommunity(communityKey);
|
|
}
|
|
|
|
function setActiveCommunity(communityId) {
|
|
mainModule.setActiveSectionById(communityId);
|
|
}
|
|
|
|
function navigateToCommunity(communityId) {
|
|
root.communitiesModuleInst.navigateToCommunity(communityId)
|
|
}
|
|
|
|
function removeFileListItem(filePath) {
|
|
root.communitiesModuleInst.removeFileListItem(filePath)
|
|
}
|
|
function setFileListItems(filePaths) {
|
|
root.communitiesModuleInst.setFileListItems(filePaths)
|
|
}
|
|
|
|
function clearFileList() {
|
|
root.communitiesModuleInst.clearFileList()
|
|
}
|
|
|
|
function requestExtractChannelsAndCategories() {
|
|
root.communitiesModuleInst.requestExtractDiscordChannelsAndCategories()
|
|
}
|
|
|
|
function clearDiscordCategoriesAndChannels() {
|
|
root.communitiesModuleInst.clearDiscordCategoriesAndChannels()
|
|
}
|
|
|
|
function toggleDiscordCategory(id, selected) {
|
|
root.communitiesModuleInst.toggleDiscordCategory(id, selected)
|
|
}
|
|
|
|
function toggleDiscordChannel(id, selected) {
|
|
root.communitiesModuleInst.toggleDiscordChannel(id, selected)
|
|
}
|
|
|
|
function requestCancelDiscordCommunityImport(id) {
|
|
root.communitiesModuleInst.requestCancelDiscordCommunityImport(id)
|
|
}
|
|
|
|
function resetDiscordImport() {
|
|
root.communitiesModuleInst.resetDiscordImport(false)
|
|
}
|
|
|
|
function requestImportDiscordCommunity(args = {
|
|
name: "",
|
|
description: "",
|
|
introMessage: "",
|
|
outroMessage: "",
|
|
color: "",
|
|
tags: "",
|
|
image: {
|
|
src: "",
|
|
AX: 0,
|
|
AY: 0,
|
|
BX: 0,
|
|
BY: 0,
|
|
},
|
|
options: {
|
|
historyArchiveSupportEnabled: false,
|
|
checkedMembership: false,
|
|
pinMessagesAllowedForMembers: false,
|
|
encrypted: false
|
|
}
|
|
}, from = 0) {
|
|
return communitiesModuleInst.requestImportDiscordCommunity(
|
|
args.name, args.description, args.introMessage, args.outroMessage, args.options.checkedMembership,
|
|
args.color, args.tags,
|
|
args.image.src, args.image.AX, args.image.AY, args.image.BX, args.image.BY,
|
|
args.options.historyArchiveSupportEnabled, args.options.pinMessagesAllowedForMembers, from, args.options.encrypted);
|
|
}
|
|
}
|