Skip to content

Commit 28b31d7

Browse files
authored
Merge branch 'develop' into cl-19226-remove-not-implemented-box
2 parents c5870f0 + 6a88a34 commit 28b31d7

File tree

13 files changed

+209
-181
lines changed

13 files changed

+209
-181
lines changed

src/legacy/status_im/data_store/chats.cljs

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262

6363
(defn <-color
6464
[value]
65-
(if (string/starts-with? value "#") value (keyword value)))
65+
(if (and (some? value)
66+
(string/starts-with? value "#"))
67+
value
68+
(keyword value)))
6669

6770
(defn <-rpc
6871
[chat]

src/react_native/keychain.cljs

+14-11
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,26 @@
6262
([server username password]
6363
(save-credentials server username password identity))
6464
([server username password callback]
65-
(-> (.setInternetCredentials ^js react-native-keychain
66-
(string/lower-case server)
67-
username
68-
password
69-
keychain-secure-hardware
70-
keychain-restricted-availability)
71-
(.then callback))))
65+
(when-not (empty? server)
66+
(-> (.setInternetCredentials ^js react-native-keychain
67+
(string/lower-case server)
68+
username
69+
password
70+
keychain-secure-hardware
71+
keychain-restricted-availability)
72+
(.then callback)))))
7273

7374
(defn get-credentials
7475
"Gets the credentials for a specified server from the Keychain"
7576
([server]
7677
(get-credentials server identity))
7778
([server callback]
78-
(-> (.getInternetCredentials ^js react-native-keychain (string/lower-case server))
79-
(.then callback))))
79+
(when-not (empty? server)
80+
(-> (.getInternetCredentials ^js react-native-keychain (string/lower-case server))
81+
(.then callback)))))
8082

