clean old onboarding and communities (#15994)

This commit is contained in:
flexsurfer 2023-05-24 11:16:12 +02:00 committed by GitHub
parent 2493b8ad4b
commit 2c44882c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 21 additions and 2946 deletions

View File

@ -3,8 +3,6 @@
[status-im.ui.screens.about-app.views :as about-app]
[status-im.ui.screens.keycard.views :as keycard]
[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.recover.views :as recover.views]
[status-im.bottom-sheet.view :as bottom-sheet]
[react-native.core :as rn]))
@ -30,13 +28,7 @@
(merge keycard/more-sheet)
(= view :learn-more)
(merge about-app/learn-more)
(= view :recover-sheet)
(merge recover.views/bottom-sheet)
(= view :migrate-account-password)
(merge key-storage/migrate-account-password))]
(merge about-app/learn-more))]
[:f>
(fn []

View File

@ -15,7 +15,7 @@
(assoc-in acc [chat-id message-id emoji-id emoji-reaction-id] reaction)))
(defn process-reactions
[chats]
[_]
(fn [reactions new-reactions]
;; TODO(Ferossgp): handling own reaction in subscription could be expensive,
;; for better performance we can here separate own reaction into 2 maps
@ -23,14 +23,7 @@
(fn [acc
{:keys [chat-id message-id emoji-id emoji-reaction-id retracted]
:as reaction}]
(cond-> (update-reaction acc retracted chat-id message-id emoji-id emoji-reaction-id reaction)
(get-in chats [chat-id :profile-public-key])
(update-reaction retracted
constants/timeline-chat-id
message-id
emoji-id
emoji-reaction-id
reaction)))
(update-reaction acc retracted chat-id message-id emoji-id emoji-reaction-id reaction))
reactions
new-reactions)))
@ -84,10 +77,6 @@
(message.protocol/send-retract-reaction cofx
(update reaction :chat-id #(or % current-chat-id))))
(rf/defn receive-one
{:events [::receive-one]}
[{:keys [db]} reaction]
{:db (update db :reactions (process-reactions (:chats db)) [reaction])})
(defn message-reactions
[current-public-key reactions]

View File

@ -1,14 +0,0 @@
;;this ns is needed because of cycled deps
(ns status-im.chat.models.transport
(:require [status-im.chat.models.message :as chat.message]
[status-im.transport.message.core :as transport.message]
[utils.re-frame :as rf]))
(rf/defn chat-ui-resend-message
{:events [:chat.ui/resend-message]}
[{:keys [db] :as cofx} chat-id message-id]
(let [message (get-in db [:messages chat-id message-id])]
(rf/merge
cofx
(transport.message/set-message-envelope-hash chat-id message-id (:message-type message))
(chat.message/resend-message chat-id message-id))))

View File

@ -26,10 +26,6 @@
"/c/"
community-id))
(def featured
[{:name "Status"
:id constants/status-community-id}])
(defn <-request-to-join-community-rpc
[r]
(set/rename-keys r

View File

@ -10,7 +10,6 @@
status-im.chat.models.images
status-im.chat.models.input
status-im.chat.models.loading
status-im.chat.models.transport
[status-im2.constants :as constants]
status-im.contact.block
status-im.contact.chat

View File

@ -4,8 +4,7 @@
[status-im2.constants :as constants]
[utils.i18n :as i18n]
[status-im.ui.components.chat-icon.screen :as chat-icon]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.styles.message.sheets :as sheets.styles]))
[status-im.ui.components.react :as react]))
(defn hide-sheet-and-dispatch
[event]
@ -121,29 +120,5 @@
:else [one-to-one-chat-accents chat-id]))
(defn current-chat-actions
[]
[actions @(re-frame/subscribe [:chats/current-chat])])
(defn chat-actions
[chat-id]
[actions @(re-frame/subscribe [:chat-by-id chat-id])])
(defn options
[chat-id message-id]
(fn []
[react/view
[react/i18n-text {:style sheets.styles/sheet-text :key :message-not-sent}]
[quo/list-item
{:theme :accent
:title (i18n/label :t/resend-message)
:icon :main-icons/refresh
:accessibility-label :resend-message-button
:on-press #(hide-sheet-and-dispatch [:chat.ui/resend-message chat-id message-id])}]
[quo/list-item
{:theme :negative
:title (i18n/label :t/delete-message)
:icon :main-icons/delete
:accessibility-label :delete-transaccent-button
:on-press #(hide-sheet-and-dispatch [:chat.ui/delete-message-not-used-any-more chat-id
message-id])}]]))

View File

