Compare commits

..
52 changed files with 349 additions and 638 deletions
-22
View File
@@ -90,28 +90,6 @@ their styles in the top-level of the properties map, prefer to add them inside t
]
```
### Always apply animated styles in the style file
When implementing styles for reanimated views, we should always define
them in the style file and apply animations with reanimated/apply-animations-to-style
in the style definition.
```clojure
;; bad
(defn circle
[]
(let [opacity (reanimated/use-shared-value 1)]
[reanimated/view {:style (reanimated/apply-animations-to-style
{:opacity opacity}
style/circle-container)}]))
;; good
(defn circle
[]
(let [opacity (reanimated/use-shared-value 1)]
[reanimated/view {:style (style/circle-container opacity)}]))
```
### Don't use percents to define width/height
In ReactNative, all layouts use the [flexbox
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 MiB

-47
View File
@@ -1,47 +0,0 @@
import { useDerivedValue, withTiming, Easing } from 'react-native-reanimated';
const slideAnimationDuration = 300;
const easeOut = {
duration: slideAnimationDuration,
easing: Easing.bezier(0, 0, 0.58, 1),
}
// Derived Values
export function dynamicProgressBarWidth(staticProgressBarWidth, progress) {
return useDerivedValue(
function () {
'worklet'
return staticProgressBarWidth * (progress.value || 0) / 100;
}
);
}
export function carouselLeftPosition(windowWidth, progress) {
return useDerivedValue(
function () {
'worklet'
const progressValue = progress.value;
switch (true) {
case (progressValue < 25):
return 0;
case (progressValue === 25):
return withTiming(-windowWidth, easeOut);
case (progressValue < 50):
return -windowWidth;
case (progressValue === 50):
return withTiming(-2 * windowWidth, easeOut);
case (progressValue < 75):
return -2 * windowWidth;
case (progressValue === 75):
return withTiming(-3 * windowWidth, easeOut);
case (progressValue < 100):
return -3 * windowWidth;
case (progressValue === 100):
return withTiming(-4 * windowWidth, easeOut);
default:
return 0;
}
});
}
+1 -6
View File
@@ -293,10 +293,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
:createNativeWrapper identity
:default #js {}})
(def react-native-redash
#js
{:clamp nil
:withPause (fn [])})
(def react-native-redash #js {:clamp nil})
(def react-native-languages
(clj->js {:default {:language "en"
@@ -373,7 +370,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
"react-native-screens" (clj->js {})
"react-native-reanimated" react-native-reanimated
"react-native-redash/lib/module/v1" react-native-redash
"react-native-redash" react-native-redash
"react-native-fetch-polyfill" fetch
"react-native-status-keycard" status-keycard
"react-native-keychain" keychain
@@ -411,7 +407,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
"../src/js/worklets/bottom_sheet.js" #js {}
"../src/js/worklets/record_audio.js" #js {}
"../src/js/worklets/scroll_view.js" #js {}
"../src/js/worklets/onboarding_carousel.js" #js {}
"../src/js/worklets/lightbox.js" #js {}
"./fleets.js" default-fleets
"@walletconnect/client" wallet-connect-client
@@ -16,15 +16,13 @@
:height 230
:border-radius 20}
:on-press on-press}
[rn/view
{:flex 1}
[rn/view {:flex 1}
[rn/view (style/community-cover-container 60)
[rn/image
{:source cover
:style
{:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
:style {:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
[rn/view (style/card-view-content-container 12)
[rn/view (style/card-view-chat-icon 48)
[icon/community-icon {:images images} 48]]
@@ -38,7 +36,8 @@
{:title name
:description description}]
[rn/view {:style (style/card-stats-position)}
[community-view/community-stats-column :card-view]]
[community-view/community-stats-column
{:type :card-view}]]
[rn/view {:style (style/community-tags-position)}
[community-view/community-tags tags]]]]]]])
@@ -64,7 +64,8 @@
colors/neutral-40
colors/neutral-60))}}
name]
[community-view/community-stats-column :list-view]]
[community-view/community-stats-column
{:type :list-view}]]
(if (= status :gated)
[community-view/permission-tag-container
{:locked? locked?
@@ -23,7 +23,7 @@
members-count]])
(defn community-stats-column
[type]
[{:keys [type]}]
(let [icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)]
[rn/view
(if (= type :card-view)
@@ -46,11 +46,12 @@
^{:key name}
[rn/view {:margin-right 8}
[tag/tag
{:size 24
:label name
:type :emoji
:labelled? true
:resource emoji}]])])
{:size 24
:label name
:type :emoji
:labelled? true
:scrollable? true
:resource emoji}]])])
(defn community-title
[{:keys [title description size] :or {size :small}}]
+1 -1
View File
@@ -62,7 +62,7 @@
:bottom 0
:left 0
:right 0
:height 20
:border-radius 20
:padding-horizontal padding-horizontal
:border-top-right-radius 16
:border-top-left-radius 16
-1
View File
@@ -127,7 +127,6 @@
;;Solid
(def black "#000000")
(def onboarding-header-black "#000716")
;;;;Primary
+1 -4
View File
@@ -9,7 +9,6 @@
withDelay
withSpring
withRepeat
withSequence
withDecay
Easing
Keyframe
@@ -18,8 +17,8 @@
SlideOutUp
LinearTransition)]
[reagent.core :as reagent]
["react-native-redash" :refer (withPause)]
[react-native.flat-list :as rn-flat-list]
[utils.collection]
[utils.worklets.core :as worklets.core]))
(def ^:const default-duration 300)
@@ -60,8 +59,6 @@
(def with-decay withDecay)
(def key-frame Keyframe)
(def with-repeat withRepeat)
(def with-sequence withSequence)
(def with-pause withPause)
(def cancel-animation cancelAnimation)
;; Easings
@@ -88,14 +88,14 @@
(defn valid-nickname?
[nickname]
(not (string/blank? (string/trim (or nickname "")))))
(not (string/blank? nickname)))
(defn- nickname-input
[nickname entered-nickname public-key]
[quo/text-input
{:on-change-text #(reset! entered-nickname %)
:on-submit-editing #(when (valid-nickname? @entered-nickname)
(save-nickname public-key (string/trim (or @entered-nickname ""))))
(save-nickname public-key @entered-nickname))
:auto-capitalize :none
:auto-focus false
:max-length 32
@@ -131,9 +131,7 @@
:center
[quo/button
{:type :secondary
:disabled (not (valid-nickname? @entered-nickname))
:on-press #(when (valid-nickname? @entered-nickname)
(save-nickname public-key (string/trim (or @entered-nickname ""))))}
:on-press #(save-nickname public-key @entered-nickname)}
(i18n/label :t/done)]}]])))
(defn button-item
+8 -4
View File
@@ -225,8 +225,12 @@
(defn format-members
[count]
(if (> count 1000000)
(cond
(> count 1000000)
(str (with-precision (/ count 1000000) 1) (i18n/label :t/M))
(if (and (> count 999) (< count 1000000))
(str (with-precision (/ count 1000) 1) (i18n/label :t/K))
count)))
(< 999 count 1000000)
(str (with-precision (/ count 1000) 1) (i18n/label :t/K))
:else
count))
-5
View File
@@ -126,11 +126,6 @@
(when (string? s)
(string/replace s m r)))
(defn safe-nth
[coll index]
(when (number? index)
(nth coll index)))
(defn svg?
[some-string]
(string/ends-with? some-string ".svg"))
@@ -7,7 +7,7 @@
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
[status-im.ui.screens.multiaccounts.recover.views :as recover.views]
[status-im2.common.bottom-sheet.view :as bottom-sheet]
[status-im2.contexts.chat.menus.pinned-messages.view :as pinned-messages-menu]
[status-im2.contexts.chat.messages.pin.list.view :as pin.list]
[react-native.core :as rn]))
(defn bottom-sheet
@@ -50,8 +50,7 @@
(merge key-storage/migrate-account-password)
(= view :pinned-messages-list)
(merge {:content pinned-messages-menu/pinned-messages
:bottom-safe-area-spacing? false}))]
(merge {:content pin.list/pinned-messages-list}))]
[:f>
(fn []
(rn/use-effect (fn []
+14 -9
View File
@@ -1,15 +1,20 @@
(ns status-im2.common.resources)
(def ui
{:add-new-contact (js/require "../resources/images/ui2/add-contact.png")
:lifestyle (js/require "../resources/images/ui2/lifestyle.png")
:music (js/require "../resources/images/ui2/music.png")
:podcasts (js/require "../resources/images/ui2/podcasts.png")
:sync-device (js/require "../resources/images/ui2/sync-new-device-cover-background.png")
:generate-keys (js/require "../resources/images/ui2/generate_keys.png")
:ethereum-address (js/require "../resources/images/ui2/ethereum_address.png")
:use-keycard (js/require "../resources/images/ui2/keycard.png")
:onboarding-illustration (js/require "../resources/images/ui2/onboarding_illustration.png")})
{:add-new-contact (js/require "../resources/images/ui2/add-contact.png")
:intro-1 (js/require "../resources/images/ui2/intro-1.png")
:intro-2 (js/require "../resources/images/ui2/intro-2.png")
:intro-3 (js/require "../resources/images/ui2/intro-3.png")
:intro-4 (js/require "../resources/images/ui2/intro-4.png")
:lifestyle (js/require "../resources/images/ui2/lifestyle.png")
:music (js/require "../resources/images/ui2/music.png")
:podcasts (js/require "../resources/images/ui2/podcasts.png")
:sync-device (js/require "../resources/images/ui2/sync-new-device-cover-background.png")
:onboarding-bg-1 (js/require "../resources/images/ui2/onboarding-bg-1.png")
:onboarding-blur-bg (js/require "../resources/images/ui2/onboarding_blur_bg.png")
:generate-keys (js/require "../resources/images/ui2/generate_keys.png")
:ethereum-address (js/require "../resources/images/ui2/ethereum_address.png")
:use-keycard (js/require "../resources/images/ui2/keycard.png")})
(def mock-images
{:coinbase (js/require "../resources/images/mock2/coinbase.png")
+25 -21
View File
@@ -89,7 +89,7 @@
(defn display-picture
[scroll-height cover]
[scroll-height logo]
(let [input-range (if platform/ios? [-67 10] [0 150])
y (reanimated/use-shared-value scroll-height)
animation (reanimated/interpolate y
@@ -104,7 +104,7 @@
[reanimated/view
{:style (style/display-picture-container animation)}
[rn/image
{:source cover
{:source logo
:style style/display-picture}]]))
(defn scroll-page
@@ -117,7 +117,7 @@
[:<>
[:f> scroll-page-header @scroll-height height name page-nav-right-section-buttons
logo sticky-header top-nav title-colum navigate-back?]
[rn/scroll-view
[rn/flat-list
{:content-container-style (style/scroll-view-container
(diff-with-max-min @scroll-height 16 0))
:shows-vertical-scroll-indicator false
@@ -128,21 +128,25 @@
event
"nativeEvent.contentOffset.y")))
(when on-scroll
(on-scroll @scroll-height)))}
(when cover-image
[rn/view {:style {:height 151}}
[rn/image
{:source cover-image
;; Using negative margin-bottom as a workaround because on Android,
;; ScrollView clips its children despite setting overflow: 'visible'.
;; Related issue: https://github.com/facebook/react-native/issues/31218
:style {:margin-bottom -16
:flex 1}}]])
(when children
[rn/view
{:flex 1
:border-radius (diff-with-max-min @scroll-height 16 0)
:background-color background-color}
(when cover-image
[:f> display-picture @scroll-height logo])
children])]])))
(on-scroll @scroll-height)))
:header [rn/view
(when cover-image
[rn/view {:style {:height 151}}
[rn/image
{:source cover-image
;; Using negative margin-bottom as a workaround because
;; on Android,
;; ScrollView clips its children despite setting
;; overflow: 'visible'.
;; Related issue:
;; https://github.com/facebook/react-native/issues/31218
:style {:margin-bottom -16
:flex 1}}]])
(when children
[rn/view
{:flex 1
:border-radius (diff-with-max-min @scroll-height 16 0)
:background-color background-color}
(when cover-image
[:f> display-picture @scroll-height logo])
children])]}]])))
@@ -130,7 +130,7 @@
;; The initial value of data is the image that was pressed (and not the whole album) in order
;; for the transition animation to execute properly, otherwise it would animate towards
;; outside the screen (even if we have `initialScrollIndex` set).
data (reagent/atom (if (number? index) [(nth messages index)] []))
data (reagent/atom [(nth messages index)])
scroll-index (reagent/atom index)
transparent? (reagent/atom false)
set-full-height? (reagent/atom false)
@@ -1,44 +0,0 @@
(ns status-im2.contexts.chat.menus.pinned-messages.style
(:require [quo2.foundations.colors :as colors]))
(def heading
{:margin-horizontal 20})
(def heading-container
{:flex-direction :row
:background-color (colors/theme-colors colors/neutral-10 colors/neutral-80)
:border-radius 20
:align-items :center
:align-self :flex-start
:margin-horizontal 20
:padding 4
:margin-top 8})
(def heading-text
{:margin-left 6
:margin-right 4})
(def chat-name-text
{:margin-left 4
:margin-right 8})
(defn list-footer
[bottom-inset]
{:height bottom-inset})
(defn no-pinned-messages-container
[bottom-inset]
{:justify-content :center
:align-items :center
:margin-top 20
:margin-bottom bottom-inset})
(def no-pinned-messages-icon
{:width 120
:height 120
:justify-content :center
:align-items :center
:border-width 1})
(def no-pinned-messages-text
{:margin-top 20})
@@ -1,73 +0,0 @@
(ns status-im2.contexts.chat.menus.pinned-messages.view
(:require [quo2.core :as quo]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im2.contexts.chat.messages.content.deleted.view :as content.deleted]
[status-im2.contexts.chat.messages.content.view :as message]
[status-im2.contexts.chat.menus.pinned-messages.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(def list-key-fn #(or (:message-id %) (:value %)))
(defn message-render-fn
[{:keys [deleted? deleted-for-me?] :as message} _ _ context]
;; TODO (flexsurfer) probably we don't want reactions here
(if (or deleted? deleted-for-me?)
[content.deleted/deleted-message message context]
[message/message-with-reactions message context]))
(defn pinned-messages
[chat-id]
(let [pinned-messages (rf/sub [:chats/pinned-sorted-list chat-id])
render-data (rf/sub [:chats/current-chat-message-list-view-context :in-pinned-view])
current-chat (rf/sub [:chat-by-id chat-id])
{:keys [community-id]} current-chat
community (rf/sub [:communities/community community-id])]
[safe-area/consumer
(fn [insets]
[:f>
(fn []
(let [{window-height :height} (rn/use-window-dimensions)
bottom-inset (:bottom insets)]
[rn/scroll-view
{:style {:max-height (- window-height (:top insets))}
:accessibility-label :pinned-messages-menu}
[:<>
[quo/text
{:size :heading-1
:weight :semi-bold
:style style/heading}
(i18n/label :t/pinned-messages)]
(when community
[rn/view
{:style style/heading-container}
[rn/text {:style style/heading-text} (:name community)]
[quo/icon
:i/chevron-right
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40)
:size 12}]
[rn/text
{:style style/chat-name-text}
(str "# " (:chat-name current-chat))]])]
(if (pos? (count pinned-messages))
[rn/flat-list
{:data pinned-messages
:render-data render-data
:render-fn message-render-fn
:footer [rn/view {:style (style/list-footer bottom-inset)}]
:key-fn list-key-fn
:separator quo/separator}]
[rn/view {:style (style/no-pinned-messages-container bottom-inset)}
[rn/view {:style style/no-pinned-messages-icon}
[quo/icon :i/placeholder]]
[quo/text
{:weight :semi-bold
:style style/no-pinned-messages-text}
(i18n/label :t/no-pinned-messages)]
[quo/text {:size :paragraph-2}
(i18n/label
(if community
:t/no-pinned-messages-community-desc
:t/no-pinned-messages-desc))]])]))])]))
@@ -0,0 +1,77 @@
(ns status-im2.contexts.chat.messages.pin.list.view
(:require [quo2.core :as quo]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[status-im2.contexts.chat.messages.content.deleted.view :as content.deleted]
[status-im2.contexts.chat.messages.content.view :as message]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(def list-key-fn #(or (:message-id %) (:value %)))
(defn message-render-fn
[{:keys [deleted? deleted-for-me?] :as message} _ _ context]
;; TODO (flexsurfer) probably we don't want reactions here
(if (or deleted? deleted-for-me?)
[content.deleted/deleted-message message context]
[message/message-with-reactions message context]))
(defn pinned-messages-list
[chat-id]
(let [pinned-messages (rf/sub [:chats/pinned-sorted-list chat-id])
render-data (rf/sub [:chats/current-chat-message-list-view-context :in-pinned-view])
current-chat (rf/sub [:chat-by-id chat-id])
{:keys [community-id]} current-chat
community (rf/sub [:communities/community community-id])]
[rn/view {:accessibility-label :pinned-messages-list}
;; TODO (flexsurfer) this should be a component in quo2
;; https://github.com/status-im/status-mobile/issues/14529
[:<>
[quo/text
{:size :heading-1
:weight :semi-bold
:style {:margin-horizontal 20}}
(i18n/label :t/pinned-messages)]
(when community
[rn/view
{:style {:flex-direction :row
:background-color (colors/theme-colors colors/neutral-10 colors/neutral-80)
:border-radius 20
:align-items :center
:align-self :flex-start
:margin-horizontal 20
:padding 4
:margin-top 8}}
[rn/text {:style {:margin-left 6 :margin-right 4}} (:name community)]
[quo/icon
:i/chevron-right
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40)
:size 12}]
[rn/text
{:style {:margin-left 4
:margin-right 8}}
(str "# " (:chat-name current-chat))]])]
(if (pos? (count pinned-messages))
[rn/flat-list
{:data pinned-messages
:render-data render-data
:render-fn message-render-fn
:key-fn list-key-fn
:separator quo/separator}]
[rn/view
{:style {:justify-content :center
:align-items :center
:margin-top 20}}
[rn/view
{:style {:width 120
:height 120
:justify-content :center
:align-items :center
:border-width 1}} [quo/icon :i/placeholder]]
[quo/text
{:weight :semi-bold
:style {:margin-top 20}}
(i18n/label :t/no-pinned-messages)]
[quo/text {:size :paragraph-2}
(i18n/label
(if community :t/no-pinned-messages-community-desc :t/no-pinned-messages-desc))]])]))
@@ -22,10 +22,11 @@
(def featured-list-container
{:flex-direction :row
:overflow :hidden
:margin-bottom 24
:margin-left 20
:padding-right 20})
:overflow :hidden})
(def flat-list-container
{:padding-bottom 24
:padding-horizontal 20})
(def other-communities-container
{:flex 1
@@ -7,7 +7,6 @@
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.contexts.communities.menus.community-options.view :as options]
[status-im.ui.screens.communities.community :as community]
[status-im.ui.components.react :as react]
[react-native.platform :as platform]
[status-im2.common.scroll-page.view :as scroll-page]
@@ -22,23 +21,28 @@
:group [{:id 1
:token-icon (resources/get-mock-image :status-logo)}]}]}})
(defn render-fn
[community-item _ _ {:keys [width view-type]}]
(let [item (merge community-item
(get mock-community-item-data :data))
cover {:uri (get-in (:images item) [:banner :uri])}]
(defn community-list-item
[{:keys [id] :as community} _ _ {:keys [width view-type]}]
(let [community-item (merge
community
(get mock-community-item-data :data))
cover {:uri (get-in (:images community) [:banner :uri])}]
(if (= view-type :card-view)
[quo/community-card-view-item (assoc item :width width :cover cover)
#(rf/dispatch [:navigate-to :community-overview (:id item)])]
[quo/community-card-view-item (assoc community-item :width width :cover cover)
#(rf/dispatch [:navigate-to :community-overview (:id community)])]
[quo/communities-list-view-item
{:on-press (fn []
(rf/dispatch [:communities/load-category-states (:id item)])
(rf/dispatch [:communities/load-category-states id])
(rf/dispatch [:dismiss-keyboard])
<<<<<<< HEAD
(rf/dispatch [:navigate-to :community-overview (:id item)]))
=======
(rf/dispatch [:navigate-to :community {:community-id id}]))
>>>>>>> 1675fef63 (Fix: community data not displayed)
:on-long-press #(rf/dispatch
[:bottom-sheet/show-sheet
{:content (fn []
[options/community-options-bottom-sheet (:id item)])}])}])))
[options/community-options-bottom-sheet id])}])}])))
(defn screen-title
[]
@@ -89,7 +93,6 @@
:label (i18n/label :t/gated)
:accessibility-label :gated-communities-tab}]}]])
(defn featured-list
[communities view-type]
(let [view-size (reagent/atom 0)]
@@ -98,7 +101,7 @@
{:style style/featured-list-container
:on-layout #(swap! view-size
(fn []
(- (oops/oget % "nativeEvent.layout.width") 20)))}
(- (oops/oget % "nativeEvent.layout.width") 40)))}
(when-not (= @view-size 0)
[rn/flat-list
{:key-fn :id
@@ -107,9 +110,22 @@
:shows-horizontal-scroll-indicator false
:separator [rn/view {:width 12}]
:data communities
:render-fn render-fn
:render-fn community-list-item
:render-data {:width @view-size
:view-type view-type}}])])))
:view-type view-type}
:contentContainerStyle style/flat-list-container}])])))
(defn other-communities-list
[{:keys [communities view-type]}]
[rn/view style/other-communities-container
[rn/flat-list
{:key-fn :id
:keyboard-should-persist-taps :always
:separator [rn/view {:height 16}]
:data communities
:render-fn community-list-item
:contentContainerStyle style/flat-list-container
:render-data {:view-type view-type}}]])
(defn discover-communities-header
[{:keys [featured-communities-count
@@ -120,39 +136,10 @@
[screen-title]
[featured-communities-header featured-communities-count]
[featured-list featured-communities view-type]
[quo/separator]
[rn/view {:style {:margin-horizontal 20}}
[quo/separator]]
[discover-communities-segments selected-tab false]])
(defn other-communities-list
[{:keys [communities communities-ids view-type]}]
[rn/view {:style style/other-communities-container}
(map-indexed
(fn [inner-index item]
(let [community-id (when communities-ids item)
community (if communities
item
[rf/sub [:communities/home-item community-id]])]
[rn/view
{:key (str inner-index (:id community))
:margin-bottom 16}
(if (= view-type :card-view)
[quo/community-card-view-item
(merge community
(get mock-community-item-data :data))
#(rf/dispatch [:navigate-to :community-overview (:id community)])]
[quo/communities-list-view-item
{:on-press (fn []
(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 [:bottom-sheet/show-sheet
{:content (fn []
;; TODO implement with quo2
[community/community-actions community])}])}
(merge community
(get mock-community-item-data :data))])]))
(if communities communities communities-ids))])
(defn communities-lists
[selected-tab view-type]
[rn/view {:style {:flex 1}}
@@ -5,12 +5,20 @@
{:background-color colors/neutral-95
:flex-direction :row
:position :absolute
:overflow :hidden
:top 0
:bottom 0
:left 0
:right 0})
(defn background-gradient-overlay
[dark-overlay?]
{:position :absolute
:height (if dark-overlay? 240 136)
:top 0
:left 0
:right 0
:bottom 0})
(def background-blur-overlay
{:position :absolute
:left 0
@@ -1,22 +1,26 @@
(ns status-im2.contexts.onboarding.common.background.view
(:require [react-native.core :as rn]
[react-native.blur :as blur]
[status-im2.contexts.onboarding.common.carousel.view :as carousel]
[status-im2.contexts.onboarding.common.background.style :as style]
[status-im2.contexts.onboarding.common.carousel.animation :as carousel.animation]))
[quo2.foundations.colors :as colors]
[status-im2.common.resources :as resources]
[react-native.linear-gradient :as linear-gradient]
[status-im2.contexts.onboarding.common.background.style :as style]))
(defn view
[dark-overlay?]
[:f>
(fn []
(carousel.animation/initialize-animation)
[rn/view
{:style style/background-container}
[rn/image
{:blur-radius (if dark-overlay? 13 0)
:style {:height "100%"
:width "100%"}
;; Todo - get background image from sub using carousel index on landing page
:source (resources/get-image :onboarding-bg-1)}]
[linear-gradient/linear-gradient
{:colors [(if dark-overlay? (colors/custom-color :yin 50) "#000716")
(if dark-overlay? (colors/custom-color :yin 50 0) "#000716")]
:start {:x 0 :y 0}
:end {:x 0 :y 1}
:style (style/background-gradient-overlay dark-overlay?)}]
(when dark-overlay?
[rn/view
{:style style/background-container}
[carousel/view dark-overlay?]
(when dark-overlay?
[blur/view
{:style style/background-blur-overlay
:blur-amount 30
:blur-radius 25
:blur-type :transparent
:overlay-color :transparent}])])])
{:style style/background-blur-overlay}])])
@@ -1,50 +0,0 @@
(ns status-im2.contexts.onboarding.common.carousel.animation
(:require
[react-native.reanimated :as reanimated]
[utils.worklets.onboarding-carousel :as worklets.onboarding-carousel]))
(def progress (atom nil))
(def paused (atom nil))
(def ^:const progress-bar-animation-delay 300)
(def ^:const progress-bar-animation-duration 4000)
(defn slide-animation
[progress-percentage & [delay duration]]
(reanimated/with-delay
(or delay progress-bar-animation-delay)
(reanimated/with-timing
progress-percentage
(js-obj "duration" (or duration progress-bar-animation-duration)
"easing" (:linear reanimated/easings)))))
(defn animate-progress
[progress paused]
(reanimated/set-shared-value
progress
(reanimated/with-pause
(reanimated/with-repeat
(reanimated/with-sequence
(slide-animation 25)
(slide-animation 50)
(slide-animation 75)
(slide-animation 100)
(slide-animation 0 300 0))
-1)
paused)))
(defn initialize-animation
[]
(when-not @progress
(reset! progress (reanimated/use-shared-value 0))
(reset! paused (reanimated/use-shared-value false))
(animate-progress @progress @paused)))
;; Derived Values
(defn carousel-left-position
[window-width]
(worklets.onboarding-carousel/carousel-left-position window-width @progress))
(defn dynamic-progress-bar-width
[progress-bar-width]
(worklets.onboarding-carousel/dynamic-progress-bar-width progress-bar-width @progress))
@@ -1,73 +0,0 @@
(ns status-im2.contexts.onboarding.common.carousel.style
(:require
[quo2.foundations.colors :as colors]
[react-native.reanimated :as reanimated]))
(defn header-container
[status-bar-height content-width index]
{:position :absolute
:top 0
:left (* content-width index)
:padding-top (+ 30 status-bar-height)
:width content-width
:height (+ 96 status-bar-height)
:flex-direction :row
:background-color colors/onboarding-header-black})
(defn header-text-view
[window-width]
{:flex-direction :column
:width window-width
:padding-left 20})
(def carousel-text
{:color colors/white})
(def carousel-sub-text
{:color colors/white
:margin-top 2})
(defn background-image
[content-width]
{:resize-mode :stretch
:width content-width})
(defn progress-bar-item
[static? end?]
{:height 2
:flex 1
:background-color (if static? colors/white-opa-10 colors/white)
:margin-right (if end? 0 8)
:border-radius 4})
(defn progress-bar
[width]
{:position :absolute
:top 0
:width width
:flex-direction :row})
(defn dynamic-progress-bar
[width]
(reanimated/apply-animations-to-style
{:width width}
{:height 2
:border-radius 4
:overflow :hidden}))
(defn progress-bar-container
[progress-bar-width status-bar-height]
{:position :absolute
:width progress-bar-width
:margin-left 20
:top (+ 12 status-bar-height)})
(defn carousel-container
[left]
(reanimated/apply-animations-to-style
{:left left}
{:position :absolute
:right 0
:top 0
:bottom 0
:flex-direction :row}))
@@ -1,95 +0,0 @@
(ns status-im2.contexts.onboarding.common.carousel.view
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[react-native.core :as rn]
[react-native.navigation :as navigation]
[react-native.reanimated :as reanimated]
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.common.carousel.style :as style]
[status-im2.contexts.onboarding.common.carousel.animation :as animation]))
(def header-text
[{:text (i18n/label :t/join-decentralised-communities)
:sub-text (i18n/label :t/participate-in-the-metaverse)}
{:text (i18n/label :t/chat-with-friends)
:sub-text (i18n/label :t/with-full-encryption)}
{:text (i18n/label :t/own-your-crypto)
:sub-text (i18n/label :t/use-the-multichain-wallet)}
{:text (i18n/label :t/discover-web3)
:sub-text (i18n/label :t/explore-the-decentralized-web)}])
(defn header-text-view
[index window-width]
[rn/view {:style (style/header-text-view window-width)}
[quo/text
{:style style/carousel-text
:weight :semi-bold
:size :heading-2}
(get-in header-text [index :text])]
[quo/text
{:style style/carousel-sub-text
:size :paragraph-1}
(get-in header-text [index :sub-text])]])
(defn content-view
[{:keys [window-width status-bar-height index]}]
(let [content-width (* 4 window-width)]
[:<>
[rn/image
{:style (style/background-image content-width)
:source (resources/get-image :onboarding-illustration)}]
[rn/view {:style (style/header-container status-bar-height content-width index)}
(for [index (range 4)]
^{:key index}
[header-text-view index window-width])]]))
(defn progress-bar
[{:keys [static? progress-bar-width]}]
[rn/view
{:style (style/progress-bar progress-bar-width)}
[rn/view {:style (style/progress-bar-item static? false)}]
[rn/view {:style (style/progress-bar-item static? false)}]
[rn/view {:style (style/progress-bar-item static? false)}]
[rn/view {:style (style/progress-bar-item static? true)}]])
(defn dynamic-progress-bar
[progress-bar-width]
[:f>
(fn []
(let [width (animation/dynamic-progress-bar-width progress-bar-width)]
[reanimated/view {:style (style/dynamic-progress-bar width)}
[progress-bar
{:static? false
:progress-bar-width progress-bar-width}]]))])
(defn view
[]
[:f>
(fn []
(let [window-width (rf/sub [:dimensions/window-width])
view-id (rf/sub [:view-id])
status-bar-height (:status-bar-height @navigation/constants)
progress-bar-width (- window-width 40)
carousel-left (animation/carousel-left-position window-width)]
(rn/use-effect
(fn []
(reanimated/set-shared-value @animation/paused (not= view-id :intro)))
[view-id])
[:<>
[reanimated/view {:style (style/carousel-container carousel-left)}
(for [index (range 2)]
^{:key index}
[content-view
{:window-width window-width
:status-bar-height status-bar-height
:index index}])]
[rn/view
{:style (style/progress-bar-container
progress-bar-width
status-bar-height)}
[progress-bar
{:static? true
:progress-bar-width progress-bar-width}]
[dynamic-progress-bar progress-bar-width]]]))])
@@ -1,4 +1,4 @@
(ns status-im2.contexts.onboarding.intro.style
(ns status-im2.contexts.onboarding.common.intro.style
(:require
[react-native.platform :as platform]
[quo2.foundations.colors :as colors]))
@@ -0,0 +1,88 @@
(ns status-im2.contexts.onboarding.common.intro.view
(:require [utils.i18n :as i18n]
[quo2.core :as quo]
[react-native.core :as rn]
[reagent.core :as reagent]
[utils.re-frame :as rf]
[status-im2.contexts.onboarding.common.intro.style :as style]
[status-im2.common.resources :as resources]))
(def carousels
[{:image (resources/get-image :intro-1)
:text (i18n/label :t/join-decentralised-communities)
:sub-text (i18n/label :t/participate-in-the-metaverse)}
{:image (resources/get-image :intro-2)
:text (i18n/label :t/chat-with-friends)
:sub-text (i18n/label :t/with-full-encryption)}
{:image (resources/get-image :intro-3)
:text (i18n/label :t/own-your-crypto)
:sub-text (i18n/label :t/use-the-multichain-wallet)}
{:image (resources/get-image :intro-4)
:text (i18n/label :t/discover-web3)
:sub-text (i18n/label :t/explore-the-decentralized-web)}])
(defn progress-bar
[index]
[rn/view style/progress-bar-container
[rn/view {:style (style/progress-bar-item index 0 false)}]
[rn/view {:style (style/progress-bar-item index 1 false)}]
[rn/view {:style (style/progress-bar-item index 2 false)}]
[rn/view {:style (style/progress-bar-item index 3 true)}]])
;; TODO: carousel component is to be correctly implemented as quo2 component with animations etc in:
;; https://github.com/status-im/status-mobile/issues/15012
(defn carousel
[index]
[rn/view {:style style/carousel}
[progress-bar index]
[quo/text
{:style style/carousel-text
:weight :semi-bold
:size :heading-2}
(get-in carousels [index :text])]
[quo/text
{:style style/carousel-text
:size :paragraph-1}
(get-in carousels [index :sub-text])]])
(defn set-index
[old-index]
(mod (inc old-index) 4))
(defn view
[]
(reagent/with-let [carousel-index (reagent/atom 0)
interval-id (js/setInterval #(swap! carousel-index set-index)
1500)]
[rn/view {:style style/page-container}
[carousel @carousel-index]
[rn/image
{:style style/page-image
:source (get-in carousels [@carousel-index :image])}]
[quo/drawer-buttons
{:top-card {:on-press (fn []
(rf/dispatch [:navigate-to :sign-in])
(rf/dispatch [:hide-terms-of-services-opt-in-screen]))
:heading (i18n/label :t/sign-in)
:accessibility-label :already-use-status-button}
:bottom-card {:on-press (fn []
(rf/dispatch [:navigate-to :new-to-status])
(rf/dispatch [:hide-terms-of-services-opt-in-screen]))
:heading (i18n/label :t/new-to-status)
:accessibility-label :new-to-status-button}}
(i18n/label :t/you-already-use-status)
[quo/text
{:style style/text-container}
[quo/text
{:size :paragraph-2
:style style/plain-text
:weight :semi-bold}
(i18n/label :t/by-continuing-you-accept)]
[quo/text
{:on-press #(rf/dispatch [:open-modal :privacy-policy])
:size :paragraph-2
:style style/highlighted-text
:weight :semi-bold}
(i18n/label :t/terms-of-service)]]]]
(finally
(js/clearInterval interval-id))))
+8 -22
View File
@@ -5,12 +5,11 @@
[status-im.utils.types :as types]
[status-im2.config :as config]
[clojure.string :as string]
[utils.i18n :as i18n]
[utils.security.core :as security]
[status-im.native-module.core :as status]
[status-im.ethereum.core :as ethereum]
[status-im2.constants :as constants]
[status-im2.contexts.onboarding.profiles.view :as profiles.view]))
[utils.i18n :as i18n]))
(re-frame/reg-fx
:multiaccount/create-account-and-login
@@ -23,10 +22,10 @@
(status/validate-mnemonic
(security/safe-unmask-data mnemonic)
(fn [result]
(let [{:keys [error keyUID]} (types/json->clj result)]
(let [{:keys [error]} (types/json->clj result)]
(if (seq error)
(when on-error (on-error error))
(on-success mnemonic keyUID)))))))
(on-success mnemonic)))))))
(re-frame/reg-fx
:multiaccount/restore-account-and-login
@@ -122,28 +121,15 @@
{:events [:onboarding-2/seed-phrase-entered]}
[_ seed-phrase on-error]
{:multiaccount/validate-mnemonic [seed-phrase
(fn [mnemonic key-uid]
(re-frame/dispatch [:onboarding-2/seed-phrase-validated
mnemonic key-uid]))
#(re-frame/dispatch [:onboarding-2/seed-phrase-validated
seed-phrase])
on-error]})
(rf/defn seed-phrase-validated
{:events [:onboarding-2/seed-phrase-validated]}
[{:keys [db]} seed-phrase key-uid]
(if (contains? (:multiaccounts/multiaccounts db) key-uid)
{:utils/show-confirmation
{:title (i18n/label :t/multiaccount-exists-title)
:content (i18n/label :t/multiaccount-exists-content)
:confirm-button-text (i18n/label :t/unlock)
:on-accept #(do
(re-frame/dispatch [:pop-to-root :profiles])
;; FIXME(rasom): obviously not cool
(reset! profiles.view/show-profiles? false)
(re-frame/dispatch
[:multiaccounts.login.ui/multiaccount-selected key-uid]))
:on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}}
{:db (assoc-in db [:onboarding-2/profile :seed-phrase] seed-phrase)
:dispatch [:navigate-to :create-profile]}))
[{:keys [db]} seed-phrase]
{:db (assoc-in db [:onboarding-2/profile :seed-phrase] seed-phrase)
:dispatch [:navigate-to :create-profile]})
(rf/defn navigate-to-create-profile
{:events [:onboarding-2/navigate-to-create-profile]}
@@ -1,37 +0,0 @@
(ns status-im2.contexts.onboarding.intro.view
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[react-native.core :as rn]
[status-im2.contexts.onboarding.intro.style :as style]
[status-im2.contexts.onboarding.common.background.view :as background]))
(defn view
[]
[rn/view {:style style/page-container}
[background/view false]
[quo/drawer-buttons
{:top-card {:on-press (fn []
(rf/dispatch [:navigate-to :sign-in])
(rf/dispatch [:hide-terms-of-services-opt-in-screen]))
:heading (i18n/label :t/sign-in)
:accessibility-label :already-use-status-button}
:bottom-card {:on-press (fn []
(rf/dispatch [:navigate-to :new-to-status])
(rf/dispatch [:hide-terms-of-services-opt-in-screen]))
:heading (i18n/label :t/new-to-status)
:accessibility-label :new-to-status-button}}
(i18n/label :t/you-already-use-status)
[quo/text
{:style style/text-container}
[quo/text
{:size :paragraph-2
:style style/plain-text
:weight :semi-bold}
(i18n/label :t/by-continuing-you-accept)]
[quo/text
{:on-press #(rf/dispatch [:open-modal :privacy-policy])
:size :paragraph-2
:style style/highlighted-text
:weight :semi-bold}
(i18n/label :t/terms-of-service)]]]])
@@ -4,13 +4,20 @@
(def full-screen {:flex 1})
(def content-container
{:padding-top (if platform/ios? 44 0)
:position :absolute
:top 0
:bottom 0
:left 0
:right 0})
(def image-background
{:height "100%"
:width "100%"})
(def layer-background
{:padding-top (if platform/ios? 44 0)
:position :absolute
:top 0
:bottom 0
:left 0
:right 0
:background-color colors/neutral-80-opa-80-blur})
(def navigation-bar {:height 56})
(def options-container
{:padding-top 12
@@ -7,10 +7,16 @@
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.new-to-status.style :as style]
[status-im2.contexts.onboarding.common.navigation-bar.view :as navigation-bar]
[status-im2.contexts.onboarding.common.background.view :as background]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn background-image
[]
[rn/image
{:style style/image-background
:blur-radius 13
:source (resources/get-image :onboarding-blur-bg)}])
(defn sign-in-options
[]
(let [window (rf/sub [:dimensions/window])]
@@ -72,7 +78,7 @@
(defn new-to-status
[]
[rn/view {:style style/full-screen}
[background/view true]
[rn/view {:style style/content-container}
[background-image]
[rn/view {:style style/layer-background}
[navigation-bar/navigation-bar {:on-press-info #(js/alert "Info pressed")}]
[sign-in-options]]])
@@ -31,7 +31,7 @@
:label (i18n/label :t/add-existing-status-profile)
:on-press #(do
(rf/dispatch [:bottom-sheet/hide])
(rf/dispatch [:navigate-to :sign-in]))
(rf/dispatch [:navigate-to :new-to-status]))
:accessibility-label :multi-profile}]]])
(defn show-new-account-options
@@ -202,4 +202,4 @@
[background/view true]
(if @show-profiles?
[profiles-section]
[login-section])]))
[login-section show-profiles?])]))
@@ -11,8 +11,8 @@
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.constants :as constants]
[status-im2.contexts.onboarding.common.background.view :as background]
[status-im2.contexts.onboarding.sign-in.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -216,7 +216,9 @@
:camera-options {:zoomMode :off}
:scan-barcode true
:on-read-code on-read-code}]
[background/view true])
[rn/image
{:style (merge style/absolute-fill {:height height :width width})
:source (resources/get-image :intro-4)}])
(conj hole-view-wrapper
[blur/view
{:style style/absolute-fill
+1 -1
View File
@@ -13,7 +13,7 @@
[status-im2.contexts.chat.photo-selector.view :as photo-selector]
[status-im2.contexts.communities.discover.view :as communities.discover]
[status-im2.contexts.communities.overview.view :as communities.overview]
[status-im2.contexts.onboarding.intro.view :as intro]
[status-im2.contexts.onboarding.common.intro.view :as intro]
[status-im2.contexts.onboarding.create-password.view :as create-password]
[status-im2.contexts.onboarding.create-profile.view :as create-profile]
[status-im2.contexts.onboarding.enable-biometrics.view :as enable-biometrics]
+4 -4
View File
@@ -3,10 +3,10 @@
[re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.tokens :as tokens]
[status-im.utils.currency :as currency]
[status-im.utils.money :as money]
[utils.i18n :as i18n]
[status-im2.config :as config]
[utils.i18n :as i18n]))
[status-im.utils.currency :as currency]
[status-im.utils.money :as money]))
(re-frame/reg-sub
:balance
@@ -253,7 +253,7 @@
:wallet/currency
:<- [:wallet.settings/currency]
(fn [currency-id]
(get currency/currencies currency-id (get currency/currencies :usd))))
(get currency/currencies currency-id)))
(defn filter-recipient-favs
[search-filter {:keys [name]}]
@@ -1,11 +0,0 @@
(ns utils.worklets.onboarding-carousel)
(def worklets (js/require "../src/js/worklets/onboarding_carousel.js"))
(defn dynamic-progress-bar-width
[static-progress-bar-width progress]
(.dynamicProgressBarWidth ^js worklets static-progress-bar-width progress))
(defn carousel-left-position
[window-width progress]
(.carouselLeftPosition ^js worklets window-width progress))
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.141.2",
"commit-sha1": "91c6949cd25449d5459581a21f2c8b929290ced0",
"src-sha256": "0d4x1y9jhdxy5jn9kqp5avx157iqz4ma7903c3ys0njmnxhmjyf8"
"version": "v0.141.1",
"commit-sha1": "458f28178ca15732df8e6c806ef5326fad44427c",
"src-sha256": "1hhfswn17dja62rxkb572afd6fsx86wfxs4j666lhscdz7zzs4gx"
}
+1 -1
View File
@@ -637,7 +637,7 @@ class UnpinMessagePopUp(BaseElement):
class PinnedMessagesList(BaseElement):
def __init__(self, driver):
super().__init__(driver, xpath="//*[@content-desc='pinned-messages-menu']")
super().__init__(driver, xpath="//*[@content-desc='pinned-messages-list']")
def get_pinned_messages_number(self):
self.driver.info("Getting number of pinned messages inside pinned messages list element")