feat(privacy): reimplement show only contact pfp using status-go setting
Fixes #4900
This commit is contained in:
parent
63d56aba12
commit
68a4498d11
|
@ -56,8 +56,6 @@ const LSS_KEY_FONT_SIZE* = "fontSize"
|
|||
const DEFAULT_FONT_SIZE = 2 #fontSizeM from qml
|
||||
const LSS_KEY_HIDE_SIGN_PHRASE_MODAL* = "hideSignPhraseModal"
|
||||
const DEFAULT_HIDE_SIGN_PHRASE_MODAL = false
|
||||
const LSS_KEY_ONLY_SHOW_CONTACTS_PICS* = "onlyShowContactsProfilePics"
|
||||
const DEFAULT_ONLY_SHOW_CONTACTS_PICS = true
|
||||
const LSS_KEY_QUITE_ON_CLOSE* = "quitOnClose"
|
||||
const DEFAULT_QUITE_ON_CLOSE = false
|
||||
const LSS_KEY_SKIN_COLOR* = "skinColor"
|
||||
|
@ -522,19 +520,6 @@ QtObject:
|
|||
notify = hideSignPhraseModalChanged
|
||||
|
||||
|
||||
proc onlyShowContactsProfilePicsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
||||
proc getOnlyShowContactsProfilePics*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
||||
getSettingsProp[bool](self, LSS_KEY_ONLY_SHOW_CONTACTS_PICS, newQVariant(DEFAULT_ONLY_SHOW_CONTACTS_PICS))
|
||||
proc setOnlyShowContactsProfilePics*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
|
||||
setSettingsProp(self, LSS_KEY_ONLY_SHOW_CONTACTS_PICS, newQVariant(value)):
|
||||
self.onlyShowContactsProfilePicsChanged()
|
||||
|
||||
QtProperty[bool] onlyShowContactsProfilePics:
|
||||
read = getOnlyShowContactsProfilePics
|
||||
write = setOnlyShowContactsProfilePics
|
||||
notify = onlyShowContactsProfilePicsChanged
|
||||
|
||||
|
||||
proc quitOnCloseChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
||||
proc getQuitOnClose*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
||||
getSettingsProp[bool](self, LSS_KEY_QUITE_ON_CLOSE, newQVariant(DEFAULT_QUITE_ON_CLOSE))
|
||||
|
@ -856,7 +841,6 @@ QtObject:
|
|||
of LSS_KEY_HIDE_CHANNEL_SUGGESTIONS: self.hideChannelSuggestionsChanged()
|
||||
of LSS_KEY_FONT_SIZE: self.fontSizeChanged()
|
||||
of LSS_KEY_HIDE_SIGN_PHRASE_MODAL: self.hideSignPhraseModalChanged()
|
||||
of LSS_KEY_ONLY_SHOW_CONTACTS_PICS: self.onlyShowContactsProfilePicsChanged()
|
||||
of LSS_KEY_QUITE_ON_CLOSE: self.quitOnCloseChanged()
|
||||
of LSS_KEY_SKIN_COLOR: self.skinColorChanged()
|
||||
of LSS_KEY_SHOW_DELETE_MESSAGE_WARNING: self.showDeleteMessageWarningChanged()
|
||||
|
|
|
@ -80,8 +80,10 @@ method convertToItems*[T](
|
|||
contactDetails.displayName,
|
||||
contactDetails.details.localNickname,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isIdenticon,
|
||||
contactDetails.isCurrentUser,
|
||||
contactDetails.details.added,
|
||||
n.message.outgoingStatus,
|
||||
self.controller.getRenderedText(n.message.parsedText),
|
||||
n.message.image,
|
||||
|
|
|
@ -118,6 +118,18 @@ method init*(self: Controller) =
|
|||
var args = ContactArgs(e)
|
||||
self.delegate.updateContactDetails(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_ADDED) do(e: Args):
|
||||
var args = ContactArgs(e)
|
||||
self.delegate.updateContactDetails(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_REMOVED) do(e: Args):
|
||||
var args = ContactArgs(e)
|
||||
self.delegate.updateContactDetails(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_BLOCKED) do(e: Args):
|
||||
var args = ContactArgs(e)
|
||||
self.delegate.updateContactDetails(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED) do(e: Args):
|
||||
self.delegate.updateContactDetails(singletonInstance.userProfile.getPubKey())
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ method getModuleAsVariant*(self: Module): QVariant =
|
|||
|
||||
proc createFetchMoreMessagesItem(self: Module): Item =
|
||||
let chatDto = self.controller.getChatDetails()
|
||||
let isIdenticon = false
|
||||
result = initItem(
|
||||
FETCH_MORE_MESSAGES_MESSAGE_ID,
|
||||
communityId = "",
|
||||
|
@ -79,8 +78,10 @@ proc createFetchMoreMessagesItem(self: Module): Item =
|
|||
senderDisplayName = "",
|
||||
senderLocalName = "",
|
||||
senderIcon = "",
|
||||
isIdenticon,
|
||||
senderIdenticon = "",
|
||||
isSenderIconIdenticon = false,
|
||||
amISender = false,
|
||||
senderIsAdded = false,
|
||||
outgoingStatus = "",
|
||||
text = "",
|
||||
image = "",
|
||||
|
@ -100,7 +101,10 @@ proc createChatIdentifierItem(self: Module): Item =
|
|||
var chatName = chatDto.name
|
||||
var chatIcon = chatDto.identicon
|
||||
var isIdenticon = false
|
||||
var senderIsAdded = false
|
||||
if(chatDto.chatType == ChatType.OneToOne):
|
||||
let sender = self.controller.getContactDetails(chatDto.id)
|
||||
senderIsAdded = sender.details.added
|
||||
(chatName, chatIcon, isIdenticon) = self.controller.getOneToOneChatNameAndImage()
|
||||
|
||||
result = initItem(
|
||||
|
@ -111,8 +115,10 @@ proc createChatIdentifierItem(self: Module): Item =
|
|||
senderDisplayName = chatName,
|
||||
senderLocalName = "",
|
||||
senderIcon = chatIcon,
|
||||
chatDto.identicon,
|
||||
isIdenticon,
|
||||
amISender = false,
|
||||
senderIsAdded,
|
||||
outgoingStatus = "",
|
||||
text = "",
|
||||
image = "",
|
||||
|
@ -173,8 +179,10 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
|||
sender.displayName,
|
||||
sender.details.localNickname,
|
||||
sender.icon,
|
||||
sender.details.identicon,
|
||||
sender.isIdenticon,
|
||||
isCurrentUser,
|
||||
sender.details.added,
|
||||
m.outgoingStatus,
|
||||
renderedMessageText,
|
||||
m.image,
|
||||
|
@ -259,8 +267,10 @@ method messageAdded*(self: Module, message: MessageDto) =
|
|||
sender.displayName,
|
||||
sender.details.localNickname,
|
||||
sender.icon,
|
||||
sender.details.identicon,
|
||||
sender.isIdenticon,
|
||||
isCurrentUser,
|
||||
sender.details.added,
|
||||
message.outgoingStatus,
|
||||
renderedMessageText,
|
||||
message.image,
|
||||
|
@ -386,6 +396,7 @@ method updateContactDetails*(self: Module, contactId: string) =
|
|||
item.senderLocalName = updatedContact.details.localNickname
|
||||
item.senderIcon = updatedContact.icon
|
||||
item.isSenderIconIdenticon = updatedContact.isIdenticon
|
||||
item.senderIsAdded = updatedContact.details.added
|
||||
if(item.messageContainsMentions):
|
||||
let (m, _, err) = self.controller.getMessageDetails(item.id)
|
||||
if(err.len == 0):
|
||||
|
|
|
@ -163,8 +163,10 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
|||
contactDetails.displayName,
|
||||
contactDetails.details.localNickname,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isIdenticon,
|
||||
isCurrentUser,
|
||||
contactDetails.details.added,
|
||||
m.outgoingStatus,
|
||||
self.controller.getRenderedText(m.parsedText),
|
||||
m.image,
|
||||
|
|
|
@ -87,6 +87,18 @@ method init*(self: Controller) =
|
|||
let args = ContactArgs(e)
|
||||
self.delegate.contactUpdated(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_ADDED) do(e: Args):
|
||||
let args = ContactArgs(e)
|
||||
self.delegate.contactUpdated(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_REMOVED) do(e: Args):
|
||||
let args = ContactArgs(e)
|
||||
self.delegate.contactUpdated(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_BLOCKED) do(e: Args):
|
||||
let args = ContactArgs(e)
|
||||
self.delegate.contactUpdated(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED) do(e: Args):
|
||||
self.delegate.loggedInUserImageChanged()
|
||||
|
||||
|
|
|
@ -60,7 +60,9 @@ method viewDidLoad*(self: Module) =
|
|||
alias = singletonInstance.userProfile.getUsername(),
|
||||
OnlineStatus.Online,
|
||||
singletonInstance.userProfile.getIcon(),
|
||||
singletonInstance.userProfile.getIdenticon(),
|
||||
singletonInstance.userProfile.getIsIdenticon(),
|
||||
isAdded = true,
|
||||
admin,
|
||||
joined,
|
||||
))
|
||||
|
@ -83,7 +85,9 @@ method viewDidLoad*(self: Module) =
|
|||
contactDetails.details.alias,
|
||||
status,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
admin,
|
||||
joined
|
||||
))
|
||||
|
@ -114,7 +118,9 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto]) =
|
|||
contactDetails.details.alias,
|
||||
status,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
))
|
||||
|
||||
method contactNicknameChanged*(self: Module, publicKey: string) =
|
||||
|
@ -141,6 +147,7 @@ method contactUpdated*(self: Module, publicKey: string) =
|
|||
contactDetails.details.alias,
|
||||
contactDetails.icon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
)
|
||||
|
||||
method loggedInUserImageChanged*(self: Module) =
|
||||
|
@ -164,7 +171,9 @@ method onChatMembersAdded*(self: Module, ids: seq[string]) =
|
|||
contactDetails.details.alias,
|
||||
status,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
admin,
|
||||
joined
|
||||
))
|
||||
|
@ -182,6 +191,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined
|
|||
contactDetails.details.alias,
|
||||
contactDetails.icon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
admin,
|
||||
joined)
|
||||
|
||||
|
|
|
@ -98,7 +98,9 @@ method getCommunityItem(self: Module, c: CommunityDto): SectionItem =
|
|||
contactDetails.details.alias,
|
||||
OnlineStatus.Offline, # TODO get the actual status?
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added,
|
||||
))
|
||||
)
|
||||
|
||||
|
|
|
@ -208,7 +208,9 @@ proc createCommunityItem[T](self: Module[T], c: CommunityDto): SectionItem =
|
|||
contactDetails.details.alias,
|
||||
OnlineStatus.Offline,
|
||||
contactDetails.icon,
|
||||
contactDetails.details.identicon,
|
||||
contactDetails.isidenticon,
|
||||
contactDetails.details.added
|
||||
)),
|
||||
c.pendingRequestsToJoin.map(x => pending_request_item.initItem(
|
||||
x.id,
|
||||
|
|
|
@ -60,3 +60,15 @@ method setMessagesFromContactsOnly*(self: Controller, value: bool): bool =
|
|||
|
||||
method validatePassword*(self: Controller, password: string): bool =
|
||||
return self.privacyService.validatePassword(password)
|
||||
|
||||
method getProfilePicturesShowTo*(self: Controller): int =
|
||||
self.settingsService.getProfilePicturesShowTo()
|
||||
|
||||
method setProfilePicturesShowTo*(self: Controller, value: int): bool =
|
||||
self.settingsService.saveProfilePicturesShowTo(value)
|
||||
|
||||
method getProfilePicturesVisibility*(self: Controller): int =
|
||||
self.settingsService.getProfilePicturesVisibility()
|
||||
|
||||
method setProfilePicturesVisibility*(self: Controller, value: int): bool =
|
||||
self.settingsService.saveProfilePicturesVisibility(value)
|
||||
|
|
|
@ -34,3 +34,15 @@ method setMessagesFromContactsOnly*(self: AccessInterface, value: bool): bool {.
|
|||
|
||||
method validatePassword*(self: AccessInterface, password: string): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfilePicturesShowTo*(self: AccessInterface): int {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setProfilePicturesShowTo*(self: AccessInterface, value: int): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfilePicturesVisibility*(self: AccessInterface): int {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setProfilePicturesVisibility*(self: AccessInterface, value: int): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -55,3 +55,15 @@ method setMessagesFromContactsOnly*(self: AccessInterface, value: bool) {.base.}
|
|||
|
||||
method validatePassword*(self: AccessInterface, password: string): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfilePicturesShowTo*(self: AccessInterface): int {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setProfilePicturesShowTo*(self: AccessInterface, value: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfilePicturesVisibility*(self: AccessInterface): int {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setProfilePicturesVisibility*(self: AccessInterface, value: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -78,3 +78,17 @@ method setMessagesFromContactsOnly*(self: Module, value: bool) =
|
|||
|
||||
method validatePassword*(self: Module, password: string): bool =
|
||||
self.controller.validatePassword(password)
|
||||
|
||||
method getProfilePicturesShowTo*(self: Module): int =
|
||||
self.controller.getProfilePicturesShowTo()
|
||||
|
||||
method setProfilePicturesShowTo*(self: Module, value: int) =
|
||||
if (self.controller.setProfilePicturesShowTo(value)):
|
||||
self.view.profilePicturesShowToChanged()
|
||||
|
||||
method getProfilePicturesVisibility*(self: Module): int =
|
||||
self.controller.getProfilePicturesVisibility()
|
||||
|
||||
method setProfilePicturesVisibility*(self: Module, value: int) =
|
||||
if (self.controller.setProfilePicturesVisibility(value)):
|
||||
self.view.profilePicturesVisibilityChanged()
|
||||
|
|
|
@ -60,3 +60,23 @@ QtObject:
|
|||
|
||||
proc validatePassword*(self: View, password: string): bool {.slot.} =
|
||||
self.delegate.validatePassword(password)
|
||||
|
||||
proc profilePicturesShowToChanged*(self: View) {.signal.}
|
||||
proc getProfilePicturesShowTo*(self: View): int {.slot.} =
|
||||
return self.delegate.getProfilePicturesShowTo()
|
||||
QtProperty[int] profilePicturesShowTo:
|
||||
read = getProfilePicturesShowTo
|
||||
notify = profilePicturesShowToChanged
|
||||
|
||||
proc setProfilePicturesShowTo*(self: View, value: int) {.slot.} =
|
||||
self.delegate.setProfilePicturesShowTo(value)
|
||||
|
||||
proc profilePicturesVisibilityChanged*(self: View) {.signal.}
|
||||
proc getProfilePicturesVisibility*(self: View): int {.slot.} =
|
||||
return self.delegate.getProfilePicturesVisibility()
|
||||
QtProperty[int] profilePicturesVisibility:
|
||||
read = getProfilePicturesVisibility
|
||||
notify = profilePicturesVisibilityChanged
|
||||
|
||||
proc setProfilePicturesVisibility*(self: View, value: int) {.slot.} =
|
||||
self.delegate.setProfilePicturesVisibility(value)
|
||||
|
|
|
@ -13,7 +13,9 @@ type
|
|||
senderDisplayName: string
|
||||
senderLocalName: string
|
||||
amISender: bool
|
||||
senderIsAdded: bool
|
||||
senderIcon: string
|
||||
senderIdenticon: string
|
||||
isSenderIconIdenticon: bool
|
||||
seen: bool
|
||||
outgoingStatus: string
|
||||
|
@ -42,9 +44,11 @@ proc initItem*(
|
|||
senderId,
|
||||
senderDisplayName,
|
||||
senderLocalName,
|
||||
senderIcon: string,
|
||||
senderIcon,
|
||||
senderIdenticon: string,
|
||||
isSenderIconIdenticon,
|
||||
amISender: bool,
|
||||
senderIsAdded: bool,
|
||||
outgoingStatus,
|
||||
text,
|
||||
image: string,
|
||||
|
@ -66,7 +70,9 @@ proc initItem*(
|
|||
result.senderDisplayName = senderDisplayName
|
||||
result.senderLocalName = senderLocalName
|
||||
result.amISender = amISender
|
||||
result.senderIsAdded = senderIsAdded
|
||||
result.senderIcon = senderIcon
|
||||
result.senderIdenticon = senderIdenticon
|
||||
result.isSenderIconIdenticon = isSenderIconIdenticon
|
||||
result.seen = seen
|
||||
result.outgoingStatus = outgoingStatus
|
||||
|
@ -96,6 +102,7 @@ proc `$`*(self: Item): string =
|
|||
senderDisplayName: {$self.senderDisplayName},
|
||||
senderLocalName: {self.senderLocalName},
|
||||
amISender: {$self.amISender},
|
||||
senderIsAdded: {$self.senderIsAdded},
|
||||
isSenderIconIdenticon: {$self.isSenderIconIdenticon},
|
||||
seen: {$self.seen},
|
||||
outgoingStatus:{$self.outgoingStatus},
|
||||
|
@ -143,6 +150,9 @@ proc senderIcon*(self: Item): string {.inline.} =
|
|||
proc `senderIcon=`*(self: Item, value: string) {.inline.} =
|
||||
self.senderIcon = value
|
||||
|
||||
proc senderIdenticon*(self: Item): string {.inline.} =
|
||||
self.senderIdenticon
|
||||
|
||||
proc isSenderIconIdenticon*(self: Item): bool {.inline.} =
|
||||
self.isSenderIconIdenticon
|
||||
|
||||
|
@ -152,6 +162,12 @@ proc `isSenderIconIdenticon=`*(self: Item, value: bool) {.inline.} =
|
|||
proc amISender*(self: Item): bool {.inline.} =
|
||||
self.amISender
|
||||
|
||||
proc senderIsAdded*(self: Item): bool {.inline.} =
|
||||
self.senderIsAdded
|
||||
|
||||
proc `senderIsAdded=`*(self: Item, value: bool) {.inline.} =
|
||||
self.senderIsAdded = value
|
||||
|
||||
proc outgoingStatus*(self: Item): string {.inline.} =
|
||||
self.outgoingStatus
|
||||
|
||||
|
@ -234,7 +250,9 @@ proc toJsonNode*(self: Item): JsonNode =
|
|||
"senderDisplayName": self.senderDisplayName,
|
||||
"senderLocalName": self.senderLocalName,
|
||||
"amISender": self.amISender,
|
||||
"senderIsAdded": self.senderIsAdded,
|
||||
"senderIcon": self.senderIcon,
|
||||
"senderIdenticon": self.senderIdenticon,
|
||||
"isSenderIconIdenticon": self.isSenderIconIdenticon,
|
||||
"seen": self.seen,
|
||||
"outgoingStatus": self.outgoingStatus,
|
||||
|
|
|
@ -11,8 +11,10 @@ type
|
|||
SenderDisplayName
|
||||
SenderLocalName
|
||||
SenderIcon
|
||||
SenderIdenticon
|
||||
IsSenderIconIdenticon
|
||||
AmISender
|
||||
SenderIsAdded
|
||||
Seen
|
||||
OutgoingStatus
|
||||
MessageText
|
||||
|
@ -82,8 +84,10 @@ QtObject:
|
|||
ModelRole.SenderDisplayName.int:"senderDisplayName",
|
||||
ModelRole.SenderLocalName.int:"senderLocalName",
|
||||
ModelRole.SenderIcon.int:"senderIcon",
|
||||
ModelRole.SenderIdenticon.int:"senderIdenticon",
|
||||
ModelRole.IsSenderIconIdenticon.int:"isSenderIconIdenticon",
|
||||
ModelRole.AmISender.int:"amISender",
|
||||
ModelRole.SenderIsAdded.int:"senderIsAdded",
|
||||
ModelRole.Seen.int:"seen",
|
||||
ModelRole.OutgoingStatus.int:"outgoingStatus",
|
||||
ModelRole.MessageText.int:"messageText",
|
||||
|
@ -130,10 +134,14 @@ QtObject:
|
|||
result = newQVariant(item.senderLocalName)
|
||||
of ModelRole.SenderIcon:
|
||||
result = newQVariant(item.senderIcon)
|
||||
of ModelRole.SenderIdenticon:
|
||||
result = newQVariant(item.senderIdenticon)
|
||||
of ModelRole.IsSenderIconIdenticon:
|
||||
result = newQVariant(item.isSenderIconIdenticon)
|
||||
of ModelRole.AmISender:
|
||||
result = newQVariant(item.amISender)
|
||||
of ModelRole.SenderIsAdded:
|
||||
result = newQVariant(item.senderIsAdded)
|
||||
of ModelRole.Seen:
|
||||
result = newQVariant(item.seen)
|
||||
of ModelRole.OutgoingStatus:
|
||||
|
@ -336,7 +344,7 @@ QtObject:
|
|||
var roles: seq[int]
|
||||
if(self.items[i].senderId == contactId):
|
||||
roles = @[ModelRole.SenderDisplayName.int, ModelRole.SenderLocalName.int, ModelRole.SenderIcon.int,
|
||||
ModelRole.IsSenderIconIdenticon.int]
|
||||
ModelRole.IsSenderIconIdenticon.int, ModelRole.SenderIsAdded.int]
|
||||
if(self.items[i].pinnedBy == contactId):
|
||||
roles.add(ModelRole.PinnedBy.int)
|
||||
if(self.items[i].messageContainsMentions):
|
||||
|
|
|
@ -18,7 +18,9 @@ type
|
|||
alias: string
|
||||
onlineStatus: OnlineStatus
|
||||
icon: string
|
||||
identicon: string
|
||||
isIdenticon: bool
|
||||
isAdded: bool
|
||||
isAdmin: bool
|
||||
joined: bool
|
||||
|
||||
|
@ -30,7 +32,9 @@ proc initItem*(
|
|||
alias: string,
|
||||
onlineStatus: OnlineStatus,
|
||||
icon: string,
|
||||
identicon: string,
|
||||
isidenticon: bool,
|
||||
isAdded: bool = false,
|
||||
isAdmin: bool = false,
|
||||
joined: bool = false,
|
||||
): Item =
|
||||
|
@ -42,7 +46,9 @@ proc initItem*(
|
|||
result.alias = alias
|
||||
result.onlineStatus = onlineStatus
|
||||
result.icon = icon
|
||||
result.identicon = identicon
|
||||
result.isIdenticon = isidenticon
|
||||
result.isAdded = isAdded
|
||||
result.isAdmin = isAdmin
|
||||
result.joined = joined
|
||||
|
||||
|
@ -54,7 +60,9 @@ proc `$`*(self: Item): string =
|
|||
alias: {self.alias},
|
||||
onlineStatus: {$self.onlineStatus.int},
|
||||
icon: {self.icon},
|
||||
identicon: {self.identicon},
|
||||
isIdenticon: {$self.isIdenticon}
|
||||
isAdded: {$self.isAdded}
|
||||
isAdmin: {$self.isAdmin}
|
||||
joined: {$self.joined}
|
||||
]"""
|
||||
|
@ -98,6 +106,9 @@ proc icon*(self: Item): string {.inline.} =
|
|||
proc `icon=`*(self: Item, value: string) {.inline.} =
|
||||
self.icon = value
|
||||
|
||||
proc identicon*(self: Item): string {.inline.} =
|
||||
self.identicon
|
||||
|
||||
proc isIdenticon*(self: Item): bool {.inline.} =
|
||||
self.isIdenticon
|
||||
|
||||
|
@ -110,6 +121,12 @@ proc isAdmin*(self: Item): bool {.inline.} =
|
|||
proc `isAdmin=`*(self: Item, value: bool) {.inline.} =
|
||||
self.isAdmin = value
|
||||
|
||||
proc isAdded*(self: Item): bool {.inline.} =
|
||||
self.isAdded
|
||||
|
||||
proc `isAdded=`*(self: Item, value: bool) {.inline.} =
|
||||
self.isAdded = value
|
||||
|
||||
proc joined*(self: Item): bool {.inline.} =
|
||||
self.joined
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@ type
|
|||
Alias
|
||||
OnlineStatus
|
||||
Icon
|
||||
Identicon
|
||||
IsIdenticon
|
||||
IsAdded
|
||||
IsAdmin
|
||||
Joined
|
||||
|
||||
|
@ -62,7 +64,9 @@ QtObject:
|
|||
ModelRole.Alias.int:"alias",
|
||||
ModelRole.OnlineStatus.int:"onlineStatus",
|
||||
ModelRole.Icon.int:"icon",
|
||||
ModelRole.Identicon.int:"identicon",
|
||||
ModelRole.IsIdenticon.int:"isIdenticon",
|
||||
ModelRole.IsAdded.int:"isAdded",
|
||||
ModelRole.IsAdmin.int:"isAdmin",
|
||||
ModelRole.Joined.int:"joined",
|
||||
}.toTable
|
||||
|
@ -92,8 +96,12 @@ QtObject:
|
|||
result = newQVariant(item.onlineStatus.int)
|
||||
of ModelRole.Icon:
|
||||
result = newQVariant(item.icon)
|
||||
of ModelRole.Identicon:
|
||||
result = newQVariant(item.identicon)
|
||||
of ModelRole.IsIdenticon:
|
||||
result = newQVariant(item.isIdenticon)
|
||||
of ModelRole.IsAdded:
|
||||
result = newQVariant(item.isAdded)
|
||||
of ModelRole.IsAdmin:
|
||||
result = newQVariant(item.isAdmin)
|
||||
of ModelRole.Joined:
|
||||
|
@ -175,6 +183,7 @@ QtObject:
|
|||
alias: string,
|
||||
icon: string,
|
||||
isIdenticon: bool,
|
||||
isAdded: bool = false,
|
||||
isAdmin: bool = false,
|
||||
joined: bool = false
|
||||
) =
|
||||
|
@ -188,6 +197,7 @@ QtObject:
|
|||
self.items[ind].alias = alias
|
||||
self.items[ind].icon = icon
|
||||
self.items[ind].isIdenticon = isIdenticon
|
||||
self.items[ind].isAdded = isAdded
|
||||
self.items[ind].isAdmin = isAdmin
|
||||
self.items[ind].joined = joined
|
||||
|
||||
|
@ -198,7 +208,8 @@ QtObject:
|
|||
ModelRole.Nickname.int,
|
||||
ModelRole.Alias.int,
|
||||
ModelRole.Icon.int,
|
||||
ModelRole.IsIdenticon.int,
|
||||
ModelRole.Identicon.int,
|
||||
ModelRole.IsAdded.int,
|
||||
ModelRole.IsAdmin.int,
|
||||
ModelRole.Joined.int,
|
||||
])
|
||||
|
|
|
@ -200,6 +200,7 @@ QtObject:
|
|||
identicon: singletonInstance.userProfile.getIdenticon(),
|
||||
alias: singletonInstance.userProfile.getUsername(),
|
||||
ensVerified: singletonInstance.userProfile.getEnsName().len > 0,
|
||||
added: true,
|
||||
image: Images(
|
||||
thumbnail: singletonInstance.userProfile.getThumbnailImage(),
|
||||
large: singletonInstance.userProfile.getLargeImage()
|
||||
|
|
|
@ -45,6 +45,10 @@ const KEY_GIF_FAVORITES* = "gifs/favorite-gifs"
|
|||
const KEY_GIF_RECENTS* = "gifs/recent-gifs"
|
||||
const KEY_GIF_API_KEY* = "gifs/api-key"
|
||||
|
||||
const PROFILE_PICTURES_VISIBILITY_CONTACTS_ONLY* = 1
|
||||
const PROFILE_PICTURES_VISIBILITY_EVERYONE* = 2
|
||||
const PROFILE_PICTURES_VISIBILITY_NO_ONE* = 3
|
||||
|
||||
type UpstreamConfig* = object
|
||||
Enabled*: bool
|
||||
URL*: string
|
||||
|
|
|
@ -6,6 +6,7 @@ import service_interface, ./dto/settings
|
|||
import ../../../backend/settings as status_settings
|
||||
|
||||
export service_interface
|
||||
export settings
|
||||
|
||||
logScope:
|
||||
topics = "settings-service"
|
||||
|
|
|
@ -18,7 +18,18 @@ Item {
|
|||
property string publicKey: ""
|
||||
property string name: ""
|
||||
property string icon: ""
|
||||
property string identicon: ""
|
||||
property bool isIdenticon: true
|
||||
property bool isAdded: false
|
||||
property string iconToShow: {
|
||||
if (isIdenticon || (!isAdded &&
|
||||
Global.privacyModuleInst.profilePicturesVisibility !==
|
||||
Constants.profilePicturesVisibility.everyone)) {
|
||||
return identicon
|
||||
}
|
||||
|
||||
return icon
|
||||
}
|
||||
property int userStatus: Constants.userStatus.offline
|
||||
property var messageContextMenu
|
||||
property bool enableMouseArea: true
|
||||
|
@ -45,7 +56,7 @@ Item {
|
|||
image: StatusImageSettings {
|
||||
width: 28
|
||||
height: 28
|
||||
source: wrapper.icon
|
||||
source: wrapper.iconToShow
|
||||
isIdenticon: wrapper.isIdenticon
|
||||
}
|
||||
icon: StatusIconSettings {
|
||||
|
@ -118,7 +129,7 @@ Item {
|
|||
messageContextMenu.myPublicKey = userProfile.pubKey
|
||||
messageContextMenu.selectedUserPublicKey = wrapper.publicKey
|
||||
messageContextMenu.selectedUserDisplayName = wrapper.name
|
||||
messageContextMenu.selectedUserIcon = wrapper.icon
|
||||
messageContextMenu.selectedUserIcon = wrapper.iconToShow
|
||||
messageContextMenu.isSelectedUserIconIdenticon = wrapper.isIdenticon
|
||||
messageContextMenu.popup()
|
||||
}
|
||||
|
|
|
@ -56,7 +56,9 @@ Item {
|
|||
publicKey: model.id
|
||||
name: model.name
|
||||
icon: model.icon
|
||||
identicon: model.identicon
|
||||
isIdenticon: model.isIdenticon
|
||||
isAdded: model.isAdded
|
||||
userStatus: model.onlineStatus
|
||||
messageContextMenu: root.messageContextMenu
|
||||
}
|
||||
|
|
|
@ -255,6 +255,8 @@ Item {
|
|||
senderDisplayName: model.senderDisplayName
|
||||
senderLocalName: model.senderLocalName
|
||||
senderIcon: model.senderIcon
|
||||
senderIdenticon: model.senderIdenticon
|
||||
senderIsAdded: model.senderIsAdded
|
||||
isSenderIconIdenticon: model.isSenderIconIdenticon
|
||||
amISender: model.amISender
|
||||
message: model.messageText
|
||||
|
|
|
@ -18,6 +18,10 @@ StatusAppTwoPanelLayout {
|
|||
property var globalStore
|
||||
property var systemPalette
|
||||
|
||||
Component.onCompleted: {
|
||||
Global.privacyModuleInst = store.privacyStore.privacyModule
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: _internal
|
||||
readonly property int contentMaxWidth: 624
|
||||
|
|
|
@ -8,6 +8,7 @@ QtObject {
|
|||
|
||||
// Module Properties
|
||||
property bool mnemonicBackedUp: privacyModule.mnemonicBackedUp
|
||||
property int profilePicturesVisibility: privacyModule.profilePicturesVisibility
|
||||
|
||||
function getLinkPreviewWhitelist() {
|
||||
return root.privacyModule.getLinkPreviewWhitelist()
|
||||
|
@ -32,4 +33,8 @@ QtObject {
|
|||
function validatePassword(password) {
|
||||
return root.privacyModule.validatePassword(password)
|
||||
}
|
||||
|
||||
function setProfilePicturesVisibility(value) {
|
||||
return root.privacyModule.setProfilePicturesVisibility(value)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,6 +148,7 @@ Item {
|
|||
bottomPadding: Style.current.halfPadding
|
||||
}
|
||||
|
||||
// TODO change this component from a switch to a chooser between, everyone, contacts and no one
|
||||
StatusListItem {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Style.current.padding
|
||||
|
@ -159,10 +160,19 @@ Item {
|
|||
components: [
|
||||
StatusQControls.StatusSwitch {
|
||||
id: switch1
|
||||
checked: !localAccountSensitiveSettings.onlyShowContactsProfilePics
|
||||
checked: root.privacyStore.profilePicturesVisibility ===
|
||||
Constants.profilePicturesVisibility.everyone
|
||||
onCheckedChanged: {
|
||||
if (localAccountSensitiveSettings.onlyShowContactsProfilePics === checked) {
|
||||
localAccountSensitiveSettings.onlyShowContactsProfilePics = !checked
|
||||
if (checked && root.privacyStore.profilePicturesVisibility !==
|
||||
Constants.profilePicturesVisibility.everyone) {
|
||||
root.privacyStore.setProfilePicturesVisibility(
|
||||
Constants.profilePicturesVisibility.everyone
|
||||
)
|
||||
} else if (!checked && root.privacyStore.profilePicturesVisibility ===
|
||||
Constants.profilePicturesVisibility.everyone) {
|
||||
root.privacyStore.setProfilePicturesVisibility(
|
||||
Constants.profilePicturesVisibility.contacts
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,13 @@ StatusModal {
|
|||
userName = contactDetails.alias
|
||||
userNickname = contactDetails.localNickname
|
||||
userEnsName = contactDetails.name
|
||||
userIcon = contactDetails.displayIcon
|
||||
if (contactDetails.isDisplayIconIdenticon || (!contactDetails.isContact &&
|
||||
Global.privacyModuleInst.profilePicturesVisibility !==
|
||||
Constants.profilePicturesVisibility.everyone)) {
|
||||
userIcon = contactDetails.identicon
|
||||
} else {
|
||||
userIcon = contactDetails.displayIcon
|
||||
}
|
||||
userIsEnsVerified = contactDetails.ensVerified
|
||||
userIsBlocked = contactDetails.isBlocked
|
||||
isAddedContact = contactDetails.isContact
|
||||
|
|
|
@ -34,6 +34,8 @@ Item {
|
|||
property int stickerPack
|
||||
property bool isMessageActive: false
|
||||
property bool amISender: false
|
||||
property string senderIcon: ""
|
||||
property bool isSenderIconIdenticon: true
|
||||
property bool isHovered: false
|
||||
property bool isInPinnedPopup: false
|
||||
property string communityId
|
||||
|
@ -317,8 +319,8 @@ Item {
|
|||
anchors.top: chatReply.active ? chatReply.bottom :
|
||||
pinnedRectangleLoader.active ? pinnedRectangleLoader.bottom : parent.top
|
||||
anchors.topMargin: chatReply.active || pinnedRectangleLoader.active ? 4 : Style.current.smallPadding
|
||||
icon: senderIcon
|
||||
isIdenticon: isSenderIconIdenticon
|
||||
icon: root.senderIcon
|
||||
isIdenticon: root.isSenderIconIdenticon
|
||||
onClickMessage: {
|
||||
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, false, "")
|
||||
}
|
||||
|
|
|
@ -34,8 +34,18 @@ Column {
|
|||
property string senderDisplayName: ""
|
||||
property string senderLocalName: ""
|
||||
property string senderIcon: ""
|
||||
property string senderIdenticon: ""
|
||||
property bool isSenderIconIdenticon: true
|
||||
property bool amISender: false
|
||||
property bool senderIsAdded: false
|
||||
property string senderIconToShow: {
|
||||
if (isSenderIconIdenticon || (!senderIsAdded &&
|
||||
Global.privacyModuleInst.profilePicturesVisibility !==
|
||||
Constants.profilePicturesVisibility.everyone)) {
|
||||
return senderIdenticon
|
||||
}
|
||||
return senderIcon
|
||||
}
|
||||
property string message: ""
|
||||
property string messageImage: ""
|
||||
property string messageTimestamp: ""
|
||||
|
@ -170,7 +180,7 @@ Column {
|
|||
|
||||
messageContextMenu.selectedUserPublicKey = root.senderId
|
||||
messageContextMenu.selectedUserDisplayName = root.senderDisplayName
|
||||
messageContextMenu.selectedUserIcon = root.senderIcon
|
||||
messageContextMenu.selectedUserIcon = root.senderIconToShow
|
||||
messageContextMenu.isSelectedUserIconIdenticon = root.isSenderIconIdenticon
|
||||
|
||||
messageContextMenu.imageSource = imageSource
|
||||
|
@ -374,6 +384,8 @@ Column {
|
|||
sticker: root.sticker
|
||||
stickerPack: root.stickerPack
|
||||
isMessageActive: root.isMessageActive
|
||||
isSenderIconIdenticon: root.isSenderIconIdenticon
|
||||
senderIcon: root.senderIconToShow
|
||||
amISender: root.amISender
|
||||
isHovered: root.isHovered
|
||||
editModeOn: root.editModeOn
|
||||
|
|
|
@ -79,6 +79,12 @@ QtObject {
|
|||
readonly property int editType: 11
|
||||
}
|
||||
|
||||
readonly property QtObject profilePicturesVisibility: QtObject {
|
||||
readonly property int contactsOnly: 1
|
||||
readonly property int everyone: 2
|
||||
readonly property int noOne: 3
|
||||
}
|
||||
|
||||
readonly property int communityImported: 0
|
||||
readonly property int communityImportingInProgress: 1
|
||||
readonly property int communityImportingError: 2
|
||||
|
|
|
@ -13,6 +13,7 @@ QtObject {
|
|||
property var errorSound
|
||||
|
||||
property var mainModuleInst
|
||||
property var privacyModuleInst
|
||||
property var toastMessage
|
||||
property bool profilePopupOpened: false
|
||||
property string currentNetworkId: ""
|
||||
|
@ -58,7 +59,9 @@ QtObject {
|
|||
}
|
||||
|
||||
let contactDetails = Utils.getContactDetailsAsJson(pubkey)
|
||||
if (localAccountSensitiveSettings.onlyShowContactsProfilePics && !contactDetails.isContact) {
|
||||
|
||||
if (root.privacyModuleInst.profilePicturesVisibility !==
|
||||
Constants.profilePicturesVisibility.everyone && !contactDetails.isContact) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue