chore(general): Remove profile pictures visibility options

From now on, if the image is available it should be displayed
uncoditionally.

Closes: #7609
This commit is contained in:
Michał Cieślak 2022-10-06 22:15:15 +02:00 committed by Iuri Matias
parent 948dc8e747
commit f0e238dce6
12 changed files with 6 additions and 271 deletions

View File

@ -37,14 +37,6 @@ proc init*(self: Controller) =
var args = OperationSuccessArgs(e)
self.delegate.onPasswordChanged(args.success, args.errorMsg)
self.events.on(SIGNAL_SETTING_PROFILE_PICTURES_SHOW_TO_CHANGED) do(e: Args):
var args = SettingProfilePictureArgs(e)
self.delegate.emitProfilePicturesShowToChanged(args.value)
self.events.on(SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED) do(e: Args):
var args = SettingProfilePictureArgs(e)
self.delegate.emitProfilePicturesVisibilityChanged(args.value)
proc isMnemonicBackedUp*(self: Controller): bool =
return self.privacyService.isMnemonicBackedUp()
@ -72,18 +64,6 @@ proc setMessagesFromContactsOnly*(self: Controller, value: bool): bool =
proc validatePassword*(self: Controller, password: string): bool =
return self.privacyService.validatePassword(password)
proc getProfilePicturesShowTo*(self: Controller): int =
self.settingsService.getProfilePicturesShowTo()
proc setProfilePicturesShowTo*(self: Controller, value: int): bool =
self.settingsService.saveProfilePicturesShowTo(value)
proc getProfilePicturesVisibility*(self: Controller): int =
self.settingsService.getProfilePicturesVisibility()
proc setProfilePicturesVisibility*(self: Controller, value: int): bool =
self.settingsService.saveProfilePicturesVisibility(value)
method getPasswordStrengthScore*(self: Controller, password, userName: string): int =
return self.generalService.getPasswordStrengthScore(password, userName)

View File

@ -56,24 +56,5 @@ 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")
method getPasswordStrengthScore*(self: AccessInterface, password: string): int {.base.} =
raise newException(ValueError, "No implementation available")
method emitProfilePicturesShowToChanged*(self: AccessInterface, value: int) {.base.} =
raise newException(ValueError, "No implementation available")
method emitProfilePicturesVisibilityChanged*(self: AccessInterface, value: int) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -83,25 +83,5 @@ 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 emitProfilePicturesShowToChanged*(self: Module, value: int) =
self.view.profilePicturesShowToChanged()
method emitProfilePicturesVisibilityChanged*(self: Module, value: int) =
self.view.profilePicturesVisibilityChanged()
method getProfilePicturesVisibility*(self: Module): int =
self.controller.getProfilePicturesVisibility()
method setProfilePicturesVisibility*(self: Module, value: int) =
if (self.controller.setProfilePicturesVisibility(value)):
self.view.profilePicturesVisibilityChanged()
method getPasswordStrengthScore*(self: Module, password: string): int =
return self.controller.getPasswordStrengthScore(password, singletonInstance.userProfile.getUsername())
return self.controller.getPasswordStrengthScore(password, singletonInstance.userProfile.getUsername())

View File

@ -61,25 +61,5 @@ 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)
proc getPasswordStrengthScore*(self: View, password: string): int {.slot.} =
return self.delegate.getPasswordStrengthScore(password)
return self.delegate.getPasswordStrengthScore(password)

View File