@ -1,66 +0,0 @@
(ns status-im.ui.screens.communities.channel-details
(:require [clojure.string :as string]
[quo.core :as quo]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[status-im.ui.components.profile-header.view :as profile-header]
[utils.re-frame :as rf]))
(defn view
[]
(let [{:keys [chat-id]} (rf/sub [:get-screen-params])]
(fn []
(let [current-chat (rf/sub [:chat-by-id chat-id])
{:keys [chat-name color description community-id emoji]} current-chat
{:keys [position]} (rf/sub [:chats/community-chat-by-id
community-id chat-id])
category (rf/sub [:chats/category-by-chat-id
community-id chat-id])
{:keys [admin]} (rf/sub [:communities/community
community-id])
pinned-messages (rf/sub [:chats/pinned chat-id])]
[quo/animated-header
{:left-accessories [{:icon :main-icons/arrow-left
:accessibility-label :back-button
:on-press #(rf/dispatch [:navigate-back])}]
:right-accessories (when admin
[{:icon :edit
:accessibility-label :invite-button
:on-press #(rf/dispatch [::communities/edit-channel-pressed
community-id
chat-name
description
color
emoji
chat-id
(:id category)
position])}])
:extended-header (profile-header/extended-header
{:title chat-name
:color color
:emoji emoji
:subtitle (i18n/label :t/public-channel)})
:use-insets true}
(when-not (string/blank? description)
[:<>
[quo/list-footer {:color :main}
description]
[quo/separator {:style {:margin-vertical 8}}]
(when admin
[quo/list-item
{:title (i18n/label :t/category)
:on-press #(rf/dispatch [:open-modal :select-category
{:chat current-chat
:category category
:community-id community-id}])
:chevron true
:accessory :text
:accessory-text (if category
(:name category)
(i18n/label :t/none))}])
[quo/list-item
{:title (i18n/label :t/pinned-messages)
:accessory :text
:accessory-text (count pinned-messages)
:chevron true
:on-press #(rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id])}]])]))))

View File

@ -1,340 +0,0 @@
(ns status-im.ui.screens.communities.community
(:require
[utils.i18n :as i18n]
[quo.core :as quo]
[quo.design-system.colors :as colors]
[quo2.components.community.style :as styles]
[quo2.components.navigation.floating-shell-button :as floating-shell-button]
[react-native.core :as rn]
[status-im.communities.core :as communities]
[status-im2.constants :as constants]
[status-im.react-native.resources :as resources]
[status-im.ui.components.accordion :as accordion]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.icons.icons :as icons]
[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.toolbar :as toolbar]
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.chat.photos :as photos]
[status-im.ui.screens.chat.sheets :as sheets]
[status-im.utils.core :as utils]
[utils.datetime :as datetime]
[utils.re-frame :as rf]
[status-im.ui.screens.home.views.inner-item :as inner-item]))
(def request-cooldown-ms (* 24 60 60 1000))
(defn can-request-access-again?
[requested-at]
(> (datetime/timestamp) (+ (* requested-at 1000) request-cooldown-ms)))
(defn toolbar-content
[id display-name color images show-members-count? members]
(let [thumbnail-image (get-in images [:thumbnail :uri])]
[rn/view
{:style {:flex 1
:align-items :center
:flex-direction :row}}
[rn/view {:padding-right 10}
(cond
(= id constants/status-community-id)
[rn/image
{:source (resources/get-image :status-logo)
:style {:width 40
:height 40}}]
(seq thumbnail-image)
[photos/photo thumbnail-image {:size 40}]
:else
[chat-icon.screen/chat-icon-view-toolbar
id
true
display-name
(or color (rand-nth colors/chat-colors)) nil 36])]
[rn/view {:style {:flex 1 :justify-content :center}}
[quo/text
{:number-of-lines 1
:accessibility-label :community-name-text}
display-name]
[quo/text
{:number-of-lines 1
:size :small
:color :secondary}
(if show-members-count?
(i18n/label-pluralize members :t/community-members {:count members})
(i18n/label :t/open-membership))]]]))
(defn hide-sheet-and-dispatch
[event]
(rf/dispatch [:bottom-sheet/hide-old])
(rf/dispatch event))
(defn community-plus-actions
[{:keys [id permissions can-manage-users?]}]
(let [can-invite? (and can-manage-users?
(not= (:access permissions) constants/community-no-membership-access))
can-share? (not= (:access permissions) constants/community-invitation-only-access)]
[:<>
[quo/list-item
{:theme :accent
:title (i18n/label :t/create-channel)
:accessibility-label :community-create-channel
:icon :main-icons/channel
:on-press #(hide-sheet-and-dispatch [::communities/create-channel-pressed id])}]
[quo/list-item
{:theme :accent
:title (i18n/label :t/create-category)
:accessibility-label :community-create-category
:icon :main-icons/channel-category
:on-press #(hide-sheet-and-dispatch [:open-modal :create-community-category
{:community-id id}])}]
[quo/separator]
(when can-invite?
[quo/list-item
{:theme :accent
:title (i18n/label :t/invite-people)
:icon :main-icons/share
:accessibility-label :community-invite-people
:on-press #(rf/dispatch [:communities/invite-people-pressed id])}])
(when (and can-share? (not can-invite?))
[quo/list-item
{:theme :accent
:title (i18n/label :t/invite-people)
:icon :main-icons/share
:accessibility-label :community-share
:on-press #(rf/dispatch [:communities/share-community-pressed id])}])]))
(defn community-actions
[{:keys [id name images color can-manage-users?]}]
(let [thumbnail-image (get-in images [:thumbnail :uri])]
[:<>
[quo/list-item
{:title name
:subtitle (i18n/label :t/community-info)
:on-press #(hide-sheet-and-dispatch [:navigate-to :community-management {:community-id id}])
:chevron true
:icon (cond
(= id constants/status-community-id)
[rn/image
{:source (resources/get-image :status-logo)
:style {:width 40
:height 40}}]
(seq thumbnail-image)
[photos/photo thumbnail-image {:size 40}]
:else
[chat-icon.screen/chat-icon-view-chat-sheet
name
true
name
(or color (rand-nth colors/chat-colors))])}]
[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-in-community-pressed id])}]
(when can-manage-users?
[:<>
[quo/list-item
{:theme :accent
:title (i18n/label :t/export-key)
:accessibility-label :community-export-key
:icon :main-icons/objects
:on-press #(hide-sheet-and-dispatch [::communities/export-pressed id])}]
[quo/separator]
[quo/list-item
{:theme :accent
:title (i18n/label :t/edit-chats)
:accessibility-label :community-edit-chats
:icon :main-icons/edit
:on-press #(hide-sheet-and-dispatch
[:open-modal :community-reorder-categories {:community-id id}])}]])]))
(defn blank-page
[text]
[rn/view
{:style {:padding 16 :flex 1 :flex-direction :row :align-items :center :justify-content :center}}
[quo/text
{:align :center
:color :secondary}
text]])
(defn community-chat-item
[{:keys [chat-id] :as home-item} _ _ _]
[inner-item/home-list-item-old
;; We want communities to behave as public chats when it comes to
;; unread indicator
(assoc home-item :public? true)
{:on-press (fn []
(rf/dispatch [:dismiss-keyboard])
(rf/dispatch [:chat/navigate-to-chat chat-id])
(rf/dispatch [:search/home-filter-changed nil]))
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet-old
{:content (fn []
[sheets/actions home-item])}])}])
(defn categories-accordion
[community-id chats categories data]
[:<>
(for [{:keys [name id state]} categories]
^{:key (str "cat" name id)}
[:<>
[accordion/section
{:on-open #(rf/dispatch [::communities/store-category-state community-id id true])
:on-close #(rf/dispatch [::communities/store-category-state community-id id false])
:default state
:title [rn/view styles/category-item
[icons/icon :main-icons/channel-category {:color colors/gray}]
[rn/text {:style {:font-size 17 :margin-left 10 :color colors/black}} name]]
:content [:<>
(for [chat (get chats id)]
^{:key (str "chat" chat id)}
[community-chat-item chat nil nil data])]}]
[quo/separator]])])
(defn community-chat-list
[community-id categories from-chat]
(let [chats (rf/sub [:chats/sorted-categories-by-community-id community-id])]
(if (and (empty? categories) (empty? chats))
[blank-page (i18n/label :t/welcome-community-blank-message)]
[list/flat-list
{:key-fn :chat-id
:content-container-style {:padding-bottom 8}
:keyboard-should-persist-taps :always
:data (get chats "")
:render-data {:from-chat from-chat}
:render-fn community-chat-item
:header [categories-accordion community-id chats categories
{:from-chat from-chat}]
:footer [rn/view {:height 68}]}])))
(defn channel-preview-item
[{:keys [id name]}]
(let [color colors/default-community-color]
[quo/list-item
{:icon [chat-icon.screen/chat-icon-view-chat-list
id true name color false false]
:title [rn/view
{:flex-direction :row
:flex 1
:padding-right 16
:align-items :center}
[icons/icon :main-icons/tiny-group
{:color colors/black
:width 15
:height 15
:container-style {:width 15
:height 15
:margin-right 2}}]
[quo/text
{:weight :medium
:accessibility-label :chat-name-text
:ellipsize-mode :tail
:number-of-lines 1}
(utils/truncate-str name 30)]]
:title-accessibility-label :chat-name-text}]))
(defn community-channel-preview-list
[_ chats-without-id]
(let [chats (reduce-kv
(fn [acc k v]
(conj acc (assoc v :id (name k))))
[]
chats-without-id)]
[list/flat-list
{:key-fn :id
:content-container-style {:padding-vertical 8}
:keyboard-should-persist-taps :always
:data chats
:render-fn channel-preview-item}]))
(defn unknown-community
[community-id]
(let [fetching (rf/sub [:communities/fetching-community community-id])]
[:<> {:style {:flex 1}}
[topbar/topbar {:title (if fetching (i18n/label :t/fetching-community) (i18n/label :t/not-found))}]
[rn/view
{:style {:padding 16 :flex 1 :flex-direction :row :align-items :center :justify-content :center}}
[quo/button
{:on-press (when-not fetching #(rf/dispatch [:chat.ui/resolve-community-info community-id]))
:disabled fetching
:color :secondary}
(if fetching
[react/small-loading-indicator]
(i18n/label :t/fetch-community))]]]))
(defn community
[]
(let [{:keys [community-id from-chat]} (rf/sub [:get-screen-params :community])]
(fn []
(let [{:keys [id chats name images members permissions color joined
can-request-access? can-join? requested-to-join-at admin]
:as community}
(rf/sub [:communities/community community-id])
categories (rf/sub [:communities/sorted-categories community-id])]
(if community
[rn/view {:style {:flex 1}}
[topbar/topbar
{:content
[toolbar-content
id
name
color
images
(not= (:access permissions) constants/community-no-membership-access)
(count members)]
:right-accessories
(when (or admin joined)
[{:icon :main-icons/more
:accessibility-label :community-menu-button
:on-press #(rf/dispatch [:bottom-sheet/show-sheet-old
{:content (fn []
[community-actions community])}])}])}]
(if joined
[community-chat-list id categories false from-chat]
[community-channel-preview-list id chats])
(when admin
[components.plus-button/plus-button-old
{:on-press #(rf/dispatch [:bottom-sheet/show-sheet-old
{:content (fn []
[community-plus-actions community])}])
:accessibility-label :new-chat-button}])
(when-not joined
(cond
can-join?
[toolbar/toolbar
{:show-border? true
:center [quo/button
{:on-press #(rf/dispatch [:communities/join id])
:type :secondary}
(i18n/label :t/join)]}]
can-request-access?
(if (and (pos? requested-to-join-at)
(not (can-request-access-again? requested-to-join-at)))
[toolbar/toolbar
{:show-border? true
:left [quo/text {:color :secondary}
(i18n/label :t/membership-request-pending)]}]
[toolbar/toolbar
{:show-border? true
:center [quo/button
{:on-press #(rf/dispatch [:communities/request-to-join id])
:type :secondary}
(i18n/label :t/request-access)]}])
:else
[toolbar/toolbar
{:show-border? true
:center [quo/button
{:on-press #(rf/dispatch [:communities/join id])
:type :secondary}
(i18n/label :t/follow)]}]))
[floating-shell-button/floating-shell-button
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}}
{:position :absolute
:bottom 70}]]
[unknown-community community-id])))))

View File

@ -1,55 +0,0 @@
(ns status-im.ui.screens.communities.community-emoji-thumbnail-picker
(:require [clojure.string :as string]
[quo.core :as quo]
[quo.react-native :as rn]
[status-im.communities.core :as communities]
[status-im.ui.components.emoji-thumbnail.color-picker :as color-picker]
[status-im.ui.components.emoji-thumbnail.preview :as emoji-thumbnail-preview]
[status-im.ui.components.emoji-thumbnail.styles :as styles]
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
[status-im.ui.components.react :as react]
[utils.re-frame :as rf]))
(defn thumbnail-preview-section
[]
(let [{:keys [color emoji]} (rf/sub [:communities/create-channel])
size styles/emoji-thumbnail-preview-size]
[rn/view styles/emoji-thumbnail-preview
[emoji-thumbnail-preview/emoji-thumbnail
emoji color size]]))
(defn color-circle
[item]
(let [{:keys [color]} (rf/sub [:communities/create-channel])
item-color (:color item)
key (:key key)
color-selected? (= (string/lower-case item-color) (string/lower-case color))]
[react/touchable-opacity
{:key key
:accessibility-label :color-circle
:on-press #(rf/dispatch [::communities/create-channel-field :color item-color])}
[rn/view {:style (styles/emoji-picker-color-border item-color color-selected?)}
[rn/view {:style (styles/emoji-picker-color item-color)}]]]))
(defn update-emoji
[emoji]
(when-not (string/blank? emoji)
(rf/dispatch [::communities/create-channel-field :emoji emoji])))
(defn emoji-keyboard-section
[]
(let [{:keys [width height]} (rf/sub [:dimensions/window])
keyboard_height (if (> width height)
400
(- height styles/emoji-picker-upper-components-size))]
[rn/view {:style {:height keyboard_height} :accessibility-label :emoji-keyboard-container}
[rn/emoji-keyboard (styles/emoji-keyboard #(update-emoji (.-emoji ^js %)))]]))
(defn view
[]
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
[rn/scroll-view
[quo/separator]
[thumbnail-preview-section]
[color-picker/color-picker-section color-circle]
[emoji-keyboard-section]]])

View File

@ -8,7 +8,6 @@
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.communities.membership :as memberships]
[utils.re-frame :as rf]
[status-im.utils.image :as utils.image]
[utils.debounce :as debounce]))
@ -151,7 +150,7 @@
(defn form
[]
(let [{:keys [name description membership editing?]} (rf/sub [:communities/create])]
(let [{:keys [name description editing?]} (rf/sub [:communities/create])]
[rn/scroll-view
{:keyboard-should-persist-taps :handled
:style {:flex 1}
@ -189,17 +188,11 @@
[:<>
[quo/separator {:style {:margin-vertical 10}}]
[quo/list-item
{:title (i18n/label :t/membership-button)
:accessory-text (i18n/label (get-in memberships/options
[membership :title]
:t/membership-none))
:accessory :text
:on-press #(rf/dispatch [:navigate-to :community-membership])
:chevron true
:size :small}]
[quo/list-footer
(i18n/label
(get-in memberships/options [membership :description] :t/membership-none-placeholder))]])]))
{:title (i18n/label :t/membership-button)
:accessory :text
:on-press #(rf/dispatch [:navigate-to :community-membership])
:chevron true
:size :small}]])]))
(defn view
[]

View File

@ -1,73 +0,0 @@
(ns status-im.ui.screens.communities.create-category
(:require [clojure.string :as string]
[quo.core :as quo]
[reagent.core :as reagent]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[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.toolbar :as toolbar]
[status-im.ui.screens.home.views.inner-item :as inner-item]
[utils.re-frame :as rf]
[utils.debounce :as debounce]))
(defn valid?
[category-name]
(and (not (string/blank? category-name))
(<= (count category-name) 30)))
(def selected-items (reagent/atom #{}))
(defn render-fn
[{:keys [chat-id] :as home-item}]
(let [selected (get @selected-items chat-id)
on-change (fn []
(swap! selected-items #(if selected (disj % chat-id) (conj % chat-id))))]
[react/view {:flex-direction :row :flex 1 :align-items :center}
[react/view {:padding-left 16}
[quo/checkbox
{:value selected
:on-change on-change}]]
[react/view {:flex 1}
[inner-item/home-list-item-old
(assoc home-item :public? true)
{:on-press on-change}]]]))
(defn view
[]
(let [{:keys [community-id]} (rf/sub [:get-screen-params])
category-name (reagent/atom "")
_ (reset! selected-items #{})]
(fn []
(let [chats (rf/sub [:chats/with-empty-category-by-community-id community-id])]
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
[react/view {:flex 1}
[react/view {:padding-horizontal 16}
[quo/text-input
{:placeholder (i18n/label :t/category-title)
:on-change-text #(reset! category-name %)
:auto-focus true}]]
[quo/separator {:style {:margin-vertical 10}}]
(when (seq chats)
[:<>
[quo/list-header (i18n/label :t/include)]
[list/flat-list
{:key-fn :chat-id
:content-container-style {:padding-vertical 8}
:keyboard-should-persist-taps :always
:data chats
:render-fn render-fn}]])]
[toolbar/toolbar
{:show-border? true
:center
[quo/button
{:disabled (not (valid? @category-name))
:type :secondary
:on-press #(debounce/dispatch-and-chill
[::communities/create-category-confirmation-pressed
community-id
@category-name
(vec @selected-items)]
3000)}
(i18n/label :t/create)]}]]))))

View File

@ -1,72 +0,0 @@
(ns status-im.ui.screens.communities.create-channel
(:require [clojure.string :as string]
[quo.core :as quo]
[quo.react-native :as rn]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[status-im.ui.components.emoji-thumbnail.preview :as emoji-thumbnail-preview]
[status-im.ui.components.emoji-thumbnail.styles :as styles]
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.communities.create :as create]
[utils.re-frame :as rf]
[utils.debounce :as debounce]))
(defn valid?
[channel-name channel-description]
(and (not (string/blank? channel-name))
(not (string/blank? channel-description))
(<= (count channel-name) create/max-name-length)
(<= (count channel-description) create/max-description-length)))
(defn thumbnail
[]
(let [{:keys [color emoji]} (rf/sub [:communities/create-channel])
size styles/emoji-thumbnail-preview-size]
[rn/view styles/emoji-thumbnail-preview
[emoji-thumbnail-preview/emoji-thumbnail-touchable
emoji color size
#(rf/dispatch [:open-modal :community-emoji-thumbnail-picker nil])]]))
(defn form
[]
(let [{:keys [name description]} (rf/sub [:communities/create-channel])]
[rn/scroll-view
{:style {:flex 1}
:content-container-style {:padding-bottom 16}}
[:<>
[thumbnail]
[rn/view {:padding-horizontal 16}
[quo/text-input
{:placeholder (i18n/label :t/name-your-channel-placeholder)
:on-change-text #(rf/dispatch [::communities/create-channel-field :name %])
:default-value name
:auto-focus false}]]
[quo/separator {:style {:margin-vertical 16}}]
[rn/view {:padding-horizontal 16}
[create/countable-label
{:label (i18n/label :t/description)
:text description
:max-length create/max-description-length}]
[quo/text-input
{:placeholder (i18n/label :t/give-a-short-description-community)
:multiline true
:default-value description
:on-change-text #(rf/dispatch [::communities/create-channel-field :description %])}]]]]))
(defn view
[]
(let [{:keys [name description]} (rf/sub [:communities/create-channel])]
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
[quo/separator]
[form]
[toolbar/toolbar
{:show-border? true
:center
[quo/button
{:disabled (not (valid? name description))
:type :secondary
:on-press #(debounce/dispatch-and-chill
[::communities/create-channel-confirmation-pressed]
3000)}
(i18n/label :t/create)]}]]))

View File

@ -1,21 +0,0 @@
(ns status-im.ui.screens.communities.edit
(:require [quo.core :as quo]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.communities.create :as community.create]
[utils.re-frame :as rf]))
(defn edit
[]
(let [{:keys [name description]} (rf/sub [:communities/create])]
[:<>
[community.create/form]
[toolbar/toolbar
{:show-border? true
:center
[quo/button
{:disabled (not (community.create/valid? name description))
:type :secondary
:on-press #(rf/dispatch [::communities/edit-confirmation-pressed])}
(i18n/label :t/save)]}]]))

View File

@ -1,30 +0,0 @@
(ns status-im.ui.screens.communities.edit-channel
(:require [clojure.string :as string]
[quo.core :as quo]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.communities.create-channel :as create-channel]
[utils.re-frame :as rf]
[utils.debounce :as debounce]))
(defn valid?
[community-name]
(not (string/blank? community-name)))
(defn view
[]
(let [{:keys [name]} (rf/sub [:communities/create-channel])]
(fn []
[:<>
[create-channel/form]
[toolbar/toolbar
{:show-border? true
:center
[quo/button
{:disabled (not (valid? name))
:type :secondary
:on-press #(debounce/dispatch-and-chill
[::communities/edit-channel-confirmation-pressed]
3000)}
(i18n/label :t/save)]}]])))

View File

@ -1,43 +0,0 @@
(ns status-im.ui.screens.communities.icon
(:require [quo.design-system.colors :as colors]
[status-im2.constants :as constants]
[status-im.react-native.resources :as resources]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.photos :as photos]))
(defn community-icon
[{:keys [id name images color]}]
(let [color (or color (rand-nth colors/chat-colors))
thumbnail-image (get-in images [:thumbnail :uri])]
(cond
(= id constants/status-community-id)
[react/image
{:source (resources/get-image :status-logo) ;; TODO replace with real data (or remove this code)
:style {:width 40
:height 40}}]
(seq thumbnail-image)
[photos/photo {:uri thumbnail-image} {:size 40}]
:else
[chat-icon.screen/chat-icon-view-chat-list
id true name color false false])))
;; TODO (flexsurfer) reimplement with new design, its still old design, photos and chat-icon components
;; from old design
(defn community-icon-redesign
[{:keys [id name images color]} size]
(let [color (or color (rand-nth colors/chat-colors))
thumbnail-image (get-in images [:thumbnail :uri])]
(cond
(= id constants/status-community-id)
[react/image
{:source (resources/get-image :status-logo) ;; TODO replace with real data
:style {:width size
:height size}}]
(seq thumbnail-image)
[photos/photo thumbnail-image {:size size}]
:else
[chat-icon.screen/chat-icon-view-chat-list-redesign
id true name color size])))

View File

@ -1,127 +0,0 @@
(ns status-im.ui.screens.communities.profile
(:require [clojure.string :as string]
[quo.core :as quo]
[quo.design-system.colors :as colors]
[quo.react-native :as rn]
[reagent.core :as reagent]
[status-im.communities.core :as communities]
[status-im2.constants :as constants]
[utils.i18n :as i18n]
[status-im.react-native.resources :as resources]
[status-im.ui.components.copyable-text :as copyable-text]
[status-im.ui.components.profile-header.view :as profile-header]
[status-im.ui.components.react :as react]
[status-im.ui.components.unviewed-indicator :as unviewed-indicator]
[utils.re-frame :as rf]))
(defn management
[]
(let [{:keys [community-id]} (rf/sub [:get-screen-params])]
(fn []
(let [requests-to-join (rf/sub [:communities/requests-to-join-for-community community-id])
community (rf/sub [:communities/community community-id])
{:keys [color members permissions description
name admin]} community
roles false
notifications false
show-members-count? (not= (:access permissions) constants/community-no-membership-access)
request-membership? (= (:access permissions) constants/community-on-request-access)
members-count (count members)]
[:<>
[quo/animated-header
{:left-accessories [{:icon :main-icons/arrow-left
:accessibility-label :back-button
:on-press #(rf/dispatch [:navigate-back])}]
:right-accessories [{:icon :main-icons/share
:accessibility-label :invite-button
:on-press #(rf/dispatch [:communities/share-community-pressed
community-id])}]
:extended-header (profile-header/extended-header
{:title name
:color (or color (rand-nth colors/chat-colors))
:photo (if (= community-id constants/status-community-id)
(:uri
(rn/resolve-asset-source
(resources/get-image :status-logo)))
(get-in community [:images :large :uri]))
:membership (when request-membership?
(i18n/label :t/membership-approval))
:subtitle (if show-members-count?
(i18n/label-pluralize members-count
:t/community-members
{:count members-count})
(i18n/label :t/open-membership))
:community? true})
:use-insets true}
[:<>
(when-not (string/blank? description)
[:<>
[quo/list-footer {:color :main}
description]
[quo/separator {:style {:margin-vertical 8}}]])
[:<>
(let [link (communities/universal-link community-id)]
[react/view
{:padding-vertical 10
:padding-horizontal 16}
[react/view {:margin-bottom 20}
[quo/text {:color :secondary} (i18n/label :t/community-link)]]
[copyable-text/copyable-text-view
{:copied-text link}
[react/view
{:border-radius 16
:padding-horizontal 16
:padding-vertical 11
:background-color colors/blue-light}
[quo/text {:color :link} (subs link 8)]]]])
[quo/separator {:style {:margin-vertical 8}}]]
(when show-members-count?
[quo/list-item
{:chevron true
:accessory
[react/view {:flex-direction :row}
(when (pos? members-count)
[quo/text {:color :secondary} (str members-count)])
[unviewed-indicator/unviewed-indicator (count requests-to-join)]]
:on-press #(rf/dispatch [:navigate-to :community-members {:community-id community-id}])
:title (i18n/label :t/members-label)
:icon :main-icons/group-chat}])
(when (and admin roles)
[quo/list-item
{:chevron true
:title (i18n/label :t/commonuity-role)
:icon :main-icons/objects}])
(when notifications
[quo/list-item
{:chevron true
:title (i18n/label :t/chat-notification-preferences)
:icon :main-icons/notification}])
(when (or show-members-count? notifications (and admin roles))
[quo/separator {:style {:margin-vertical 8}}])
(when admin
[quo/list-item
{:theme :accent
:icon :main-icons/edit
:title (i18n/label :t/edit-community)
:on-press #(rf/dispatch [::communities/open-edit-community community-id])}])
[quo/list-item
{:theme :accent
:icon :main-icons/arrow-left
:title (i18n/label :t/leave-community)
:on-press #(rf/dispatch [:communities/leave community-id])}]
;; Disable as not implemented yet
(when false
[quo/list-item
{:theme :negative
:icon :main-icons/delete
:title (i18n/label :t/delete)
:on-press #(rf/dispatch [::communities/delete-community community-id])}])]]]))))
(defn management-container
[]
(reagent/create-class
{:display-name "community-profile-view"
:component-did-mount (fn []
(communities/fetch-requests-to-join! (get (rf/sub [:get-screen-params])
:community-id)))
:reagent-render management}))

View File

@ -1,217 +0,0 @@
(ns status-im.ui.screens.communities.reorder-categories
(:require [clojure.set :as set]
[clojure.string :as string]
[clojure.walk :as walk]
[quo.core :as quo]
[quo.design-system.colors :as colors]
[quo.react-native :as rn]
[quo2.components.community.style :as styles]
[reagent.core :as reagent]
[status-im.communities.core :as communities]
[status-im2.constants :as constants]
[utils.i18n :as i18n]
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im.ui.components.tabs :as tabs]
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.communities.community :as community]
[status-im.ui.screens.home.views.inner-item :as inner-item]
[utils.re-frame :as rf]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]))
(def data (reagent/atom []))
(def state (reagent/atom {:tab :chats}))
(defn show-delete-chat-confirmation
[community-id chat-id]
(utils/show-confirmation
{:title (i18n/label :t/delete-confirmation)
:content (i18n/label :t/delete-chat-confirmation)
:confirm-button-text (i18n/label :t/delete)
:on-accept #(rf/dispatch [:delete-community-chat community-id chat-id])}))
(defn show-delete-category-confirmation
[community-id category-id]
(utils/show-confirmation
{:title (i18n/label :t/delete-confirmation)
:content (i18n/label :t/delete-category-confirmation)
:confirm-button-text (i18n/label :t/delete)
:on-accept #(rf/dispatch [:delete-community-category community-id category-id])}))
(defn categories-tab?
[]
(let [{:keys [tab]} @state]
(= tab :categories)))
(defn chat-item
[{:keys [id community-id] :as home-item} is-active? drag]
(let [chat-id (string/replace id community-id "")
background-color (if is-active? colors/gray-lighter colors/white)
home-item (set/rename-keys home-item {:id :chat-id})]
[rn/view
{:accessibility-label :chat-item
:style (merge styles/category-item
{:background-color background-color})}
[rn/touchable-opacity
{:accessibility-label :delete-community-chat
:on-press #(show-delete-chat-confirmation community-id chat-id)}
[icons/icon :main-icons/delete-circle {:no-color true}]]
[rn/view {:flex 1}
[inner-item/home-list-item-old (assoc home-item :edit? true) {:active-opacity 1}]]
[rn/touchable-opacity
{:on-long-press drag
:delay-long-press 100
:accessibility-label :chat-drag-handle
:style {:padding 20}}
[icons/icon :main-icons/reorder-handle {:no-color true :width 18 :height 12}]]]))
(defn category-item
[{:keys [id name community-id]} is-active? drag]
(let [background-color (if is-active? colors/gray-lighter colors/white)
category-none? (string/blank? id)]
[:<>
[quo/separator]
[rn/view
{:accessibility-label :category-item
:style (merge styles/category-item
{:background-color background-color})}
(if (not (categories-tab?))
[icons/icon :main-icons/channel-category {:color colors/gray}]
[rn/touchable-opacity
{:accessibility-label :delete-category-button
:on-press #(show-delete-category-confirmation community-id id)}
[icons/icon :main-icons/delete-circle {:no-color true}]])
[rn/view {:flex 1}
[rn/text {:style {:font-size 17 :margin-left 10 :color colors/black}} name]]
(when (and (not category-none?) (categories-tab?))
[rn/touchable-opacity
{:accessibility-label :category-drag-handle
:on-long-press drag
:delay-long-press 100
:style {:padding 20}}
[icons/icon :main-icons/reorder-handle {:no-color true :width 18 :height 12}]])]]))
(defn render-fn
[{:keys [chat-type] :as item} _ _ _ is-active? drag]
(if (= chat-type constants/community-chat-type)
[chat-item item is-active? drag]
[category-item item is-active? drag]))
(defn calculate-chat-new-position-and-category
[to second-call? old-category going-up?]
(let [{:keys [id chat-type categoryID position]} (get @data to)
[new-category new-position]
(if going-up?
(if (= chat-type constants/community-chat-type)
[categoryID (if second-call? (inc position) position)]
(if second-call?
[id 0]
(calculate-chat-new-position-and-category (dec to) true old-category true)))
(if (= chat-type constants/community-chat-type)
(if (= categoryID old-category)
[categoryID position]
[categoryID (inc position)])
[id 0]))]
[new-category new-position]))
(defn update-local-atom
[data-js]
(reset! data data-js)
(reagent/flush))
(defn on-drag-end-chat
[from to data-js]
(let [{:keys [id community-id categoryID position]} (get @data from)
[new-category new-position] (calculate-chat-new-position-and-category
to
false
categoryID
(> from to))
chat-id (string/replace id community-id "")]
(when-not (and (= new-position position) (= new-category categoryID))
(update-local-atom data-js)
(rf/dispatch [::communities/reorder-community-category-chat
community-id new-category chat-id new-position]))))
(defn on-drag-end-category
[from to data-js]
(let [{:keys [id community-id position]} (get @data from)]
(when (and (< to (count @data)) (not= position to) (not= id ""))
(update-local-atom data-js)
(rf/dispatch [::communities/reorder-community-category community-id id to]))))
(defn on-drag-end-fn
[from to data-js]
(if (categories-tab?)
(on-drag-end-category from to data-js)
(when-not (= to 0) (on-drag-end-chat from to data-js))))
(defn reset-data
[categories chats]
(reset! data
(if (categories-tab?)
categories
(walk/postwalk-replace
{:chat-id :id}
(reduce (fn [acc category]
(-> acc
(conj category)
(into (get chats (:id category)))))
[]
categories)))))
(defn draggable-list
[]
[rn/draggable-flat-list
{:key-fn :id
:data @data
:render-fn render-fn
:autoscroll-threshold (if platform/android? 150 250)
:autoscroll-speed (if platform/android? 10 150) ;; TODO - Use same speed for both ios and android
:container-style {:margin-bottom 108} ;; after bumping react native version to >
;; 0.64
:on-drag-end-fn on-drag-end-fn}])
(defn chats_and_categories
[]
(let [{:keys [tab]} @state]
[:<>
[react/view
{:flex-direction :row
:margin-horizontal 16
:margin-vertical 8
:border-radius 8
:background-color colors/blue-light}
[tabs/tab-button state :chats (i18n/label :t/edit-chats) (= tab :chats)]
[tabs/tab-button state :categories (i18n/label :t/edit-categories) (= tab :categories)]]]))
(defn view
[]
(let [{:keys [community-id]} (rf/sub [:get-screen-params])
{:keys [id name images members permissions color]}
(rf/sub [:communities/community community-id])
sorted-categories (rf/sub [:communities/sorted-categories
community-id])
categories (if (categories-tab?)
sorted-categories
(conj sorted-categories
{:id ""
:position (count
sorted-categories)
:name (i18n/label :t/none)
:community-id community-id}))
chats (rf/sub
[:chats/sorted-categories-by-community-id
community-id])]
(reset-data categories chats)
[:<>
[topbar/topbar
{:content [community/toolbar-content id name color images
(not= (:access permissions) constants/community-no-membership-access)
(count members)]}]
(if (and (empty? sorted-categories) (empty? chats))
[community/blank-page (i18n/label :t/welcome-community-blank-message-edit-chats)]
[:<>
[chats_and_categories]
[draggable-list]])]))

View File

@ -1,67 +0,0 @@
(ns status-im.ui.screens.communities.select-category
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[reagent.core :as reagent]
[status-im.communities.core :as communities]
[utils.i18n :as i18n]
[status-im.ui.components.icons.icons :as icons]
[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]
[utils.re-frame :as rf]
[utils.debounce :as debounce]))
(def selected-item (reagent/atom ""))
(defn render-fn
[{:keys [name id]}]
[quo/list-item
{:title name
:accessory :radio
:on-press #(reset! selected-item id)
:active (= id @selected-item)
:icon [icons/icon :main-icons/channel-category {:color colors/gray}]}])
(defn view
[]
(let [{:keys [community-id chat]} (rf/sub [:get-screen-params])]
(fn []
(let [categories (rf/sub [:communities/sorted-categories community-id])
chats (rf/sub [:chats/sorted-categories-by-community-id community-id])
comm-chat (rf/sub [:chats/community-chat-by-id community-id (:chat-id chat)])
_ (reset! selected-item (:categoryID comm-chat))]
[:<>
[topbar/topbar
{:title (str "#" (:chat-name chat))
:subtitle (i18n/label :t/public-channel)
:modal? true}]
[react/view {:flex 1}
[quo/list-header (i18n/label :t/category)]
[list/flat-list
{:key-fn :chat-id
:content-container-style {:padding-vertical 8}
:keyboard-should-persist-taps :always
:footer [quo/list-item
{:theme :accent
:icon :main-icons/channel-category
:on-press #(rf/dispatch [:open-modal
:create-community-category
{:community-id community-id}])
:title (i18n/label :t/create-category)}]
:data (conj categories {:name (i18n/label :t/none) :id ""})
:render-fn render-fn}]]
[toolbar/toolbar
{:show-border? true
:center
[quo/button
{:type :secondary
:on-press #(debounce/dispatch-and-chill
[::communities/change-category-confirmation-pressed
community-id
@selected-item
(assoc comm-chat
:position
(count (get chats @selected-item)))] ;; Add as last item in new category
3000)}
(i18n/label :t/done)]}]]))))

View File

@ -1,34 +0,0 @@
(ns status-im.ui.screens.multiaccounts.key-storage.styles
(:require [quo.design-system.colors :as colors]))
(def help-text-container
{:width "60%"
:align-self :center
:padding-vertical 24})
(def help-text
{:text-align :center})
(def popover-title
{:typography :title-bold
:margin-top 8
:margin-bottom 24})
(def popover-body-container
{:flex-wrap :wrap
:flex-direction :row
:justify-content :center
:text-align :center})
(def popover-text
{:color colors/gray
:text-align :center
:line-height 22})
(def header
{:flex-direction :row
:align-items :center
:justify-content :space-between
:padding-top 16
:padding-left 16
:margin-bottom 11})

View File

@ -1,436 +0,0 @@
(ns status-im.ui.screens.multiaccounts.key-storage.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[re-frame.db]
[utils.i18n :as i18n]
[status-im.multiaccounts.key-storage.core :as multiaccounts.key-storage]
[status-im.react-native.resources :as resources]
[status-im.ui.components.accordion :as accordion]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.icons.icons :as icons]
[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.multiaccounts.key-storage.styles :as styles]
[status-im.ui.screens.multiaccounts.views :as multiaccounts.views]
[utils.security.core]))
(defn local-topbar
[subtitle action]
[topbar/topbar
(merge {:title (i18n/label :t/key-managment)
:subtitle subtitle}
(when action {:navigation {:on-press #(re-frame/dispatch [action])}}))])
(defonce accordian-data
[{:id :type
:label (i18n/label :t/type)
:value (i18n/label :t/master-account)}
{:id :back-up
:label (i18n/label :t/back-up)
:value (i18n/label :t/recovery-phrase)}
{:id :storage
:label (i18n/label :t/storage)
:value (i18n/label :t/key-on-device)}])
(defn accordion-content
[]
[react/view
{:padding-horizontal 16
:flex-direction :row}
[react/view
{:flex-shrink 0
:margin-right 20}
(for [{:keys [id label]} accordian-data]
^{:key (str "left-" id)}
[react/text
{:style {:color colors/gray
:padding-vertical 8}} label])]
[react/view {:flex 1}
(for [{:keys [id value]} accordian-data]
^{:key (str "right-" id)}
[react/text
{:flex 1
:flex-wrap :wrap
:style {:padding-vertical 8}}
value])]])
;; Component to render Key and Storage management screen
(defview actions-base
[{:keys [next-title next-event]}]
(letsubs [{:keys [name] :as multiaccount} [:multiaccounts/login]
{:keys [move-keystore-checked? reset-db-checked?]} [:multiaccounts/key-storage]]
[react/view {:flex 1}
[local-topbar (i18n/label :t/choose-actions)]
[accordion/section
{:title name
:icon [chat-icon.screen/contact-icon-contacts-tab multiaccount]
:content [accordion-content]}]
[react/view
{:flex 1
:flex-direction :column
:justify-content :space-between}
[react/view
[quo/list-header (i18n/label :t/actions)]
[quo/list-item
{:title (i18n/label :t/move-keystore-file)
:subtitle (i18n/label :t/select-new-location-for-keys)
:subtitle-max-lines 4
:accessibility-label :move-keystore-file
:accessory :checkbox
:active move-keystore-checked?
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/move-keystore-checked
(not move-keystore-checked?)])}]
[quo/list-item
{:title (i18n/label :t/reset-database)
:subtitle (i18n/label :t/reset-database-warning)
:subtitle-max-lines 4
:active reset-db-checked?
:disabled (not move-keystore-checked?)
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/reset-db-checked
(not reset-db-checked?)])
:accessory :checkbox}]]
(when (and next-title next-event)
[toolbar/toolbar
{:show-border? true
:right [quo/button
{:type :secondary
:disabled (not move-keystore-checked?)
:on-press #(re-frame/dispatch next-event)
:after :main-icons/next}
next-title]}])]]))
(defn actions-not-logged-in
"To be used when the flow is accessed before login, will enter seed phrase next"
[]
[actions-base
{:next-title (i18n/label :t/enter-seed-phrase)
:next-event [::multiaccounts.key-storage/enter-seed-pressed]}])
(defn actions-logged-in
"To be used when the flow is accessed from profile, will choose storage next"
[]
[actions-base
{:next-title (i18n/label :t/choose-storage)
:next-event [::multiaccounts.key-storage/choose-storage-pressed]}])
(defview seed-phrase
[]
(letsubs
[{:keys [seed-word-count seed-shape-invalid?]} [:multiaccounts/key-storage]
{:keys [creating-backup?]} [:keycard]]
[react/keyboard-avoiding-view
{:style {:flex 1}
:ignore-offset true}
[local-topbar (i18n/label :t/enter-seed-phrase) ::multiaccounts.key-storage/navigate-back]
[multiaccounts.views/seed-phrase-input
{:on-change-event [::multiaccounts.key-storage/seed-phrase-input-changed]
:seed-word-count seed-word-count
:seed-shape-invalid? seed-shape-invalid?}]
[react/text
{:style {:color colors/gray
:font-size 14
:margin-bottom 8
:text-align :center}}
(i18n/label :t/multiaccounts-recover-enter-phrase-text)]
[toolbar/toolbar
{:show-border? true
:right [quo/button
{:type :secondary
:disabled (or seed-shape-invalid?
(nil? seed-shape-invalid?))
:on-press #(re-frame/dispatch
[::multiaccounts.key-storage/choose-storage-pressed])
:after :main-icons/next}
(i18n/label (if creating-backup? :t/next :t/choose-storage))]}]]))
(defn keycard-upsell-banner
[]
[react/view
{:background-color (if (colors/dark?) "#2C5955" "#DDF8F4")
:border-radius 16
:padding-left 12
:padding-right 50
:margin 16}
[react/touchable-highlight
{:on-press #(do
(re-frame/dispatch [:hide-keycard-banner])
(.openURL ^js react/linking "https://get-keycard.status.im/"))}
[react/view
{:padding-vertical 8
:flex-direction :row}
[react/image
{:source (resources/get-theme-image :keycard)
:resize-mode :contain
:style {:width 48
:height 48}}]
[react/view
{:flex 1
:margin-left 12}
[react/text
{:style {:font-size 20
:font-weight "700"}}
(i18n/label :t/get-a-keycard)]
[react/text {:style {:color (colors/alpha colors/text 0.8)}}
(i18n/label :t/keycard-upsell-subtitle)]]]]
[react/touchable-highlight
{:style {:position :absolute
:right 0
:top 0
:align-items :center
:justify-content :center
:margin 2}
:on-press #(re-frame/dispatch [:hide-keycard-banner])
:accessibility-label :hide-home-button}
[icons/icon :main-icons/close-circle {:color colors/gray}]]])
(defview storage
[]
(letsubs
[{:keys [keycard-storage-selected?]} [:multiaccounts/key-storage]]
[react/view {:flex 1}
[local-topbar (i18n/label :t/choose-storage)]
[react/view {:style styles/help-text-container}
[react/text {:style styles/help-text}
(i18n/label :t/choose-new-location-for-keystore)]]
[react/view
[quo/list-header (i18n/label :t/current)]
[quo/list-item
{:title (i18n/label :t/this-device)
:text-size :base
:icon :main-icons/mobile
:disabled true}]
[quo/list-header (i18n/label :t/new)]
[quo/list-item
{:title (i18n/label :t/keycard)
:subtitle (i18n/label :t/empty-keycard-required)
:subtitle-max-lines 4
:icon :main-icons/keycard
:active keycard-storage-selected?
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/keycard-storage-pressed
(not keycard-storage-selected?)])
:accessory :radio}]]
[react/view
{:flex 1
:justify-content :flex-end}
(when-not keycard-storage-selected?
[keycard-upsell-banner])
[toolbar/toolbar
{:show-border? true
:right [quo/button
{:type :secondary
:disabled (not keycard-storage-selected?)
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/storage-selected])}
(i18n/label :t/confirm)]}]]]))
(defview migrate-account-password-view
[]
(letsubs [{:keys [migration-password-error migration-password-valid?]} [:keycard]]
[react/view {:flex 1}
[react/view styles/header
[react/text {:style {:typography :title-bold}} (i18n/label :t/enter-password)]
[react/view {:padding-horizontal 24}
[quo/button
{:type :secondary
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/skip-password-pressed])}
(i18n/label :t/skip)]]]
[quo/separator]
[react/view {:padding-horizontal 16 :padding-vertical 12}
[react/text {:style {:margin-top 6 :margin-bottom 12 :color colors/gray}}
(i18n/label :t/enter-password-migration-prompt)]
[quo/text-input
{:secure-text-entry true
:placeholder (i18n/label :t/current-password)
:on-change-text #(re-frame/dispatch [::multiaccounts.key-storage/password-changed
(utils.security.core/mask-data %)])
:accessibility-label :enter-password-input
:auto-capitalize :none
:error migration-password-error
:show-cancel false}]]
[react/view {:padding-horizontal 16 :padding-vertical 12}
[quo/button
{:on-press #(re-frame/dispatch [::multiaccounts.key-storage/verify-password])
:disabled (not migration-password-valid?)}
(i18n/label :t/confirm)]]]))
(def migrate-account-password
{:content migrate-account-password-view})
(defview seed-key-uid-mismatch-popover
[]
(letsubs [{:keys [name]} [:multiaccounts/login]
{logged-in-name :name} [:multiaccount]]
[react/view
{:margin-top 24
:margin-horizontal 24
:align-items :center}
[react/view
{:width 32
:height 32
:border-radius 16
:align-items :center
:justify-content :center}
[icons/icon :main-icons/warning {:color colors/blue}]]
[react/text
{:style {:typography :title-bold
:margin-top 8
:margin-bottom 24}}
(i18n/label :t/seed-key-uid-mismatch)]
[react/view styles/popover-body-container
[react/view
[react/text
{:style (into styles/popover-text
{:margin-bottom 16})}
(i18n/label :t/seed-key-uid-mismatch-desc-1 {:multiaccount-name (or name logged-in-name)})]
[react/text {:style styles/popover-text}
(i18n/label :t/seed-key-uid-mismatch-desc-2)]]]
[react/view
{:margin-vertical 24
:align-items :center}
[quo/button
{:on-press #(re-frame/dispatch [:hide-popover])
:type :secondary}
(i18n/label :t/try-again)]]]))
(defview transfer-multiaccount-warning-popover
[]
[react/view
{:margin-top 24
:margin-horizontal 24
:align-items :center}
[react/view
{:width 32
:height 32
:border-radius 16
:align-items :center
:justify-content :center}
[icons/icon :main-icons/tiny-warning-background {:color colors/red}]]
[react/text {:style styles/popover-title}
(i18n/label :t/move-keystore-file-to-keycard)]
[react/view styles/popover-body-container
[react/text {:style styles/popover-text}
(i18n/label :t/database-reset-warning)]]
[react/view
{:margin-vertical 24
:align-items :center}
[quo/button
{:on-press #(re-frame/dispatch
[::multiaccounts.key-storage/delete-multiaccount-and-init-keycard-onboarding])
:accessibility-label :move-and-reset-button
:type :primary
:theme :negative}
(i18n/label :t/move-and-reset)]
[quo/button
{:on-press #(re-frame/dispatch [:hide-popover])
:accessibility-label :cancel-move-seed-phrase-button
:type :secondary}
(i18n/label :t/cancel)]]])
(defview unknown-error-popover
[]
[react/view
{:margin-top 24
:margin-horizontal 24
:align-items :center}
[react/view
{:width 32
:height 32
:border-radius 16
:align-items :center
:justify-content :center}
[icons/icon :main-icons/close {:color colors/red}]]
[react/text
{:style {:typography :title-bold
:margin-top 8
:margin-bottom 24}}
(i18n/label :t/something-went-wrong)]
[react/view styles/popover-body-container
[react/view
[react/text
{:style (into styles/popover-text
{:margin-bottom 16})}
(i18n/label :t/transfer-ma-unknown-error-desc-1)]
[react/text {:style styles/popover-text}
(i18n/label :t/transfer-ma-unknown-error-desc-2)]]]
[react/view
{:margin-vertical 24
:align-items :center}
[quo/button
{:on-press #(re-frame/dispatch
[::multiaccounts.key-storage/hide-popover-and-goto-multiaccounts-screen])
:type :secondary}
(i18n/label :t/okay)]]])
(comment
;; UI flow
(do
;; Goto key management actions screen
(re-frame/dispatch [::multiaccounts.key-storage/key-and-storage-management-pressed])
;; Check move key store checkbox
(re-frame/dispatch [::multiaccounts.key-storage/move-keystore-checked true])
;; Goto enter seed screen
(re-frame/dispatch [::multiaccounts.key-storage/enter-seed-pressed])
;; Enter seed phrase
;; invalid seed shape
#_(re-frame/dispatch [::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data "h h h h h h h h h h h h")])
;; valid seed for Trusty Candid Bighornedsheep
;; If you try to select Dim Venerated Yaffle, but use this seed instead,
;; validate-seed-against-key-uid will fail miserably
#_(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
"disease behave roof exile ghost head carry item tumble census rocket champion")])
;; valid seed for Swiffy Warlike Seagull
#_(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
"dirt agent garlic merge tuna leaf congress hedgehog absent dish pizza scrap")])
;; valid seed for Dim Venerated Yaffle (this is just a test account, okay to leak seed)
(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo")])
;; Click choose storage
(re-frame/dispatch [::multiaccounts.key-storage/choose-storage-pressed])
;; Choose Keycard from storage options
(re-frame/dispatch [::multiaccounts.key-storage/keycard-storage-pressed true])
;; Confirm migration popup
(re-frame/dispatch [::multiaccounts.key-storage/show-transfer-warning-popup])
;; Delete multiaccount and init keycard onboarding
(re-frame/dispatch [::multiaccounts.key-storage/delete-multiaccount-and-init-keycard-onboarding]))
;; Show error popup
(re-frame/dispatch [::multiaccounts.key-storage/show-seed-key-uid-mismatch-error-popup])
(re-frame/dispatch [::multiaccounts.key-storage/show-transfer-warning-popup])
(re-frame/dispatch [::multiaccounts.key-storage/delete-multiaccount-error])
(re-frame/dispatch [:hide-popover])
;; Flow to populate state after multiaccount is deleted
(do
;; set seed phrase for Dim Venerated Yaffle
(re-frame/dispatch
[:set-in [:multiaccounts/key-storage :seed-phrase]
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo"])
;; set seed for Trusty Candid Bighornedsheep
#_(re-frame/dispatch
[:set-in [:multiaccounts/key-storage :seed-phrase]
"disease behave roof exile ghost head carry item tumble census rocket champion"])
;; simulate delete multiaccount success
(re-frame/dispatch [::multiaccounts.key-storage/delete-multiaccount-success])))

View File

@ -1,52 +0,0 @@
(ns status-im.ui.screens.multiaccounts.login.styles
(:require [quo.design-system.colors :as colors]))
(def login-view
{:flex 1
:margin-horizontal 16})
(def login-badge-container
{:margin-top 24})
(def processing-view
{:flex 1
:align-items :center
:justify-content :center})
(def processing
{:margin-top 16
:color colors/gray})
(def login-badge
{:align-items :center})
(def login-badge-image-size 56)
(def login-badge-name
{:margin-top 10
:text-align :center
:font-weight "500"})
(def login-badge-pubkey
{:margin-top 4})
(def password-container
{:margin-top 24
:android {:margin-top 11
:padding-top 13}})
(def save-password-unavailable-android
{:margin-top 8
:width "100%"
:color colors/text-gray
:text-align :center
:flex-direction :row
:align-items :center})
(def biometric-button
{:justify-content :center
:align-items :center
:height 40
:width 40
:border-radius 20
:margin-left 16})

View File

@ -1,120 +0,0 @@
(ns status-im.ui.screens.multiaccounts.login.views
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.ui.components.checkbox.view :as checkbox]
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.chat.photos :as photos]
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
[status-im.ui.screens.multiaccounts.login.styles :as styles]
[status-im.ui.screens.multiaccounts.styles :as ast]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]
[utils.security.core :as security])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn login-multiaccount
[^js password-text-input]
(.blur password-text-input)
(re-frame/dispatch [:multiaccounts.login.ui/password-input-submitted]))
(defn multiaccount-login-badge
[{:keys [compressed-key public-key name] :as multiaccount}]
[react/view styles/login-badge
[photos/photo
(multiaccounts/displayed-photo multiaccount)
{:size styles/login-badge-image-size}]
[react/view
[react/text
{:style styles/login-badge-name
:ellipsize-mode :middle
:numberOfLines 1}
name]
[quo/text
{:monospace true
:align :center
:color :secondary
:style styles/login-badge-pubkey}
(utils/get-shortened-address (or compressed-key public-key))]]])
(defn topbar-button
[]
(react/dismiss-keyboard!)
(re-frame/dispatch [:multiaccounts.recover.ui/recover-multiaccount-button-pressed]))
(defview login
[]
(letsubs [{:keys [error processing save-password?] :as multiaccount} [:multiaccounts/login]
password-text-input (atom nil)
sign-in-enabled? [:sign-in-enabled?]
auth-method [:auth-method]
view-id [:view-id]
supported-biometric-auth [:supported-biometric-auth]
keycard? [:keycard-multiaccount?]
banner-hidden [:keycard/banner-hidden]]
[react/keyboard-avoiding-view {:style ast/multiaccounts-view}
[react/scroll-view
{:keyboard-should-persist-taps :always
:style styles/login-view}
[react/view styles/login-badge-container
[multiaccount-login-badge multiaccount]
[react/view {:style styles/password-container}
[react/view {:flex-direction :row :align-items :center}
[react/view {:flex 1}
[quo/text-input
{:placeholder (i18n/label :t/enter-your-password)
:get-ref #(reset! password-text-input %)
:auto-focus (= view-id :login)
:accessibility-label :password-input
:show-cancel false
:on-submit-editing (when sign-in-enabled?
#(login-multiaccount @password-text-input))
:on-change-text #(do
(re-frame/dispatch [:set-in [:multiaccounts/login :password]
(security/mask-data %)])
(re-frame/dispatch [:set-in [:multiaccounts/login :error] ""]))
:secure-text-entry true
:error (when (not-empty error) error)}]]
(when (and supported-biometric-auth (= auth-method "biometric"))
[react/touchable-highlight {:on-press #(re-frame/dispatch [:biometric-authenticate])}
[react/view {:style styles/biometric-button}
[icons/icon
(if (= supported-biometric-auth :FaceID)
:main-icons/faceid
:main-icons/print)
{:color colors/blue}]]])]]
(if (and platform/android? (not auth-method))
;; on Android, there is much more reasons for the password save to be unavailable,
;; so we don't show the checkbox whatsoever but put a label explaining why it happenned.
[react/i18n-text
{:style styles/save-password-unavailable-android
:key :save-password-unavailable-android}]
[react/view
{:style {:flex-direction :row
:align-items :center
:justify-content :flex-start
:margin-top 19}}
[checkbox/checkbox
{:checked? save-password?
:style {:margin-left 3 :margin-right 10}
:on-value-change #(re-frame/dispatch [:multiaccounts/save-password %])}]
[react/text (i18n/label :t/save-password)]])]]
(if processing
[react/view styles/processing-view
[react/activity-indicator {:animating true}]
[react/i18n-text {:style styles/processing :key :processing}]]
(when-not (or keycard? banner-hidden)
[key-storage/keycard-upsell-banner]))
[toolbar/toolbar
{:size :large
:center
[react/view {:padding-horizontal 8}
[quo/button
{:disabled (or (not sign-in-enabled?) processing)
:on-press #(login-multiaccount @password-text-input)}
(i18n/label :t/sign-in)]]}]]))

View File

@ -1,150 +0,0 @@
(ns status-im.ui.screens.multiaccounts.recover.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.keycard.recovery :as keycard]
[status-im.multiaccounts.key-storage.core :as multiaccounts.key-storage]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.qr-scanner.core :as qr-scanner]
[status-im.react-native.resources :as resources]
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im2.config :as config]
[utils.security.core]))
(defn hide-sheet-and-dispatch
[event]
(re-frame/dispatch [:bottom-sheet/hide-old])
(re-frame/dispatch event))
(defview custom-seed-phrase
[]
[react/view
[react/view {:margin-top 24 :margin-horizontal 24 :align-items :center}
[react/view
{:width 32
:height 32
:border-radius 16
:align-items :center
:justify-content :center}
[icons/icon :main-icons/help {:color colors/blue}]]
[react/text
{:style {:typography :title-bold
:margin-top 8
:margin-bottom 8}}
(i18n/label :t/custom-seed-phrase)]
[react/view
{:flex-wrap :wrap
:flex-direction :row
:justify-content :center
:text-align :center}
[react/nested-text
{:style {:color colors/gray
:text-align :center
:line-height 22}}
(i18n/label :t/custom-seed-phrase-text-1)]]
[react/view
{:margin-vertical 24
:align-items :center}
[quo/button
{:on-press #(re-frame/dispatch [:hide-popover])
:accessibility-label :cancel-custom-seed-phrase
:type :secondary}
(i18n/label :t/cancel)]]]])
(defview bottom-sheet-view
[]
(letsubs [view-id [:view-id]
acc-to-login-keycard-pairing [:intro-wizard/acc-to-login-keycard-pairing]]
[react/view {:flex-direction :row}
[react/view {}
;; Show manage storage link when on login screen, only on android devices
;; and the selected account is not paired with keycard
(when (and (= view-id :login)
(not acc-to-login-keycard-pairing))
[quo/list-item
{:theme :accent
:title (i18n/label :t/manage-keys-and-storage)
:accessibility-label :manage-keys-and-storage-button
:icon :main-icons/key
:on-press #(hide-sheet-and-dispatch
[::multiaccounts.key-storage/key-and-storage-management-pressed])}])
[quo/list-item
{:theme :accent
:title (i18n/label :t/recover-with-seed-phrase)
:accessibility-label :enter-seed-phrase-button
:icon :main-icons/text
:on-press #(hide-sheet-and-dispatch [::multiaccounts.recover/enter-phrase-pressed])}]
[quo/list-item
{:theme :accent
:title (i18n/label :t/recover-with-keycard)
:accessibility-label :recover-with-keycard-button
:icon [react/view
{:border-width 1
:border-radius 20
:border-color colors/blue-light
:background-color colors/blue-light
:justify-content :center
:align-items :center
:width 40
:height 40}
[react/image
{:source (resources/get-image :keycard-logo-blue)
:style {:width 24 :height 24}}]]
:on-press #(hide-sheet-and-dispatch [::keycard/recover-with-keycard-pressed])}]
(when config/database-management-enabled?
[quo/list-item
{:theme :accent
:on-press #(hide-sheet-and-dispatch [:multiaccounts.login.ui/import-db-submitted])
:icon :main-icons/receive
:title "Import unencrypted"}])
(when config/database-management-enabled?
[quo/list-item
{:theme :accent
:on-press #(hide-sheet-and-dispatch [:multiaccounts.login.ui/export-db-submitted])
:icon :main-icons/send
:title "Export unencrypted"}])
(when config/local-pairing-mode-enabled?
[:<>
[quo/list-item
{:theme :accent
:on-press #(hide-sheet-and-dispatch [::qr-scanner/scan-code
{:handler ::qr-scanner/on-scan-success}])
:icon :i/key
:title (i18n/label :t/scan-sync-code)}]
[quo/list-item
{:theme :accent
:on-press #(hide-sheet-and-dispatch [:navigate-to :multiaccounts])
:icon :i/key
:title (i18n/label :t/show-existing-keys)}]])]]))
(def bottom-sheet
{:content bottom-sheet-view})
(comment
;; Recover with seed to device UI flow
(do
;; Goto seed screen
(re-frame/dispatch [::multiaccounts.recover/enter-phrase-pressed])
;; Enter seed phrase for Dim Venerated Yaffle
(re-frame/dispatch
[:multiaccounts.recover/enter-phrase-input-changed
(utils.security.core/mask-data
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo")])
;; Recover multiaccount
(re-frame/dispatch [:multiaccounts.recover/enter-phrase-next-pressed])
;; Press Re-encrypt
(re-frame/dispatch [:multiaccounts.recover/re-encrypt-pressed])
;; Press next on default storage (ie store on device)
(re-frame/dispatch [:multiaccounts.recover/select-storage-next-pressed])
;; Enter password (need to wait for a moment for this to finish)
(re-frame/dispatch [:multiaccounts.recover/enter-password-next-pressed "111111"])))

View File

@ -1,18 +0,0 @@
(ns status-im.ui.screens.multiaccounts.sheets
(:require [quo.core :as quo]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]))
(defn- hide-sheet-and-dispatch
[event]
(re-frame/dispatch [:bottom-sheet/hide-old])
(re-frame/dispatch event))
(defn actions-sheet
[]
[quo/list-item
{:theme :accent
:on-press #(hide-sheet-and-dispatch [:navigate-to :intro])
:icon :main-icons/add
:accessibility-label :generate-a-new-key
:title (i18n/label :t/generate-a-new-key)}])

View File

@ -1,14 +0,0 @@
(ns status-im.ui.screens.multiaccounts.styles)
(def multiaccounts-view
{:flex 1})
(def multiaccounts-container
{:flex 1
:justify-content :space-between})
(def multiaccount-image-size 40)
(def multiaccounts-list-container
{:padding-top 24
:padding-bottom 8})

View File

@ -1,94 +0,0 @@
(ns status-im.ui.screens.multiaccounts.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.react-native.resources :as resources]
[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.screens.chat.photos :as photos]
[status-im.ui.screens.multiaccounts.styles :as styles]
[status-im.ui.screens.multiaccounts.sheets :as sheets]
[utils.security.core :as security]))
(defn multiaccount-view
[{:keys [key-uid name keycard-pairing] :as account}]
[quo/list-item
{:on-press #(re-frame/dispatch
[:multiaccounts.login.ui/multiaccount-selected key-uid])
:icon [photos/photo (multiaccounts/displayed-photo account)
{:size styles/multiaccount-image-size}]
:title name
:accessory-style (when keycard-pairing {:flex-basis 100})
:accessory (when keycard-pairing
[react/view
{:justify-content :center
:align-items :center
:width 32
:height 32
:border-radius 24
:background-color colors/white
:border-width 1
:border-color colors/black-transparent}
[react/image
{:source (resources/get-image :keycard-key)
:style {:width 11
:height 19}}]])
:chevron true}])
(defn topbar-button
[]
(re-frame/dispatch [:bottom-sheet/show-sheet-old
{:content sheets/actions-sheet}]))
(defview multiaccounts
[]
(letsubs [multiaccounts [:multiaccounts/multiaccounts]]
[:<>
[react/view styles/multiaccounts-container
[list/flat-list
{:data (vals multiaccounts)
:contentContainerStyle styles/multiaccounts-list-container
:key-fn (comp str :address)
:render-fn multiaccount-view}]]
[toolbar/toolbar
{:show-border? true
:size :large
:center [quo/button
{:on-press #(re-frame/dispatch
[:multiaccounts.recover.ui/recover-multiaccount-button-pressed])
:type :secondary}
(i18n/label :t/access-existing-keys)]}]]))
(defn seed-phrase-input
[{:keys [on-change-event
seed-word-count
seed-shape-invalid?]}]
[react/view
{:flex 1
:justify-content :center
:padding-horizontal 16}
[quo/text-input
{:show-cancel false
:auto-correct false
:keyboard-type :visible-password
:placeholder (i18n/label :t/seed-phrase-placeholder)
:monospace true
:multiline true
:auto-focus true
:accessibility-label :passphrase-input
:on-change-text #(re-frame/dispatch (conj on-change-event (security/mask-data %)))}]
;; word counter view
[react/view {:align-items :flex-end}
[react/view
{:flex-direction :row
:align-items :center
:padding-vertical 8
:opacity (if seed-word-count 1 0)}
[quo/text
{:color (if seed-shape-invalid? :secondary :main)
:size :small}
(when-not seed-shape-invalid? "✓ ")
(i18n/label-pluralize seed-word-count :t/words-n)]]]])

View File

@ -1,110 +0,0 @@
(ns status-im.ui.screens.onboarding.keys.views
(:require [quo.core :as quo]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im2.constants :as constants]
[utils.i18n :as i18n]
[status-im.react-native.resources :as resources]
[status-im.ui.components.react :as react]
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.onboarding.styles :as styles]
[status-im.ui.screens.onboarding.views :as ui]
[status-im.utils.gfycat.core :as gfy]
[status-im.utils.identicon :as identicon]
[status-im.utils.utils :as utils]
[utils.debounce :refer [dispatch-and-chill]])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defview choose-a-chat-name
[]
(letsubs [{:keys [multiaccounts selected-id]} [:intro-wizard/choose-key]]
[:<>
[topbar/topbar
{:border-bottom false
:navigation {:label (i18n/label :t/cancel)
:on-press (fn []
(utils/show-question
(i18n/label :t/are-you-sure-to-cancel)
(i18n/label :t/you-will-start-from-scratch)
#(re-frame/dispatch [:navigate-back])))}}]
[ui/title-with-description :t/intro-wizard-title2 :t/intro-wizard-text2]
[ui/learn-more :t/about-names-title :t/about-names-content]
[react/view
{:style {:flex 1
:justify-content :center}}
[react/scroll-view
{:style {:max-height 410}
:content-container-style {:justify-content :flex-start}}
(for [[acc accessibility-n] (map vector multiaccounts (range (count multiaccounts)))]
(let [selected? (= (:id acc) selected-id)
public-key (get-in acc [:derived constants/path-whisper-keyword :public-key])
compressed-key (get-in acc [:derived constants/path-whisper-keyword :compressed-key])]
^{:key public-key}
[quo/list-item
{:accessibility-label (keyword (str "select-account-button-" accessibility-n))
:active selected?
:title [quo/text
{:number-of-lines 2
:weight :medium
:ellipsize-mode :middle
:accessibility-label :username}
(gfy/generate-gfy public-key)]
:subtitle [quo/text
{:weight :monospace
:color :secondary}
(utils/get-shortened-address (or compressed-key
public-key))]
:accessory :radio
:on-press #(re-frame/dispatch [:intro-wizard/on-key-selected (:id acc)])
:icon [react/image
{:source {:uri (identicon/identicon public-key)}
:resize-mode :cover
:style styles/multiaccount-image}]}]))]]
[ui/next-button #(dispatch-and-chill [:navigate-to :select-key-storage] 300) false]]))
(defn get-your-keys-image
[]
(let [dimensions (reagent/atom {})]
(fn []
;;TODO this is not really the best way to do it, resize is visible, we need to find a better way
[react/view
{:on-layout (fn [^js e]
(reset! dimensions (js->clj (-> e .-nativeEvent .-layout) :keywordize-keys true)))
:style {:align-items :center
:justify-content :center
:flex 1}}
(let [image-size (- (min (:width @dimensions) (:height @dimensions)) 40)]
[react/image
{:source (resources/get-theme-image :keys)
:resize-mode :contain
:style {:width image-size :height image-size}}])])))
(defview get-your-keys
[]
(letsubs [{:keys [processing?]} [:intro-wizard/choose-key]]
[:<>
[ui/title-with-description :t/intro-wizard-title1 :t/intro-wizard-text1]
[get-your-keys-image]
(if processing?
[react/view {:style {:align-items :center}}
[react/view {:min-height 46 :max-height 46 :align-self :stretch :margin-bottom 16}
[react/activity-indicator
{:animating true
:size :large}]]
[react/text {:style (assoc (styles/wizard-text) :margin-top 20 :margin-bottom 16)}
(i18n/label :t/generating-keys)]]
[react/view {:style {:align-items :center}}
[react/view {:style (assoc styles/bottom-button :margin-bottom 16)}
[quo/button
{:test-ID :generate-keys
;:disabled existing-account?
:on-press #(re-frame/dispatch [:generate-and-derive-addresses])
:accessibility-label :onboarding-next-button}
(i18n/label :t/generate-a-key)]]
[react/view {:padding-vertical 8}
[quo/button
{:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old :recover-sheet])
:type :secondary}
(i18n/label :t/access-existing-keys)]]
[react/text {:style (assoc (styles/wizard-text) :margin-top 20 :margin-bottom 16)}
(i18n/label :t/this-will-take-few-seconds)]])]))

View File

@ -1,40 +0,0 @@
(ns status-im.ui.screens.onboarding.notifications.views
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[quo.platform :as platform]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.notifications.core :as notifications]
[status-im.react-native.resources :as resources]
[status-im.ui.components.react :as react]))
(defn notifications-onboarding
[]
[react/view
{:flex 1
:background-color colors/white
:align-items :center
:padding-bottom 16}
[react/text
{:style {:margin-top 72
:margin-bottom 16
:typography :header}}
(i18n/label :t/private-notifications)]
[react/text {:style {:color colors/gray :text-align :center :margin-horizontal 24}}
(i18n/label :t/private-notifications-descr)]
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/image
{:source (resources/get-image :notifications)
:style {:width 118
:height 118}}]]
[quo/button
{:on-press #(do (re-frame/dispatch [::notifications/switch true platform/ios?])
(re-frame/dispatch [:init-root :welcome]))
:accessibility-label :enable-notifications}
(i18n/label :t/intro-wizard-title6)]
[quo/button
{:type :secondary
:style {:margin-top 8}
:accessibility-label :maybe-later
:on-press #(re-frame/dispatch [:init-root :welcome])}
(i18n/label :t/maybe-later)]])

View File

@ -1,124 +0,0 @@
(ns status-im.ui.screens.onboarding.password.views
(:require [quo.core :as quo]
[quo.react-native :as rn]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im2.constants :as const]
[utils.i18n :as i18n]
[status-im.ui.components.toolbar :as toolbar]
[utils.security.core :as security]))
(defn validate-password
[password]
(>= (count password) const/min-password-length))
(defn confirm-password
[password confirm]
(= password confirm))
(defn screen
[]
(let [password (reagent/atom nil)
confirm (reagent/atom nil)
processing? (reagent/atom nil)
show-error (reagent/atom nil)
confirm-ref (atom nil)]
(fn []
(let [valid-password (validate-password @password)
valid-form (confirm-password @password @confirm)
{:keys [recovering?]} @(re-frame/subscribe [:intro-wizard])
on-submit (fn []
(when (not @processing?)
(if (and valid-password valid-form)
(do (reset! show-error false)
(reset! processing? true)
(if recovering?
(re-frame/dispatch
[:multiaccounts.recover/enter-password-next-pressed
@password])
(re-frame/dispatch [:create-multiaccount @password])))
(reset! show-error true))))]
[rn/keyboard-avoiding-view {:flex 1}
[rn/view
{:style {:flex 1
:justify-content :space-between
:padding-vertical 16
:padding-horizontal 16}}
[quo/text
{:weight :bold
:align :center
:size :x-large}
(i18n/label :intro-wizard-title-alt4)]
[rn/view
[rn/view {:style {:padding 16}}
[quo/text-input
{:test-ID :password-placeholder
:secure-text-entry true
:auto-capitalize :none
:auto-focus true
:show-cancel false
:accessibility-label :password-input
:placeholder (i18n/label :t/password-placeholder)
:on-change-text #(reset! password (security/mask-data %))
:return-key-type :next
:on-submit-editing #(when valid-password
(some-> ^js @confirm-ref
.focus))}]]
[rn/view
{:style {:padding 16
:opacity (if-not valid-password 0.33 1)}}
[quo/text-input
{:test-ID :confirm-password-placeholder
:secure-text-entry true
:get-ref #(reset! confirm-ref %)
:auto-capitalize :none
:show-cancel false
:accessibility-label :password-input
:editable valid-password
:placeholder (i18n/label :t/confirm-password-placeholder)
:return-key-type :go
:error (when @show-error (i18n/label :t/password_error1))
:blur-on-submit true
:on-focus #(reset! show-error false)
:on-submit-editing on-submit
:on-change-text #(do
(reset! confirm (security/mask-data %))
(cond
(> (count @password) (count @confirm))
(reset! show-error false)
(not (confirm-password @password @confirm))
(reset! show-error true)
:else (reset! show-error
false)))}]]]
[quo/text
{:color :secondary
:align :center
:size :small}
(i18n/label :t/password-description)]]
[toolbar/toolbar
(merge {:show-border? true}
(if @processing?
{:center
[rn/view
{:align-items :center
:justify-content :center
:flex-direction :row}
[rn/activity-indicator
{:size :small
:animating true}]
[rn/view {:padding-horizontal 8}
[quo/text {:color :secondary}
(i18n/label :t/processing)]]]}
{:right
[quo/button
{:on-press on-submit
:accessibility-label :onboarding-next-button
:disabled (or (nil? @confirm)
(not valid-password)
(not valid-form)
@processing?)
:type :secondary
:after :main-icons/next}
(i18n/label :t/next)]}))]]))))

View File

@ -1,151 +0,0 @@
(ns status-im.ui.screens.onboarding.phrase.view
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[utils.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.screens.onboarding.views :as ui]
[utils.datetime :as datetime]
[status-im.utils.utils :as utils]
[utils.debounce :refer [dispatch-and-chill]]
[utils.security.core :as security]))
(defview wizard-recovery-success
[]
(letsubs [{:keys [pubkey
processing?
compressed-key
name]}
[:intro-wizard/recovery-success]
existing-account? [:intro-wizard/recover-existing-account?]]
[react/view
{:style {:flex 1
:justify-content :space-between}}
[ui/title-with-description :t/keycard-recovery-success-header :t/recovery-success-text]
[react/view
{:flex 1
:justify-content :space-between
:background-color colors/white}
[react/view
{:flex 1
:justify-content :space-between
:align-items :center}
[react/view
{:flex-direction :column
:flex 1
:justify-content :center
:align-items :center}
[react/view
{:margin-horizontal 16
:flex-direction :column}
[react/view
{:justify-content :center
:align-items :center
:margin-bottom 11}]
[react/text
{:style {:text-align :center
:color colors/black
:font-weight "500"}
:number-of-lines 1
:ellipsize-mode :middle}
name]
[quo/text
{:style {:margin-top 4}
:monospace true
:color :secondary
:align :center
:number-of-lines 1
:ellipsize-mode :middle}
(utils/get-shortened-address (or compressed-key pubkey))]]]]]
[ui/next-button
#(dispatch-and-chill [:multiaccounts.recover/re-encrypt-pressed] 300)
(or processing? existing-account?)]]))
(defn enter-phrase
[_]
(let [show-bip39-password? (reagent/atom false)
pressed-in-at (atom nil)]
(fn []
(let [{:keys [processing?
passphrase-word-count
next-button-disabled?
passphrase-error]}
@(re-frame/subscribe [:intro-wizard/enter-phrase])]
[react/keyboard-avoiding-view {:flex 1}
[quo/text
{:weight :bold
:align :center
:size :x-large}
(i18n/label :t/multiaccounts-recover-enter-phrase-title)]
[react/pressable
{:style {:background-color colors/white
:flex 1
:justify-content :center
:padding-horizontal 16}
;; BIP39 password input will be shown only after pressing on screen
;; for longer than 2 seconds
:on-press-in (fn []
(reset! pressed-in-at (datetime/now)))
:on-press-out (fn []
(when (>= (datetime/seconds-ago @pressed-in-at) 2)
(reset! show-bip39-password? true)))}
[react/view
[quo/text-input
{:on-change-text #(re-frame/dispatch [:multiaccounts.recover/enter-phrase-input-changed
(security/mask-data %)])
:auto-focus true
:error (when passphrase-error (i18n/label passphrase-error))
:accessibility-label :passphrase-input
:placeholder (i18n/label :t/seed-phrase-placeholder)
:show-cancel false
:bottom-value 40
:multiline true
:auto-correct false
:keyboard-type :visible-password
:monospace true}]
[react/view {:align-items :flex-end}
[react/view
{:flex-direction :row
:align-items :center
:padding-vertical 8
:opacity (if passphrase-word-count 1 0)}
[quo/text
{:color (if next-button-disabled? :secondary :main)
:size :small}
(when-not next-button-disabled?
"✓ ")
(i18n/label-pluralize passphrase-word-count :t/words-n)]]]
(when @show-bip39-password?
;; BIP39 password (`passphrase` in BIP39
;; https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed)
;; is an advanced security feature which allows to add an arbitrary
;; extra word to your existing mnemonic. The password is an empty
;; string if not provided. If the password is added a completely
;; different key will be created.
[quo/text-input
{:on-change-text
#(re-frame/dispatch [:multiaccounts.recover/enter-passphrase-input-changed
(security/mask-data %)])
:placeholder (i18n/label :t/bip39-password-placeholder)
:show-cancel false}])]]
[react/view {:align-items :center}
[react/text
{:style {:color colors/gray
:font-size 14
:margin-bottom 8
:text-align :center}}
(i18n/label :t/multiaccounts-recover-enter-phrase-text)]
(when processing?
[react/view {:flex 1 :align-items :center}
[react/activity-indicator
{:size :large
:animating true}]
[react/text
{:style {:color colors/gray
:margin-top 8}}
(i18n/label :t/processing)]])]
[ui/next-button
#(dispatch-and-chill [:multiaccounts.recover/enter-phrase-next-pressed] 300)
next-button-disabled?]]))))

View File

@ -1,53 +0,0 @@
(ns status-im.ui.screens.onboarding.storage.views
(:require [quo.core :as quo]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.screens.onboarding.views :as ui]
[utils.debounce :refer [dispatch-and-chill]])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn storage-entry
[{:keys [type icon title desc]} selected-storage-type]
[:<>
[quo/list-header (i18n/label type)]
[quo/list-item
{:accessibility-label (keyword (str "select-storage-" type))
:on-press #(re-frame/dispatch [:intro-wizard/on-key-storage-selected type])
:icon icon
:accessory :radio
:active (= type selected-storage-type)
:title (i18n/label title)
:subtitle (i18n/label desc)
:subtitle-max-lines 2}]])
(defview select-key-storage
[]
(letsubs [{:keys [selected-storage-type recovering?]} [:intro-wizard/select-key-storage]]
[:<>
[react/view {:style {:flex 1}}
[ui/title-with-description :t/intro-wizard-title3 :t/intro-wizard-text3]
[ui/learn-more :t/about-key-storage-title :t/about-key-storage-content]
[react/view {:style {:margin-top 60}}
[storage-entry
{:type :default
:icon :main-icons/mobile
:title :t/this-device
:desc :t/this-device-desc}
selected-storage-type]
[react/view {:style {:height 16}}]
[storage-entry
{:type :advanced
:icon :main-icons/keycard
:title :t/keycard
:desc :t/keycard-desc}
selected-storage-type]]]
[ui/next-button
#(dispatch-and-chill
(if (= :advanced selected-storage-type)
(if recovering?
[:multiaccounts.recover/select-storage-next-pressed]
[:keycard/start-onboarding-flow])
[:navigate-to :create-password])
300)
false]]))

View File

@ -1,34 +0,0 @@
(ns status-im.ui.screens.onboarding.styles
(:require [quo.design-system.colors :as colors]))
(def wizard-title
{:margin-bottom 16
:text-align :center})
(defn wizard-text
[]
{:color colors/gray
:text-align :center})
(def bottom-button
{:padding-horizontal 24
:justify-content :center
:align-items :center
:flex-direction :row})
(def multiaccount-image
{:width 40
:height 40
:border-radius 20
:border-width 1
:border-color colors/black-transparent})
(defn list-item
[selected?]
{:flex-direction :row
:align-items :center
:justify-content :space-between
:padding-left 16
:padding-right 10
:background-color (if selected? colors/blue-light colors/white)
:padding-vertical 12})

View File

@ -1,44 +0,0 @@
(ns status-im.ui.screens.onboarding.views
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.screens.onboarding.styles :as styles]))
(defn learn-more
[title content]
[react/text
{:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old :learn-more
{:title (i18n/label title)
:content (i18n/label content)}])
:style (merge (styles/wizard-text) {:color colors/blue})
:accessibility-label :learn-more}
(i18n/label :learn-more)])
(defn title-with-description
[title description]
[react/view
{:style {:margin-vertical 16
:margin-horizontal 32}}
[quo/text
{:style styles/wizard-title
:align :center
:weight :bold
:size :x-large}
(i18n/label title)]
[react/text {:style (styles/wizard-text)}
(i18n/label description)]])
(defn next-button
[handler disabled]
[toolbar/toolbar
{:show-border? true
:right [quo/button
{:on-press handler
:accessibility-label :onboarding-next-button
:type :secondary
:disabled disabled
:after :main-icons/next}
(i18n/label :t/next)]}])

