Add messages from contacts only

This commit is contained in:
Andrea Maria Piana 2021-04-12 10:26:43 +02:00
parent 310a1ad5f1
commit 5bb849f9c1
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
5 changed files with 115 additions and 64 deletions

View File

@ -0,0 +1,33 @@
(ns status-im.ui.screens.privacy-and-security-settings.messages-from-contacts-only
(:require-macros [status-im.utils.views :as views])
(:require [re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[status-im.ui.components.react :as react]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.ui.components.topbar :as topbar]
[status-im.i18n.i18n :as i18n]
[quo.core :as quo]))
(fx/defn handle-messages-from-contacts-only-switched
{:events [::messages-from-contacts-only-switched]}
[cofx value]
(multiaccounts.update/multiaccount-update cofx
:messages-from-contacts-only value {}))
(views/defview messages-from-contacts-only []
(views/letsubs [{:keys [messages-from-contacts-only]} [:multiaccount]]
[react/view {:flex 1}
[topbar/topbar {:title (i18n/label :t/accept-new-chats-from)}]
[react/view {:margin-top 8}
[quo/list-item
{:active (not messages-from-contacts-only)
:accessory :radio
:title (i18n/label :t/anyone)
:on-press #(re-frame/dispatch [::messages-from-contacts-only-switched false])}]
[quo/list-item
{:active messages-from-contacts-only
:accessory :radio
:title (i18n/label :t/contacts)
:subtitle (i18n/label :t/messages-from-contacts-only-subtitle)
:subtitle-max-lines 4
:on-press #(re-frame/dispatch [::messages-from-contacts-only-switched true])}]]]))

View File

@ -14,7 +14,10 @@
[quo/separator {:style {:margin-vertical 8}}]) [quo/separator {:style {:margin-vertical 8}}])
(views/defview privacy-and-security [] (views/defview privacy-and-security []
(views/letsubs [{:keys [mnemonic preview-privacy? webview-allow-permission-requests?]} [:multiaccount] (views/letsubs [{:keys [mnemonic
preview-privacy?
messages-from-contacts-only
webview-allow-permission-requests?]} [:multiaccount]
supported-biometric-auth [:supported-biometric-auth] supported-biometric-auth [:supported-biometric-auth]
auth-method [:auth-method]] auth-method [:auth-method]]
[react/view {:flex 1 :background-color colors/white} [react/view {:flex 1 :background-color colors/white}
@ -67,6 +70,15 @@
:chevron true :chevron true
:on-press #(re-frame/dispatch [:navigate-to :link-previews-settings]) :on-press #(re-frame/dispatch [:navigate-to :link-previews-settings])
:accessibility-label :chat-link-previews}] :accessibility-label :chat-link-previews}]
[quo/list-item {:size :small
:title (i18n/label :t/accept-new-chats-from)
:chevron true
:accessory :text
:accessory-text (i18n/label (if messages-from-contacts-only
:t/contacts
:t/anyone))
:on-press #(re-frame/dispatch [:navigate-to :messages-from-contacts-only])
:accessibility-label :accept-new-chats-from}]
(when platform/android? (when platform/android?
[quo/list-item {:size :small [quo/list-item {:size :small
:title (i18n/label :t/webview-camera-permission-requests) :title (i18n/label :t/webview-camera-permission-requests)

View File

@ -16,6 +16,7 @@
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions] [status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
[status-im.ui.screens.link-previews-settings.views :as link-previews-settings] [status-im.ui.screens.link-previews-settings.views :as link-previews-settings]
[status-im.ui.screens.privacy-and-security-settings.views :as privacy-and-security] [status-im.ui.screens.privacy-and-security-settings.views :as privacy-and-security]
[status-im.ui.screens.privacy-and-security-settings.messages-from-contacts-only :as messages-from-contacts-only]
[status-im.ui.screens.sync-settings.views :as sync-settings] [status-im.ui.screens.sync-settings.views :as sync-settings]
[status-im.ui.screens.advanced-settings.views :as advanced-settings] [status-im.ui.screens.advanced-settings.views :as advanced-settings]
[status-im.ui.screens.help-center.views :as help-center] [status-im.ui.screens.help-center.views :as help-center]
@ -82,6 +83,8 @@
:component link-previews-settings/link-previews-settings} :component link-previews-settings/link-previews-settings}
{:name :privacy-and-security {:name :privacy-and-security
:component privacy-and-security/privacy-and-security} :component privacy-and-security/privacy-and-security}
{:name :messages-from-contacts-only
:component messages-from-contacts-only/messages-from-contacts-only}
{:name :appearance {:name :appearance
:component appearance/appearance} :component appearance/appearance}
{:name :appearance-profile-pic {:name :appearance-profile-pic

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead", "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.75.2", "version": "feature/notification-center-2",
"commit-sha1": "ddc48c7cf45f8176ed23f82478cd1bde1811e8a6", "commit-sha1": "6322d0c1ed9cee5f00eba53ad60daa47fc388944",
"src-sha256": "17nxdspixvj47xli6b2583yll5iky5msiyib8wg6v8m48ssq21ka" "src-sha256": "1ljcds0qfx2n2fm4in5ja12dfbkr0xi5y1h30hkzh1wr104d03gb"
} }

View File

@ -9,6 +9,9 @@
"accept-and-share-address": "Accept and share address", "accept-and-share-address": "Accept and share address",
"account-added": "Account added", "account-added": "Account added",
"account-color": "Account color", "account-color": "Account color",
"anyone": "Anyone",
"messages-from-contacts-only-subtitle": "Only people you added as contacts can start a new chat with you or invite you to a group",
"accept-new-chats-from": "Accept new chats from",
"account-name": "Account name", "account-name": "Account name",
"account-settings": "Account settings", "account-settings": "Account settings",
"accounts": "Accounts", "accounts": "Accounts",