Skip to content

Commit 2aab702

Browse files
committed
Merge remote-tracking branch 'origin/develop' into cl-19226-remove-not-implemented-box
2 parents 3948c32 + 01a8815 commit 2aab702

File tree

96 files changed

+2925
-1136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2925
-1136
lines changed

src/js/worklets/chat/messenger/messages.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { withTiming, runOnJS } from 'react-native-reanimated';
1+
import { useAnimatedReaction, withTiming, runOnJS } from 'react-native-reanimated';
2+
import { useState } from 'react';
23

34
export function messagesListOnScroll(distanceFromListTop, chatListScrollY, callback) {
45
return function (event) {
@@ -12,3 +13,21 @@ export function messagesListOnScroll(distanceFromListTop, chatListScrollY, callb
1213
runOnJS(callback)(layoutHeight, newDistance);
1314
};
1415
}
16+
17+
export function useMessagesScrolledToThreshold(distanceFromListTop, threshold) {
18+
const [scrolledToThreshold, setScrolledToThreshold] = useState(false);
19+
20+
useAnimatedReaction(
21+
function () {
22+
return distanceFromListTop.value <= threshold;
23+
},
24+
function (current) {
25+
if (current !== scrolledToThreshold) {
26+
runOnJS(setScrolledToThreshold)(current);
27+
}
28+
},
29+
[scrolledToThreshold],
30+
);
31+
32+
return scrolledToThreshold;
33+
}

src/js/worklets/chat/messenger/navigation.js

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ export function navigationHeaderPosition(distanceFromListTop, isAllLoaded, topBa
1919
});
2020
}
2121

22+
export function navigationButtonsCompleteOpacity(isCalculationComplete) {
23+
return useDerivedValue(function () {
24+
'worklet';
25+
return isCalculationComplete.value ? withTiming(1) : 0;
26+
});
27+
}
28+
2229
export function interpolateNavigationViewOpacity(props) {
2330
return useDerivedValue(function () {
2431
'worklet';

src/legacy/status_im/data_store/activities_test.cljs

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
:line-count nil
4545
:links nil
4646
:text nil}
47+
:bridge-message nil
4748
:outgoing false}
4849
:message nil
4950
:reply-message {:quoted-message nil
@@ -61,6 +62,7 @@
6162
:line-count nil
6263
:links nil
6364
:text nil}
65+
:bridge-message nil
6466
:outgoing false}}
6567
(-> raw-notification
6668
store/<-rpc

src/legacy/status_im/data_store/messages.cljs

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@
8282
:albumImagesCount :album-images-count
8383
:displayName :display-name
8484
:linkPreviews :link-previews
85-
:statusLinkPreviews :status-link-previews})
85+
:statusLinkPreviews :status-link-previews
86+
:bridgeMessage :bridge-message})
87+
(update :bridge-message
88+
set/rename-keys
89+
{:bridgeName :bridge-name
90+
:userName :user-name
91+
:userAvatar :user-avatar})
8692
(update :link-previews #(map <-link-preview-rpc %))
8793
(update :status-link-previews #(map <-status-link-previews-rpc %))
8894
(update :quoted-message

src/legacy/status_im/data_store/messages_test.cljs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
:image nil
2222
:response-to "a"
2323
:links nil}
24+
:bridge-message nil
2425
:whisper-timestamp 1
2526
:contact-verification-state 1
2627
:contact-request-state 2

src/quo/components/avatars/collection_avatar/style.cljs

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
(:require
33
[quo.foundations.colors :as colors]))
44

5+
(defn- get-dimensions
6+
[size]
7+
(case size
8+
:size-24 24
9+
:size-20 20
10+
nil))
11+
512
(defn collection-avatar
6-
[theme]
7-
{:width 24
8-
:height 24
13+
[theme size]
14+
{:width (get-dimensions size)
15+
:height (get-dimensions size)
916
:border-width 1
1017
:border-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
1118
:border-radius 6})

src/quo/components/avatars/collection_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
1010
:image - collection image
1111
:theme - keyword -> :light/:dark"
12-
[{:keys [image theme]}]
12+
[{:keys [image theme size] :or {size :size-24}}]
1313
[fast-image/fast-image
1414
{:accessibility-label :collection-avatar
1515
:source image
16-
:style (style/collection-avatar theme)}])
16+
:style (style/collection-avatar theme size)}])
1717

1818
(def view (quo.theme/with-theme view-internal))