@ -26,8 +26,6 @@ const KEY_SIGNING_PHRASE* = "signing-phrase"
const KEY_DEFAULT_SYNC_PERIOD* = "default-sync-period"
const KEY_SEND_PUSH_NOTIFICATIONS* = "send-push-notifications?"
const KEY_APPEARANCE* = "appearance"
const KEY_PROFILE_PICTURES_SHOW_TO* = "profile-pictures-show-to"
const KEY_PROFILE_PICTURES_VISIBILITY* = "profile-pictures-visibility"
const KEY_USE_MAILSERVERS* = "use-mailservers?"
const KEY_WALLET_ROOT_ADDRESS* = "wallet-root-address"
const KEY_SEND_STATUS_UPDATES* = "send-status-updates?"
@ -115,8 +113,6 @@ type
defaultSyncPeriod*: int
sendPushNotifications*: bool
appearance*: int
profilePicturesShowTo*: int
profilePicturesVisibility*: int
useMailservers*: bool
walletRootAddress*: string
sendStatusUpdates*: bool
@ -151,12 +147,7 @@ proc toCurrentUserStatus*(jsonObj: JsonNode): CurrentUserStatus =
proc toSettingsFieldDto*(jsonObj: JsonNode): SettingsFieldDto =
var field = SettingsFieldDto()
field.name = jsonObj["name"].getStr()
case field.name:
of KEY_PROFILE_PICTURES_SHOW_TO, KEY_PROFILE_PICTURES_VISIBILITY:
field.value = jsonObj["value"].getInt().intToStr
else:
field.value = jsonObj["value"].getStr()
field.value = jsonObj["value"].getStr()
result = field
proc toSettingsDto*(jsonObj: JsonNode): SettingsDto =
@ -181,8 +172,6 @@ proc toSettingsDto*(jsonObj: JsonNode): SettingsDto =
discard jsonObj.getProp(KEY_DEFAULT_SYNC_PERIOD, result.defaultSyncPeriod)
discard jsonObj.getProp(KEY_SEND_PUSH_NOTIFICATIONS, result.sendPushNotifications)
discard jsonObj.getProp(KEY_APPEARANCE, result.appearance)
discard jsonObj.getProp(KEY_PROFILE_PICTURES_SHOW_TO, result.profilePicturesShowTo)
discard jsonObj.getProp(KEY_PROFILE_PICTURES_VISIBILITY, result.profilePicturesVisibility)
discard jsonObj.getProp(KEY_USE_MAILSERVERS, result.useMailservers)
discard jsonObj.getProp(KEY_WALLET_ROOT_ADDRESS, result.walletRootAddress)
discard jsonObj.getProp(KEY_SEND_STATUS_UPDATES, result.sendStatusUpdates)

View File

@ -21,8 +21,6 @@ const DEFAULT_TELEMETRY_SERVER_URL* = "https://telemetry.status.im"
const DEFAULT_FLEET* = $Fleet.StatusProd
const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated"
const SIGNAL_SETTING_PROFILE_PICTURES_SHOW_TO_CHANGED* = "profilePicturesShowToChanged"
const SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED* = "profilePicturesVisibilityChanged"
logScope:
topics = "settings-service"
@ -66,15 +64,6 @@ QtObject:
if receivedData.settings.len > 0:
for settingsField in receivedData.settings:
if settingsField.name == KEY_PROFILE_PICTURES_SHOW_TO:
self.settings.profilePicturesShowTo = settingsfield.value.parseInt
self.events.emit(SIGNAL_SETTING_PROFILE_PICTURES_SHOW_TO_CHANGED, SettingProfilePictureArgs(value: self.settings.profilePicturesShowTo))
if settingsField.name == KEY_PROFILE_PICTURES_VISIBILITY:
self.settings.profilePicturesVisibility = settingsfield.value.parseInt
self.events.emit(SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED, SettingProfilePictureArgs(value: self.settings.profilePicturesVisibility))
if settingsField.name == KEY_CURRENCY:
self.settings.currency = settingsField.value
@ -286,24 +275,6 @@ QtObject:
proc getAppearance*(self: Service): int =
self.settings.appearance
proc saveProfilePicturesShowTo*(self: Service, value: int): bool =
if(self.saveSetting(KEY_PROFILE_PICTURES_SHOW_TO, value)):
self.settings.profilePicturesShowTo = value
return true
return false
proc getProfilePicturesShowTo*(self: Service): int =
self.settings.profilePicturesShowTo
proc saveProfilePicturesVisibility*(self: Service, value: int): bool =
if(self.saveSetting(KEY_PROFILE_PICTURES_VISIBILITY, value)):
self.settings.profilePicturesVisibility = value
return true
return false
proc getProfilePicturesVisibility*(self: Service): int =
self.settings.profilePicturesVisibility
proc saveUseMailservers*(self: Service, value: bool): bool =
if(self.saveSetting(KEY_USE_MAILSERVERS, value)):
self.settings.useMailservers = value

View File

