feature: require manual acceptance of terms-of-use and privacy-statement during onboarding

This commit is contained in:
Sean Hagstrom 2024-08-12 10:17:50 +01:00
parent 87374e5c75
commit 7dc3720c05
No known key found for this signature in database
GPG Key ID: 5257FEDF56307320
2 changed files with 70 additions and 39 deletions

View File

@ -7,9 +7,14 @@
:justify-content :flex-end}) :justify-content :flex-end})
(def text-container (def text-container
{:text-align :center {:flex 1
:margin-top 4 :flex-wrap :wrap
:flex-wrap :wrap}) :text-align :center})
(def terms-privacy-container
{:gap 8
:padding-horizontal 20
:padding-vertical 8})
(def plain-text (def plain-text
{:color colors/white-opa-70}) {:color colors/white-opa-70})

View File

@ -6,45 +6,71 @@
[status-im.contexts.onboarding.common.background.view :as background] [status-im.contexts.onboarding.common.background.view :as background]
[status-im.contexts.onboarding.common.overlay.view :as overlay] [status-im.contexts.onboarding.common.overlay.view :as overlay]
[status-im.contexts.onboarding.intro.style :as style] [status-im.contexts.onboarding.intro.style :as style]
[status-im.contexts.onboarding.privacy.view :as privacy]
[status-im.contexts.onboarding.terms.view :as terms] [status-im.contexts.onboarding.terms.view :as terms]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn view (defn view
[] []
[rn/view {:style style/page-container} (let [[terms-accepted? set-terms-accepted?] (rn/use-state false)]
[background/view false] [rn/view {:style style/page-container}
[quo/bottom-actions [background/view false]
{:container-style (style/bottom-actions-container (safe-area/get-bottom)) [quo/bottom-actions
:actions :two-vertical-actions {:container-style (style/bottom-actions-container (safe-area/get-bottom))
:description :bottom :actions :two-vertical-actions
:description-text [quo/text :description :top
{:style style/text-container :description-top-text [rn/view
:size :paragraph-2 {:style style/terms-privacy-container
:weight :regular} :flex-direction :row}
[quo/text {:style style/plain-text} [quo/selectors
(i18n/label :t/by-continuing-you-accept)] {:type :checkbox
[quo/text :checked? terms-accepted?
{:on-press #(rf/dispatch [:show-bottom-sheet :on-change #(set-terms-accepted? not)}]
{:content (fn [] [terms/terms-of-use]) [rn/view {:style {:flex 1}}
:shell? true}]) [quo/text
:style style/highlighted-text} {:style style/text-container
(i18n/label :t/terms-of-service)]] :size :paragraph-2}
:button-one-label (i18n/label :t/sync-or-recover-profile) [quo/text
:button-one-props {:type :dark-grey {:style style/plain-text
:accessibility-label :already-use-status-button :size :paragraph-2}
:on-press (fn [] (str (i18n/label :t/accept-status-tos-prefix) " ")]
(when-let [blur-show-fn @overlay/blur-show-fn-atom] [quo/text
(blur-show-fn)) {:on-press #(rf/dispatch [:show-bottom-sheet
(rf/dispatch {:content (fn [] [terms/terms-of-use])
[:open-modal :shell? true}])
:screen/onboarding.sync-or-recover-profile]))} :style style/highlighted-text
:button-two-label (i18n/label :t/create-profile) :size :paragraph-2}
:button-two-props {:accessibility-label :new-to-status-button (i18n/label :t/terms-of-service)]
:on-press [quo/text
(fn [] {:style style/plain-text
(when-let [blur-show-fn @overlay/blur-show-fn-atom] :size :paragraph-2}
(blur-show-fn)) " & "]
(rf/dispatch [quo/text
[:open-modal :screen/onboarding.new-to-status]))}}] {:on-press #(rf/dispatch [:show-bottom-sheet
[overlay/view]]) {:content (fn [] [privacy/privacy-statement])
:shell? true}])
:style style/highlighted-text
:size :paragraph-2
:weight :regular}
(i18n/label :t/intro-privacy-statement)]]]]
:button-one-label (i18n/label :t/sync-or-recover-profile)
:button-one-props {:type :dark-grey
:disabled? (not terms-accepted?)
:accessibility-label :already-use-status-button
:on-press (fn []
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch
[:open-modal
:screen/onboarding.sync-or-recover-profile]))}
:button-two-label (i18n/label :t/create-profile)
:button-two-props {:accessibility-label :new-to-status-button
:disabled? (not terms-accepted?)
:on-press
(fn []
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch
[:open-modal :screen/onboarding.new-to-status]))}}]
[overlay/view]]))