diff --git a/src/app/profile/core.nim b/src/app/profile/core.nim index e8e7f86474..08ed867efd 100644 --- a/src/app/profile/core.nim +++ b/src/app/profile/core.nim @@ -40,10 +40,12 @@ proc init*(self: ProfileController, account: Account) = let network = self.status.settings.getSetting[:string](Setting.Networks_CurrentNetwork, DEFAULT_NETWORK_NAME) let appearance = self.status.settings.getSetting[:int](Setting.Appearance) let messagesFromContactsOnly = self.status.settings.getSetting[:bool](Setting.MessagesFromContactsOnly) + let sendUserStatus = self.status.settings.getSetting[:bool](Setting.SendUserStatus) profile.appearance = appearance profile.id = pubKey profile.address = account.keyUid profile.messagesFromContactsOnly = messagesFromContactsOnly + profile.sendUserStatus = sendUserStatus let identityImage = self.status.profile.getIdentityImage(profile.address) diff --git a/src/app/profile/view.nim b/src/app/profile/view.nim index 1c19a781f1..10eb6fcb32 100644 --- a/src/app/profile/view.nim +++ b/src/app/profile/view.nim @@ -179,3 +179,10 @@ QtObject: QtProperty[QVariant] mutedChats: read = getMutedChats + + proc setSendUserStatus*(self: ProfileView, sendUserStatus: bool) {.slot.} = + if (sendUserStatus == self.profile.sendUserStatus): + return + self.profile.setSendUserStatus(sendUserStatus) + self.status.saveSetting(Setting.SendUserStatus, sendUserStatus) + diff --git a/src/app/profile/views/profile_info.nim b/src/app/profile/views/profile_info.nim index c3d222d696..f2360a16bb 100644 --- a/src/app/profile/views/profile_info.nim +++ b/src/app/profile/views/profile_info.nim @@ -14,6 +14,7 @@ QtObject: appearance*: int ensVerified*: bool messagesFromContactsOnly*: bool + sendUserStatus*: bool proc setup(self: ProfileInfoView) = self.QObject.setup @@ -31,6 +32,7 @@ QtObject: result.identityImage = IdentityImage() result.ensVerified = false result.messagesFromContactsOnly = false + result.sendUserStatus = false result.setup proc profileChanged*(self: ProfileInfoView) {.signal.} @@ -46,6 +48,7 @@ QtObject: self.ensVerified = profile.ensVerified self.identityImage = profile.identityImage self.messagesFromContactsOnly = profile.messagesFromContactsOnly + self.sendUserStatus = profile.sendUserStatus self.profileChanged() proc setIdentityImage*(self: ProfileInfoView, identityImage: IdentityImage) = @@ -130,3 +133,14 @@ QtObject: QtProperty[bool] ensVerified: read = ensVerified notify = profileChanged + + proc sendUserStatus*(self: ProfileInfoView): bool {.slot.} = result = self.sendUserStatus + proc setSendUserStatus*(self: ProfileInfoView, sendUserStatus: bool) {.slot.} = + if self.sendUserStatus == sendUserStatus: + return + self.sendUserStatus = sendUserStatus + self.profileChanged() + QtProperty[bool] sendUserStatus: + read = sendUserStatus + write = setSendUserStatus + notify = profileChanged \ No newline at end of file diff --git a/src/status/profile/profile.nim b/src/status/profile/profile.nim index 102b530ce9..0fa4886507 100644 --- a/src/status/profile/profile.nim +++ b/src/status/profile/profile.nim @@ -5,6 +5,7 @@ type Profile* = ref object id*, alias*, username*, identicon*, address*, ensName*, localNickname*: string ensVerified*: bool messagesFromContactsOnly*: bool + sendUserStatus*: bool identityImage*: IdentityImage appearance*: int systemTags*: seq[string] diff --git a/src/status/types.nim b/src/status/types.nim index 2084fff3ff..c88b9376b7 100644 --- a/src/status/types.nim +++ b/src/status/types.nim @@ -197,6 +197,7 @@ type VisibleTokens = "wallet/visible-tokens" PinnedMailservers = "pinned-mailservers" WakuBloomFilterMode = "waku-bloom-filter-mode" + SendUserStatus = "send-status-updates?" UpstreamConfig* = ref object enabled* {.serializedFieldName("Enabled").}: bool diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityUserList.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityUserList.qml index 4441cde34e..3f6f131c20 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityUserList.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityUserList.qml @@ -42,8 +42,7 @@ Rectangle { property string nickname: appMain.getUserNickname(model.pubKey) publicKey: model.pubKey - name: chatsModel.communities.activeCommunity.memberLastSeen(model.pubKey) + "--" + ( !model.userName.endsWith(".eth") && !!nickname ? - nickname : Utils.removeStatusEns(model.userName)) + name: !model.userName.endsWith(".eth") && !!nickname ? nickname : Utils.removeStatusEns(model.userName) identicon: model.identicon lastSeen: chatsModel.communities.activeCommunity.memberLastSeen(model.pubKey) currentTime: svRoot.currentTime diff --git a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml index 68a4b59e51..6efc523bcf 100644 --- a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml @@ -126,8 +126,8 @@ Item { } StatusSettingsLineButton { - //% "Online users" - text: qsTrId("online-users") + id: onlineUsers + text: qsTr("Online users") isSwitch: true switchChecked: appSettings.showOnlineUsers onClicked: { @@ -135,6 +135,20 @@ Item { } } + Loader { + active: onlineUsers.switchChecked + anchors.left: parent.left + anchors.right: parent.right + sourceComponent: StatusSettingsLineButton { + text: qsTr("Broadcast user status") + isSwitch: true + switchChecked: profileModel.profile.sendUserStatus + onClicked: function (checked) { + profileModel.setSendUserStatus(checked) + } + } + } + StatusSectionHeadline { text: qsTr("Bloom filter level") topPadding: Style.current.bigPadding @@ -212,7 +226,7 @@ Item { } } } - } + } // StatusSettingsLineButton { // //% "Node Management"