Skip to content

Commit

Permalink
Merge branch 'develop' into 17996-cl-biometry-login
Browse files Browse the repository at this point in the history
  • Loading branch information
clauxx authored Dec 12, 2023
2 parents 579e70d + f1bcc62 commit 92425d6
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 138 deletions.
Binary file added resources/images/ui2/notifications@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/ui2/notifications@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/videos2/notifications_01.mp4
Binary file not shown.
Binary file added resources/videos2/notifications_02.mp4
Binary file not shown.
Binary file added resources/videos2/notifications_03.mp4
Binary file not shown.
Binary file added resources/videos2/notifications_04.mp4
Binary file not shown.
7 changes: 6 additions & 1 deletion src/status_im2/common/resources.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
:no-contacts-to-invite-dark (js/require "../resources/images/ui2/no-contacts-to-invite-dark.png")
:no-notifications-light (js/require "../resources/images/ui2/no-notifications-light.png")
:no-notifications-dark (js/require "../resources/images/ui2/no-notifications-dark.png")
:notifications (js/require "../resources/images/ui2/notifications.png")
:welcome-illustration (js/require "../resources/images/ui2/welcome_illustration.png")})

(def ui-themed
Expand Down Expand Up @@ -138,7 +139,11 @@
(js/require "../resources/videos2/biometrics_04.mp4")]
:generate-keys [(js/require "../resources/videos2/generating_keys_01.mp4")
(js/require "../resources/videos2/generating_keys_02.mp4")
(js/require "../resources/videos2/generating_keys_03.mp4")]})
(js/require "../resources/videos2/generating_keys_03.mp4")]
:notifications [(js/require "../resources/videos2/notifications_01.mp4")
(js/require "../resources/videos2/notifications_02.mp4")
(js/require "../resources/videos2/notifications_03.mp4")
(js/require "../resources/videos2/notifications_04.mp4")]})

(def services
{:latamex (js/require "../resources/images/services/Latamex.png")
Expand Down
2 changes: 0 additions & 2 deletions src/status_im2/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,4 @@

(def default-kdf-iterations 3200)

(def shell-navigation-disabled? false)

(def community-accounts-selection-enabled? false)
3 changes: 0 additions & 3 deletions src/status_im2/contexts/chat/composer/sub_view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[react-native.blur :as blur]
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[status-im2.config :as config]
[status-im2.contexts.chat.composer.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
Expand Down Expand Up @@ -40,8 +39,6 @@
[quo/floating-shell-button
{:jump-to
{:on-press (fn []
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close true]))
(rf/dispatch [:shell/navigate-to-jump-to]))
:customization-color customization-color
:label (i18n/label :t/jump-to)
Expand Down
15 changes: 3 additions & 12 deletions src/status_im2/contexts/chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[status-im.chat.models.loading :as loading]
[status-im.data-store.chats :as chats-store]
[status-im2.common.muting.helpers :refer [format-mute-till]]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.link-preview.events :as link-preview]
status-im2.contexts.chat.effects
Expand Down Expand Up @@ -168,7 +167,7 @@

(rf/defn close-chat
{:events [:chat/close]}
[{:keys [db] :as cofx} navigate-to-shell?]
[{:keys [db] :as cofx}]
(when-let [chat-id (:current-chat-id db)]
(chat.state/reset-visible-item)
(rf/merge cofx
Expand All @@ -177,15 +176,7 @@
(dissoc :current-chat-id)
(assoc-in [:chat/inputs chat-id :focused?] false))
:effects.async-storage/set {:chat-id nil
:key-uid nil}}
(let [community-id (get-in db [:chats chat-id :community-id])]
;; When navigating back from community chat to community, update switcher card
;; A close chat event is also called while opening any chat.
;; That might lead to duplicate :dispatch keys in fx/merge, that's why dispatch-n
;; is used here.
(when (and community-id config/shell-navigation-disabled? (not navigate-to-shell?))
{:dispatch-n [[:shell/add-switcher-card
:community-overview community-id]]})))
:key-uid nil}})
(link-preview/reset-all)
(delete-for-me/sync-all)
(delete-message/send-all)
Expand Down Expand Up @@ -219,7 +210,7 @@
{:dispatch [(if animation :shell/navigate-to :navigate-to) :chat chat-id animation]}
(when-not (#{:community :community-overview :shell} (:view-id db))
(navigation/pop-to-root :shell-stack))
(close-chat false)
(close-chat)
(force-close-chat chat-id)
(fn [{:keys [db]}]
{:db (assoc db :current-chat-id chat-id)})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.i18n :as i18n]
Expand Down Expand Up @@ -40,8 +39,6 @@
[quo/floating-shell-button
{:jump-to
{:on-press (fn []
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close true]))
(rf/dispatch [:shell/navigate-to-jump-to]))
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
Expand Down
11 changes: 3 additions & 8 deletions src/status_im2/contexts/chat/messages/list/style.cljs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
(ns status-im2.contexts.chat.messages.list.style
(:require
[quo.foundations.colors :as colors]
[react-native.reanimated :as reanimated]
[status-im2.config :as config]))
[react-native.reanimated :as reanimated]))