View File

@ -1,17 +0,0 @@
(ns status-im.ui.screens.onboarding.welcome.styles
(:require [quo.design-system.colors :as colors]))
(def welcome-view
{:flex 1
:justify-content :flex-end})
(def welcome-text
{:typography :header
:text-align :center})
(def welcome-text-description
{:margin-top 16
:margin-bottom 32
:text-align :center
:margin-horizontal 40
:color colors/gray})

View File

@ -1,40 +0,0 @@
(ns status-im.ui.screens.onboarding.welcome.views
(:require [cljs-bean.core :as bean]
[quo.core :as quo]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[utils.i18n :as i18n]
[status-im.react-native.resources :as resources]
[status-im.ui.components.react :as react]
[status-im.ui.screens.onboarding.welcome.styles :as styles]))
(defn welcome-image-wrapper
[]
(let [dimensions (reagent/atom {})]
(fn []
[react/view
{:on-layout (fn [^js e]
(reset! dimensions (bean/->clj (-> e .-nativeEvent .-layout))))
:style {:align-items :center
:justify-content :center
:flex 1}}
(let [padding 0
image-size (- (min (:width @dimensions) (:height @dimensions)) padding)]
[react/image
{:source (resources/get-theme-image :welcome)
:resize-mode :contain
:style {:width image-size :height image-size}}])])))
(defn welcome
[]
[react/view {:style styles/welcome-view}
[welcome-image-wrapper]
[react/i18n-text {:style styles/welcome-text :key :welcome-to-status}]
[react/i18n-text
{:style styles/welcome-text-description
:key :welcome-to-status-description}]
[react/view {:align-items :center :margin-bottom 50}
[quo/button
{:on-press #(re-frame/dispatch [:welcome-lets-go])
:accessibility-label :lets-go-button}
(i18n/label :t/lets-go)]]])