src/quo/components/counter/collectible_counter/view.cljs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[:catn
1212
[:props
1313
[:map {:closed true}
14+
[:container-style {:optional true} [:maybe :map]]
1415
[:value {:optional true} [:maybe [:or :string :int]]]
1516
[:status {:optional true} [:maybe :keyword]]
1617
[:size {:optional true} [:maybe [:enum :size-32 :size-24]]]
@@ -19,15 +20,15 @@
1920
:any])
2021

2122
(defn- view-internal
22-
[{:keys [value accessibility-label]
23+
[{:keys [value accessibility-label container-style]
2324
:as props}]
2425
(let [default-props {:status :default
2526
:size :size-32}
2627
props (merge default-props props)]
2728
[rn/view
2829
{:accessible true
2930
:accessibility-label (or accessibility-label :collectible-counter)
30-
:style (style/container props)}
31+
:style (merge (style/container props) container-style)}
3132
[text/text
3233
{:weight :medium
3334
:size (style/get-text-size props)

src/quo/components/drawers/action_drawers/view.cljs

+9-8
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858
:on-press on-press}
5959
[rn/view
6060
{:style (style/row-container sub-label)}
61-
[rn/view
62-
{:accessibility-label :left-icon-for-action
63-
:accessible true
64-
:style (style/left-icon sub-label)}
65-
[icon/icon icon
66-
{:color (or icon-color (get-icon-color danger? theme))
67-
:no-color no-icon-color?
68-
:size 20}]]
61+
(when icon
62+
[rn/view
63+
{:accessibility-label :left-icon-for-action
64+
:accessible true
65+
:style (style/left-icon sub-label)}
66+
[icon/icon icon
67+
{:color (or icon-color (get-icon-color danger? theme))
68+
:no-color no-icon-color?
69+
:size 20}]])
6970
[rn/view
7071
{:style style/text-container}
7172
[text/text

src/quo/components/drawers/bottom_actions/component_spec.cljs

+11
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,15 @@
5959
:button-one-label "Request to join"}])
6060
(h/is-truthy (h/get-by-text "Eligible to join as"))
6161
(h/is-truthy (h/get-by-text "Admin"))
62+
(h/is-truthy (h/get-by-text "Request to join")))
63+
64+
(h/test "render with top description with custom text & 1 action"
65+
(render [bottom-actions/view
66+
{:description :top
67+
:role :admin
68+
:actions :one-action
69+
:description-top-text "You'll be an"
70+
:button-one-label "Request to join"}])
71+
(h/is-truthy (h/get-by-text "You'll be an"))
72+
(h/is-truthy (h/get-by-text "Admin"))
6273
(h/is-truthy (h/get-by-text "Request to join"))))

src/quo/components/drawers/bottom_actions/view.cljs

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
[:actions [:maybe [:enum :one-action :two-actions]]]
2020
[:description {:optional true} [:maybe [:enum :top :bottom :top-error]]]
2121
[:description-text {:optional true} [:maybe :string]]
22+
[:description-top-text {:optional true} [:maybe :string]]
2223
[:error-message {:optional true} [:maybe :string]]
2324
[:role {:optional true} [:maybe [:enum :admin :member :token-master :owner]]]
2425
[:button-one-label {:optional true} [:maybe :string]]
@@ -38,8 +39,8 @@
3839
:owner :i/crown})
3940

4041
(defn- view-internal
41-
[{:keys [actions description description-text error-message role button-one-label button-two-label
42-
blur? button-one-props button-two-props theme scroll? container-style]}]
42+
[{:keys [actions description description-text description-top-text error-message role button-one-label
43+
button-two-label blur? button-one-props button-two-props theme scroll? container-style]}]
4344
[rn/view
4445
{:style (merge (style/container scroll? blur? theme) container-style)}
4546
(when (= description :top-error)
@@ -54,12 +55,11 @@
5455
error-message]])
5556

5657
(when (and (= description :top) role)
57-
[rn/view
58-
{:style style/description-top}
58+
[rn/view {:style style/description-top}
5959
[text/text
6060
{:size :paragraph-2
6161
:style (style/description-top-text scroll? blur? theme)}
62-
(i18n/label :t/eligible-to-join-as)]
62+
(or description-top-text (i18n/label :t/eligible-to-join-as))]
6363
[context-tag/view
6464
{:type :icon
6565
:size 24

src/quo/components/list_items/preview_list/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@
7676
:blur? overflow-label blur?}
7777
items preview list items (only 4 items is required for preview)
7878
"
79-
[{:keys [type size number blur?]} items]
79+
[{:keys [type size number blur? container-style]} items]
8080
(let [size-key (if (contains? properties/sizes size) size :size-24)
8181
number (or number (count items))
8282
border-type (properties/border-type type)
8383
margin-left (get-in properties/sizes [size-key :margin-left])]
84-
[rn/view {:style {:flex-direction :row}}
84+
[rn/view {:style (assoc container-style :flex-direction :row)}
8585
(for [index (range (if (> number 4) 3 number))]
8686
^{:key (str index number)}
8787
[list-item

src/quo/components/list_items/user.cljs

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
:align-items :center})
1919

2020
(defn action-icon
21-
[{:keys [type on-press on-check disabled? checked?]} theme]
21+
[{:keys [type on-press on-check disabled? checked?]} customization-color theme]
2222
[rn/touchable-opacity
23-
{:on-press (when on-press on-press)}
23+
{:on-press on-press}
2424
(case type
2525
:options
2626
[icons/icon :i/options
@@ -30,6 +30,7 @@
3030
[selectors/view
3131
{:type :checkbox
3232
:checked? checked?
33+
:customization-color customization-color
3334
:accessibility-label :user-list-toggle-check
3435
:disabled? disabled?
3536
:on-change (when on-check on-check)}]
@@ -68,4 +69,4 @@
6869
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40)}}
6970
short-chat-key])]
7071
(when accessory
71-
[action-icon accessory theme])]])
72+
[action-icon accessory customization-color theme])]])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
(ns quo.components.profile.collectible-list-item.component-spec
2+
(:require
3+
[quo.components.profile.collectible-list-item.view :as collectible-list-item]
4+
[test-helpers.component :as h]))
5+
6+
(h/describe "Profile/ collectible list item tests"
7+
(h/describe "type card"
8+
(h/test "Renders default and on press fires"
9+
(let [on-press (h/mock-fn)]
10+
(h/render-with-theme-provider
11+
[collectible-list-item/view
12+
{:type :card
13+
:on-press on-press}])
14+
(h/fire-event :press (h/get-by-label-text :collectible-list-item))
15+
(h/was-called on-press)))
16+
17+
(h/test "Renders loading and on press fires"
18+
(let [on-press (h/mock-fn)]
19+
(h/render-with-theme-provider
20+
[collectible-list-item/view
21+
{:type :card
22+
:status :loading
23+
:on-press on-press}])
24+
(h/fire-event :press (h/get-by-label-text :collectible-list-item))
25+
(h/was-not-called on-press)
26+
(h/is-truthy (h/get-by-label-text :gradient-overlay))))
27+
28+
(h/test "Renders counter"
29+
(h/render-with-theme-provider
30+
[collectible-list-item/view
31+
{:type :card
32+
:counter "x500"}])
33+
(h/is-truthy (h/get-by-text "x500")))
34+
35+
(h/test "Renders counter and collectible name"
36+
(h/render-with-theme-provider
37+
[collectible-list-item/view
38+
{:type :card
39+
:collectible-name "Doodle #6822"
40+
:counter "x500"}])
41+
(h/is-truthy (h/get-by-text "x500"))
42+
(h/is-truthy (h/get-by-text "Doodle #6822")))
43+
44+
(h/test "Renders status cant-fetch"
45+
(h/render-with-theme-provider
46+
[collectible-list-item/view
47+
{:type :card
48+
:status :cant-fetch}])
49+
(h/is-truthy (h/get-by-translation-text :t/cant-fetch-info)))
50+
51+
(h/test "Renders status unsupported"
52+
(h/render-with-theme-provider
53+
[collectible-list-item/view
54+
{:type :card
55+
:status :unsupported}])
56+
(h/is-truthy (h/get-by-translation-text :t/unsupported-file)))
57+
58+
(h/test "Renders status unsupported and counter"
59+
(h/render-with-theme-provider
60+
[collectible-list-item/view
61+
{:type :card
62+
:status :unsupported
63+
:counter "x500"}])
64+
(h/is-truthy (h/get-by-text "x500"))
65+
(h/is-truthy (h/get-by-translation-text :t/unsupported-file))))
66+
67+
(h/describe "type image"
68+
(h/test "Renders default and on press fires"
69+
(let [on-press (h/mock-fn)]
70+
(h/render-with-theme-provider
71+
[collectible-list-item/view
72+
{:type :image
73+
:on-press on-press}])
74+
(h/fire-event :press (h/get-by-label-text :collectible-list-item))
75+
(h/was-called on-press)))
76+
77+
(h/test "Renders loading and on press fires"
78+
(let [on-press (h/mock-fn)]
79+
(h/render-with-theme-provider
80+
[collectible-list-item/view
81+
{:type :image
82+
:status :loading
83+
:on-press on-press}])
84+
(h/fire-event :press (h/get-by-label-text :collectible-list-item))
85+
(h/was-not-called on-press)
86+
(h/is-truthy (h/get-by-label-text :gradient-overlay))))
87+
88+
(h/test "Renders counter"
89+
(h/render-with-theme-provider
90+
[collectible-list-item/view
91+
{:type :image
92+
:counter "x500"}])
93+
(h/is-truthy (h/get-by-text "x500")))
94+
95+
(h/test "Renders status cant-fetch"
96+
(h/render-with-theme-provider
97+
[collectible-list-item/view
98+
{:type :image
99+
:status :cant-fetch}])
100+
(h/is-truthy (h/get-by-translation-text :t/cant-fetch-info)))
101+
102+
(h/test "Renders status unsupported"
103+
(h/render-with-theme-provider
104+
[collectible-list-item/view
105+
{:type :image
106+
:status :unsupported}])
107+
(h/is-truthy (h/get-by-translation-text :t/unsupported-file)))
108+
109+
(h/test "Renders status unsupported and counter"
110+
(h/render-with-theme-provider
111+
[collectible-list-item/view
112+
{:type :image
113+
:status :unsupported
114+
:counter "x500"}])
115+
(h/get-by-text "x500")
116+
(h/is-truthy (h/get-by-translation-text :t/unsupported-file)))))

0 commit comments

Comments
 (0)