(defonce ^:const cover-height 168)
(defonce ^:const overscroll-cover-height 2000)
(defonce ^:const header-avatar-top-offset -36)

(defn keyboard-avoiding-container
[{:keys [top]}]
{:position :relative
:flex 1
:top (if config/shell-navigation-disabled? (- top) 0)
:margin-bottom (if config/shell-navigation-disabled? (- top) 0)})
(def keyboard-avoiding-container
{:flex 1})

(def list-container
{:padding-vertical 16})
Expand Down
6 changes: 1 addition & 5 deletions src/status_im2/contexts/chat/messages/navigation/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[status-im2.common.home.actions.view :as actions]
[status-im2.config :as config]
[status-im2.contexts.chat.messages.list.view :refer [topbar-invisible-scroll-y-value]]
[status-im2.contexts.chat.messages.navigation.style :as style]
[status-im2.contexts.chat.messages.pin.banner.view :as pin.banner]
Expand Down Expand Up @@ -116,10 +115,7 @@
:background :blur
:size 32
:accessibility-label :back-button
:on-press #(do
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close]))
(rf/dispatch [:navigate-back]))}
:on-press #(rf/dispatch [:navigate-back])}
back-icon]
[reanimated/view
{:style (style/animated-header all-loaded? translate-animation title-opacity-animation)}
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/contexts/chat/messages/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
;; Note - Don't pass `behavior :height` to keyboard avoiding view,. It breaks composer -
;; https://github.com/status-im/status-mobile/issues/16595
[rn/keyboard-avoiding-view
{:style (style/keyboard-avoiding-container insets)
{:style style/keyboard-avoiding-container
:keyboard-vertical-offset (- (:bottom insets))}

[list.view/message-list-content-view
Expand Down
23 changes: 10 additions & 13 deletions src/status_im2/contexts/onboarding/enable_notifications/style.cljs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
(ns status-im2.contexts.onboarding.enable-notifications.style
(:require
[quo.foundations.colors :as colors]))
(ns status-im2.contexts.onboarding.enable-notifications.style)

(def default-margin 20)

(defn page-container
[insets]
{:flex 1
:padding-top (:top insets)})
{:flex 1
:justify-content :space-between
:padding-top (:top insets)})

(def page-illustration
{:flex 1
:background-color colors/danger-50
:align-items :center
:margin-horizontal default-margin
:border-radius 20
:margin-top default-margin
:justify-content :center})
(defn page-illustration
[width]
{:flex 1
:width width})

(def page-heading {:z-index 1})

(defn buttons
[insets]
Expand Down
43 changes: 33 additions & 10 deletions src/status_im2/contexts/onboarding/enable_notifications/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im2.common.parallax.view :as parallax]
[status-im2.common.parallax.whitelist :as whitelist]
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.enable-notifications.style :as style]
[status-im2.contexts.shell.jump-to.utils :as shell.utils]
[taoensso.timbre :as log]
Expand Down Expand Up @@ -35,7 +38,7 @@
(rf/dispatch [:navigate-to-within-stack
[:welcome :enable-notifications]]))
:type :primary
:before :i/notifications
:icon-left :i/notifications
:accessibility-label :enable-notifications-button
:customization-color profile-color}
(i18n/label :t/intro-wizard-title6)]
Expand All @@ -50,16 +53,36 @@
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))

(defn enable-notifications
(defn enable-notifications-parallax
[]
(let [stretch (if rn/small-screen? -40 -25)]
[parallax/video
{:layers (:notifications resources/parallax-video)
:stretch stretch}]))

(defn enable-notifications-simple
[]
(let [width (:width (rn/get-window))]
[rn/image
{:resize-mode :contain
:style (style/page-illustration width)
:source (resources/get-image :notifications)}]))

(defn f-enable-notifications
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back-within-stack :enable-biometrics])}]
[page-title]
[rn/view {:style style/page-illustration}
[quo/text
"Illustration here"]]
[rn/view {:style style/page-heading}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back-within-stack :enable-biometrics])}]
[page-title]]
(if whitelist/whitelisted?
[enable-notifications-parallax]
[enable-notifications-simple])
[enable-notification-buttons {:insets insets}]]))

(defn view
[]
[:f> f-enable-notifications])
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[quo.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.fast-image :as fast-image]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]
[status-im2.contexts.shell.jump-to.animation :as animation]
Expand Down Expand Up @@ -198,13 +197,7 @@
(rf/dispatch [:chat/navigate-to-chat id])

