clean old code, remove public chat, implement drawers for home screens (#15766)
This commit is contained in:
parent
2f988fcd47
commit
e0ed2a250b
|
@ -1,102 +0,0 @@
|
||||||
(ns status-im.add-new.core
|
|
||||||
(:require [clojure.string :as string]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[status-im.add-new.db :as db]
|
|
||||||
[status-im2.contexts.chat.events :as chat]
|
|
||||||
[status-im2.contexts.contacts.events :as contact]
|
|
||||||
[status-im.ethereum.core :as ethereum]
|
|
||||||
[status-im.ethereum.ens :as ens]
|
|
||||||
[status-im.ethereum.stateofus :as stateofus]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[status-im.router.core :as router]
|
|
||||||
[status-im.utils.db :as utils.db]
|
|
||||||
[utils.re-frame :as rf]
|
|
||||||
[status-im.utils.random :as random]
|
|
||||||
[status-im.utils.utils :as utils]
|
|
||||||
[status-im2.navigation.events :as navigation]))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
|
||||||
:resolve-public-key
|
|
||||||
(fn [{:keys [chain-id contact-identity cb]}]
|
|
||||||
(let [ens-name (stateofus/ens-name-parse contact-identity)]
|
|
||||||
(ens/pubkey chain-id ens-name cb))))
|
|
||||||
|
|
||||||
;;NOTE we want to handle only last resolve
|
|
||||||
(def resolve-last-id (atom nil))
|
|
||||||
|
|
||||||
(rf/defn new-chat-set-new-identity
|
|
||||||
{:events [:new-chat/set-new-identity]}
|
|
||||||
[{db :db} new-identity-raw new-ens-name id]
|
|
||||||
(let [ens-error (and (= new-identity-raw "0x") (not (string/blank? new-ens-name)))]
|
|
||||||
(when (or (not id) (= id @resolve-last-id))
|
|
||||||
(if ens-error
|
|
||||||
{:db (assoc-in db [:contacts/new-identity :state] :error)}
|
|
||||||
(let [new-identity (utils/safe-trim new-identity-raw)
|
|
||||||
is-public-key? (and (string? new-identity)
|
|
||||||
(utils.db/valid-public-key? new-identity))
|
|
||||||
is-ens? (and (not is-public-key?)
|
|
||||||
(ens/valid-eth-name-prefix? new-identity))
|
|
||||||
error (db/validate-pub-key db new-identity)]
|
|
||||||
(reset! resolve-last-id nil)
|
|
||||||
(merge {:db (assoc db
|
|
||||||
:contacts/new-identity
|
|
||||||
{:public-key new-identity
|
|
||||||
:state (cond is-ens?
|
|
||||||
:searching
|
|
||||||
(and (string/blank? new-identity) (not new-ens-name))
|
|
||||||
:empty
|
|
||||||
error
|
|
||||||
:error
|
|
||||||
:else
|
|
||||||
:valid)
|
|
||||||
:error error
|
|
||||||
:ens-name (stateofus/ens-name-parse new-ens-name)})}
|
|
||||||
(when is-ens?
|
|
||||||
(reset! resolve-last-id (random/id))
|
|
||||||
{:resolve-public-key
|
|
||||||
{:chain-id (ethereum/chain-id db)
|
|
||||||
:contact-identity new-identity
|
|
||||||
:cb #(re-frame/dispatch [:new-chat/set-new-identity
|
|
||||||
%
|
|
||||||
new-identity
|
|
||||||
@resolve-last-id])}})))))))
|
|
||||||
|
|
||||||
(rf/defn clear-new-identity
|
|
||||||
{:events [::clear-new-identity ::new-chat-focus]}
|
|
||||||
[{:keys [db]}]
|
|
||||||
{:db (dissoc db :contacts/new-identity)})
|
|
||||||
|
|
||||||
(rf/defn qr-code-handled
|
|
||||||
{:events [::qr-code-handled]}
|
|
||||||
[{:keys [db] :as cofx} {:keys [type public-key chat-id data ens-name]}
|
|
||||||
{:keys [new-contact? nickname] :as opts}]
|
|
||||||
(let [public-key? (and (string? data)
|
|
||||||
(string/starts-with? data "0x"))
|
|
||||||
chat-key (cond
|
|
||||||
(= type :private-chat) chat-id
|
|
||||||
(= type :contact) public-key
|
|
||||||
(and (= type :undefined)
|
|
||||||
public-key?)
|
|
||||||
data)
|
|
||||||
validation-result (db/validate-pub-key db chat-key)]
|
|
||||||
(if-not validation-result
|
|
||||||
(if new-contact?
|
|
||||||
(rf/merge cofx
|
|
||||||
(contact/send-contact-request chat-key)
|
|
||||||
(navigation/navigate-to :contacts-list {}))
|
|
||||||
(chat/start-chat cofx chat-key ens-name))
|
|
||||||
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
|
||||||
:content (case validation-result
|
|
||||||
:invalid
|
|
||||||
(i18n/label :t/use-valid-contact-code)
|
|
||||||
:yourself
|
|
||||||
(i18n/label :t/can-not-add-yourself))
|
|
||||||
:on-dismiss #(re-frame/dispatch [:pop-to-root :shell-stack])}})))
|
|
||||||
|
|
||||||
(rf/defn qr-code-scanned
|
|
||||||
{:events [:contact/qr-code-scanned]}
|
|
||||||
[{:keys [db]} data opts]
|
|
||||||
{::router/handle-uri {:chain (ethereum/chain-keyword db)
|
|
||||||
:chats (get db :chats)
|
|
||||||
:uri data
|
|
||||||
:cb #(re-frame/dispatch [::qr-code-handled % opts])}})
|
|
|
@ -1,30 +0,0 @@
|
||||||
(ns status-im.add-new.db
|
|
||||||
(:require [cljs.spec.alpha :as spec]
|
|
||||||
[status-im.ethereum.ens :as ens]
|
|
||||||
[utils.validators :as validators]))
|
|
||||||
|
|
||||||
(defn own-public-key?
|
|
||||||
[{:keys [multiaccount]} public-key]
|
|
||||||
(= (:public-key multiaccount) public-key))
|
|
||||||
|
|
||||||
(defn validate-pub-key
|
|
||||||
[db public-key]
|
|
||||||
(cond
|
|
||||||
(or (not (validators/valid-public-key? public-key))
|
|
||||||
(= public-key ens/default-key))
|
|
||||||
:invalid
|
|
||||||
(own-public-key? db public-key)
|
|
||||||
:yourself))
|
|
||||||
|
|
||||||
(spec/def ::name (spec/and string? not-empty))
|
|
||||||
|
|
||||||
(spec/def ::topic
|
|
||||||
(spec/and string?
|
|
||||||
not-empty
|
|
||||||
(partial re-matches #"[a-z0-9\-]+")))
|
|
||||||
|
|
||||||
(defn valid-topic?
|
|
||||||
[topic]
|
|
||||||
(and topic
|
|
||||||
(spec/valid? ::topic topic)
|
|
||||||
(not (validators/valid-public-key? topic))))
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im.bottom-sheet.sheets
|
(ns status-im.bottom-sheet.sheets
|
||||||
(:require [utils.re-frame :as rf]
|
(:require [utils.re-frame :as rf]
|
||||||
[status-im.ui.screens.about-app.views :as about-app]
|
[status-im.ui.screens.about-app.views :as about-app]
|
||||||
[status-im.ui.screens.home.sheet.views :as home.sheet]
|
|
||||||
[status-im.ui.screens.keycard.views :as keycard]
|
[status-im.ui.screens.keycard.views :as keycard]
|
||||||
[status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
|
[status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
|
||||||
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
|
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
|
||||||
|
@ -27,9 +26,6 @@
|
||||||
(= view :mobile-network-offline)
|
(= view :mobile-network-offline)
|
||||||
(merge mobile-network-settings/offline-sheet)
|
(merge mobile-network-settings/offline-sheet)
|
||||||
|
|
||||||
(= view :add-new)
|
|
||||||
(merge home.sheet/add-new)
|
|
||||||
|
|
||||||
(= view :keycard.login/more)
|
(= view :keycard.login/more)
|
||||||
(merge keycard/more-sheet)
|
(merge keycard/more-sheet)
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
(ns status-im.chat.models
|
|
||||||
(:require [utils.i18n :as i18n]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[utils.re-frame :as rf]
|
|
||||||
[taoensso.timbre :as log]
|
|
||||||
[status-im.add-new.db :as new-public-chat.db]
|
|
||||||
[status-im.data-store.chats :as chats-store]))
|
|
||||||
|
|
||||||
;; OLD
|
|
||||||
|
|
||||||
(rf/defn handle-public-chat-created
|
|
||||||
{:events [::public-chat-created]}
|
|
||||||
[{:keys [db]} chat-id response]
|
|
||||||
{:db (-> db
|
|
||||||
(assoc-in [:chats chat-id] (chats-store/<-rpc (first (:chats response))))
|
|
||||||
(update :chats-home-list conj chat-id))
|
|
||||||
:dispatch [:chat/navigate-to-chat chat-id]})
|
|
||||||
|
|
||||||
(rf/defn create-public-chat-go
|
|
||||||
[_ chat-id]
|
|
||||||
{:json-rpc/call [{:method "wakuext_createPublicChat"
|
|
||||||
:params [{:id chat-id}]
|
|
||||||
:on-success #(re-frame/dispatch [::public-chat-created chat-id %])
|
|
||||||
:on-error #(log/error "failed to create public chat" chat-id %)}]})
|
|
||||||
|
|
||||||
(rf/defn start-public-chat
|
|
||||||
"Starts a new public chat"
|
|
||||||
{:events [:chat.ui/start-public-chat]}
|
|
||||||
[cofx topic]
|
|
||||||
(if (new-public-chat.db/valid-topic? topic)
|
|
||||||
(create-public-chat-go
|
|
||||||
cofx
|
|
||||||
topic)
|
|
||||||
{:utils/show-popup {:title (i18n/label :t/cant-open-public-chat)
|
|
||||||
:content (i18n/label :t/invalid-public-chat-topic)}}))
|
|
|
@ -505,7 +505,7 @@
|
||||||
(handle-response response-js)))
|
(handle-response response-js)))
|
||||||
|
|
||||||
(rf/defn open-create-community
|
(rf/defn open-create-community
|
||||||
{:events [::open-create-community]}
|
{:events [:legacy-only-for-e2e/open-create-community]}
|
||||||
[{:keys [db] :as cofx}]
|
[{:keys [db] :as cofx}]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc db :communities/create {:membership constants/community-no-membership-access})}
|
{:db (assoc db :communities/create {:membership constants/community-no-membership-access})}
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
(defn rpc->type
|
(defn rpc->type
|
||||||
[{:keys [chat-type name] :as chat}]
|
[{:keys [chat-type name] :as chat}]
|
||||||
(cond
|
(cond
|
||||||
(or (= constants/public-chat-type chat-type)
|
(or (= constants/profile-chat-type chat-type)
|
||||||
(= constants/profile-chat-type chat-type)
|
|
||||||
(= constants/timeline-chat-type chat-type))
|
(= constants/timeline-chat-type chat-type))
|
||||||
(assoc chat
|
(assoc chat
|
||||||
:chat-name (str "#" name)
|
:chat-name (str "#" name)
|
||||||
|
@ -39,10 +38,6 @@
|
||||||
(defn- unmarshal-members
|
(defn- unmarshal-members
|
||||||
[{:keys [members chat-type] :as chat}]
|
[{:keys [members chat-type] :as chat}]
|
||||||
(cond
|
(cond
|
||||||
(= constants/public-chat-type chat-type) (assoc chat
|
|
||||||
:contacts #{}
|
|
||||||
:admins #{}
|
|
||||||
:members-joined #{})
|
|
||||||
(= constants/private-group-chat-type chat-type) (merge chat
|
(= constants/private-group-chat-type chat-type) (merge chat
|
||||||
(reduce members-reducer
|
(reduce members-reducer
|
||||||
{:admins #{}
|
{:admins #{}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
status-im.bootnodes.core
|
status-im.bootnodes.core
|
||||||
status-im.browser.core
|
status-im.browser.core
|
||||||
status-im.browser.permissions
|
status-im.browser.permissions
|
||||||
status-im.chat.models
|
|
||||||
status-im.chat.models.images
|
status-im.chat.models.images
|
||||||
status-im.chat.models.input
|
status-im.chat.models.input
|
||||||
status-im.chat.models.loading
|
status-im.chat.models.loading
|
||||||
|
|
|
@ -2,21 +2,6 @@
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.utils.http :as http]))
|
[status-im.utils.http :as http]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
|
||||||
:http-get
|
|
||||||
(fn [{:keys [url response-validator on-success on-error timeout-ms]}]
|
|
||||||
(let [opts {:valid-response? response-validator
|
|
||||||
:timeout-ms timeout-ms}]
|
|
||||||
(http/get url on-success on-error opts))))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
|
||||||
:http-get-n
|
|
||||||
(fn [calls]
|
|
||||||
(doseq [{:keys [url response-validator on-success on-error timeout-ms]} calls]
|
|
||||||
(let [opts {:valid-response? response-validator
|
|
||||||
:timeout-ms timeout-ms}]
|
|
||||||
(http/get url on-success on-error opts)))))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:http-post
|
:http-post
|
||||||
(fn [{:keys [url data response-validator on-success on-error timeout-ms opts]}]
|
(fn [{:keys [url data response-validator on-success on-error timeout-ms opts]}]
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
(rf-test/wait-for ; wait for login
|
(rf-test/wait-for ; wait for login
|
||||||
[::transport/messenger-started]
|
[::transport/messenger-started]
|
||||||
(assert-messenger-started)
|
(assert-messenger-started)
|
||||||
(rf/dispatch-sync [:status-im.communities.core/open-create-community])
|
(rf/dispatch-sync [:legacy-only-for-e2e/open-create-community])
|
||||||
(doseq [[k v] (dissoc community :membership)]
|
(doseq [[k v] (dissoc community :membership)]
|
||||||
(rf/dispatch-sync [:status-im.communities.core/create-field k v]))
|
(rf/dispatch-sync [:status-im.communities.core/create-field k v]))
|
||||||
(rf/dispatch [:status-im.communities.core/create-confirmation-pressed])
|
(rf/dispatch [:status-im.communities.core/create-confirmation-pressed])
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
(ns status-im.qr-scanner.core
|
(ns status-im.qr-scanner.core
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.add-new.db :as new-chat.db]
|
|
||||||
[status-im.chat.models :as chat]
|
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
[status-im.group-chats.core :as group-chats]
|
[status-im.group-chats.core :as group-chats]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
|
@ -43,25 +41,24 @@
|
||||||
{:browser/show-browser-selection url}
|
{:browser/show-browser-selection url}
|
||||||
(navigation/navigate-back)))
|
(navigation/navigate-back)))
|
||||||
|
|
||||||
|
(defn own-public-key?
|
||||||
|
[{:keys [multiaccount]} public-key]
|
||||||
|
(= (:public-key multiaccount) public-key))
|
||||||
|
|
||||||
(rf/defn handle-private-chat
|
(rf/defn handle-private-chat
|
||||||
[{:keys [db] :as cofx} {:keys [chat-id]}]
|
[{:keys [db] :as cofx} {:keys [chat-id]}]
|
||||||
(if-not (new-chat.db/own-public-key? db chat-id)
|
(if-not (own-public-key? db chat-id)
|
||||||
{:dispatch [:chat.ui/start-chat chat-id]}
|
{:dispatch [:chat.ui/start-chat chat-id]}
|
||||||
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
||||||
:content (i18n/label :t/can-not-add-yourself)}}))
|
:content (i18n/label :t/can-not-add-yourself)}}))
|
||||||
|
|
||||||
(rf/defn handle-public-chat
|
|
||||||
[cofx {:keys [topic]}]
|
|
||||||
(when (seq topic)
|
|
||||||
(chat/start-public-chat cofx topic)))
|
|
||||||
|
|
||||||
(rf/defn handle-group-chat
|
(rf/defn handle-group-chat
|
||||||
[cofx params]
|
[cofx params]
|
||||||
(group-chats/create-from-link cofx params))
|
(group-chats/create-from-link cofx params))
|
||||||
|
|
||||||
(rf/defn handle-view-profile
|
(rf/defn handle-view-profile
|
||||||
[{:keys [db] :as cofx} {:keys [public-key ens-name]}]
|
[{:keys [db] :as cofx} {:keys [public-key ens-name]}]
|
||||||
(let [own (new-chat.db/own-public-key? db public-key)]
|
(let [own (own-public-key? db public-key)]
|
||||||
(cond
|
(cond
|
||||||
(and public-key own)
|
(and public-key own)
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
|
@ -85,11 +82,6 @@
|
||||||
(navigation/change-tab :wallet-stack)
|
(navigation/change-tab :wallet-stack)
|
||||||
(navigation/pop-to-root :shell-stack)))
|
(navigation/pop-to-root :shell-stack)))
|
||||||
|
|
||||||
(rf/defn handle-wallet-connect
|
|
||||||
{:events [::handle-wallet-connect-uri]}
|
|
||||||
[cofx data]
|
|
||||||
{:dispatch [:wallet-connect/pair data]})
|
|
||||||
|
|
||||||
(rf/defn handle-local-pairing
|
(rf/defn handle-local-pairing
|
||||||
{:events [::handle-local-pairing-uri]}
|
{:events [::handle-local-pairing-uri]}
|
||||||
[_ data]
|
[_ data]
|
||||||
|
@ -99,7 +91,6 @@
|
||||||
{:events [::match-scanned-value]}
|
{:events [::match-scanned-value]}
|
||||||
[cofx {:keys [type] :as data}]
|
[cofx {:keys [type] :as data}]
|
||||||
(case type
|
(case type
|
||||||
:public-chat (handle-public-chat cofx data)
|
|
||||||
:group-chat (handle-group-chat cofx data)
|
:group-chat (handle-group-chat cofx data)
|
||||||
:private-chat (handle-private-chat cofx data)
|
:private-chat (handle-private-chat cofx data)
|
||||||
:contact (handle-view-profile cofx data)
|
:contact (handle-view-profile cofx data)
|
||||||
|
|
|
@ -65,11 +65,3 @@
|
||||||
k
|
k
|
||||||
(get ui k))
|
(get ui k))
|
||||||
k)))
|
k)))
|
||||||
|
|
||||||
(def reactions-old
|
|
||||||
{:love (js/require "../resources/images/reactions/love.png")
|
|
||||||
:angry (js/require "../resources/images/reactions/angry.png")
|
|
||||||
:sad (js/require "../resources/images/reactions/sad.png")
|
|
||||||
:laugh (js/require "../resources/images/reactions/laugh.png")
|
|
||||||
:thumbs-up (js/require "../resources/images/reactions/thumbs-up.png")
|
|
||||||
:thumbs-down (js/require "../resources/images/reactions/thumbs-down.png")})
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
(:require [bidi.bidi :as bidi]
|
(:require [bidi.bidi :as bidi]
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.add-new.db :as public-chat.db]
|
|
||||||
[status-im2.contexts.chat.events :as chat.events]
|
[status-im2.contexts.chat.events :as chat.events]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
|
@ -21,8 +20,6 @@
|
||||||
|
|
||||||
(def uri-schemes ["status-im://" "status-im:"])
|
(def uri-schemes ["status-im://" "status-im:"])
|
||||||
|
|
||||||
(def wallet-connect-scheme "wc:")
|
|
||||||
|
|
||||||
(def web-prefixes ["https://" "http://" "https://www." "http://wwww."])
|
(def web-prefixes ["https://" "http://" "https://www." "http://wwww."])
|
||||||
|
|
||||||
(def web2-domain "join.status.im")
|
(def web2-domain "join.status.im")
|
||||||
|
@ -48,9 +45,7 @@
|
||||||
|
|
||||||
(def routes
|
(def routes
|
||||||
[""
|
[""
|
||||||
{handled-schemes {["" :chat-id] :public-chat
|
{handled-schemes {"b/" browser-extractor
|
||||||
"chat" {["/public/" :chat-id] :public-chat}
|
|
||||||
"b/" browser-extractor
|
|
||||||
"browser/" browser-extractor
|
"browser/" browser-extractor
|
||||||
["p/" :chat-id] :private-chat
|
["p/" :chat-id] :private-chat
|
||||||
["cr/" :community-id] :community-requests
|
["cr/" :community-id] :community-requests
|
||||||
|
@ -107,14 +102,6 @@
|
||||||
(callback {:type :contact
|
(callback {:type :contact
|
||||||
:error :not-found}))))
|
:error :not-found}))))
|
||||||
|
|
||||||
(defn match-public-chat
|
|
||||||
[{:keys [chat-id]}]
|
|
||||||
(if (public-chat.db/valid-topic? chat-id)
|
|
||||||
{:type :public-chat
|
|
||||||
:topic chat-id}
|
|
||||||
{:type :public-chat
|
|
||||||
:error :invalid-topic}))
|
|
||||||
|
|
||||||
(defn match-group-chat
|
(defn match-group-chat
|
||||||
[chats {:strs [a a1 a2]}]
|
[chats {:strs [a a1 a2]}]
|
||||||
(let [[admin-pk encoded-chat-name chat-id] [a a1 a2]
|
(let [[admin-pk encoded-chat-name chat-id] [a a1 a2]
|
||||||
|
@ -225,8 +212,6 @@
|
||||||
(let [{:keys [handler route-params query-params]} (match-uri uri)]
|
(let [{:keys [handler route-params query-params]} (match-uri uri)]
|
||||||
(log/info "[router] uri " uri " matched " handler " with " route-params)
|
(log/info "[router] uri " uri " matched " handler " with " route-params)
|
||||||
(cond
|
(cond
|
||||||
(= handler :public-chat)
|
|
||||||
(cb (match-public-chat route-params))
|
|
||||||
|
|
||||||
(= handler :browser)
|
(= handler :browser)
|
||||||
(cb (match-browser uri route-params))
|
(cb (match-browser uri route-params))
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
:query-params (when (= 3 (count expected)) (last expected))
|
:query-params (when (= 3 (count expected)) (last expected))
|
||||||
:uri uri})
|
:uri uri})
|
||||||
|
|
||||||
"status-im://status"
|
|
||||||
[:public-chat {:chat-id "status"}]
|
|
||||||
|
|
||||||
"status-im://u/statuse2e"
|
"status-im://u/statuse2e"
|
||||||
[:user {:user-id "statuse2e"}]
|
[:user {:user-id "statuse2e"}]
|
||||||
|
|
||||||
|
@ -36,9 +33,6 @@
|
||||||
(str "https://join.status.im/g/args?a=" public-key "&a1=" chat-name-url "&a2=" chat-id)
|
(str "https://join.status.im/g/args?a=" public-key "&a1=" chat-name-url "&a2=" chat-id)
|
||||||
[:group-chat {:params "arg"} {"a" public-key "a1" chat-name "a2" chat-id}]
|
[:group-chat {:params "arg"} {"a" public-key "a1" chat-name "a2" chat-id}]
|
||||||
|
|
||||||
"https://join.status.im/status"
|
|
||||||
[:public-chat {:chat-id "status"}]
|
|
||||||
|
|
||||||
"https://join.status.im/u/statuse2e"
|
"https://join.status.im/u/statuse2e"
|
||||||
[:user {:user-id "statuse2e"}]
|
[:user {:user-id "statuse2e"}]
|
||||||
|
|
||||||
|
|
|
@ -1,362 +0,0 @@
|
||||||
(ns status-im.ui.screens.add-new.new-chat.views
|
|
||||||
(:require
|
|
||||||
[clojure.string :as string]
|
|
||||||
[quo.core :as quo]
|
|
||||||
[quo.design-system.colors :as colors]
|
|
||||||
[quo.platform :as platform]
|
|
||||||
[quo.react-native :as rn]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[reagent.core :as reagent]
|
|
||||||
[status-im.ethereum.ens :as ens]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[status-im.multiaccounts.core :as multiaccounts]
|
|
||||||
[status-im.qr-scanner.core :as qr-scanner]
|
|
||||||
[status-im.ui.components.animation :as animation]
|
|
||||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
|
||||||
[status-im.ui.components.invite.views :as invite]
|
|
||||||
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
|
|
||||||
[status-im.ui.components.list.views :as list]
|
|
||||||
[status-im.ui.components.react :as react]
|
|
||||||
[status-im.ui.components.topbar :as topbar]
|
|
||||||
[status-im.ui.screens.chat.photos :as photos]
|
|
||||||
[utils.validators :as validators]
|
|
||||||
[status-im.utils.gfycat.core :as gfycat]
|
|
||||||
[status-im.utils.identicon :as identicon]
|
|
||||||
[status-im.utils.utils :as utils]
|
|
||||||
[utils.debounce :as debounce])
|
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
|
||||||
|
|
||||||
(defn- render-row
|
|
||||||
[row]
|
|
||||||
[quo/list-item
|
|
||||||
{:title (:primary-name row)
|
|
||||||
:icon [chat-icon/contact-icon-contacts-tab
|
|
||||||
(multiaccounts/displayed-photo row)]
|
|
||||||
:on-press #(re-frame/dispatch [:chat.ui/start-chat
|
|
||||||
(:public-key row)])}])
|
|
||||||
|
|
||||||
(defn- icon-wrapper
|
|
||||||
[color icon]
|
|
||||||
[react/view
|
|
||||||
{:style {:width 32
|
|
||||||
:height 32
|
|
||||||
:border-radius 25
|
|
||||||
:align-items :center
|
|
||||||
:justify-content :center
|
|
||||||
:background-color color}}
|
|
||||||
icon])
|
|
||||||
|
|
||||||
(defn- input-icon
|
|
||||||
[state new-contact? entered-nickname blocked?]
|
|
||||||
(let [icon (if new-contact? :main-icons/add :main-icons/arrow-right)]
|
|
||||||
(cond
|
|
||||||
(= state :searching)
|
|
||||||
[icon-wrapper colors/gray
|
|
||||||
[react/activity-indicator {:color colors/white-persist}]]
|
|
||||||
|
|
||||||
(and (= state :valid) (not blocked?))
|
|
||||||
[react/touchable-highlight
|
|
||||||
{:on-press #(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted new-contact?
|
|
||||||
entered-nickname]
|
|
||||||
3000)}
|
|
||||||
[icon-wrapper colors/blue
|
|
||||||
[icons/icon icon {:color colors/white-persist}]]]
|
|
||||||
|
|
||||||
:else
|
|
||||||
[icon-wrapper colors/gray
|
|
||||||
[icons/icon icon {:color colors/white-persist}]])))
|
|
||||||
|
|
||||||
(defn get-validation-label
|
|
||||||
[value]
|
|
||||||
(case value
|
|
||||||
:invalid
|
|
||||||
(i18n/label :t/profile-not-found)
|
|
||||||
:yourself
|
|
||||||
(i18n/label :t/can-not-add-yourself)))
|
|
||||||
|
|
||||||
(defn search-contacts
|
|
||||||
[filter-text {:keys [name alias nickname]}]
|
|
||||||
(or
|
|
||||||
(string/includes? (string/lower-case (str name)) filter-text)
|
|
||||||
(string/includes? (string/lower-case (str alias)) filter-text)
|
|
||||||
(when nickname
|
|
||||||
(string/includes? (string/lower-case (str nickname)) filter-text))))
|
|
||||||
|
|
||||||
(defn filter-contacts
|
|
||||||
[filter-text contacts]
|
|
||||||
(let [lower-filter-text (string/lower-case filter-text)]
|
|
||||||
(if filter-text
|
|
||||||
(filter (partial search-contacts lower-filter-text) contacts)
|
|
||||||
contacts)))
|
|
||||||
|
|
||||||
(defn is-public-key?
|
|
||||||
[k]
|
|
||||||
(and
|
|
||||||
(string? k)
|
|
||||||
(string/starts-with? k "0x")))
|
|
||||||
|
|
||||||
(defn is-valid-username?
|
|
||||||
[username]
|
|
||||||
(let [is-chat-key? (and (is-public-key? username)
|
|
||||||
(= (count username) 132))
|
|
||||||
is-ens? (ens/valid-eth-name-prefix? username)]
|
|
||||||
(or is-chat-key? is-ens?)))
|
|
||||||
|
|
||||||
(defn translate-anim
|
|
||||||
[translate-y-value translate-y-anim-value]
|
|
||||||
(animation/start
|
|
||||||
(animation/timing translate-y-anim-value
|
|
||||||
{:toValue translate-y-value
|
|
||||||
:duration 200
|
|
||||||
:useNativeDriver true})))
|
|
||||||
(views/defview new-chat
|
|
||||||
[]
|
|
||||||
(views/letsubs [contacts [:contacts/active]
|
|
||||||
{:keys [state ens-name public-key error]} [:contacts/new-identity]
|
|
||||||
search-value (reagent/atom "")
|
|
||||||
account @(re-frame/subscribe [:multiaccount])
|
|
||||||
on-share #(re-frame/dispatch
|
|
||||||
[:show-popover
|
|
||||||
{:view :share-chat-key
|
|
||||||
:address (account :public-key)
|
|
||||||
:ens-name (account :preferred-name)}])
|
|
||||||
my-profile-button-anim-y (animation/create-value 0)
|
|
||||||
keyboard-show-listener (atom nil)
|
|
||||||
keyboard-hide-listener (atom nil)
|
|
||||||
on-keyboard-show (fn []
|
|
||||||
;; 42 is the bottom position so we
|
|
||||||
;; translate it by 32 pts to leave 10 as
|
|
||||||
;; margin
|
|
||||||
(translate-anim 32
|
|
||||||
my-profile-button-anim-y))
|
|
||||||
on-keyboard-hide (fn []
|
|
||||||
(translate-anim 0
|
|
||||||
my-profile-button-anim-y))
|
|
||||||
keyboard-show-event (if platform/android?
|
|
||||||
"keyboardDidShow"
|
|
||||||
"keyboardWillShow")
|
|
||||||
keyboard-hide-event (if platform/android?
|
|
||||||
"keyboardDidHide"
|
|
||||||
"keyboardWillHide")]
|
|
||||||
{:component-did-mount
|
|
||||||
(fn [_]
|
|
||||||
(reset! keyboard-show-listener (.addListener react/keyboard keyboard-show-event on-keyboard-show))
|
|
||||||
(reset! keyboard-hide-listener (.addListener react/keyboard
|
|
||||||
keyboard-hide-event
|
|
||||||
on-keyboard-hide)))
|
|
||||||
:component-will-unmount
|
|
||||||
(fn []
|
|
||||||
(some-> ^js @keyboard-show-listener
|
|
||||||
.remove)
|
|
||||||
(some-> ^js @keyboard-hide-listener
|
|
||||||
.remove))}
|
|
||||||
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
|
||||||
[react/view {:style {:flex 1}}
|
|
||||||
[topbar/topbar
|
|
||||||
{:title (i18n/label :t/new-chat)
|
|
||||||
:modal? true
|
|
||||||
:right-accessories
|
|
||||||
[{:icon :qr
|
|
||||||
:accessibility-label :scan-contact-code-button
|
|
||||||
:on-press #(re-frame/dispatch [::qr-scanner/scan-code
|
|
||||||
{:title (i18n/label :t/new-chat)
|
|
||||||
:handler :contact/qr-code-scanned}])}]}]
|
|
||||||
[react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:padding 16}
|
|
||||||
[react/view {:flex 1}
|
|
||||||
[quo/text-input
|
|
||||||
{:on-change-text
|
|
||||||
#(do
|
|
||||||
(reset! search-value %)
|
|
||||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :empty])
|
|
||||||
(debounce/debounce-and-dispatch [:contacts/set-new-identity %] 600))
|
|
||||||
:on-submit-editing
|
|
||||||
#(when (= state :valid)
|
|
||||||
(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted false nil] 3000))
|
|
||||||
:placeholder (i18n/label :t/enter-contact-code)
|
|
||||||
:show-cancel false
|
|
||||||
:accessibility-label :enter-contact-code-input
|
|
||||||
:auto-capitalize :none
|
|
||||||
:return-key-type :go
|
|
||||||
:monospace true
|
|
||||||
:auto-correct false}]]]
|
|
||||||
[react/scroll-view
|
|
||||||
{:style {:flex 1}
|
|
||||||
:keyboard-dismiss-mode :on-drag
|
|
||||||
:keyboard-should-persist-taps :handled}
|
|
||||||
[react/view
|
|
||||||
(when (and
|
|
||||||
(= (count contacts) 0)
|
|
||||||
(= @search-value ""))
|
|
||||||
{:flex 1})
|
|
||||||
(if (and
|
|
||||||
(= (count contacts) 0)
|
|
||||||
(= @search-value ""))
|
|
||||||
[react/view
|
|
||||||
{:flex 1
|
|
||||||
:align-items :center
|
|
||||||
:padding-horizontal 58
|
|
||||||
:padding-top 160}
|
|
||||||
[quo/text
|
|
||||||
{:size :base
|
|
||||||
:align :center
|
|
||||||
:color :secondary}
|
|
||||||
(i18n/label :t/you-dont-have-contacts-invite-friends)]
|
|
||||||
[invite/button]]
|
|
||||||
[list/flat-list
|
|
||||||
{:data (filter-contacts @search-value contacts)
|
|
||||||
:key-fn :address
|
|
||||||
:render-fn render-row}])]
|
|
||||||
(when-not (= @search-value "")
|
|
||||||
[react/view
|
|
||||||
[quo/text
|
|
||||||
{:style {:margin-horizontal 16
|
|
||||||
:margin-vertical 14}
|
|
||||||
:size :base
|
|
||||||
:align :left
|
|
||||||
:color :secondary}
|
|
||||||
(i18n/label :t/non-contacts)]
|
|
||||||
(when (and (= state :searching)
|
|
||||||
(is-valid-username? @search-value))
|
|
||||||
[rn/activity-indicator
|
|
||||||
{:color colors/gray
|
|
||||||
:size (if platform/android? :large :small)}])
|
|
||||||
(if (= state :valid)
|
|
||||||
[quo/list-item
|
|
||||||
(merge
|
|
||||||
{:title (or ens-name (gfycat/generate-gfy public-key))
|
|
||||||
:subtitle (if ens-name
|
|
||||||
(gfycat/generate-gfy public-key)
|
|
||||||
(utils/get-shortened-address public-key))
|
|
||||||
:icon [chat-icon/contact-icon-contacts-tab
|
|
||||||
(identicon/identicon public-key)]
|
|
||||||
:on-press #(do
|
|
||||||
(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted false] 3000)
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))}
|
|
||||||
(when ens-name {:subtitle-secondary public-key}))]
|
|
||||||
[quo/text
|
|
||||||
{:style {:margin-horizontal 16}
|
|
||||||
:size :base
|
|
||||||
:align :center
|
|
||||||
:color :secondary}
|
|
||||||
(if (is-valid-username? @search-value)
|
|
||||||
(when (= state :error)
|
|
||||||
(get-validation-label error))
|
|
||||||
(i18n/label :t/invalid-username-or-key))])])]
|
|
||||||
(when-not (and
|
|
||||||
(= (count contacts) 0)
|
|
||||||
(= @search-value ""))
|
|
||||||
[react/animated-view
|
|
||||||
{:style {:height 36
|
|
||||||
:width 124
|
|
||||||
:position :absolute
|
|
||||||
:bottom 42
|
|
||||||
:transform [{:translateY my-profile-button-anim-y}]
|
|
||||||
:align-self :center}}
|
|
||||||
[react/touchable-opacity
|
|
||||||
{:style {:padding-horizontal 2
|
|
||||||
:height 36
|
|
||||||
:width 124
|
|
||||||
:background-color colors/blue
|
|
||||||
:border-radius 18
|
|
||||||
:elevation 4
|
|
||||||
:shadow-offset {:width 0 :height 4}
|
|
||||||
:shadow-color "rgba(0, 34, 51, 0.16)"
|
|
||||||
:shadow-radius 4
|
|
||||||
:shadow-opacity 1}
|
|
||||||
:on-press on-share}
|
|
||||||
[react/view
|
|
||||||
{:style {:flex 1
|
|
||||||
:flex-direction :row
|
|
||||||
:align-items :center}}
|
|
||||||
[photos/photo
|
|
||||||
(multiaccounts/displayed-photo account)
|
|
||||||
{:size 32
|
|
||||||
:accessibility-label :current-account-photo}]
|
|
||||||
[quo/text
|
|
||||||
{:size :base
|
|
||||||
:weight :medium
|
|
||||||
:color :inverse
|
|
||||||
:style {:margin-left 6}}
|
|
||||||
(i18n/label :t/my-profile)]]]])]]))
|
|
||||||
|
|
||||||
(defn- nickname-input
|
|
||||||
[entered-nickname]
|
|
||||||
[quo/text-input
|
|
||||||
{:on-change-text #(reset! entered-nickname %)
|
|
||||||
:auto-capitalize :none
|
|
||||||
:max-length 32
|
|
||||||
:auto-focus false
|
|
||||||
:accessibility-label :nickname-input
|
|
||||||
:placeholder (i18n/label :t/add-nickname)
|
|
||||||
:return-key-type :done
|
|
||||||
:auto-correct false}])
|
|
||||||
|
|
||||||
(defn new-contact
|
|
||||||
[]
|
|
||||||
(let [entered-nickname (reagent/atom "")]
|
|
||||||
(fn []
|
|
||||||
(let [{:keys [state ens-name public-key error]} @(re-frame/subscribe [:contacts/new-identity])
|
|
||||||
blocked? (and
|
|
||||||
(validators/valid-public-key? (or public-key ""))
|
|
||||||
@(re-frame/subscribe [:contacts/contact-blocked?
|
|
||||||
public-key]))]
|
|
||||||
[react/view {:style {:flex 1}}
|
|
||||||
[topbar/topbar
|
|
||||||
{:title (i18n/label :t/new-contact)
|
|
||||||
:modal? true
|
|
||||||
:right-accessories
|
|
||||||
[{:icon :qr
|
|
||||||
:accessibility-label :scan-contact-code-button
|
|
||||||
:on-press #(re-frame/dispatch [::qr-scanner/scan-code
|
|
||||||
{:title (i18n/label :t/new-contact)
|
|
||||||
:handler :contact/qr-code-scanned
|
|
||||||
:new-contact? true
|
|
||||||
:nickname @entered-nickname}])}]}]
|
|
||||||
[react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:padding 16}
|
|
||||||
[react/view
|
|
||||||
{:flex 1
|
|
||||||
:padding-right 16}
|
|
||||||
[quo/text-input
|
|
||||||
{:on-change-text
|
|
||||||
#(do
|
|
||||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
|
||||||
(debounce/debounce-and-dispatch [:contacts/set-new-identity %] 600))
|
|
||||||
:on-submit-editing
|
|
||||||
#(when (= state :valid)
|
|
||||||
(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted true @entered-nickname]
|
|
||||||
3000))
|
|
||||||
:placeholder (i18n/label :t/enter-contact-code)
|
|
||||||
:show-cancel false
|
|
||||||
:accessibility-label :enter-contact-code-input
|
|
||||||
:auto-capitalize :none
|
|
||||||
:return-key-type :go}]]
|
|
||||||
[react/view
|
|
||||||
{:justify-content :center
|
|
||||||
:align-items :center}
|
|
||||||
[input-icon state true @entered-nickname blocked?]]]
|
|
||||||
[react/view {:min-height 30 :justify-content :flex-end :margin-bottom 16}
|
|
||||||
[quo/text
|
|
||||||
{:style {:margin-horizontal 16}
|
|
||||||
:size :small
|
|
||||||
:align :center
|
|
||||||
:color :secondary}
|
|
||||||
(cond (= state :error)
|
|
||||||
(get-validation-label error)
|
|
||||||
(= state :valid)
|
|
||||||
(str (when ens-name (str ens-name " • "))
|
|
||||||
(utils/get-shortened-address public-key))
|
|
||||||
:else "")]]
|
|
||||||
[react/text {:style {:margin-horizontal 16 :color colors/gray}}
|
|
||||||
(i18n/label :t/nickname-description)]
|
|
||||||
[react/view {:padding 16}
|
|
||||||
[nickname-input entered-nickname]
|
|
||||||
[react/text
|
|
||||||
{:style {:align-self :flex-end
|
|
||||||
:margin-top 16
|
|
||||||
:color colors/gray}}
|
|
||||||
(str (count @entered-nickname) " / 32")]]]))))
|
|
|
@ -1,50 +0,0 @@
|
||||||
(ns status-im.ui.screens.add-new.new-public-chat.view
|
|
||||||
(:require [quo.core :as quo]
|
|
||||||
[quo.design-system.colors :as colors]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[status-im.add-new.db :as db]
|
|
||||||
[status-im.react-native.resources :as resources]
|
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
|
||||||
[status-im.ui.components.react :as react]
|
|
||||||
[utils.i18n :as i18n])
|
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
|
||||||
|
|
||||||
(defn- start-chat
|
|
||||||
[topic]
|
|
||||||
(re-frame/dispatch [:chat.ui/start-public-chat topic])
|
|
||||||
(re-frame/dispatch [:set :public-group-topic nil]))
|
|
||||||
|
|
||||||
(defn- hash-icon
|
|
||||||
[]
|
|
||||||
[icons/icon :main-icons/channel {:color colors/gray}])
|
|
||||||
|
|
||||||
(defn- chat-name-input
|
|
||||||
[topic error]
|
|
||||||
[quo/text-input
|
|
||||||
{:on-change-text #(re-frame/dispatch [:set :public-group-topic %])
|
|
||||||
:on-submit-editing #(when (db/valid-topic? topic) (start-chat topic))
|
|
||||||
:auto-capitalize :none
|
|
||||||
:auto-focus false
|
|
||||||
:accessibility-label :chat-name-input
|
|
||||||
:before {:component [hash-icon]}
|
|
||||||
;; Set default-value as otherwise it will
|
|
||||||
;; be erased in global `onWillBlur` handler
|
|
||||||
:default-value topic
|
|
||||||
:placeholder "chat-name"
|
|
||||||
:return-key-type :go
|
|
||||||
:auto-correct false
|
|
||||||
:error error}])
|
|
||||||
|
|
||||||
(views/defview new-public-chat
|
|
||||||
[]
|
|
||||||
(views/letsubs [topic [:public-group-topic]
|
|
||||||
error [:public-chat.new/topic-error-message]]
|
|
||||||
[react/scroll-view {:style {:flex 1}}
|
|
||||||
[react/view {:padding-horizontal 16}
|
|
||||||
[react/view {:align-items :center :padding-vertical 8}
|
|
||||||
[react/image
|
|
||||||
{:source (:new-chat-header resources/ui)
|
|
||||||
:style {:width 160 :height 160}}]]
|
|
||||||
[react/text {:style {:text-align :center :margin-bottom 16 :line-height 22}}
|
|
||||||
(i18n/label :t/public-chat-description)]
|
|
||||||
[chat-name-input topic error]]]))
|
|
|
@ -41,8 +41,7 @@
|
||||||
(defn browser-options
|
(defn browser-options
|
||||||
[url account empty-tab name]
|
[url account empty-tab name]
|
||||||
(fn []
|
(fn []
|
||||||
(let [topic (http/topic-from-url url)
|
(let [bookmarks @(re-frame/subscribe [:bookmarks/active])
|
||||||
bookmarks @(re-frame/subscribe [:bookmarks/active])
|
|
||||||
permissions @(re-frame/subscribe [:dapps/permissions])
|
permissions @(re-frame/subscribe [:dapps/permissions])
|
||||||
fav? (get bookmarks url)
|
fav? (get bookmarks url)
|
||||||
connected? (some #{constants/dapp-permission-web3}
|
connected? (some #{constants/dapp-permission-web3}
|
||||||
|
@ -85,15 +84,6 @@
|
||||||
(js/setTimeout
|
(js/setTimeout
|
||||||
#(browser/share-link url)
|
#(browser/share-link url)
|
||||||
200))}]
|
200))}]
|
||||||
[quo/list-item
|
|
||||||
{:icon [chat-icon/custom-icon-view-list
|
|
||||||
topic
|
|
||||||
(rand-nth colors/chat-colors)]
|
|
||||||
:accessibility-label :open-chat
|
|
||||||
:title (str "#" topic)
|
|
||||||
:subtitle (i18n/label :t/open-chat)
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:chat.ui/start-public-chat topic])
|
|
||||||
:chevron true}]
|
|
||||||
[components/separator]])
|
[components/separator]])
|
||||||
(if connected?
|
(if connected?
|
||||||
[quo/list-item
|
[quo/list-item
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||||
[status-im.ui.components.list-selection :as list-selection]
|
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.screens.chat.styles.message.sheets :as sheets.styles]
|
[status-im.ui.screens.chat.styles.message.sheets :as sheets.styles]))
|
||||||
[status-im.utils.universal-links.utils :as universal-links]))
|
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
(defn hide-sheet-and-dispatch
|
||||||
[event]
|
[event]
|
||||||
|
@ -42,41 +40,6 @@
|
||||||
:icon :main-icons/delete
|
:icon :main-icons/delete
|
||||||
:on-press #(re-frame/dispatch [:chat.ui/show-remove-confirmation chat-id])}]]))
|
:on-press #(re-frame/dispatch [:chat.ui/show-remove-confirmation chat-id])}]]))
|
||||||
|
|
||||||
(defn public-chat-accents
|
|
||||||
[chat-id]
|
|
||||||
(let [link (universal-links/generate-link :public-chat :external chat-id)
|
|
||||||
message (i18n/label :t/share-public-chat-text {:link link})]
|
|
||||||
[react/view
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/share-chat)
|
|
||||||
:accessibility-label :share-chat-button
|
|
||||||
:icon :main-icons/share
|
|
||||||
:on-press (fn []
|
|
||||||
(re-frame/dispatch [:bottom-sheet/hide-old])
|
|
||||||
;; https://github.com/facebook/react-native/pull/26839
|
|
||||||
(js/setTimeout
|
|
||||||
#(list-selection/open-share {:message message})
|
|
||||||
250))}]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/mark-all-read)
|
|
||||||
:accessibility-label :mark-all-read-button
|
|
||||||
:icon :main-icons/check
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/clear-history)
|
|
||||||
:accessibility-label :clear-history-button
|
|
||||||
:icon :main-icons/close
|
|
||||||
:on-press #(re-frame/dispatch [:chat.ui/show-clear-history-confirmation chat-id])}]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :negative
|
|
||||||
:title (i18n/label :t/delete-chat)
|
|
||||||
:accessibility-label :delete-chat-button
|
|
||||||
:icon :main-icons/delete
|
|
||||||
:on-press #(re-frame/dispatch [:chat.ui/show-remove-confirmation chat-id])}]]))
|
|
||||||
|
|
||||||
(defn community-chat-accents
|
(defn community-chat-accents
|
||||||
[]
|
[]
|
||||||
(fn [{:keys [chat-id group-chat chat-name color emoji]}]
|
(fn [{:keys [chat-id group-chat chat-name color emoji]}]
|
||||||
|
@ -150,11 +113,6 @@
|
||||||
[{:keys [chat-type chat-id]
|
[{:keys [chat-type chat-id]
|
||||||
:as current-chat}]
|
:as current-chat}]
|
||||||
(cond
|
(cond
|
||||||
(#{constants/public-chat-type
|
|
||||||
constants/profile-chat-type
|
|
||||||
constants/timeline-chat-type}
|
|
||||||
chat-type)
|
|
||||||
[public-chat-accents chat-id]
|
|
||||||
|
|
||||||
(= chat-type constants/community-chat-type)
|
(= chat-type constants/community-chat-type)
|
||||||
[community-chat-accents current-chat]
|
[community-chat-accents current-chat]
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
[status-im.ui.components.topbar :as topbar]
|
[status-im.ui.components.topbar :as topbar]
|
||||||
[status-im.ui.screens.chat.photos :as photos]
|
[status-im.ui.screens.chat.photos :as photos]
|
||||||
[status-im.ui.screens.chat.sheets :as sheets]
|
[status-im.ui.screens.chat.sheets :as sheets]
|
||||||
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
|
||||||
[status-im.utils.core :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[utils.datetime :as datetime]
|
[utils.datetime :as datetime]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]
|
||||||
|
[status-im.ui.screens.home.views.inner-item :as inner-item]))
|
||||||
|
|
||||||
(def request-cooldown-ms (* 24 60 60 1000))
|
(def request-cooldown-ms (* 24 60 60 1000))
|
||||||
|
|
||||||
|
|
|
@ -1,183 +0,0 @@
|
||||||
(ns status-im.ui.screens.communities.views
|
|
||||||
(:require [quo.core :as quo]
|
|
||||||
[quo.design-system.colors :as quo.colors]
|
|
||||||
[status-im.communities.core :as communities]
|
|
||||||
[status-im2.constants :as constants]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[status-im.ui.components.badge :as badge]
|
|
||||||
[status-im.ui.components.copyable-text :as copyable-text]
|
|
||||||
[status-im.ui.components.list.views :as list]
|
|
||||||
[status-im.ui.components.react :as react]
|
|
||||||
[status-im.ui.components.toolbar :as toolbar]
|
|
||||||
[status-im.ui.components.topbar :as topbar]
|
|
||||||
[status-im.ui.screens.communities.community :as community]
|
|
||||||
[status-im.ui.screens.communities.icon :as communities.icon]
|
|
||||||
[status-im.utils.core :as utils]
|
|
||||||
[utils.re-frame :as rf]))
|
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
|
||||||
[event]
|
|
||||||
(rf/dispatch [:bottom-sheet/hide-old])
|
|
||||||
(rf/dispatch event))
|
|
||||||
|
|
||||||
(defn community-unviewed-count
|
|
||||||
[id]
|
|
||||||
(let [{:keys [unviewed-messages-count unviewed-mentions-count]} (rf/sub [:communities/unviewed-counts
|
|
||||||
id])]
|
|
||||||
(cond
|
|
||||||
(pos? unviewed-mentions-count)
|
|
||||||
[badge/message-counter unviewed-mentions-count]
|
|
||||||
|
|
||||||
(pos? unviewed-messages-count)
|
|
||||||
[react/view
|
|
||||||
{:style {:background-color quo.colors/blue
|
|
||||||
:border-radius 6
|
|
||||||
:margin-right 5
|
|
||||||
:margin-top 2
|
|
||||||
:width 12
|
|
||||||
:height 12}
|
|
||||||
:accessibility-label :unviewed-messages-public}])))
|
|
||||||
|
|
||||||
(defn community-home-list-item
|
|
||||||
[{:keys [id name last?] :as community}]
|
|
||||||
[react/touchable-opacity
|
|
||||||
{:style (merge {:height 64}
|
|
||||||
(when last?
|
|
||||||
{:border-bottom-color (quo.colors/get-color :ui-01)
|
|
||||||
:border-bottom-width 1}))
|
|
||||||
:on-press (fn []
|
|
||||||
(rf/dispatch [:communities/load-category-states id])
|
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
|
||||||
(rf/dispatch [:navigate-to :community-overview id]))
|
|
||||||
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet-old
|
|
||||||
{:content (fn []
|
|
||||||
[community/community-actions community])}])}
|
|
||||||
[:<>
|
|
||||||
[react/view {:top 12 :left 16 :position :absolute}
|
|
||||||
[communities.icon/community-icon community]]
|
|
||||||
[react/view
|
|
||||||
{:style {:margin-left 72
|
|
||||||
:flex-direction :row
|
|
||||||
:flex 1}
|
|
||||||
:accessibility-label :chat-name-text}
|
|
||||||
[react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:flex 1
|
|
||||||
:padding-right 16
|
|
||||||
:align-items :center}
|
|
||||||
[quo/text
|
|
||||||
{:weight :medium
|
|
||||||
:accessibility-label :chat-name-text
|
|
||||||
:font-size 17
|
|
||||||
:ellipsize-mode :tail
|
|
||||||
:number-of-lines 1}
|
|
||||||
name]]
|
|
||||||
[react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:flex 1
|
|
||||||
:margin-right 15
|
|
||||||
:justify-content :flex-end
|
|
||||||
:align-items :center}
|
|
||||||
[community-unviewed-count id]]]]])
|
|
||||||
|
|
||||||
(defn community-list-item
|
|
||||||
[{:keys [id permissions members name description] :as community}]
|
|
||||||
(let [members-count (count members)
|
|
||||||
show-members-count? (not= (:access permissions) constants/community-no-membership-access)]
|
|
||||||
[quo/list-item
|
|
||||||
{:icon [communities.icon/community-icon community]
|
|
||||||
:title [react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:flex 1
|
|
||||||
:padding-right 16
|
|
||||||
:align-items :center}
|
|
||||||
[quo/text
|
|
||||||
{:weight :medium
|
|
||||||
:accessibility-label :community-name-text
|
|
||||||
:ellipsize-mode :tail
|
|
||||||
:number-of-lines 1}
|
|
||||||
(utils/truncate-str name 30)]]
|
|
||||||
:title-accessibility-label :community-name-text
|
|
||||||
:subtitle [react/view
|
|
||||||
[quo/text {:number-of-lines 1}
|
|
||||||
description]
|
|
||||||
[quo/text
|
|
||||||
{:number-of-lines 1
|
|
||||||
:color :secondary}
|
|
||||||
(if show-members-count?
|
|
||||||
(i18n/label-pluralize members-count
|
|
||||||
:t/community-members
|
|
||||||
{:count members-count})
|
|
||||||
(i18n/label :t/open-membership))]]
|
|
||||||
:on-press #(do
|
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
|
||||||
(rf/dispatch [:navigate-to :community-overview id]))}]))
|
|
||||||
|
|
||||||
(defn communities-actions
|
|
||||||
[]
|
|
||||||
[:<>
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/import-community)
|
|
||||||
:accessibility-label :community-import-community
|
|
||||||
:icon :main-icons/objects
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:navigate-to :community-import])}]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/create-community)
|
|
||||||
:accessibility-label :community-create-community
|
|
||||||
:icon :main-icons/add
|
|
||||||
:on-press #(hide-sheet-and-dispatch [::communities/open-create-community])}]])
|
|
||||||
|
|
||||||
(defn communities-list
|
|
||||||
[communities]
|
|
||||||
[list/section-list
|
|
||||||
{:content-container-style {:padding-vertical 8}
|
|
||||||
:key-fn :id
|
|
||||||
:keyboard-should-persist-taps :always
|
|
||||||
:sticky-section-headers-enabled false
|
|
||||||
:sections communities
|
|
||||||
:render-section-header-fn quo/list-index
|
|
||||||
:render-fn community-list-item}])
|
|
||||||
|
|
||||||
(defn communities
|
|
||||||
[]
|
|
||||||
(let [communities (rf/sub [:communities/section-list])]
|
|
||||||
[:<>
|
|
||||||
[topbar/topbar
|
|
||||||
{:title (i18n/label :t/communities)
|
|
||||||
:right-accessories
|
|
||||||
[{:icon :main-icons/more
|
|
||||||
:accessibility-label :chat-menu-button
|
|
||||||
:on-press
|
|
||||||
#(rf/dispatch [:bottom-sheet/show-sheet-old
|
|
||||||
{:content (fn []
|
|
||||||
[communities-actions])
|
|
||||||
:height 256}])}]}]
|
|
||||||
[communities-list communities]
|
|
||||||
[toolbar/toolbar
|
|
||||||
{:show-border? true
|
|
||||||
:center [quo/button
|
|
||||||
{:on-press #(rf/dispatch [::communities/open-create-community])
|
|
||||||
:type :secondary}
|
|
||||||
(i18n/label :t/create-community)]}]]))
|
|
||||||
|
|
||||||
(defn export-community
|
|
||||||
[]
|
|
||||||
(let [{:keys [community-key]} (rf/sub [:popover/popover])]
|
|
||||||
[react/view
|
|
||||||
{:style {:padding-top 16
|
|
||||||
:padding-horizontal 16}}
|
|
||||||
[quo/text
|
|
||||||
{:size :x-large
|
|
||||||
:align :center}
|
|
||||||
(i18n/label :t/community-private-key)]
|
|
||||||
[copyable-text/copyable-text-view
|
|
||||||
{:container-style {:padding-vertical 12}
|
|
||||||
:copied-text community-key}
|
|
||||||
[quo/text
|
|
||||||
{:number-of-lines 1
|
|
||||||
:ellipsize-mode :middle
|
|
||||||
:accessibility-label :chat-key
|
|
||||||
:monospace true}
|
|
||||||
community-key]]]))
|
|
|
@ -11,8 +11,7 @@
|
||||||
:title (i18n/label :t/faq)
|
:title (i18n/label :t/faq)
|
||||||
:accessibility-label :faq-button
|
:accessibility-label :faq-button
|
||||||
:on-press
|
:on-press
|
||||||
#(.openURL ^js react/linking
|
#(.openURL ^js react/linking constants/faq)
|
||||||
constants/faq)
|
|
||||||
:chevron true}
|
:chevron true}
|
||||||
{:size :small
|
{:size :small
|
||||||
:title (i18n/label :t/glossary)
|
:title (i18n/label :t/glossary)
|
||||||
|
@ -25,13 +24,6 @@
|
||||||
:accessibility-label :submit-bug-button
|
:accessibility-label :submit-bug-button
|
||||||
:on-press
|
:on-press
|
||||||
#(re-frame/dispatch [:open-modal :bug-report])
|
#(re-frame/dispatch [:open-modal :bug-report])
|
||||||
:chevron true}
|
|
||||||
{:size :small
|
|
||||||
:title (i18n/label :t/request-feature)
|
|
||||||
:accessibility-label :request-a-feature-button
|
|
||||||
:on-press
|
|
||||||
#(re-frame/dispatch [:chat.ui/start-public-chat
|
|
||||||
"support"])
|
|
||||||
:chevron true}])
|
:chevron true}])
|
||||||
|
|
||||||
(defn help-center
|
(defn help-center
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
(ns status-im.ui.screens.home.sheet.styles)
|
|
||||||
(def add-new-view-wrapper
|
|
||||||
{:style {:flex-direction :row
|
|
||||||
:padding-left 16
|
|
||||||
:padding-right 8
|
|
||||||
:justify-content :space-between
|
|
||||||
:align-items :center}})
|
|
|
@ -1,62 +0,0 @@
|
||||||
(ns status-im.ui.screens.home.sheet.views
|
|
||||||
(:require [quo.core :as quo]
|
|
||||||
[utils.re-frame :as rf]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[status-im.qr-scanner.core :as qr-scanner]
|
|
||||||
[status-im.ui.components.invite.views :as invite]
|
|
||||||
[status-im.ui.components.react :as rn]
|
|
||||||
[status-im2.config :as config]
|
|
||||||
[status-im.ui.screens.home.sheet.styles :as style]))
|
|
||||||
|
|
||||||
(defn- hide-sheet-and-dispatch
|
|
||||||
[event]
|
|
||||||
(rf/dispatch [:bottom-sheet/hide-old])
|
|
||||||
(rf/dispatch event))
|
|
||||||
|
|
||||||
(defn add-new-view
|
|
||||||
[]
|
|
||||||
[rn/view
|
|
||||||
[rn/view style/add-new-view-wrapper
|
|
||||||
[quo/text
|
|
||||||
{:size :large
|
|
||||||
:weight :bold}
|
|
||||||
(i18n/label :t/open-home)]
|
|
||||||
[quo/button
|
|
||||||
{:type :icon
|
|
||||||
:theme :icon
|
|
||||||
:accessibility-label :universal-qr-scanner
|
|
||||||
:on-press #(hide-sheet-and-dispatch
|
|
||||||
[::qr-scanner/scan-code
|
|
||||||
{:handler ::qr-scanner/on-scan-success}])}
|
|
||||||
:main-icons/qr]]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/start-new-chat)
|
|
||||||
:accessibility-label :start-1-1-chat-button
|
|
||||||
:icon :main-icons/one-on-one-chat
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:open-modal :new-chat])}]
|
|
||||||
(when config/group-chat-enabled?
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/start-group-chat)
|
|
||||||
:accessibility-label :start-group-chat-button
|
|
||||||
:icon :main-icons/group-chat
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:contact.ui/start-group-chat-pressed])}])
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/new-public-group-chat)
|
|
||||||
:accessibility-label :join-public-chat-button
|
|
||||||
:icon :main-icons/public-chat
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:open-modal :new-public-chat])}]
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:title (i18n/label :t/communities-alpha)
|
|
||||||
:accessibility-label :communities-button
|
|
||||||
:icon :main-icons/communities
|
|
||||||
:on-press #(hide-sheet-and-dispatch [:navigate-to :communities])}]
|
|
||||||
[invite/list-item
|
|
||||||
{:accessibility-label :chats-menu-invite-friends-button}]])
|
|
||||||
|
|
||||||
;; Deprecated
|
|
||||||
(def add-new
|
|
||||||
{:content add-new-view})
|
|
|
@ -1,375 +0,0 @@
|
||||||
(ns status-im.ui.screens.home.views
|
|
||||||
(:require
|
|
||||||
[quo.core :as quo]
|
|
||||||
[quo.design-system.colors :as colors]
|
|
||||||
[quo2.components.buttons.button :as quo2.button]
|
|
||||||
[quo2.components.markdown.text :as quo2.text]
|
|
||||||
[quo2.foundations.colors :as quo2.colors]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[reagent.core :as reagent]
|
|
||||||
[status-im.add-new.db :as db]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[status-im.qr-scanner.core :as qr-scanner]
|
|
||||||
[status-im.react-native.resources :as resources]
|
|
||||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
|
||||||
[status-im.ui.components.chat-icon.styles :as chat-icon.styles]
|
|
||||||
[status-im.ui.components.connectivity.view :as connectivity]
|
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
|
||||||
[status-im.ui.components.invite.views :as invite]
|
|
||||||
[status-im.ui.components.list.views :as list]
|
|
||||||
[status-im.ui.components.plus-button :as components.plus-button]
|
|
||||||
[status-im.ui.components.react :as react]
|
|
||||||
[status-im.ui.components.search-input.view :as search-input]
|
|
||||||
[status-im.ui.components.topbar :as topbar]
|
|
||||||
[status-im.ui.screens.chat.sheets :as sheets]
|
|
||||||
[status-im.ui.screens.communities.views :as communities.views]
|
|
||||||
[status-im.ui.screens.home.styles :as styles]
|
|
||||||
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
|
||||||
[status-im.utils.utils :as utils]
|
|
||||||
[utils.debounce :as debounce])
|
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
|
||||||
|
|
||||||
(defn home-tooltip-view
|
|
||||||
[]
|
|
||||||
[react/view (styles/chat-tooltip)
|
|
||||||
[react/view
|
|
||||||
{:style {:width 66
|
|
||||||
:position :absolute
|
|
||||||
:top -6
|
|
||||||
:background-color colors/white
|
|
||||||
:align-items :center}}
|
|
||||||
[react/image
|
|
||||||
{:source (resources/get-image :empty-chats-header)
|
|
||||||
:style {:width 50 :height 50}}]]
|
|
||||||
[react/touchable-highlight
|
|
||||||
{:style {:position :absolute
|
|
||||||
:right 0
|
|
||||||
:top 0
|
|
||||||
:width 44
|
|
||||||
:height 44
|
|
||||||
:align-items :center
|
|
||||||
:justify-content :center}
|
|
||||||
:on-press #(re-frame/dispatch [:multiaccounts.ui/hide-home-tooltip])
|
|
||||||
:accessibility-label :hide-home-button}
|
|
||||||
[icons/icon :main-icons/close-circle {:color colors/gray}]]
|
|
||||||
[react/i18n-text {:style styles/no-chats-text :key :chat-and-transact}]
|
|
||||||
[react/view
|
|
||||||
{:align-items :center
|
|
||||||
:margin-top 8
|
|
||||||
:margin-bottom 12}
|
|
||||||
[invite/button]]])
|
|
||||||
|
|
||||||
(defn welcome-blank-page
|
|
||||||
[]
|
|
||||||
[react/view {:style {:flex 1 :flex-direction :row :align-items :center :justify-content :center}}
|
|
||||||
[react/i18n-text {:style styles/welcome-blank-text :key :welcome-blank-message}]])
|
|
||||||
|
|
||||||
(defonce search-active? (reagent/atom false))
|
|
||||||
|
|
||||||
(defn search-input-wrapper
|
|
||||||
[search-filter chats-empty]
|
|
||||||
[react/view
|
|
||||||
{:padding-horizontal 16
|
|
||||||
:padding-vertical 10}
|
|
||||||
[search-input/search-input
|
|
||||||
{:search-active? search-active?
|
|
||||||
:placeholder (i18n/label :t/search)
|
|
||||||
:border-radius 10
|
|
||||||
:search-filter search-filter
|
|
||||||
:before true
|
|
||||||
:on-cancel #(re-frame/dispatch [:search/home-filter-changed nil])
|
|
||||||
:on-blur (fn []
|
|
||||||
(when chats-empty
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
|
||||||
(re-frame/dispatch [:contacts/clear-new-identity]))
|
|
||||||
:on-focus (fn [search-filter]
|
|
||||||
(when-not search-filter
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed ""])
|
|
||||||
(re-frame/dispatch [:contacts/clear-new-identity])))
|
|
||||||
:on-change (fn [text]
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed text])
|
|
||||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
|
||||||
(debounce/debounce-and-dispatch [:contacts/set-new-identity text] 300))}]])
|
|
||||||
|
|
||||||
(defn search-input-wrapper-old
|
|
||||||
[search-filter chats-empty]
|
|
||||||
[react/view
|
|
||||||
{:padding-horizontal 16
|
|
||||||
:padding-vertical 10}
|
|
||||||
[search-input/search-input-old
|
|
||||||
{:search-active? search-active?
|
|
||||||
:search-filter search-filter
|
|
||||||
:on-cancel #(re-frame/dispatch [:search/home-filter-changed nil])
|
|
||||||
:on-blur (fn []
|
|
||||||
(when chats-empty
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
|
||||||
(re-frame/dispatch [:contacts/clear-new-identity]))
|
|
||||||
:on-focus (fn [search-filter]
|
|
||||||
(when-not search-filter
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed ""])
|
|
||||||
(re-frame/dispatch [:contacts/clear-new-identity])))
|
|
||||||
:on-change (fn [text]
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed text])
|
|
||||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
|
||||||
(debounce/debounce-and-dispatch [:new-chat/set-new-identity text] 300))}]])
|
|
||||||
|
|
||||||
(defn start-suggestion
|
|
||||||
[search-value]
|
|
||||||
(let [{:keys [state ens-name public-key compressed-key]}
|
|
||||||
@(re-frame/subscribe [:contacts/new-identity])
|
|
||||||
valid-private? (= state :valid)
|
|
||||||
valid-public? (db/valid-topic? search-value)]
|
|
||||||
(when (or valid-public? valid-private?)
|
|
||||||
[react/view
|
|
||||||
[quo/list-header (i18n/label :t/search-no-chat-found)]
|
|
||||||
(when valid-private?
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:icon :main-icons/private-chat
|
|
||||||
:title (or ens-name
|
|
||||||
(utils/get-shortened-address
|
|
||||||
(or compressed-key public-key)))
|
|
||||||
:subtitle (i18n/label :t/join-new-private-chat)
|
|
||||||
:on-press (fn []
|
|
||||||
(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted false] 3000)
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))}])
|
|
||||||
(when valid-public?
|
|
||||||
[quo/list-item
|
|
||||||
{:theme :accent
|
|
||||||
:icon :main-icons/public-chat
|
|
||||||
:title (str "#" search-value)
|
|
||||||
:subtitle (i18n/label :t/join-new-public-chat)
|
|
||||||
:on-press (fn []
|
|
||||||
(re-frame/dispatch [:chat.ui/start-public-chat search-value])
|
|
||||||
(re-frame/dispatch [:set :public-group-topic nil])
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))}])])))
|
|
||||||
|
|
||||||
(defn render-fn
|
|
||||||
[{:keys [chat-id] :as home-item}]
|
|
||||||
;; We use `chat-id` to distinguish communities from chats
|
|
||||||
(if chat-id
|
|
||||||
[inner-item/home-list-item
|
|
||||||
home-item
|
|
||||||
{:on-press (fn []
|
|
||||||
(re-frame/dispatch [:dismiss-keyboard])
|
|
||||||
(re-frame/dispatch [:chat/navigate-to-chat chat-id])
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
|
||||||
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
|
||||||
{:content (fn []
|
|
||||||
[sheets/actions home-item])}])}]
|
|
||||||
[communities.views/community-home-list-item home-item]))
|
|
||||||
|
|
||||||
(defn render-fn-old
|
|
||||||
[{:keys [chat-id] :as home-item}]
|
|
||||||
;; We use `chat-id` to distinguish communities from chats
|
|
||||||
(if chat-id
|
|
||||||
[inner-item/home-list-item-old
|
|
||||||
home-item
|
|
||||||
{:on-press (fn []
|
|
||||||
(re-frame/dispatch [:dismiss-keyboard])
|
|
||||||
(re-frame/dispatch [:chat/navigate-to-chat chat-id])
|
|
||||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
|
||||||
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
|
||||||
{:content (fn []
|
|
||||||
[sheets/actions home-item])}])}]
|
|
||||||
[communities.views/community-home-list-item home-item]))
|
|
||||||
|
|
||||||
(defn chat-list-key-fn
|
|
||||||
[item]
|
|
||||||
(or (:chat-id item) (:id item)))
|
|
||||||
|
|
||||||
(defn get-item-layout
|
|
||||||
[_ index]
|
|
||||||
#js {:length 64 :offset (* 64 index) :index index})
|
|
||||||
|
|
||||||
(views/defview communities-and-chats
|
|
||||||
[]
|
|
||||||
(views/letsubs [{:keys [items search-filter]} [:home-items]
|
|
||||||
hide-home-tooltip? [:hide-home-tooltip?]]
|
|
||||||
(if (and (empty? items)
|
|
||||||
(empty? search-filter)
|
|
||||||
hide-home-tooltip?
|
|
||||||
(not @search-active?))
|
|
||||||
[welcome-blank-page]
|
|
||||||
[list/flat-list
|
|
||||||
{:key-fn chat-list-key-fn
|
|
||||||
:getItemLayout get-item-layout
|
|
||||||
:on-end-reached #(re-frame/dispatch [:chat/show-more-chats])
|
|
||||||
:keyboard-should-persist-taps :always
|
|
||||||
:data items
|
|
||||||
:render-fn render-fn
|
|
||||||
:header [:<>
|
|
||||||
(when (or (seq items) @search-active? (seq search-filter))
|
|
||||||
[search-input-wrapper search-filter (empty? items)])
|
|
||||||
(when (and (empty? items)
|
|
||||||
(or @search-active? (seq search-filter)))
|
|
||||||
[start-suggestion search-filter])]
|
|
||||||
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
|
|
||||||
[home-tooltip-view]
|
|
||||||
[react/view {:height 68}])}])))
|
|
||||||
|
|
||||||
(views/defview communities-and-chats-old
|
|
||||||
[]
|
|
||||||
(views/letsubs [{:keys [items search-filter]} [:home-items]
|
|
||||||
hide-home-tooltip? [:hide-home-tooltip?]]
|
|
||||||
(if (and (empty? items)
|
|
||||||
(empty? search-filter)
|
|
||||||
hide-home-tooltip?
|
|
||||||
(not @search-active?))
|
|
||||||
[welcome-blank-page]
|
|
||||||
[list/flat-list
|
|
||||||
{:key-fn chat-list-key-fn
|
|
||||||
:getItemLayout get-item-layout
|
|
||||||
:on-end-reached #(re-frame/dispatch [:chat/show-more-chats])
|
|
||||||
:keyboard-should-persist-taps :always
|
|
||||||
:data items
|
|
||||||
:render-fn render-fn-old
|
|
||||||
:header [:<>
|
|
||||||
(when (or (seq items) @search-active? (seq search-filter))
|
|
||||||
[search-input-wrapper-old search-filter (empty? items)])
|
|
||||||
(when (and (empty? items)
|
|
||||||
(or @search-active? (seq search-filter)))
|
|
||||||
[start-suggestion search-filter])]
|
|
||||||
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
|
|
||||||
[home-tooltip-view]
|
|
||||||
[react/view {:height 68}])}])))
|
|
||||||
|
|
||||||
(views/defview chats-list
|
|
||||||
[]
|
|
||||||
(views/letsubs [loading? [:chats/loading?]]
|
|
||||||
[:<>
|
|
||||||
[connectivity/loading-indicator]
|
|
||||||
(if loading?
|
|
||||||
[react/view {:flex 1 :align-items :center :justify-content :center}
|
|
||||||
[react/activity-indicator {:animating true}]]
|
|
||||||
[communities-and-chats])]))
|
|
||||||
|
|
||||||
(views/defview chats-list-old
|
|
||||||
[]
|
|
||||||
(views/letsubs [loading? [:chats/loading?]]
|
|
||||||
[:<>
|
|
||||||
[connectivity/loading-indicator]
|
|
||||||
(if loading?
|
|
||||||
[react/view {:flex 1 :align-items :center :justify-content :center}
|
|
||||||
[react/activity-indicator {:animating true}]]
|
|
||||||
[communities-and-chats-old])]))
|
|
||||||
|
|
||||||
(views/defview plus-button
|
|
||||||
[]
|
|
||||||
(views/letsubs [logging-in? [:multiaccounts/login]]
|
|
||||||
[components.plus-button/plus-button-old
|
|
||||||
{:on-press (when-not logging-in?
|
|
||||||
(fn []
|
|
||||||
(re-frame/dispatch [:group-chat/clear-contacts])
|
|
||||||
(re-frame/dispatch [:bottom-sheet/show-sheet-old :start-a-new-chat {}])))
|
|
||||||
:loading logging-in?
|
|
||||||
:accessibility-label :new-chat-button}]))
|
|
||||||
|
|
||||||
(views/defview plus-button-old
|
|
||||||
[]
|
|
||||||
(views/letsubs [logging-in? [:multiaccounts/login]]
|
|
||||||
[components.plus-button/plus-button-old
|
|
||||||
{:on-press (when-not logging-in?
|
|
||||||
(fn []
|
|
||||||
(re-frame/dispatch [:group-chat/clear-contacts])
|
|
||||||
(re-frame/dispatch [:bottom-sheet/show-sheet-old :start-a-new-chat {}])))
|
|
||||||
:loading logging-in?
|
|
||||||
:accessibility-label :new-chat-button}]))
|
|
||||||
|
|
||||||
(views/defview notifications-button
|
|
||||||
[]
|
|
||||||
(views/letsubs [notif-count [:activity-center/unread-count]]
|
|
||||||
[react/view
|
|
||||||
[quo2.button/button
|
|
||||||
{:type :grey
|
|
||||||
:size 32
|
|
||||||
:width 32
|
|
||||||
:style {:margin-left 12}
|
|
||||||
:accessibility-label :notifications-button
|
|
||||||
:on-press #(re-frame/dispatch [:activity-center/open])}
|
|
||||||
[icons/icon :main-icons/notification2
|
|
||||||
{:color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}]]
|
|
||||||
(when (pos? notif-count)
|
|
||||||
[react/view
|
|
||||||
{:style (merge (styles/counter-public-container) {:top 5 :right 5})
|
|
||||||
:pointer-events :none}
|
|
||||||
[react/view
|
|
||||||
{:style styles/counter-public
|
|
||||||
:accessibility-label :notifications-unread-badge}]])]))
|
|
||||||
|
|
||||||
(defn qr-button
|
|
||||||
[]
|
|
||||||
[quo2.button/button
|
|
||||||
{:type :grey
|
|
||||||
:accessibility-label "qr-button"
|
|
||||||
:size 32
|
|
||||||
:width 32
|
|
||||||
:style {:margin-left 12}
|
|
||||||
:on-press #(do
|
|
||||||
(re-frame/dispatch [::qr-scanner/scan-code
|
|
||||||
{:handler ::qr-scanner/on-scan-success}]))}
|
|
||||||
[icons/icon :main-icons/qr2
|
|
||||||
{:color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}]])
|
|
||||||
|
|
||||||
(defn scan-button
|
|
||||||
[]
|
|
||||||
[quo2.button/button
|
|
||||||
{:type :grey
|
|
||||||
:size 32
|
|
||||||
:width 32
|
|
||||||
:accessibility-label "scan-button"
|
|
||||||
:on-press #(do
|
|
||||||
(re-frame/dispatch [::qr-scanner/scan-code
|
|
||||||
{:handler ::qr-scanner/on-scan-success}]))}
|
|
||||||
[icons/icon :main-icons/scan2
|
|
||||||
{:color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}]])
|
|
||||||
|
|
||||||
(views/defview profile-button
|
|
||||||
[]
|
|
||||||
(views/letsubs [{:keys [public-key preferred-name emoji]} [:multiaccount]]
|
|
||||||
[react/view
|
|
||||||
[chat-icon.screen/emoji-chat-icon-view public-key false preferred-name emoji
|
|
||||||
{:size 28
|
|
||||||
:chat-icon chat-icon.styles/chat-icon-chat-list}]]))
|
|
||||||
|
|
||||||
(defn home
|
|
||||||
[]
|
|
||||||
[react/keyboard-avoiding-view
|
|
||||||
{:style {:flex 1
|
|
||||||
:background-color (quo2.colors/theme-colors quo2.colors/neutral-5
|
|
||||||
quo2.colors/neutral-95)}
|
|
||||||
:ignore-offset true}
|
|
||||||
[topbar/topbar
|
|
||||||
{:navigation :none
|
|
||||||
:use-insets true
|
|
||||||
:background (quo2.colors/theme-colors quo2.colors/neutral-5 quo2.colors/neutral-95)
|
|
||||||
:left-component [react/view {:flex-direction :row :margin-left 16}
|
|
||||||
[profile-button]]
|
|
||||||
:right-component [react/view {:flex-direction :row :margin-right 16}
|
|
||||||
[scan-button]
|
|
||||||
[qr-button]
|
|
||||||
[notifications-button]]
|
|
||||||
:border-bottom false}]
|
|
||||||
[react/view
|
|
||||||
{:flex-direction :row
|
|
||||||
:justify-content :space-between
|
|
||||||
:align-items :center
|
|
||||||
:margin-horizontal 16
|
|
||||||
:margin-top 15
|
|
||||||
:margin-bottom 8}
|
|
||||||
[quo2.text/text {:size :heading-1 :weight :semi-bold} (i18n/label :t/messages)]
|
|
||||||
[plus-button]]
|
|
||||||
[chats-list]])
|
|
||||||
|
|
||||||
(defn home-old
|
|
||||||
[]
|
|
||||||
[react/keyboard-avoiding-view
|
|
||||||
{:style {:flex 1}
|
|
||||||
:ignore-offset true}
|
|
||||||
[topbar/topbar
|
|
||||||
{:title (i18n/label :t/chat)
|
|
||||||
:navigation :none
|
|
||||||
:right-component [react/view {:flex-direction :row :margin-right 16}
|
|
||||||
[connectivity/connectivity-button]]}]
|
|
||||||
[chats-list-old]
|
|
||||||
[plus-button-old]])
|
|
|
@ -7,7 +7,6 @@
|
||||||
[status-im.ui.components.animation :as anim]
|
[status-im.ui.components.animation :as anim]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.screens.biometric.views :as biometric]
|
[status-im.ui.screens.biometric.views :as biometric]
|
||||||
[status-im.ui.screens.communities.views :as communities]
|
|
||||||
[status-im.ui.screens.keycard.frozen-card.view :as frozen-card]
|
[status-im.ui.screens.keycard.frozen-card.view :as frozen-card]
|
||||||
[status-im.ui.screens.keycard.views :as keycard.views]
|
[status-im.ui.screens.keycard.views :as keycard.views]
|
||||||
[status-im.ui.screens.multiaccounts.key-storage.views :as multiaccounts.key-storage]
|
[status-im.ui.screens.multiaccounts.key-storage.views :as multiaccounts.key-storage]
|
||||||
|
@ -167,9 +166,6 @@
|
||||||
(= :blocked-card view)
|
(= :blocked-card view)
|
||||||
[keycard.views/blocked-card-popover]
|
[keycard.views/blocked-card-popover]
|
||||||
|
|
||||||
(= :export-community view)
|
|
||||||
[communities/export-community]
|
|
||||||
|
|
||||||
(= :seed-key-uid-mismatch view)
|
(= :seed-key-uid-mismatch view)
|
||||||
[multiaccounts.key-storage/seed-key-uid-mismatch-popover]
|
[multiaccounts.key-storage/seed-key-uid-mismatch-popover]
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
[status-im.ui.components.icons.icons :as icons]
|
||||||
[status-im.ui.screens.about-app.views :as about-app]
|
[status-im.ui.screens.about-app.views :as about-app]
|
||||||
[status-im.ui.screens.add-new.new-chat.views :as new-chat]
|
|
||||||
[status-im.ui.screens.add-new.new-public-chat.view :as new-public-chat]
|
|
||||||
[status-im.ui.screens.advanced-settings.views :as advanced-settings]
|
[status-im.ui.screens.advanced-settings.views :as advanced-settings]
|
||||||
[status-im.ui.screens.appearance.views :as appearance]
|
[status-im.ui.screens.appearance.views :as appearance]
|
||||||
[status-im.ui.screens.backup-settings.view :as backup-settings]
|
[status-im.ui.screens.backup-settings.view :as backup-settings]
|
||||||
|
@ -30,7 +28,6 @@
|
||||||
[status-im.ui.screens.communities.reorder-categories :as reorder-categories]
|
[status-im.ui.screens.communities.reorder-categories :as reorder-categories]
|
||||||
[status-im.ui.screens.communities.requests-to-join :as requests-to-join]
|
[status-im.ui.screens.communities.requests-to-join :as requests-to-join]
|
||||||
[status-im.ui.screens.communities.select-category :as select-category]
|
[status-im.ui.screens.communities.select-category :as select-category]
|
||||||
[status-im.ui.screens.communities.views :as communities]
|
|
||||||
[status-im.ui.screens.contacts-list.views :as contacts-list]
|
[status-im.ui.screens.contacts-list.views :as contacts-list]
|
||||||
[status-im.ui.screens.currency-settings.views :as currency-settings]
|
[status-im.ui.screens.currency-settings.views :as currency-settings]
|
||||||
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
|
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
|
||||||
|
@ -277,13 +274,10 @@
|
||||||
:options {:insets {:top? true}}
|
:options {:insets {:top? true}}
|
||||||
;;TODO custom subtitle
|
;;TODO custom subtitle
|
||||||
:component group-chat/new-group}
|
:component group-chat/new-group}
|
||||||
{:name :communities
|
|
||||||
;;TODO custom
|
|
||||||
:options {:insets {:top? true}}
|
|
||||||
:component communities/communities}
|
|
||||||
{:name :community-import
|
{:name :community-import
|
||||||
:options {:topBar {:title {:text (i18n/label :t/import-community-title)}}
|
:options {:topBar {:title {:text (i18n/label :t/import-community-title)}}
|
||||||
:insets {:top? true}}
|
:insets {:top? true
|
||||||
|
:bottom? true}}
|
||||||
:component communities.import/view}
|
:component communities.import/view}
|
||||||
{:name :community-edit
|
{:name :community-edit
|
||||||
:options {:topBar {:title {:text (i18n/label :t/community-edit-title)}}
|
:options {:topBar {:title {:text (i18n/label :t/community-edit-title)}}
|
||||||
|
@ -291,11 +285,13 @@
|
||||||
:component community.edit/edit}
|
:component community.edit/edit}
|
||||||
{:name :community-create
|
{:name :community-create
|
||||||
:options {:topBar {:title {:text (i18n/label :t/new-community-title)}}
|
:options {:topBar {:title {:text (i18n/label :t/new-community-title)}}
|
||||||
:insets {:top? true}}
|
:insets {:top? true
|
||||||
|
:bottom? true}}
|
||||||
:component communities.create/view}
|
:component communities.create/view}
|
||||||
{:name :community-membership
|
{:name :community-membership
|
||||||
:options {:topBar {:title {:text (i18n/label :t/membership-title)}}
|
:options {:topBar {:title {:text (i18n/label :t/membership-title)}}
|
||||||
:insets {:top? true}}
|
:insets {:top? true
|
||||||
|
:bottom? true}}
|
||||||
:component membership/membership}
|
:component membership/membership}
|
||||||
|
|
||||||
;;WALLET
|
;;WALLET
|
||||||
|
@ -576,20 +572,6 @@
|
||||||
|
|
||||||
;;MODALS
|
;;MODALS
|
||||||
|
|
||||||
;[Chat] New Chat
|
|
||||||
{:name :new-chat
|
|
||||||
:on-focus [:contacts/new-chat-focus]
|
|
||||||
;;TODO accessories
|
|
||||||
:options {:insets {:top? true}}
|
|
||||||
:component new-chat/new-chat}
|
|
||||||
|
|
||||||
;[Chat] New Public chat
|
|
||||||
{:name :new-public-chat
|
|
||||||
:options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}}
|
|
||||||
:insets {:bottom? true
|
|
||||||
:top? true}}
|
|
||||||
:component new-public-chat/new-public-chat}
|
|
||||||
|
|
||||||
;[Chat] Link preview settings
|
;[Chat] Link preview settings
|
||||||
{:name :link-preview-settings
|
{:name :link-preview-settings
|
||||||
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
|
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
|
||||||
|
@ -610,13 +592,6 @@
|
||||||
:options {:insets {:top? true}}
|
:options {:insets {:top? true}}
|
||||||
:component new-chat-aio/contact-selection-list}
|
:component new-chat-aio/contact-selection-list}
|
||||||
|
|
||||||
;[Chat] New Public chat
|
|
||||||
{:name :new-public-chat
|
|
||||||
:options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}}
|
|
||||||
:insets {:bottom? true
|
|
||||||
:top? true}}
|
|
||||||
:component new-public-chat/new-public-chat}
|
|
||||||
|
|
||||||
;[Group chat] Add participants
|
;[Group chat] Add participants
|
||||||
{:name :add-participants-toggle-list
|
{:name :add-participants-toggle-list
|
||||||
:on-focus [:group/add-participants-toggle-list]
|
:on-focus [:group/add-participants-toggle-list]
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[goog.string :as gstring]
|
[goog.string :as gstring]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.add-new.db :as new-chat.db]
|
|
||||||
[status-im.chat.models :as chat]
|
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
[status-im.group-chats.core :as group-chats]
|
[status-im.group-chats.core :as group-chats]
|
||||||
|
@ -26,8 +24,7 @@
|
||||||
:internal "status-im:/"})
|
:internal "status-im:/"})
|
||||||
|
|
||||||
(def links
|
(def links
|
||||||
{:public-chat "%s/%s"
|
{:private-chat "%s/p/%s"
|
||||||
:private-chat "%s/p/%s"
|
|
||||||
:community-requests "%s/cr/%s"
|
:community-requests "%s/cr/%s"
|
||||||
:community "%s/c/%s"
|
:community "%s/c/%s"
|
||||||
:group-chat "%s/g/%s"
|
:group-chat "%s/g/%s"
|
||||||
|
@ -60,11 +57,15 @@
|
||||||
(log/info "universal-links: handling group" params)
|
(log/info "universal-links: handling group" params)
|
||||||
(group-chats/create-from-link cofx params))
|
(group-chats/create-from-link cofx params))
|
||||||
|
|
||||||
|
(defn own-public-key?
|
||||||
|
[{:keys [multiaccount]} public-key]
|
||||||
|
(= (:public-key multiaccount) public-key))
|
||||||
|
|
||||||
(rf/defn handle-private-chat
|
(rf/defn handle-private-chat
|
||||||
[{:keys [db] :as cofx} {:keys [chat-id]}]
|
[{:keys [db] :as cofx} {:keys [chat-id]}]
|
||||||
(log/info "universal-links: handling private chat" chat-id)
|
(log/info "universal-links: handling private chat" chat-id)
|
||||||
(when chat-id
|
(when chat-id
|
||||||
(if-not (new-chat.db/own-public-key? db chat-id)
|
(if-not (own-public-key? db chat-id)
|
||||||
{:dispatch [:chat.ui/start-chat chat-id]}
|
{:dispatch [:chat.ui/start-chat chat-id]}
|
||||||
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
||||||
:content (i18n/label :t/can-not-add-yourself)}})))
|
:content (i18n/label :t/can-not-add-yourself)}})))
|
||||||
|
@ -98,17 +99,11 @@
|
||||||
(log/info "universal-links: handling community chat" chat-id)
|
(log/info "universal-links: handling community chat" chat-id)
|
||||||
{:dispatch [:chat/navigate-to-chat chat-id]})
|
{:dispatch [:chat/navigate-to-chat chat-id]})
|
||||||
|
|
||||||
(rf/defn handle-public-chat
|
|
||||||
[cofx {:keys [topic]}]
|
|
||||||
(log/info "universal-links: handling public chat" topic)
|
|
||||||
(when (seq topic)
|
|
||||||
(chat/start-public-chat cofx topic)))
|
|
||||||
|
|
||||||
(rf/defn handle-view-profile
|
(rf/defn handle-view-profile
|
||||||
[{:keys [db] :as cofx} {:keys [public-key ens-name]}]
|
[{:keys [db] :as cofx} {:keys [public-key ens-name]}]
|
||||||
(log/info "universal-links: handling view profile" public-key)
|
(log/info "universal-links: handling view profile" public-key)
|
||||||
(cond
|
(cond
|
||||||
(and public-key (new-chat.db/own-public-key? db public-key))
|
(and public-key (own-public-key? db public-key))
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:pop-to-root-fx :shell-stack}
|
{:pop-to-root-fx :shell-stack}
|
||||||
(navigation/navigate-to :my-profile nil))
|
(navigation/navigate-to :my-profile nil))
|
||||||
|
@ -153,7 +148,6 @@
|
||||||
[cofx url {:keys [type] :as data}]
|
[cofx url {:keys [type] :as data}]
|
||||||
(case type
|
(case type
|
||||||
:group-chat (handle-group-chat cofx data)
|
:group-chat (handle-group-chat cofx data)
|
||||||
:public-chat (handle-public-chat cofx data)
|
|
||||||
:private-chat (handle-private-chat cofx data)
|
:private-chat (handle-private-chat cofx data)
|
||||||
:community-requests (handle-community-requests cofx data)
|
:community-requests (handle-community-requests cofx data)
|
||||||
:community (handle-community cofx data)
|
:community (handle-community cofx data)
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
:internal "status-im:/"})
|
:internal "status-im:/"})
|
||||||
|
|
||||||
(def links
|
(def links
|
||||||
{:public-chat "%s/%s"
|
{:private-chat "%s/p/%s"
|
||||||
:private-chat "%s/p/%s"
|
|
||||||
:user "%s/u/%s"
|
:user "%s/u/%s"
|
||||||
:browse "%s/b/%s"})
|
:browse "%s/b/%s"})
|
||||||
|
|
||||||
|
|
|
@ -433,15 +433,6 @@
|
||||||
(notification-actions item inside-chat?)
|
(notification-actions item inside-chat?)
|
||||||
(destructive-actions item)]])
|
(destructive-actions item)]])
|
||||||
|
|
||||||
(defn public-chat-actions
|
|
||||||
[{:keys [chat-id] :as item} inside-chat?]
|
|
||||||
[quo/action-drawer
|
|
||||||
[[(group-details-entry chat-id)
|
|
||||||
(when inside-chat?
|
|
||||||
(add-members-entry))]
|
|
||||||
(notification-actions item inside-chat?)
|
|
||||||
(destructive-actions item)]])
|
|
||||||
|
|
||||||
(defn private-group-chat-actions
|
(defn private-group-chat-actions
|
||||||
[item inside-chat?]
|
[item inside-chat?]
|
||||||
[quo/action-drawer
|
[quo/action-drawer
|
||||||
|
@ -470,8 +461,6 @@
|
||||||
(case chat-type
|
(case chat-type
|
||||||
constants/one-to-one-chat-type
|
constants/one-to-one-chat-type
|
||||||
[one-to-one-actions item inside-chat?]
|
[one-to-one-actions item inside-chat?]
|
||||||
constants/public-chat-type
|
|
||||||
[public-chat-actions item inside-chat?]
|
|
||||||
constants/private-group-chat-type
|
constants/private-group-chat-type
|
||||||
[private-group-chat-actions item inside-chat?]))
|
[private-group-chat-actions item inside-chat?]))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
(ns status-im2.contexts.chat.actions.view
|
||||||
|
(:require [quo2.core :as quo]
|
||||||
|
[utils.i18n :as i18n]
|
||||||
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
(defn new-chat
|
||||||
|
[]
|
||||||
|
[quo/action-drawer
|
||||||
|
[[{:icon :i/new-message
|
||||||
|
:accessibility-label :start-a-new-chat
|
||||||
|
:label (i18n/label :t/new-chat)
|
||||||
|
:on-press (fn []
|
||||||
|
(rf/dispatch [:group-chat/clear-contacts])
|
||||||
|
(rf/dispatch [:open-modal :start-a-new-chat]))}
|
||||||
|
{:icon :i/add-user
|
||||||
|
:accessibility-label :add-a-contact
|
||||||
|
:label (i18n/label :t/add-a-contact)
|
||||||
|
:sub-label (i18n/label :t/enter-a-chat-key)
|
||||||
|
:add-divider? true
|
||||||
|
:on-press #(rf/dispatch [:open-modal :new-contact])}]]])
|
|
@ -15,7 +15,7 @@
|
||||||
[react-native.blur :as blur]
|
[react-native.blur :as blur]
|
||||||
[status-im2.contexts.chat.home.style :as style]
|
[status-im2.contexts.chat.home.style :as style]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[status-im2.contexts.chat.sheets.view :as home.sheet]))
|
[status-im2.contexts.chat.actions.view :as home.sheet]))
|
||||||
|
|
||||||
(defn get-item-layout
|
(defn get-item-layout
|
||||||
[_ index]
|
[_ index]
|
||||||
|
@ -117,8 +117,7 @@
|
||||||
[common.home/top-nav]
|
[common.home/top-nav]
|
||||||
[common.home/title-column
|
[common.home/title-column
|
||||||
{:label (i18n/label :t/messages)
|
{:label (i18n/label :t/messages)
|
||||||
:handler #(rf/dispatch [:show-bottom-sheet
|
:handler #(rf/dispatch [:show-bottom-sheet {:content home.sheet/new-chat}])
|
||||||
{:content home.sheet/new-chat-bottom-sheet}])
|
|
||||||
:accessibility-label :new-chat-button}]
|
:accessibility-label :new-chat-button}]
|
||||||
[quo/discover-card
|
[quo/discover-card
|
||||||
{:title (i18n/label :t/invite-friends-to-status)
|
{:title (i18n/label :t/invite-friends-to-status)
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
(ns status-im2.contexts.chat.sheets.view
|
|
||||||
(:require [quo2.core :as quo]
|
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[quo2.foundations.colors :as colors]
|
|
||||||
[utils.re-frame :as rf]))
|
|
||||||
|
|
||||||
(defn new-chat-bottom-sheet
|
|
||||||
[]
|
|
||||||
[:<>
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/new-chat)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:style-props {:border-bottom-width 1
|
|
||||||
:border-bottom-color (colors/theme-colors colors/neutral-10
|
|
||||||
colors/neutral-90)}
|
|
||||||
:icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)
|
|
||||||
:accessibility-label :start-a-new-chat
|
|
||||||
:icon :i/new-message
|
|
||||||
:on-press (fn []
|
|
||||||
(rf/dispatch [:group-chat/clear-contacts])
|
|
||||||
(rf/dispatch [:open-modal :start-a-new-chat]))}]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/add-a-contact)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:icon-container-style {:padding-horizontal 0}
|
|
||||||
:container-padding-horizontal {:padding-horizontal 4}
|
|
||||||
:style-props {:margin-top 18
|
|
||||||
:margin-bottom 9}
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)
|
|
||||||
:accessibility-label :add-a-contact
|
|
||||||
:subtitle (i18n/label :t/enter-a-chat-key)
|
|
||||||
:subtitle-color colors/neutral-50
|
|
||||||
:icon :i/add-user
|
|
||||||
:on-press #(rf/dispatch [:open-modal :new-contact])}]])
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
(ns status-im2.contexts.communities.menus.community-options.component-spec
|
(ns status-im2.contexts.communities.actions.community-options.component-spec
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[test-helpers.component :as h]
|
[test-helpers.component :as h]
|
||||||
[status-im2.contexts.communities.menus.community-options.view :as options]))
|
[status-im2.contexts.communities.actions.community-options.view :as options]))
|
||||||
|
|
||||||
(defn setup-subs
|
(defn setup-subs
|
||||||
[subs]
|
[subs]
|
|
@ -1,9 +1,9 @@
|
||||||
(ns status-im2.contexts.communities.menus.community-options.view
|
(ns status-im2.contexts.communities.actions.community-options.view
|
||||||
(:require [utils.i18n :as i18n]
|
(:require [utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[status-im2.contexts.communities.menus.see-rules.view :as see-rules]
|
[status-im2.contexts.communities.actions.see-rules.view :as see-rules]
|
||||||
[status-im2.contexts.communities.menus.leave.view :as leave-menu]))
|
[status-im2.contexts.communities.actions.leave.view :as leave-menu]))
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
(defn hide-sheet-and-dispatch
|
||||||
[event]
|
[event]
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im2.contexts.communities.menus.community-rules-list.style
|
(ns status-im2.contexts.communities.actions.community-rules-list.style
|
||||||
(:require [quo2.foundations.colors :as colors]))
|
(:require [quo2.foundations.colors :as colors]))
|
||||||
|
|
||||||
(def community-rule
|
(def community-rule
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im2.contexts.communities.menus.community-rules-list.view
|
(ns status-im2.contexts.communities.actions.community-rules-list.view
|
||||||
(:require [react-native.core :as rn]
|
(:require [react-native.core :as rn]
|
||||||
[status-im2.contexts.communities.menus.community-rules-list.style :as style]
|
[status-im2.contexts.communities.actions.community-rules-list.style :as style]
|
||||||
[quo2.core :as quo]))
|
[quo2.core :as quo]))
|
||||||
|
|
||||||
;; TODO: update with real data
|
;; TODO: update with real data
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im2.contexts.communities.menus.generic-menu.style)
|
(ns status-im2.contexts.communities.actions.generic-menu.style)
|
||||||
|
|
||||||
(def container
|
(def container
|
||||||
{:flex 1
|
{:flex 1
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im2.contexts.communities.menus.generic-menu.view
|
(ns status-im2.contexts.communities.actions.generic-menu.view
|
||||||
(:require [quo2.core :as quo]
|
(:require [quo2.core :as quo]
|
||||||
[status-im2.contexts.communities.menus.generic-menu.style :as style]
|
[status-im2.contexts.communities.actions.generic-menu.style :as style]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
(ns status-im2.contexts.communities.actions.home-plus.view
|
||||||
|
(:require [quo2.core :as quo]
|
||||||
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
(defn view
|
||||||
|
[]
|
||||||
|
[quo/action-drawer
|
||||||
|
[[{:icon :i/download
|
||||||
|
:accessibility-label :import-community
|
||||||
|
:label "Import community"
|
||||||
|
:on-press #(rf/dispatch [:navigate-to :community-import])}
|
||||||
|
{:icon :i/communities
|
||||||
|
:accessibility-label :create-community
|
||||||
|
:label "Create community (only for e2e)"
|
||||||
|
:on-press #(rf/dispatch [:legacy-only-for-e2e/open-create-community])}]]])
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im2.contexts.communities.menus.leave.style)
|
(ns status-im2.contexts.communities.actions.leave.style)
|
||||||
|
|
||||||
(def button-container
|
(def button-container
|
||||||
{:margin-top 20
|
{:margin-top 20
|
|
@ -1,8 +1,8 @@
|
||||||
(ns status-im2.contexts.communities.menus.leave.view
|
(ns status-im2.contexts.communities.actions.leave.view
|
||||||
(:require [utils.i18n :as i18n]
|
(:require [utils.i18n :as i18n]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[status-im2.contexts.communities.menus.generic-menu.view :as generic-menu]
|
[status-im2.contexts.communities.actions.generic-menu.view :as generic-menu]
|
||||||
[status-im2.contexts.communities.menus.leave.style :as style]
|
[status-im2.contexts.communities.actions.leave.style :as style]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im2.contexts.communities.menus.request-to-join.style
|
(ns status-im2.contexts.communities.actions.request-to-join.style
|
||||||
(:require [quo2.foundations.colors :as colors]))
|
(:require [quo2.foundations.colors :as colors]))
|
||||||
|
|
||||||
(def page-container
|
(def page-container
|
|
@ -1,8 +1,8 @@
|
||||||
(ns status-im2.contexts.communities.menus.request-to-join.view
|
(ns status-im2.contexts.communities.actions.request-to-join.view
|
||||||
(:require [react-native.core :as rn]
|
(:require [react-native.core :as rn]
|
||||||
[status-im2.contexts.communities.menus.community-rules-list.view :as community-rules]
|
[status-im2.contexts.communities.actions.community-rules-list.view :as community-rules]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im2.contexts.communities.menus.request-to-join.style :as style]
|
[status-im2.contexts.communities.actions.request-to-join.style :as style]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
|
@ -0,0 +1,12 @@
|
||||||
|
(ns status-im2.contexts.communities.actions.see-rules.view
|
||||||
|
(:require [status-im2.contexts.communities.actions.generic-menu.view :as generic-menu]
|
||||||
|
[status-im2.contexts.communities.actions.community-rules-list.view :as community-rules]
|
||||||
|
[utils.i18n :as i18n]))
|
||||||
|
|
||||||
|
(defn view
|
||||||
|
[id]
|
||||||
|
[generic-menu/view
|
||||||
|
{:id id
|
||||||
|
:title (i18n/label :t/community-rules)}
|
||||||
|
|
||||||
|
[community-rules/view community-rules/rules]])
|
|
@ -1 +0,0 @@
|
||||||
(ns status-im2.contexts.communities.actions.view)
|
|
|
@ -7,7 +7,7 @@
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im2.common.resources :as resources]
|
[status-im2.common.resources :as resources]
|
||||||
[status-im2.contexts.communities.menus.community-options.view :as options]
|
[status-im2.contexts.communities.actions.community-options.view :as options]
|
||||||
[status-im.ui.screens.communities.community :as community]
|
[status-im.ui.screens.communities.community :as community]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im2.common.scroll-page.view :as scroll-page]
|
[status-im2.common.scroll-page.view :as scroll-page]
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[status-im2.common.home.view :as common.home]
|
[status-im2.common.home.view :as common.home]
|
||||||
[status-im2.contexts.communities.menus.community-options.view :as options]
|
[status-im2.contexts.communities.actions.community-options.view :as options]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[react-native.safe-area :as safe-area]
|
[react-native.safe-area :as safe-area]
|
||||||
[react-native.blur :as blur]
|
[react-native.blur :as blur]
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[status-im2.contexts.communities.home.style :as style]
|
[status-im2.contexts.communities.home.style :as style]
|
||||||
[react-native.platform :as platform]))
|
[react-native.platform :as platform]
|
||||||
|
[status-im2.contexts.communities.actions.home-plus.view :as actions.home-plus]))
|
||||||
|
|
||||||
(defn item-render
|
(defn item-render
|
||||||
[{:keys [id] :as item}]
|
[{:keys [id] :as item}]
|
||||||
|
@ -58,7 +59,7 @@
|
||||||
[common.home/top-nav]
|
[common.home/top-nav]
|
||||||
[common.home/title-column
|
[common.home/title-column
|
||||||
{:label (i18n/label :t/communities)
|
{:label (i18n/label :t/communities)
|
||||||
:handler #(rf/dispatch [:bottom-sheet/show-sheet-old :add-new {}])
|
:handler #(rf/dispatch [:show-bottom-sheet {:content actions.home-plus/view}])
|
||||||
:accessibility-label :new-chat-button}]
|
:accessibility-label :new-chat-button}]
|
||||||
[quo/discover-card
|
[quo/discover-card
|
||||||
{:on-press #(rf/dispatch [:navigate-to :discover-communities])
|
{:on-press #(rf/dispatch [:navigate-to :discover-communities])
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
(ns status-im2.contexts.communities.menus.see-rules.view
|
|
||||||
(:require [status-im2.contexts.communities.menus.generic-menu.view :as generic-menu]
|
|
||||||
[status-im2.contexts.communities.menus.community-rules-list.view :as community-rules]
|
|
||||||
[utils.i18n :as i18n]))
|
|
||||||
|
|
||||||
(defn view
|
|
||||||
[id]
|
|
||||||
[generic-menu/view
|
|
||||||
{:id id
|
|
||||||
:title (i18n/label :t/community-rules)
|
|
||||||
}
|
|
||||||
[community-rules/view community-rules/rules]])
|
|
|
@ -10,7 +10,7 @@
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im2.common.scroll-page.view :as scroll-page]
|
[status-im2.common.scroll-page.view :as scroll-page]
|
||||||
[status-im2.contexts.communities.overview.style :as style]
|
[status-im2.contexts.communities.overview.style :as style]
|
||||||
[status-im2.contexts.communities.menus.community-options.view :as options]
|
[status-im2.contexts.communities.actions.community-options.view :as options]
|
||||||
[quo2.components.navigation.floating-shell-button :as floating-shell-button]
|
[quo2.components.navigation.floating-shell-button :as floating-shell-button]
|
||||||
[status-im2.contexts.communities.overview.utils :as utils]
|
[status-im2.contexts.communities.overview.utils :as utils]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(ns status-im2.core-spec
|
(ns status-im2.core-spec
|
||||||
(:require
|
(:require
|
||||||
[status-im2.contexts.communities.menus.community-options.component-spec]))
|
[status-im2.contexts.communities.actions.community-options.component-spec]))
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
[status-im2.navigation.options :as options]
|
[status-im2.navigation.options :as options]
|
||||||
[status-im2.contexts.chat.group-details.view :as group-details]
|
[status-im2.contexts.chat.group-details.view :as group-details]
|
||||||
[status-im.ui.screens.screens :as old-screens]
|
[status-im.ui.screens.screens :as old-screens]
|
||||||
[status-im2.contexts.communities.menus.request-to-join.view :as join-menu]
|
[status-im2.contexts.communities.actions.request-to-join.view :as join-menu]
|
||||||
[status-im2.contexts.syncing.setup-syncing.view :as settings-setup-syncing]))
|
[status-im2.contexts.syncing.setup-syncing.view :as settings-setup-syncing]))
|
||||||
|
|
||||||
(defn screens
|
(defn screens
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[quo.design-system.colors :as colors]
|
[quo.design-system.colors :as colors]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.add-new.db :as db]
|
|
||||||
[status-im.communities.core :as communities]
|
[status-im.communities.core :as communities]
|
||||||
[status-im.group-chats.core :as group-chat]
|
[status-im.group-chats.core :as group-chat]
|
||||||
[status-im.group-chats.db :as group-chats.db]
|
[status-im.group-chats.db :as group-chats.db]
|
||||||
|
@ -10,7 +9,6 @@
|
||||||
[utils.image-server :as image-server]
|
[utils.image-server :as image-server]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im2.contexts.chat.events :as chat.events]
|
[status-im2.contexts.chat.events :as chat.events]
|
||||||
[utils.i18n :as i18n]
|
|
||||||
[quo2.theme :as theme]))
|
[quo2.theme :as theme]))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
|
@ -332,14 +330,6 @@
|
||||||
(fn [{:keys [metadata]}]
|
(fn [{:keys [metadata]}]
|
||||||
(:sending-image metadata)))
|
(:sending-image metadata)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
:public-chat.new/topic-error-message
|
|
||||||
:<- [:public-group-topic]
|
|
||||||
(fn [topic]
|
|
||||||
(when-not (or (empty? topic)
|
|
||||||
(db/valid-topic? topic))
|
|
||||||
(i18n/label :topic-name-error))))
|
|
||||||
|
|
||||||
(defn filter-selected-contacts
|
(defn filter-selected-contacts
|
||||||
[selected-contacts contacts]
|
[selected-contacts contacts]
|
||||||
(filter #(:added? (contacts %)) selected-contacts))
|
(filter #(:added? (contacts %)) selected-contacts))
|
||||||
|
|
|
@ -5,17 +5,6 @@
|
||||||
[cljs.test :refer [is testing]]
|
[cljs.test :refer [is testing]]
|
||||||
[status-im2.constants :as constants]))
|
[status-im2.constants :as constants]))
|
||||||
|
|
||||||
(def public-profile-timeline-chats
|
|
||||||
{"0xpublic-chat" {:chat-type constants/public-chat-type
|
|
||||||
:unviewed-messages-count 5
|
|
||||||
:unviewed-mentions-count 6}
|
|
||||||
"0xprofile-chat" {:chat-type constants/profile-chat-type
|
|
||||||
:unviewed-messages-count 5
|
|
||||||
:unviewed-mentions-count 6}
|
|
||||||
"0xtimeline-chat" {:chat-type constants/timeline-chat-type
|
|
||||||
:unviewed-messages-count 5
|
|
||||||
:unviewed-mentions-count 6}})
|
|
||||||
|
|
||||||
(def expected-notification-data-for-public-profile-timeline-chats
|
(def expected-notification-data-for-public-profile-timeline-chats
|
||||||
{:communities-stack {:new-notifications? false
|
{:communities-stack {:new-notifications? false
|
||||||
:notification-indicator :unread-dot
|
:notification-indicator :unread-dot
|
||||||
|
@ -66,10 +55,6 @@
|
||||||
|
|
||||||
(h/deftest-sub :shell/bottom-tabs-notifications-data
|
(h/deftest-sub :shell/bottom-tabs-notifications-data
|
||||||
[sub-name]
|
[sub-name]
|
||||||
(testing "public, profile and timeline chats should not affect shell bottom tab indicator"
|
|
||||||
(swap! rf-db/app-db assoc :chats public-profile-timeline-chats)
|
|
||||||
(is (= (rf/sub [sub-name]) expected-notification-data-for-public-profile-timeline-chats)))
|
|
||||||
|
|
||||||
(testing "chats with only unviewed-messages, without unviewed-mentions count should use unread-dot"
|
(testing "chats with only unviewed-messages, without unviewed-mentions count should use unread-dot"
|
||||||
(swap! rf-db/app-db assoc :chats one-to-one-group-community-chats1)
|
(swap! rf-db/app-db assoc :chats one-to-one-group-community-chats1)
|
||||||
(is (= (rf/sub [sub-name]) expected-notification-data-for-one-to-one-group-community-chats1)))
|
(is (= (rf/sub [sub-name]) expected-notification-data-for-one-to-one-group-community-chats1)))
|
||||||
|
|
Loading…
Reference in New Issue