View File

@ -9,16 +9,13 @@
[status-im.ui.screens.biometric.views :as biometric]
[status-im.ui.screens.keycard.frozen-card.view :as frozen-card]
[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.recover.views :as multiaccounts.recover]
[status-im.ui.screens.profile.user.views :as profile.user]
[status-im.ui.screens.reset-password.views :as reset-password.views]
[status-im.ui.screens.signing.sheets :as signing-sheets]
[status-im.ui.screens.signing.views :as signing]
[status-im.ui.screens.wallet.request.views :as request]
[status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[status-im.utils.platform :as platform]
[status-im2.contexts.activity-center.view :as activity-center]))
[status-im.utils.platform :as platform]))
(defn hide-panel-anim
[bottom-anim-value alpha-value window-height]
@ -145,9 +142,6 @@
(= :share-chat-key view)
[profile.user/share-chat-key]
(= :custom-seed-phrase view)
[multiaccounts.recover/custom-seed-phrase]
(= :enable-biometric view)
[biometric/enable-biometric-popover]
@ -166,24 +160,12 @@
(= :blocked-card view)
[keycard.views/blocked-card-popover]
(= :seed-key-uid-mismatch view)
[multiaccounts.key-storage/seed-key-uid-mismatch-popover]
(= :transfer-multiaccount-to-keycard-warning view)
[multiaccounts.key-storage/transfer-multiaccount-warning-popover]
(= :transfer-multiaccount-unknown-error view)
[multiaccounts.key-storage/unknown-error-popover]
(= :password-reset-popover view)
[reset-password.views/reset-password-popover]
(= :fees-warning view)
[signing-sheets/fees-warning]
(= :activity-center view)
[activity-center/view request-close]
:else
[view])]]]])))})))

