diff --git a/resources/default_contacts.json b/resources/default_contacts.json deleted file mode 100644 index 4393a28868..0000000000 --- a/resources/default_contacts.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "transactor": - { - "name": - { - "en": "Transactor" - }, - "dapp?": true, - "hide-contact?": true, - "bot-url": "local://transactor-bot" - }, - "demo-bot": - { - "name": - { - "en": "Demo bot" - }, - "dapp?": true, - "bot-url": "local://demo-bot" - } -} diff --git a/src/status_im/chat/models/loading.cljs b/src/status_im/chat/models/loading.cljs index bfc24e2c4c..5be857e7c0 100644 --- a/src/status_im/chat/models/loading.cljs +++ b/src/status_im/chat/models/loading.cljs @@ -11,30 +11,6 @@ (def index-messages (partial into {} (map (juxt :message-id identity)))) -(fx/defn add-default-contacts - [{:keys [db default-contacts] :as cofx}] - (let [new-contacts (-> {} - (into (map (fn [[id props]] - (let [contact-id (name id)] - [contact-id {:whisper-identity contact-id - :address (utils.contacts/public-key->address contact-id) - :name (-> props :name :en) - :photo-path (:photo-path props) - :public-key (:public-key props) - :unremovable? (-> props :unremovable? boolean) - :hide-contact? (-> props :hide-contact? boolean) - :pending? (-> props :pending? boolean) - :dapp? (:dapp? props) - :dapp-url (-> props :dapp-url :en) - :bot-url (:bot-url props) - :description (:description props)}]))) - default-contacts)) - existing-contacts (:contacts/contacts db) - contacts-to-add (select-keys new-contacts (set/difference (set (keys new-contacts)) - (set (keys existing-contacts))))] - {:db (update db :contacts/contacts merge contacts-to-add) - :data-store/tx [(contacts-store/save-contacts-tx (vals contacts-to-add))]})) - (defn- sort-references "Sorts message-references sequence primary by clock value, breaking ties by `:message-id`" @@ -104,7 +80,6 @@ :chats chats :contacts/dapps default-dapps)} (group-messages) - (add-default-contacts) (commands/load-commands commands/register)))) (fx/defn initialize-pending-messages diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index a45f0ed4ac..d48aa5c2fe 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -37,11 +37,8 @@ (cond public? (str "#" name) group-chat name - :else (i18n/get-contact-translated - chat-id - :name - (or contact-name - (gfycat/generate-gfy chat-id))))) + :else (or contact-name + (gfycat/generate-gfy chat-id)))) (reg-sub :get-current-chat-name :<- [:get-current-chat-contact] diff --git a/src/status_im/contact/core.cljs b/src/status_im/contact/core.cljs index fc36bebbd2..81328d1817 100644 --- a/src/status_im/contact/core.cljs +++ b/src/status_im/contact/core.cljs @@ -13,11 +13,6 @@ [status-im.utils.utils :as utils] [status-im.utils.fx :as fx])) -(re-frame/reg-cofx - :get-default-contacts - (fn [coeffects _] - (assoc coeffects :default-contacts js-res/default-contacts))) - (fx/defn load-contacts [{:keys [db all-contacts]}] (let [contacts-list (map #(vector (:whisper-identity %) %) all-contacts) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 977d5eee1f..3e5c8f6365 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -84,7 +84,6 @@ (handlers/register-handler-fx :init.callback/account-change-success [(re-frame/inject-cofx :web3/get-web3) - (re-frame/inject-cofx :get-default-contacts) (re-frame/inject-cofx :get-default-dapps) (re-frame/inject-cofx :data-store/all-chats) (re-frame/inject-cofx :data-store/get-messages) diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs index 0c0a1ddade..f16aaa2341 100644 --- a/src/status_im/i18n.cljs +++ b/src/status_im/i18n.cljs @@ -3,7 +3,6 @@ (:require [cljs.spec.alpha :as spec] [status-im.react-native.js-dependencies :as rn-dependencies] - [status-im.utils.js-resources :refer [default-contacts]] [clojure.string :as string] [clojure.set :as set] [status-im.utils.types :as types])) @@ -279,12 +278,6 @@ (def locale (.-locale rn-dependencies/i18n)) -(defn get-contact-translated [contact-id key fallback] - (let [translation #(get-in default-contacts [(keyword contact-id) key (keyword %)])] - (or (translation locale) - (translation (subs locale 0 2)) - fallback))) - (defn format-currency ([value currency-code] (format-currency value currency-code true)) diff --git a/src/status_im/ui/components/contact/contact.cljs b/src/status_im/ui/components/contact/contact.cljs index 90a68114ad..a37259cca7 100644 --- a/src/status_im/ui/components/contact/contact.cljs +++ b/src/status_im/ui/components/contact/contact.cljs @@ -29,10 +29,9 @@ :number-of-lines 1} (when dapp? {:accessibility-label :dapp-name}) props) - (if (pos? (count name)) - (i18n/get-contact-translated whisper-identity :name name) - ;;TODO is this correct behaviour? - (gfycat/generate-gfy whisper-identity))] + (if (string/blank? name) + (gfycat/generate-gfy whisper-identity) + (or name (i18n/label :t/chat-name)))] (when info [react/text {:style styles/info-text} info])]])) diff --git a/src/status_im/utils/js_resources.cljs b/src/status_im/utils/js_resources.cljs index a41e27008d..aca421b5dc 100644 --- a/src/status_im/utils/js_resources.cljs +++ b/src/status_im/utils/js_resources.cljs @@ -8,8 +8,6 @@ (defn local-resource? [url] (and (string? url) (s/starts-with? url local-protocol))) -(def default-contacts (json->clj (slurp "resources/default_contacts.json"))) - (def webview-js (slurp "resources/js/webview.js")) (def web3 (str "; if (typeof Web3 == 'undefined') {" (slurp "node_modules/web3/dist/web3.min.js")