8183
(defn reset-credentials
8284
[server]
83-
(-> (.resetInternetCredentials ^js react-native-keychain (string/lower-case server))
84-
(.then #(when-not % (log/error (str "Error while clearing saved password."))))))
85+
(when-not (empty? server)
86+
(-> (.resetInternetCredentials ^js react-native-keychain (string/lower-case server))
87+
(.then #(when-not % (log/error (str "Error while clearing saved password.")))))))

src/status_im/common/floating_button_page/view.cljs

+22-10
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
(reset! ratom height))))
3030

3131
(defn- init-keyboard-listeners
32-
[{:keys [on-did-show]}]
32+
[{:keys [on-did-show scroll-view-ref]}]
3333
(let [keyboard-will-show? (reagent/atom false)
3434
keyboard-did-show? (reagent/atom false)
3535
add-listener (fn [listener callback]
@@ -41,7 +41,10 @@
4141
(reset! keyboard-did-show? true)
4242
(when on-did-show (on-did-show e))))
4343
will-hide-listener (add-listener "keyboardWillHide"
44-
#(reset! keyboard-will-show? false))
44+
(fn []
45+
(reset! keyboard-will-show? false)
46+
(reagent/flush)
47+
(.scrollTo @scroll-view-ref #js {:x 0 :y 0 :animated true})))
4548
did-hide-listener (add-listener "keyboardDidHide"
4649
#(reset! keyboard-did-show? false))
4750
remove-listeners (fn []
@@ -55,9 +58,11 @@
5558
(defn view
5659
[{:keys [header footer customization-color footer-container-padding header-container-style
5760
gradient-cover?]
58-
:or {footer-container-padding (safe-area/get-top)}} &
59-
children]
60-
(reagent/with-let [window-height (:height (rn/get-window))
61+
:or {footer-container-padding (safe-area/get-top)}}
62+
& children]
63+
(reagent/with-let [scroll-view-ref (atom nil)
64+
set-scroll-ref #(reset! scroll-view-ref %)
65+
window-height (:height (rn/get-window))
6166
footer-container-height (reagent/atom 0)
6267
header-height (reagent/atom 0)
6368
content-container-height (reagent/atom 0)
@@ -66,7 +71,8 @@
6671
{:keys [keyboard-will-show?
6772
keyboard-did-show?
6873
remove-listeners]} (init-keyboard-listeners
69-
{:on-did-show
74+
{:scroll-view-ref scroll-view-ref
75+
:on-did-show
7076
(fn [e]
7177
(reset! keyboard-height
7278
(oops/oget e "endCoordinates.height")))})
@@ -85,16 +91,22 @@
8591
:header-height @header-height
8692
:keyboard-shown? keyboard-shown?})]
8793
[:<>
88-
(when gradient-cover? [quo/gradient-cover {:customization-color customization-color}])
94+
(when gradient-cover?
95+
[quo/gradient-cover {:customization-color customization-color}])
8996
[rn/view {:style style/page-container}
9097
[rn/view
9198
{:on-layout set-header-height
9299
:style header-container-style}
93100
header]
94101
[gesture/scroll-view
95-
{:on-scroll set-content-y-scroll
96-
:scroll-event-throttle 64
97-
:content-container-style {:flex-grow 1}}
102+
{:ref set-scroll-ref
103+
:on-scroll set-content-y-scroll
104+
:scroll-event-throttle 64
105+
:content-container-style {:flex-grow 1
106+
:padding-bottom (when @keyboard-did-show?
107+
@footer-container-height)}
108+
:always-bounce-vertical @keyboard-did-show?
109+
:shows-vertical-scroll-indicator false}
98110
(into [rn/view {:on-layout set-content-container-height}]
99111
children)]
100112
[rn/keyboard-avoiding-view

src/status_im/contexts/chat/home/add_new_contact/views.cljs

+60-52
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[quo.core :as quo]
44
[react-native.clipboard :as clipboard]
55
[react-native.core :as rn]
6-
[reagent.core :as reagent]
76
[status-im.contexts.chat.home.add-new-contact.style :as style]
87
[utils.address :as address]
98
[utils.debounce :as debounce]
@@ -51,57 +50,66 @@
5150

5251
(defn- search-input
5352
[]
54-
(reagent/with-let [input-value (reagent/atom nil)
55-
input-ref (atom nil)
56-
clear-input (fn []
57-
(reset! input-value nil)
58-
(rf/dispatch [:contacts/clear-new-identity]))
59-
paste-on-input #(clipboard/get-string
60-
(fn [clipboard-text]
61-
(reset! input-value clipboard-text)
62-
(rf/dispatch [:contacts/set-new-identity
63-
{:input clipboard-text}])))]
64-
(let [{:keys [scanned] contact-public-key :id} (rf/sub [:contacts/new-identity])
65-
contact-public-key-or-scanned (or contact-public-key scanned)
66-
empty-input? (and (string/blank? @input-value)
67-
(string/blank? contact-public-key-or-scanned))]
68-
[rn/view {:style style/input-and-scan-container}
69-
[quo/input
70-
{:accessibility-label :enter-contact-code-input
71-
:ref #(reset! input-ref %)
72-
:container-style {:flex 1}
73-
:auto-capitalize :none
74-
:multiline? true
75-
:blur-on-submit true
76-
:return-key-type :done
77-
:label (i18n/label :t/ens-or-chat-key)
78-
:placeholder (i18n/label :t/type-some-chat-key)
79-
:clearable? (not empty-input?)
80-
:on-clear clear-input
81-
:button (when empty-input?
82-
{:on-press paste-on-input
83-
:text (i18n/label :t/paste)})
84-
;; NOTE: `contact-public-key-or-scanned` has priority over `@input-value`,
85-
;; we clean it when the input is updated so that it's `nil` and
86-
;; `@input-value`is shown. To fastly clean it, we use `dispatch-sync`.
87-
;; This call could be avoided if `::qr-scanner/scan-code` were able to
88-
;; receive a callback function, not only a re-frame event as callback.
89-
:value (or contact-public-key-or-scanned @input-value)
90-
:on-change-text (fn [new-text]
91-
(reset! input-value new-text)
92-
(as-> [:contacts/set-new-identity {:input new-text}] $
93-
(if (string/blank? contact-public-key-or-scanned)
94-
(debounce/debounce-and-dispatch $ 600)
95-
(rf/dispatch-sync $))))}]
96-
[rn/view {:style style/scan-button-container}
97-
[quo/button
98-
{:type :outline
99-
:icon-only? true
100-
:size 40
101-
:on-press #(rf/dispatch [:open-modal :scan-profile-qr-code])}
102-
:i/scan]]])
103-
(finally
104-
(rf/dispatch [:contacts/clear-new-identity]))))
53+
(let [[input-value set-input-value] (rn/use-state nil)
54+
input-ref (rn/use-ref-atom nil)
55+
on-ref (rn/use-callback #(reset! input-ref %))
56+
{:keys [scanned]
57+
contact-public-key :id} (rf/sub [:contacts/new-identity])
58+
contact-public-key-or-scanned (or contact-public-key scanned)
59+
empty-input? (and (string/blank? input-value)
60+
(string/blank? contact-public-key-or-scanned))
61+
clear-input (rn/use-callback
62+
(fn []
63+
(set-input-value nil)
64+
(rf/dispatch [:contacts/clear-new-identity])))
65+
paste-on-input (rn/use-callback
66+
(fn []
67+
(clipboard/get-string
68+
(fn [clipboard-text]
69+
(set-input-value clipboard-text)
70+
(rf/dispatch [:contacts/set-new-identity
71+
{:input clipboard-text}])))))
72+
on-change-text (rn/use-callback
73+
(fn [new-text]
74+
(set-input-value new-text)
75+
(if (string/blank? contact-public-key-or-scanned)
76+
(debounce/debounce-and-dispatch [:contacts/set-new-identity
77+
{:input new-text}]
78+
600)
79+
(rf/dispatch-sync [:contacts/set-new-identity
80+
{:input new-text}])))
81+
[contact-public-key-or-scanned])]
82+
(rn/use-unmount #(rf/dispatch [:contacts/clear-new-identity]))
83+
[rn/view {:style style/input-and-scan-container}
84+
[quo/input
85+
{:accessibility-label :enter-contact-code-input
86+
:ref on-ref
87+
:container-style {:flex 1}
88+
:auto-capitalize :none
89+
:multiline? true
90+
:blur-on-submit true
91+
:return-key-type :done
92+
:label (i18n/label :t/ens-or-chat-key)
93+
:placeholder (i18n/label :t/type-some-chat-key)
94+
:clearable? (not empty-input?)
95+
:on-clear clear-input
96+
:button (when empty-input?
97+
{:on-press paste-on-input
98+
:text (i18n/label :t/paste)})
99+
;; NOTE: `contact-public-key-or-scanned` has priority over `input-value`,
100+
;; we clean it when the input is updated so that it's `nil` and
101+
;; `input-value`is shown. To fastly clean it, we use `dispatch-sync`.
102+
;; This call could be avoided if `::qr-scanner/scan-code` were able to
103+
;; receive a callback function, not only a re-frame event as callback.
104+
:value (or contact-public-key-or-scanned input-value)
105+
:on-change-text on-change-text}]
106+
[rn/view {:style style/scan-button-container}
107+
[quo/button
108+
{:type :outline
109+
:icon-only? true
110+
:size 40
111+
:on-press #(rf/dispatch [:open-modal :scan-profile-qr-code])}
112+
:i/scan]]]))
105113

106114
(defn- invalid-text
107115
[message]

src/status_im/contexts/communities/actions/accounts_selection/view.cljs

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
has-permissions? (rf/sub [:communities/has-permissions? id])
2121
airdrop-account (rf/sub [:communities/airdrop-account id])
2222
revealed-accounts (rf/sub [:communities/accounts-to-reveal id])
23+
revealed-accounts-count (count revealed-accounts)
24+
wallet-accounts-count (count (rf/sub [:wallet/accounts-without-watched-accounts]))
25+
addresses-shared-text (if (= revealed-accounts-count wallet-accounts-count)
26+
(i18n/label :t/all-addresses)
27+
(i18n/label-pluralize
28+
revealed-accounts-count
29+
:t/address-count))
2330
{:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id])
2431
highest-role-text (i18n/label (communities.utils/role->translation-key
2532
highest-permission-role
@@ -108,7 +115,7 @@
108115
:label :preview
109116
:label-props {:type :accounts
110117
:data revealed-accounts}
111-
:description-props {:text (i18n/label :t/all-addresses)}}
118+
:description-props {:text addresses-shared-text}}
112119
{:title (i18n/label :t/for-airdrops)
113120
:on-press show-airdrop-addresses
114121
:description :text

src/status_im/contexts/wallet/add_address_to_watch/confirm_address/view.cljs

+9-14
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,19 @@
1414

1515
(defn view
1616
[]
17-
(let [{:keys [address]} (rf/sub [:get-screen-params])
18-
number-of-accounts (count (rf/sub [:wallet/watch-only-accounts]))
19-
account-name (reagent/atom "")
20-
placeholder (i18n/label :t/default-watched-address-placeholder
21-
{:number (inc number-of-accounts)})
22-
account-color (reagent/atom (rand-nth colors/account-colors))
23-
account-emoji (reagent/atom (emoji-picker.utils/random-emoji))
24-
on-change-name #(reset! account-name %)
25-
on-change-color #(reset! account-color %)
26-
on-change-emoji #(reset! account-emoji %)]
17+
(let [{:keys [address]} (rf/sub [:get-screen-params])
18+
placeholder (i18n/label :t/default-watched-address-placeholder)
19+
account-name (reagent/atom "")
20+
account-color (reagent/atom (rand-nth colors/account-colors))
21+
account-emoji (reagent/atom (emoji-picker.utils/random-emoji))
22+
on-change-name #(reset! account-name %)
23+
on-change-color #(reset! account-color %)
24+
on-change-emoji #(reset! account-emoji %)]
2725
(fn []
2826
[rn/view {:style style/container}
2927
[create-or-edit-account/view
3028
{:page-nav-right-side [{:icon-name :i/info
31-
:on-press
32-
#(js/alert
33-
"Get info (to be
34-
implemented)")}]
29+
:on-press #(js/alert "Get info (to be implemented)")}]
3530
:placeholder placeholder
3631
:account-name @account-name
3732
:account-emoji @account-emoji

src/status_im/contexts/wallet/common/screen_base/create_or_edit_account/view.cljs

+7-10
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@
1414
on-change-name
1515
on-change-color
1616
on-change-emoji section-label
17-
hide-bottom-action?
1817
bottom-action-label bottom-action-props
1918
custom-bottom-action watch-only?]} & children]
2019
(let [{window-width :width} (rn/get-window)
21-
footer (when-not hide-bottom-action?
22-
(if custom-bottom-action
23-
custom-bottom-action
24-
[quo/button
25-
(merge
26-
{:size 40
27-
:type :primary}
28-
bottom-action-props)
29-
(i18n/label bottom-action-label)]))]
20+
footer (if custom-bottom-action
21+
custom-bottom-action
22+
[quo/button
23+
(merge {:size 40
24+
:type :primary}
25+
bottom-action-props)
26+
(i18n/label bottom-action-label)])]
3027
[floating-button-page/view
3128
{:header [quo/page-nav
3229
{:type :no-title

src/status_im/contexts/wallet/create_account/style.cljs

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,4 @@
2929
{:margin-top 12
3030
:margin-bottom 8})
3131

32-
(defn slide-button-container
33-
[bottom]
34-
{:position :absolute
35-
:bottom (+ bottom 12)
36-
:left 20
37-
:right 20})
32+
(def slide-button-container {:z-index 1})

0 commit comments

Comments
 (0)