View File

@ -11,22 +11,11 @@
[status-im.ui.screens.bootnodes-settings.views :as bootnodes-settings]
[status-im.ui.screens.browser.bookmarks.views :as bookmarks]
[status-im.ui.screens.bug-report :as bug-report]
[status-im.ui.screens.communities.channel-details :as communities.channel-details]
[status-im.ui.screens.communities.community :as community]
[status-im.ui.screens.communities.community-emoji-thumbnail-picker :as
community-emoji-thumbnail-picker]
[status-im.ui.screens.communities.create :as communities.create]
[status-im.ui.screens.communities.create-category :as create-category]
[status-im.ui.screens.communities.create-channel :as create-channel]
[status-im.ui.screens.communities.edit :as community.edit]
[status-im.ui.screens.communities.edit-channel :as edit-channel]
[status-im.ui.screens.communities.import :as communities.import]
[status-im.ui.screens.communities.invite :as communities.invite]
[status-im.ui.screens.communities.members :as members]
[status-im.ui.screens.communities.membership :as membership]
[status-im.ui.screens.communities.profile :as community.profile]
[status-im.ui.screens.communities.reorder-categories :as reorder-categories]
[status-im.ui.screens.communities.select-category :as select-category]
[status-im.ui.screens.contacts-list.views :as contacts-list]
[status-im.ui.screens.currency-settings.views :as currency-settings]
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
@ -46,9 +35,6 @@
[status-im.ui.screens.link-previews-settings.views :as link-previews-settings]
[status-im.ui.screens.log-level-settings.views :as log-level-settings]
[status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage.views]
[status-im.ui.screens.multiaccounts.login.views :as login]
[status-im.ui.screens.multiaccounts.views :as multiaccounts]
[status-im.ui.screens.network-info.views :as network-info]
[status-im.ui.screens.network.edit-network.views :as edit-network]
[status-im.ui.screens.network.network-details.views :as network-details]
@ -56,12 +42,6 @@
[status-im.ui.screens.notifications-settings.views :as notifications-settings]
[status-im.ui.screens.offline-messaging-settings.edit-mailserver.views :as edit-mailserver]
[status-im.ui.screens.offline-messaging-settings.views :as offline-messaging-settings]
[status-im.ui.screens.onboarding.keys.views :as onboarding.keys]
[status-im.ui.screens.onboarding.notifications.views :as onboarding.notifications]
[status-im.ui.screens.onboarding.password.views :as onboarding.password]
[status-im.ui.screens.onboarding.phrase.view :as onboarding.phrase]
[status-im.ui.screens.onboarding.storage.views :as onboarding.storage]
[status-im.ui.screens.onboarding.welcome.views :as onboarding.welcome]
[status-im.ui.screens.pairing.views :as pairing]
[status-im.ui.screens.peers-stats :as peers-stats]
[status-im.ui.screens.privacy-and-security-settings.delete-profile :as delete-profile]
@ -106,91 +86,10 @@
[]
[;;INTRO, ONBOARDING, LOGIN
;Multiaccounts
{:name :multiaccounts
:options {:insets {:bottom? true
:top? true}
:topBar {:title {:text (i18n/label :t/your-keys)}
:rightButtons (right-button-options :multiaccounts :more)}}
:right-handler multiaccounts/topbar-button
:component multiaccounts/multiaccounts}
;Login
{:name :login
:options {:insets {:bottom? true
:top? true}
:topBar {:rightButtons (right-button-options :login :more)}}
:right-handler login/topbar-button
:component login/login}
{:name :progress
:options {:insets {:top? true}}
:component progress/progress}
;[Onboarding]
{:name :get-your-keys
:options {:insets {:bottom? true
:top? true}}
:component onboarding.keys/get-your-keys}
;[Onboarding]
{:name :choose-name
:options {:topBar {:visible false}
:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.keys/choose-a-chat-name}
;[Onboarding]
{:name :select-key-storage
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.storage/select-key-storage}
;[Onboarding] Create Password
{:name :create-password
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.password/screen}
;[Onboarding] Welcome
{:name :welcome
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.welcome/welcome}
;[Onboarding] Notification
{:name :onboarding-notification
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.notifications/notifications-onboarding}
;[Onboarding] Recovery
{:name :recover-multiaccount-enter-phrase
:options {:insets {:top? true :bottom? true}}
:component onboarding.phrase/enter-phrase}
{:name :recover-multiaccount-success
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}
:insets {:bottom? true
:top? true}}
:component onboarding.phrase/wizard-recovery-success}
;;CHAT
{:name :group-chat-profile
@ -211,52 +110,12 @@
:options {:insets {:top? true}}
:component stickers/pack}
;; Community
{:name :community
;;TODO custom
:options {:insets {:top? true}}
:component community/community}
{:name :community-management
;;TODO animated-header
:options {:topBar {:visible false}}
:component community.profile/management-container}
;; Community (legacy only for e2e needed)
{:name :community-members
;;TODO custom subtitle
:options {:insets {:top? true}}
:component members/members-container}
{:name :create-community-channel
:options {:topBar {:title {:text (i18n/label :t/create-channel-title)}}
:insets {:bottom? true
:top? true}}
:component create-channel/view}
{:name :community-emoji-thumbnail-picker
:options {:topBar {:title {:text (i18n/label :t/community-emoji-thumbnail-title)}}
:insets {:bottom? true
:top? true}}
:component community-emoji-thumbnail-picker/view}
{:name :create-community-category
:options {:topBar {:title {:text (i18n/label :t/new-category)}}
:insets {:bottom? true
:top? true}}
:component create-category/view}
{:name :select-category
;;TODO custom
:options {:topBar {:visible false}
:insets {:bottom? true
:top? true}}
:component select-category/view}
{:name :community-reorder-categories
:options {:topBar {:visible false}}
:component reorder-categories/view}
{:name :community-channel-details
;;TODO custom
:options {:topBar {:visible false}}
:component communities.channel-details/view}
{:name :edit-community-channel
:options {:topBar {:title {:text (i18n/label :t/edit-channel-title)}}
:insets {:bottom? true
:top? true}}
:component edit-channel/view}
{:name :contact-toggle-list
;;TODO custom subtitle
:options {:insets {:top? true}}
@ -270,10 +129,6 @@
:insets {:top? true
:bottom? true}}
:component communities.import/view}
{:name :community-edit
:options {:topBar {:title {:text (i18n/label :t/community-edit-title)}}
:insets {:top? true}}
:component community.edit/edit}
{:name :community-create
:options {:topBar {:title {:text (i18n/label :t/new-community-title)}}
:insets {:top? true
@ -434,10 +289,6 @@
:options {:topBar {:title {:text (i18n/label :t/dapps-permissions)}}
:insets {:top? true}}
:component dapps-permissions/dapps-permissions}
{:name :link-previews-settings
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
:insets {:top? true}}
:component link-previews-settings/link-previews-settings}
{:name :privacy-and-security
:options {:topBar {:title {:text (i18n/label :t/privacy-and-security)}}
:insets {:top? true}}
@ -564,7 +415,8 @@
;;MODALS
;[Chat] Link preview settings
{:name :link-preview-settings
{:name :link-previews-settings
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
:insets {:top? true}}
:component link-previews-settings/link-previews-settings}
@ -722,11 +574,7 @@
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}
:component keycard.recovery/pair}
{:name :seed-phrase
;;TODO subtitle
:options {:insets {:bottom? true
:top? true}}
:component key-storage.views/seed-phrase}
{:name :keycard-recovery-pin
;;TODO dynamic
:options {:insets {:bottom? true
@ -818,26 +666,6 @@
:insets {:bottom? true}
:component keycard.pairing/change-pairing-code}
;;KEYSTORAGE
{:name :actions-not-logged-in
;;TODO: topbar
:options {:insets {:bottom? true
:top? true}}
;;TODO move to popover?
:component key-storage.views/actions-not-logged-in}
{:name :actions-logged-in
;;TODO: topbar
:options {:insets {:bottom? true
:top? true}}
;;TODO move to popover?
:component key-storage.views/actions-logged-in}
{:name :storage
;;TODO: topbar
:options {:insets {:bottom? true
:top? true}}
;;TODO move to popover?
:component key-storage.views/storage}
{:name :show-all-connections
:options {:topBar {:title {:text (i18n/label :all-connections)}}
:insets {:bottom? true

View File

@ -193,11 +193,6 @@
(def ^:const faq-keycard (str faq "#keycard"))
(def ^:const keycard-integration-link "https://status.im/keycard-integration")
(def ^:const status-community-id "0x039b2da47552aa117a96ea8f1d4d108ba66637c7517a3c94a57b99dbb8a002eda2")
(def ^:const timeline-chat-id
"@timeline70bd746ddcc12beb96b2c9d572d0784ab137ffc774f5383e50585a932080b57cca0484b259e61cecbaa33a4c98a300a")
(def ^:const two-mins (* 2 60))
(def ^:const one-day (* 60 60 24))
(def ^:const three-days (* one-day 3))

View File

@ -8,7 +8,6 @@
[status-im.ui.screens.chat.message.gap :as message.gap]
[status-im.ui.screens.chat.styles.message.message :as style]
[status-im.ui.screens.chat.utils :as chat.utils]
[status-im.ui.screens.communities.icon :as communities.icon]
[status-im2.constants :as constants]
[status-im2.contexts.chat.messages.delete-message-for-me.events]
[status-im2.contexts.chat.messages.delete-message.events]
@ -245,13 +244,7 @@
[rn/view (style/community-message verified)
[rn/view
{:width 62
:padding-left 14}
(if (= community-id constants/status-community-id)
[rn/image
{:source (resources/get-image :status-logo)
:style {:width 40
:height 40}}]
[communities.icon/community-icon community])]
:padding-left 14}]
[rn/view {:padding-right 14 :flex 1}
[rn/text {:style {:font-weight "700" :font-size 17 :color quo.colors/black}}
name]

View File

@ -1,6 +1,6 @@
(ns status-im2.contexts.communities.discover.view
(:require [utils.i18n :as i18n]
[oops.core :as oops] ;; TODO move to status-im2
[oops.core :as oops]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
@ -8,7 +8,6 @@
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.contexts.communities.actions.community-options.view :as options]
[status-im.ui.screens.communities.community :as community]
[status-im.ui.components.react :as react]
[status-im2.common.scroll-page.view :as scroll-page]
[status-im2.contexts.communities.discover.style :as style]
@ -149,10 +148,7 @@
(rf/dispatch [:communities/load-category-states (:id community)])
(rf/dispatch [:dismiss-keyboard])
(rf/dispatch [:navigate-to :community-overview (:id community)]))
:on-long-press #(rf/dispatch [:show-bottom-sheet
{:content (fn []
;; TODO implement with quo2
[community/community-actions community])}])}
:on-long-press #(js/alert "TODO: to be implemented")}
(merge community
(get mock-community-item-data :data))])]))
(if communities communities communities-ids))])

View File

@ -6,11 +6,10 @@
[reagent.core :as reagent]
[utils.i18n :as i18n]
[status-im2.common.resources :as resources]
[status-im2.constants :as constants]
[status-im2.contexts.quo-preview.preview :as preview]))
(def community-data
{:id constants/status-community-id
{:id "id"
:name "Status"
:description
"Status is a secure messaging app, crypto wallet and web3 browser built with the state of the art technology"

View File

@ -1,6 +1,5 @@
(ns status-im2.subs.chat.chats
(:require [clojure.string :as string]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[status-im.communities.core :as communities]
[status-im.group-chats.core :as group-chat]
@ -53,12 +52,7 @@
{(str community-id id) {:categoryID categoryID
:position position}})
(vals comm-chats)))]
(group-by :categoryID
(sort-by :position
(map #(cond-> (merge % (chat-cat (:chat-id %)))
(= community-id constants/status-community-id)
(assoc :color colors/blue))
chats))))))
(group-by :categoryID (sort-by :position (map #(merge % (chat-cat (:chat-id %))) chats))))))
(re-frame/reg-sub
:chats/category-by-chat-id