(= card-type shell.constants/community-channel-card)
(if config/shell-navigation-disabled?
(do
(rf/dispatch [:navigate-to :community-overview id])
(js/setTimeout
#(rf/dispatch [:chat/navigate-to-chat channel-id])
100))
(rf/dispatch [:chat/navigate-to-chat channel-id]))
(rf/dispatch [:chat/navigate-to-chat channel-id])

(= card-type shell.constants/community-card)
(rf/dispatch [:navigate-to :community-overview id])))
Expand Down
6 changes: 2 additions & 4 deletions src/status_im2/contexts/shell/jump_to/effects.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im2.contexts.shell.jump-to.effects
(:require
[status-im2.config :as config]
[status-im2.contexts.shell.jump-to.animation :as animation]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[status-im2.contexts.shell.jump-to.state :as state]
Expand All @@ -15,9 +14,8 @@
(rf/reg-fx :effects.shell/navigate-to-jump-to
(fn []
(animation/close-home-stack false)
(when-not config/shell-navigation-disabled?
(some-> ^js @state/jump-to-list-ref
(.scrollToOffset #js {:y 0 :animated false})))))
(some-> ^js @state/jump-to-list-ref
(.scrollToOffset #js {:y 0 :animated false}))))

;; Note - pop-to-root resets currently opened screens to `close-screen-without-animation`.
;; This might take some time. So don't directly merge the effect of `pop-to-root` and
Expand Down
68 changes: 24 additions & 44 deletions src/status_im2/contexts/shell/jump_to/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[status-im.data-store.switcher-cards :as switcher-cards-store]
[status-im.utils.core :as utils]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
status-im2.contexts.shell.jump-to.effects
Expand Down Expand Up @@ -66,19 +65,10 @@
(when card-data
(rf/merge
cofx
(merge
{:db (assoc-in
db
[:shell/switcher-cards (:card-id card-data)]
switcher-card)}
(when config/shell-navigation-disabled?
{:effects.shell/change-tab (cond
(#{shell.constants/one-to-one-chat-card
shell.constants/private-group-chat-card}
card-type)
:chats-stack

:else :communities-stack)}))
{:db (assoc-in
db
[:shell/switcher-cards (:card-id card-data)]
switcher-card)}
(switcher-cards-store/upsert-switcher-card-rpc switcher-card)))))

(rf/defn close-switcher-card
Expand All @@ -94,32 +84,29 @@
{:events [:shell/navigate-to-jump-to]}
[{:keys [db]}]
(let [open-floating-screens (shell.utils/open-floating-screens)]
(merge
(if config/shell-navigation-disabled?
{:pop-to-root-fx :shell-stack}
{:db
(cond-> db
{:db
(cond-> db

(get open-floating-screens shell.constants/chat-screen)
(assoc-in [:shell/floating-screens shell.constants/chat-screen :animation]
shell.constants/close-screen-with-shell-animation)
(get open-floating-screens shell.constants/chat-screen)
(assoc-in [:shell/floating-screens shell.constants/chat-screen :animation]
shell.constants/close-screen-with-shell-animation)

(and (get open-floating-screens shell.constants/chat-screen)
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-without-animation)
(and (get open-floating-screens shell.constants/chat-screen)
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-without-animation)

(and (not (get open-floating-screens shell.constants/chat-screen))
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-with-shell-animation)
(and (not (get open-floating-screens shell.constants/chat-screen))
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-with-shell-animation)

(get open-floating-screens shell.constants/discover-communities-screen)
(assoc-in [:shell/floating-screens shell.constants/discover-communities-screen :animation]
shell.constants/close-screen-without-animation))
(get open-floating-screens shell.constants/discover-communities-screen)
(assoc-in [:shell/floating-screens shell.constants/discover-communities-screen :animation]
shell.constants/close-screen-without-animation))

:dispatch [:set-view-id :shell]})
{:effects.shell/navigate-to-jump-to nil})))
:dispatch [:set-view-id :shell]
:effects.shell/navigate-to-jump-to nil}))

(rf/defn change-shell-status-bar-style
{:events [:change-shell-status-bar-style]}
Expand Down Expand Up @@ -162,15 +149,8 @@
(not hidden-screen?)
(:current-chat-id db))
(conj [:chat/close]))})
(merge
{:db (assoc db :view-id go-to-view-id)
:navigate-to go-to-view-id}
(when (and config/shell-navigation-disabled?
(#{:chat :community-overview} go-to-view-id))
{:dispatch-later
;; 300 ms delay because, navigation is priority over shell card update
[{:dispatch [:shell/add-switcher-card go-to-view-id screen-params]
:ms 300}]}))))
{:db (assoc db :view-id go-to-view-id)
:navigate-to go-to-view-id}))

(rf/defn shell-navigate-back
{:events [:shell/navigate-back]}
Expand Down
Loading

0 comments on commit 92425d6

Please sign in to comment.