@ -87,17 +87,7 @@ Item {
isVerified: model.isVerified
isUntrustworthy: model.isUntrustworthy
isAdmin: model.isAdmin
asset.name: {
const isCurrentUser = model.pubKey === root.rootStore.getPubkey()
const visibility = Global.privacyModuleInst.profilePicturesVisibility
if (isCurrentUser
|| visibility === Constants.profilePicturesVisibility.everyone
|| (visibility === Constants.profilePicturesVisibility.contactsOnly && model.isContact))
return model.icon
return ""
}
asset.name: model.icon
asset.isImage: (asset.name !== "")
asset.isLetterIdenticon: (asset.name === "")
asset.color: Utils.colorForColorId(model.colorId)

View File

@ -7,9 +7,6 @@ QtObject {
property var privacyModule
property var syncModule
property int profilePicturesVisibility: privacyModule.profilePicturesVisibility
property int profilePicturesShowTo: privacyModule.profilePicturesShowTo
property var mailservers: syncModule.model
property bool useMailservers: syncModule.useMailservers
@ -44,12 +41,4 @@ QtObject {
function getLinkPreviewWhitelist() {
return root.privacyModule.getLinkPreviewWhitelist()
}
function setProfilePicturesVisibility(value) {
return root.privacyModule.setProfilePicturesVisibility(value)
}
function setProfilePicturesShowTo(value) {
return root.privacyModule.setProfilePicturesShowTo(value)
}
}

View File

@ -71,105 +71,6 @@ SettingsContentBase {
}
}
// SHOW PROFILE PICTURE TO
StatusBaseText {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
text: qsTr("Show My Profile Picture To")
font.pixelSize: 15
color: Theme.palette.directColor1
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("Everyone")
group: showProfilePictureToGroup
checked: root.messagingStore.profilePicturesShowTo ===
Constants.profilePicturesShowTo.everyone
onClicked: root.messagingStore.setProfilePicturesShowTo(
Constants.profilePicturesShowTo.everyone
)
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("Contacts")
group: showProfilePictureToGroup
checked: root.messagingStore.profilePicturesShowTo ===
Constants.profilePicturesShowTo.contactsOnly
onClicked: root.messagingStore.setProfilePicturesShowTo(
Constants.profilePicturesShowTo.contactsOnly
)
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("No One")
group: showProfilePictureToGroup
checked: root.messagingStore.profilePicturesShowTo ===
Constants.profilePicturesShowTo.noOne
onClicked: root.messagingStore.setProfilePicturesShowTo(
Constants.profilePicturesShowTo.noOne
)
}
// SEE PROFILTE PICTURES FROM
StatusBaseText {
Layout.topMargin: Constants.settingsSection.itemSpacing
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
text: qsTr("See Profile Pictures From")
font.pixelSize: 15
color: Theme.palette.directColor1
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("Everyone")
group: seeProfilePicturesFromGroup
checked: root.messagingStore.profilePicturesVisibility ===
Constants.profilePicturesVisibility.everyone
onClicked: root.messagingStore.setProfilePicturesVisibility(
Constants.profilePicturesVisibility.everyone
)
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("Contacts")
group: seeProfilePicturesFromGroup
checked: root.messagingStore.profilePicturesVisibility ===
Constants.profilePicturesVisibility.contactsOnly
onClicked: root.messagingStore.setProfilePicturesVisibility(
Constants.profilePicturesVisibility.contactsOnly
)
}
SettingsRadioButton {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
label: qsTr("No One")
group: seeProfilePicturesFromGroup
checked: root.messagingStore.profilePicturesVisibility ===
Constants.profilePicturesVisibility.noOne
onClicked: root.messagingStore.setProfilePicturesVisibility(
Constants.profilePicturesVisibility.noOne
)
}
// Open Message Links With
StatusBaseText {
Layout.topMargin: Constants.settingsSection.itemSpacing

View File

@ -47,14 +47,6 @@ Loader {
property bool amISender: false
property bool senderIsAdded: false
property int senderTrustStatus: Constants.trustStatus.unknown
readonly property string senderIconToShow: {
if ((!senderIsAdded &&
Global.privacyModuleInst.profilePicturesVisibility !==
Constants.profilePicturesVisibility.everyone)) {
return ""
}
return senderIcon
}
property string messageText: ""
property string messageImage: ""
property double messageTimestamp: 0 // We use double, because QML's int is too small
@ -158,7 +150,7 @@ Loader {
messageContextMenu.selectedUserPublicKey = root.senderId
messageContextMenu.selectedUserDisplayName = root.senderDisplayName
messageContextMenu.selectedUserIcon = root.senderIconToShow
messageContextMenu.selectedUserIcon = root.senderIcon
messageContextMenu.imageSource = imageSource
@ -336,7 +328,7 @@ Loader {
root.messageStore.getChatIcon() !== "") {
return root.messageStore.getChatIcon()
}
return root.senderIconToShow
return root.senderIcon
}
}
}

View File

@ -249,18 +249,6 @@ QtObject {
readonly property int responseToMessageWithId: 262 // ModelRole.ResponseToMessageWithId
}
readonly property QtObject profilePicturesVisibility: QtObject {
readonly property int contactsOnly: 1
readonly property int everyone: 2
readonly property int noOne: 3
}
readonly property QtObject profilePicturesShowTo: QtObject {
readonly property int contactsOnly: 1
readonly property int everyone: 2
readonly property int noOne: 3
}
readonly property QtObject trustStatus: QtObject {
readonly property int unknown: 0
readonly property int trusted: 1

View File

@ -101,12 +101,6 @@ Item {
}
let contactDetails = Utils.getContactDetailsAsJson(pubkey)
if (root.privacyModuleInst.profilePicturesVisibility !==
Constants.profilePicturesVisibility.everyone && !contactDetails.isAdded) {
return;
}
return contactDetails.displayIcon
}