Add sender name in PNs (if db is unlocked)
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
parent
fca51beaaa
commit
7366f8973b
2
deps.edn
2
deps.edn
|
@ -1,5 +1,5 @@
|
||||||
{:paths ["components/src" "src" "react-native/src/cljsjs" "resources"]
|
{:paths ["components/src" "src" "react-native/src/cljsjs" "resources"]
|
||||||
:deps {org.clojure/clojure {:mvn/version "1.9.0"}
|
:deps {org.clojure/clojure {:mvn/version "1.9.0"} ;; Keep in sync with .TOOLVERSIONS
|
||||||
org.clojure/clojurescript {:mvn/version "1.10.439"}
|
org.clojure/clojurescript {:mvn/version "1.10.439"}
|
||||||
org.clojure/core.async {:mvn/version "0.4.474"}
|
org.clojure/core.async {:mvn/version "0.4.474"}
|
||||||
reagent {:mvn/version "0.7.0"
|
reagent {:mvn/version "0.7.0"
|
||||||
|
|
|
@ -79,11 +79,14 @@
|
||||||
(def group-id "im.status.ethereum.MESSAGE")
|
(def group-id "im.status.ethereum.MESSAGE")
|
||||||
(def icon "ic_stat_status_notification")
|
(def icon "ic_stat_status_notification")
|
||||||
|
|
||||||
|
(defn- hash->contact [hash-or-pubkey accounts]
|
||||||
|
(let [hash (anonymize-pubkey hash-or-pubkey)]
|
||||||
|
(->> accounts
|
||||||
|
(filter #(= (anonymize-pubkey (:public-key %)) hash))
|
||||||
|
first)))
|
||||||
|
|
||||||
(defn- hash->pubkey [hash accounts]
|
(defn- hash->pubkey [hash accounts]
|
||||||
(:public-key
|
(:public-key (hash->contact hash accounts)))
|
||||||
(first
|
|
||||||
(filter #(= (anonymize-pubkey (:public-key %)) hash)
|
|
||||||
accounts))))
|
|
||||||
|
|
||||||
(defn lookup-contact-pubkey-from-hash
|
(defn lookup-contact-pubkey-from-hash
|
||||||
[{:keys [db] :as cofx} contact-pubkey-or-hash]
|
[{:keys [db] :as cofx} contact-pubkey-or-hash]
|
||||||
|
@ -94,7 +97,7 @@
|
||||||
(= (count contact-pubkey-or-hash) pn-pubkey-hash-length))
|
(= (count contact-pubkey-or-hash) pn-pubkey-hash-length))
|
||||||
(if-let
|
(if-let
|
||||||
[account-pubkey (hash->pubkey contact-pubkey-or-hash
|
[account-pubkey (hash->pubkey contact-pubkey-or-hash
|
||||||
(vals (:accounts/accounts db)))]
|
(-> db :accounts/accounts vals))]
|
||||||
account-pubkey
|
account-pubkey
|
||||||
(if (accounts.db/logged-in? cofx)
|
(if (accounts.db/logged-in? cofx)
|
||||||
;; TODO: for simplicity we're doing a linear lookup of the contacts,
|
;; TODO: for simplicity we're doing a linear lookup of the contacts,
|
||||||
|
@ -144,6 +147,11 @@
|
||||||
;; TODO: Rehydrate message id
|
;; TODO: Rehydrate message id
|
||||||
:id id})
|
:id id})
|
||||||
|
|
||||||
|
(defn- get-contact-name [{:keys [db] :as cofx} from]
|
||||||
|
(if (accounts.db/logged-in? cofx)
|
||||||
|
(:name (hash->contact from (-> db :contacts/contacts vals)))
|
||||||
|
(anonymize-pubkey from)))
|
||||||
|
|
||||||
(defn- build-notification [{:keys [title body decoded-payload]}]
|
(defn- build-notification [{:keys [title body decoded-payload]}]
|
||||||
(let [native-notification
|
(let [native-notification
|
||||||
(clj->js
|
(clj->js
|
||||||
|
@ -226,7 +234,7 @@
|
||||||
(assoc-in db [:push-notifications/stored (:to rehydrated-payload)]
|
(assoc-in db [:push-notifications/stored (:to rehydrated-payload)]
|
||||||
(js/JSON.stringify (clj->js rehydrated-payload)))
|
(js/JSON.stringify (clj->js rehydrated-payload)))
|
||||||
:notifications/display-notification
|
:notifications/display-notification
|
||||||
{:title (i18n/label :notifications-new-message-title)
|
{:title (get-contact-name cofx from)
|
||||||
:body (i18n/label :notifications-new-message-body)
|
:body (i18n/label :notifications-new-message-body)
|
||||||
:decoded-payload rehydrated-payload}})))
|
:decoded-payload rehydrated-payload}})))
|
||||||
|
|
||||||
|
|
|
@ -450,7 +450,6 @@
|
||||||
"other": "days"
|
"other": "days"
|
||||||
},
|
},
|
||||||
"request-transaction": "Request transaction",
|
"request-transaction": "Request transaction",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"wallet-send": "Send",
|
"wallet-send": "Send",
|
||||||
"wallet-deposit": "Deposit",
|
"wallet-deposit": "Deposit",
|
||||||
"invalid-key-title": "We detected a problem with the encryption key",
|
"invalid-key-title": "We detected a problem with the encryption key",
|
||||||
|
@ -742,7 +741,6 @@
|
||||||
"view-profile": "View profile",
|
"view-profile": "View profile",
|
||||||
"message": "Message",
|
"message": "Message",
|
||||||
"here-is-your-passphrase": "Here is your passphrase, *write this down and keep this safe!* You will need it to recover your account.",
|
"here-is-your-passphrase": "Here is your passphrase, *write this down and keep this safe!* You will need it to recover your account.",
|
||||||
"add-mailserver": "Add Mailserver",
|
|
||||||
"currency-display-name-ttd": "Trinidad and Tobago Dollar",
|
"currency-display-name-ttd": "Trinidad and Tobago Dollar",
|
||||||
"wallet-assets": "Assets",
|
"wallet-assets": "Assets",
|
||||||
"are-you-sure-description": "You will not be able to see the whole recovery phrase again",
|
"are-you-sure-description": "You will not be able to see the whole recovery phrase again",
|
||||||
|
|
|
@ -422,7 +422,6 @@
|
||||||
"not-specified": "No especificado",
|
"not-specified": "No especificado",
|
||||||
"notifications": "Notificaciones",
|
"notifications": "Notificaciones",
|
||||||
"notifications-new-message-body": "Tienes un nuevo mensaje",
|
"notifications-new-message-body": "Tienes un nuevo mensaje",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "Notificaciones y sonidos",
|
"notifications-title": "Notificaciones y sonidos",
|
||||||
"off": "Apagado",
|
"off": "Apagado",
|
||||||
"offline": "Desconectado",
|
"offline": "Desconectado",
|
||||||
|
|
|
@ -423,7 +423,6 @@
|
||||||
"not-specified": "مشخص نشده",
|
"not-specified": "مشخص نشده",
|
||||||
"notifications": "اغلان ها",
|
"notifications": "اغلان ها",
|
||||||
"notifications-new-message-body": "شما یک پیغام جدید دارید",
|
"notifications-new-message-body": "شما یک پیغام جدید دارید",
|
||||||
"notifications-new-message-title": "استتوس",
|
|
||||||
"notifications-title": "اطلاعیه ها و صداها",
|
"notifications-title": "اطلاعیه ها و صداها",
|
||||||
"off": "خاموش",
|
"off": "خاموش",
|
||||||
"offline": "آفلاین",
|
"offline": "آفلاین",
|
||||||
|
|
|
@ -450,7 +450,6 @@
|
||||||
"not-specified": "지정되지 않음",
|
"not-specified": "지정되지 않음",
|
||||||
"notifications": "알림",
|
"notifications": "알림",
|
||||||
"notifications-new-message-body": "새로운 메세지가 있습니다",
|
"notifications-new-message-body": "새로운 메세지가 있습니다",
|
||||||
"notifications-new-message-title": "스테이터스",
|
|
||||||
"notifications-title": "알림 및 소리",
|
"notifications-title": "알림 및 소리",
|
||||||
"off": "끄기",
|
"off": "끄기",
|
||||||
"offline": "오프라인",
|
"offline": "오프라인",
|
||||||
|
|
|
@ -450,7 +450,6 @@
|
||||||
"not-specified": "Tidak diberikan",
|
"not-specified": "Tidak diberikan",
|
||||||
"notifications": "Pemberitahuan",
|
"notifications": "Pemberitahuan",
|
||||||
"notifications-new-message-body": "Anda mempunyai mesej baru",
|
"notifications-new-message-body": "Anda mempunyai mesej baru",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "Pemberitahuan dan bunyi",
|
"notifications-title": "Pemberitahuan dan bunyi",
|
||||||
"off": "Tidak aktif",
|
"off": "Tidak aktif",
|
||||||
"offline": "Luar talian",
|
"offline": "Luar talian",
|
||||||
|
|
|
@ -433,7 +433,6 @@
|
||||||
"not-specified": "नतोकिएको",
|
"not-specified": "नतोकिएको",
|
||||||
"notifications": "Pemberitahuan",
|
"notifications": "Pemberitahuan",
|
||||||
"notifications-new-message-body": "Anda mempunyai mesej baru",
|
"notifications-new-message-body": "Anda mempunyai mesej baru",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "सूचना र ध्वनि",
|
"notifications-title": "सूचना र ध्वनि",
|
||||||
"off": "Tidak aktif",
|
"off": "Tidak aktif",
|
||||||
"offline": "अफलाइन",
|
"offline": "अफलाइन",
|
||||||
|
|
|
@ -415,7 +415,6 @@
|
||||||
"not-specified": "Nie określono",
|
"not-specified": "Nie określono",
|
||||||
"notifications": "Powiadomienia",
|
"notifications": "Powiadomienia",
|
||||||
"notifications-new-message-body": "Masz nową wiadomość",
|
"notifications-new-message-body": "Masz nową wiadomość",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "Powiadomienia i dźwięki",
|
"notifications-title": "Powiadomienia i dźwięki",
|
||||||
"off": "Wył.",
|
"off": "Wył.",
|
||||||
"offline": "Offline",
|
"offline": "Offline",
|
||||||
|
|
|
@ -432,7 +432,6 @@
|
||||||
"not-specified": "Не указано",
|
"not-specified": "Не указано",
|
||||||
"notifications": "Уведомления",
|
"notifications": "Уведомления",
|
||||||
"notifications-new-message-body": "Вы получили новое сообщение",
|
"notifications-new-message-body": "Вы получили новое сообщение",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "Уведомления и звуки",
|
"notifications-title": "Уведомления и звуки",
|
||||||
"off": "Выкл",
|
"off": "Выкл",
|
||||||
"offline": "Оффлайн",
|
"offline": "Оффлайн",
|
||||||
|
|
|
@ -450,7 +450,6 @@
|
||||||
"not-specified": "未指定",
|
"not-specified": "未指定",
|
||||||
"notifications": "通知",
|
"notifications": "通知",
|
||||||
"notifications-new-message-body": "你有新信息",
|
"notifications-new-message-body": "你有新信息",
|
||||||
"notifications-new-message-title": "Status",
|
|
||||||
"notifications-title": "通知和声音",
|
"notifications-title": "通知和声音",
|
||||||
"off": "关闭",
|
"off": "关闭",
|
||||||
"offline": "离线",
|
"offline": "离线",
|
||||||
|
|
Loading…
Reference in New Issue