diff --git a/android/app/src/main/java/im/status/ethereum/StatusOkHttpClientFactory.java b/android/app/src/main/java/im/status/ethereum/StatusOkHttpClientFactory.java index 31efae585f8..9db192e7e4f 100644 --- a/android/app/src/main/java/im/status/ethereum/StatusOkHttpClientFactory.java +++ b/android/app/src/main/java/im/status/ethereum/StatusOkHttpClientFactory.java @@ -27,18 +27,23 @@ public OkHttpClient createNewNetworkModuleClient() { X509Certificate cert = null; HandshakeCertificates clientCertificates; String certPem = ""; + // Get TLS PEM certificate from status-go + try { + // induce half second sleep because sometimes a cert is not immediately available + // TODO : remove sleep if App no longer crashes on Android 10 devices with + // java.lang.RuntimeException: Could not invoke WebSocketModule.connect + Thread.sleep(500); + certPem = getCertificatePem(); + } catch(Exception e) { + Log.e(TAG, "Could not getImageTLSCert",e); + } - // Get TLS PEM certificate from status-go - try { - // induce half second sleep because sometimes a cert is not immediately available - // TODO : remove sleep if App no longer crashes on Android 10 devices with - // java.lang.RuntimeException: Could not invoke WebSocketModule.connect - Thread.sleep(500); - certPem = StatusPackage.getImageTLSCert(); - } catch(Exception e) { - Log.e(TAG, "Could not getImageTLSCert",e); - } - // Convert PEM certificate string to X509Certificate object + if (certPem.isEmpty()) { + Log.e(TAG, "Certificate is empty, cannot create OkHttpClient without a valid certificate"); + return null; + } + + // Convert PEM certificate string to X509Certificate object try { // induce half second sleep because sometimes a cert is not immediately available // TODO : remove sleep if App no longer crashes on Android 10 devices @@ -74,4 +79,17 @@ public OkHttpClient createNewNetworkModuleClient() { return null; } } + private String getCertificatePem() { + try { + String certPem = StatusPackage.getImageTLSCert(); + if (certPem == null || certPem.trim().isEmpty()) { + Log.e(TAG, "Certificate PEM string is null or empty"); + return ""; + } + return certPem; + } catch (Exception e) { + Log.e(TAG, "Could not getImageTLSCert", e); + return ""; + } + } } diff --git a/package.json b/package.json index e195a1ba5fa..068d7523527 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "process": "0.11.10", "react-test-renderer": "18.0.0", "rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#refs/tags/v2.0.2-status", - "shadow-cljs": "2.25.0" + "shadow-cljs": "2.26.2" }, "binary": { "module_name": "status_nodejs_addon", diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 47e927e0964..c4144107244 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -12,9 +12,10 @@ [metosin/malli "0.13.0"] ;; Dev dependencies - [refactor-nrepl "2.5.0"] - [cider/cider-nrepl "0.25.3"] + [refactor-nrepl "3.9.1"] + [cider/cider-nrepl "0.31.0"] [cider/piggieback "0.4.1"] + [org.slf4j/slf4j-nop "2.0.9"] [re-frisk-remote "1.6.0"] ;; Use the same version specified in the Nix dependency. diff --git a/src/quo/components/ios/drawer_bar/style.cljs b/src/quo/components/ios/drawer_bar/style.cljs new file mode 100644 index 00000000000..7476dde1951 --- /dev/null +++ b/src/quo/components/ios/drawer_bar/style.cljs @@ -0,0 +1,17 @@ +(ns quo.components.ios.drawer-bar.style + (:require + [quo.foundations.colors :as colors] + [quo.theme :as theme])) + +(def handle-container + {:padding-vertical 8 + :height 20 + :align-items :center}) + +(defn handle + [{:keys [theme]}] + {:width 32 + :height 4 + :background-color (colors/theme-colors colors/neutral-100 colors/white theme) + :opacity (theme/theme-value 0.05 0.1 theme) + :border-radius 100}) diff --git a/src/quo/components/ios/drawer_bar/view.cljs b/src/quo/components/ios/drawer_bar/view.cljs new file mode 100644 index 00000000000..6dc9c3c6907 --- /dev/null +++ b/src/quo/components/ios/drawer_bar/view.cljs @@ -0,0 +1,12 @@ +(ns quo.components.ios.drawer-bar.view + (:require + [quo.components.ios.drawer-bar.style :as style] + [quo.theme :as quo.theme] + [react-native.core :as rn])) + +(defn- view-internal + [props] + [rn/view {:style style/handle-container} + [rn/view {:style (style/handle props)}]]) + +(def view (quo.theme/with-theme view-internal)) diff --git a/src/quo/components/list_items/account/component_spec.cljs b/src/quo/components/list_items/account/component_spec.cljs index 68479e12b30..aa9c5674337 100644 --- a/src/quo/components/list_items/account/component_spec.cljs +++ b/src/quo/components/list_items/account/component_spec.cljs @@ -13,7 +13,7 @@ (h/render [account/view]) (h/fire-event :on-press-in (h/get-by-label-text :container)) (h/wait-for #(h/has-style (h/query-by-label-text :container) - {:backgroundColor (colors/custom-color :blue 50 5)}))) + {:backgroundColor (colors/resolve-color :blue :light 5)}))) (h/test "on-press-in changes state to :pressed with blur? enabled" (h/render [account/view {:blur? true}]) @@ -21,31 +21,26 @@ (h/wait-for #(h/has-style (h/query-by-label-text :container) {:backgroundColor colors/white-opa-5}))) - (h/test "on-press-out changes state to :active" - (h/render [account/view]) - (h/fire-event :on-press-in (h/get-by-label-text :container)) - (h/fire-event :on-press-out (h/get-by-label-text :container)) - (h/wait-for #(h/has-style (h/query-by-label-text :container) - {:backgroundColor (colors/custom-color :blue 50 10)}))) + (h/test "render with state :active" + (h/render [account/view {:state :active}]) + (h/has-style (h/query-by-label-text :container) + {:backgroundColor (colors/resolve-color :blue :light 10)})) - (h/test "on-press-out changes state to :active with blur? enabled" - (h/render [account/view {:blur? true}]) - (h/fire-event :on-press-in (h/get-by-label-text :container)) - (h/fire-event :on-press-out (h/get-by-label-text :container)) - (h/wait-for #(h/has-style (h/query-by-label-text :container) - {:backgroundColor colors/white-opa-10}))) + (h/test "render with state :active and blur? enabled" + (h/render [account/view + {:blur? true + :state :active}]) + (h/has-style (h/query-by-label-text :container) + {:backgroundColor colors/white-opa-10})) - (h/test "on-press-out changes state to :selected" - (h/render [account/view {:selectable? true}]) - (h/fire-event :on-press-in (h/get-by-label-text :container)) - (h/fire-event :on-press-out (h/get-by-label-text :container)) - (h/wait-for #(h/is-truthy (h/query-by-label-text :check-icon)))) + (h/test "render with state :selected" + (h/render [account/view {:state :selected}]) + (h/is-truthy (h/query-by-label-text :check-icon))) - (h/test "on-press-out calls on-press" + (h/test "calls on-press" (let [on-press (h/mock-fn)] (h/render [account/view {:on-press on-press}]) - (h/fire-event :on-press-in (h/get-by-label-text :container)) - (h/fire-event :on-press-out (h/get-by-label-text :container)) + (h/fire-event :on-press (h/get-by-label-text :container)) (h/was-called on-press))) (h/test "renders token props if type :tag" diff --git a/src/quo/components/list_items/account/style.cljs b/src/quo/components/list_items/account/style.cljs index a1eebb04efe..42ad78fdeb8 100644 --- a/src/quo/components/list_items/account/style.cljs +++ b/src/quo/components/list_items/account/style.cljs @@ -3,12 +3,12 @@ [quo.foundations.colors :as colors])) (defn- background-color - [{:keys [state blur? customization-color]}] - (cond (or (= state :pressed) (= state :selected)) - (if blur? colors/white-opa-5 (colors/custom-color customization-color 50 5)) + [{:keys [state pressed? blur? customization-color]}] + (cond (or pressed? (= state :selected)) + (if blur? colors/white-opa-5 (colors/resolve-color customization-color :light 5)) (= state :active) - (if blur? colors/white-opa-10 (colors/custom-color customization-color 50 10)) - (and (= state :pressed) blur?) colors/white-opa-10 + (if blur? colors/white-opa-10 (colors/resolve-color customization-color :light 10)) + (and pressed? blur?) colors/white-opa-10 :else :transparent)) (defn container diff --git a/src/quo/components/list_items/account/view.cljs b/src/quo/components/list_items/account/view.cljs index 945fd6fa3fa..7ff29fec35f 100644 --- a/src/quo/components/list_items/account/view.cljs +++ b/src/quo/components/list_items/account/view.cljs @@ -94,62 +94,42 @@ [icon/icon :i/check {:color (if blur? colors/white - (colors/theme-colors (colors/custom-color customization-color 50) - (colors/custom-color customization-color 60) - theme))}]]) + (colors/resolve-color customization-color theme))}]]) -(defn- f-internal-view - [] - (let [state (reagent/atom :default) - active-or-selected? (atom false) - timer (atom nil) - on-press-in (fn [] - (when-not (= @state :selected) - (reset! timer (js/setTimeout #(reset! state :pressed) 100))))] - (fn [{:keys [type selectable? blur? customization-color on-press] +(defn- internal-view + [_] + (let [pressed? (reagent/atom false) + on-press-in #(reset! pressed? true) + on-press-out #(reset! pressed? false)] + (fn [{:keys [type state blur? customization-color on-press] :or {customization-color :blue type :default + state :default blur? false} :as props}] - (let [on-press-out (fn [] - (let [new-state (if @active-or-selected? - :default - (if (and (= type :default) selectable?) - :selected - :active))] - (when @timer (js/clearTimeout @timer)) - (reset! timer nil) - (reset! active-or-selected? (or (= new-state :active) - (= new-state :selected))) - (reset! state new-state) - (when on-press - (on-press))))] - (rn/use-effect - #(cond (and selectable? (= type :default) (= @state :active)) (reset! state :selected) - (and (not selectable?) (= type :default) (= @state :selected)) (reset! state :active)) - [selectable?]) - [rn/pressable - {:style (style/container - {:state @state :blur? blur? :customization-color customization-color}) - :on-press-in on-press-in - :on-press-out on-press-out - :accessibility-label :container} - [account-view props] - [rn/view {:style (when (= type :tag) style/token-tag-container)} - (when (or (= type :balance-neutral) - (= type :balance-negative) - (= type :balance-positive)) - [balance-view props]) - (when (= type :tag) - [token-tag props]) - (when (= type :action) - [options-button props]) - (when (and (= type :default) - (= @state :selected)) - [check-icon props])]])))) + [rn/pressable + {:style (style/container + {:state state + :blur? blur? + :customization-color customization-color + :pressed? @pressed?}) + :on-press-in on-press-in + :on-press on-press + :on-press-out on-press-out + :accessibility-label :container} + [account-view props] + [rn/view {:style (when (= type :tag) style/token-tag-container)} + (cond + (#{:balance-neutral :balance-negative :balance-positive} type) + [balance-view props] -(defn- internal-view - [props] - [:f> f-internal-view props]) + (= type :tag) + [token-tag props] + + (= type :action) + [options-button props] + + (and (= type :default) (= state :selected)) + [check-icon props])]]))) (def view (quo.theme/with-theme internal-view)) diff --git a/src/quo/components/tags/tag.cljs b/src/quo/components/tags/tag.cljs index b989e4f0100..cf5fcfa4733 100644 --- a/src/quo/components/tags/tag.cljs +++ b/src/quo/components/tags/tag.cljs @@ -66,17 +66,17 @@ text-color) label])]) -(defn tag +(defn tag-internal "opts {:type :icon/:emoji/:label :label string :size 32/24 :on-press fn - :blurred? true/false + :blurred? true/false :resource icon/image :labelled? true/false :disabled? true/false} - + opts - `blurred` boolean: use to determine border color if the background is blurred - `type` can be icon or emoji with or without a tag label @@ -106,5 +106,5 @@ :labelled? (if (= type :label) true labelled?)} [tag-resources size type resource icon-color label text-color labelled?]]])) -(def tag (quo.theme/with-theme tag)) +(def tag (quo.theme/with-theme tag-internal)) diff --git a/src/quo/components/wallet/account_origin/view.cljs b/src/quo/components/wallet/account_origin/view.cljs index 7ffda8f49ca..6a596b41474 100644 --- a/src/quo/components/wallet/account_origin/view.cljs +++ b/src/quo/components/wallet/account_origin/view.cljs @@ -20,12 +20,13 @@ (i18n/label :t/trip-accounts))]) (defn- row-icon - [profile-picture type secondary-color] + [customization-color profile-picture type secondary-color] (case type :default-keypair [user-avatar/user-avatar - {:size :xxs - :ring? false - :profile-picture profile-picture}] + {:size :xxs + :ring? false + :customization-color customization-color + :profile-picture profile-picture}] :recovery-phrase [icons/icon :i/seed {:accessibility-label :recovery-phrase-icon @@ -41,10 +42,11 @@ nil)) (defn- row-view - [{:keys [type theme secondary-color profile-picture title stored subtitle on-press]}] + [{:keys [type theme secondary-color customization-color profile-picture title stored subtitle + on-press]}] [rn/view {:style (style/row-container type theme)} [rn/view {:style style/icon-container} - [row-icon profile-picture type secondary-color]] + [row-icon customization-color profile-picture type secondary-color]] [rn/view {:style style/row-content-container} [row-title type title] @@ -68,18 +70,19 @@ {:color secondary-color}]])]) (defn- list-view - [{:keys [type stored profile-picture user-name theme secondary-color]}] + [{:keys [type stored customization-color profile-picture user-name theme secondary-color]}] (let [stored-name (if (= :on-device stored) (i18n/label :t/on-device) (i18n/label :t/on-keycard))] [row-view - {:type type - :stored stored - :profile-picture profile-picture - :title user-name - :subtitle stored-name - :theme theme - :secondary-color secondary-color}])) + {:type type + :stored stored + :customization-color customization-color + :profile-picture profile-picture + :title user-name + :subtitle stored-name + :theme theme + :secondary-color secondary-color}])) (defn- card-view [theme derivation-path secondary-color on-press] @@ -105,12 +108,13 @@ (def view "Create an account-origin UI component. - | key | values | - | ------------------|------------------------------------------------| - | :type | :default-keypair :recovery-phrase :private-key - | :stored | :on-device :on-keycard - | :profile-picture | image source - | :derivation-path | string - | :user-name | string - | :on-press | function" + | key | values | + | ----------------------|------------------------------------------------| + | :type | :default-keypair :recovery-phrase :private-key + | :stored | :on-device :on-keycard + | :profile-picture | image source + | :customization-color | profile color + | :derivation-path | string + | :user-name | string + | :on-press | function" (quo.theme/with-theme view-internal)) diff --git a/src/quo/core.cljs b/src/quo/core.cljs index 9517b127da0..a72ea57ac77 100644 --- a/src/quo/core.cljs +++ b/src/quo/core.cljs @@ -66,6 +66,7 @@ quo.components.inputs.recovery-phrase.view quo.components.inputs.search-input.view quo.components.inputs.title-input.view + quo.components.ios.drawer-bar.view quo.components.keycard.view quo.components.links.link-preview.view quo.components.links.url-preview-list.view @@ -268,6 +269,9 @@ (def search-input quo.components.inputs.search-input.view/search-input) (def title-input quo.components.inputs.title-input.view/view) +;;;; iOS +(def drawer-bar quo.components.ios.drawer-bar.view/view) + ;;;; Numbered Keyboard (def keyboard-key quo.components.numbered-keyboard.keyboard-key.view/view) (def numbered-keyboard quo.components.numbered-keyboard.numbered-keyboard.view/view) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 5e9e459206d..b5b98d3339b 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -136,7 +136,7 @@ (rf/defn on-return-from-background [{:keys [db now] :as cofx}] - (let [new-account? (get db :onboarding-2/new-account?) + (let [new-account? (get db :onboarding/new-account?) app-in-background-since (get db :app-in-background-since) signed-up? (get-in db [:profile/profile :signed-up?]) requires-bio-auth (and diff --git a/src/status_im/transport/core.cljs b/src/status_im/transport/core.cljs index 862b4cef543..ee389e212d5 100644 --- a/src/status_im/transport/core.cljs +++ b/src/status_im/transport/core.cljs @@ -46,7 +46,7 @@ {:events [::messenger-started]} [{:keys [db] :as cofx} {:keys [mailservers] :as response}] (log/info "Messenger started") - (let [new-account? (get db :onboarding-2/new-account?)] + (let [new-account? (get db :onboarding/new-account?)] (rf/merge cofx {:db (-> db (assoc :messenger/started? true) diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 7deec79a6bb..45ee408cfe2 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -207,7 +207,7 @@ key-uid] :as profile} @(re-frame/subscribe [:profile/profile-with-image]) - customization-color (or (:color @(re-frame/subscribe [:onboarding-2/profile])) + customization-color (or (:color @(re-frame/subscribe [:onboarding/profile])) @(re-frame/subscribe [:profile/customization-color key-uid])) on-share #(re-frame/dispatch [:show-popover {:view :share-chat-key diff --git a/src/status_im2/common/bottom_sheet/style.cljs b/src/status_im2/common/bottom_sheet/style.cljs index 03eb255b7f2..bc8333f0cde 100644 --- a/src/status_im2/common/bottom_sheet/style.cljs +++ b/src/status_im2/common/bottom_sheet/style.cljs @@ -1,19 +1,8 @@ (ns status-im2.common.bottom-sheet.style (:require [quo.foundations.colors :as colors] - [quo.theme :as theme] [react-native.platform :as platform])) -(defn handle - [theme] - {:width 32 - :height 4 - :background-color (colors/theme-colors colors/neutral-100 colors/white theme) - :opacity (theme/theme-value 0.05 0.1 theme) - :border-radius 100 - :align-self :center - :margin-vertical 8}) - (defn sheet [{:keys [top]} window-height selected-item] {:position :absolute diff --git a/src/status_im2/common/bottom_sheet/view.cljs b/src/status_im2/common/bottom_sheet/view.cljs index ea58c7d5d73..896a8c5cc3e 100644 --- a/src/status_im2/common/bottom_sheet/view.cljs +++ b/src/status_im2/common/bottom_sheet/view.cljs @@ -63,7 +63,7 @@ item-height (reagent/atom 0)] (fn [{:keys [hide? insets theme]} {:keys [content selected-item padding-bottom-override border-radius on-close shell? - gradient-cover? customization-color] + gradient-cover? customization-color hide-handle?] :or {border-radius 12}}] (let [{window-height :height} (rn/get-window) bg-opacity (reanimated/use-shared-value 0) @@ -122,7 +122,8 @@ [quo/gradient-cover {:customization-color customization-color :opacity 0.4}]]) - [rn/view {:style (style/handle theme)}] + (when-not hide-handle? + [quo/drawer-bar]) [content]]]]])))) (defn- internal-view diff --git a/src/status_im2/contexts/communities/overview/view.cljs b/src/status_im2/contexts/communities/overview/view.cljs index e164007c0aa..0bc3c40eb5b 100644 --- a/src/status_im2/contexts/communities/overview/view.cljs +++ b/src/status_im2/contexts/communities/overview/view.cljs @@ -366,9 +366,11 @@ (defn community-card-page-view [id] - (let [{:keys [id] + (let [{:keys [id joined] :as community} (rf/sub [:communities/community id]) pending? (rf/sub [:communities/my-pending-request-to-join id])] + (when joined + (rf/dispatch [:activity-center.notifications/dismiss-community-overview id])) [community-scroll-page community pending?])) (defn overview diff --git a/src/status_im2/contexts/onboarding/create_password/view.cljs b/src/status_im2/contexts/onboarding/create_password/view.cljs index 820d33c164f..7134575a4f8 100644 --- a/src/status_im2/contexts/onboarding/create_password/view.cljs +++ b/src/status_im2/contexts/onboarding/create_password/view.cljs @@ -128,7 +128,7 @@ same-password-length? #(and (seq @password) (= (count @password) (count @repeat-password)))] (fn [] - (let [{user-color :color} (rf/sub [:onboarding-2/profile]) + (let [{user-color :color} (rf/sub [:onboarding/profile]) {:keys [long-enough?] :as validations} (password-validations @password) password-strength (calc-password-strength validations) @@ -177,7 +177,7 @@ {:disabled? (not meet-requirements?) :customization-color user-color :on-press #(rf/dispatch - [:onboarding-2/password-set + [:onboarding/password-set (security/mask-data @password)])} (i18n/label :t/password-creation-confirm)]]]])))) diff --git a/src/status_im2/contexts/onboarding/create_profile/view.cljs b/src/status_im2/contexts/onboarding/create_profile/view.cljs index 3227b114a65..95cb07ade8c 100644 --- a/src/status_im2/contexts/onboarding/create_profile/view.cljs +++ b/src/status_im2/contexts/onboarding/create_profile/view.cljs @@ -218,7 +218,7 @@ :type :primary :customization-color @custom-color :on-press (fn [] - (rf/dispatch [:onboarding-2/profile-data-set + (rf/dispatch [:onboarding/profile-data-set {:image-path @profile-pic :display-name @full-name :color @custom-color}])) @@ -232,7 +232,7 @@ (defn create-profile [] (let [{:keys [top]} (safe-area/get-insets) - onboarding-profile-data (rf/sub [:onboarding-2/profile])] + onboarding-profile-data (rf/sub [:onboarding/profile])] [:<> [:f> f-page {:navigation-bar-top top diff --git a/src/status_im2/contexts/onboarding/enable_biometrics/view.cljs b/src/status_im2/contexts/onboarding/enable_biometrics/view.cljs index 8ad8a42c418..f794a8bb8c9 100644 --- a/src/status_im2/contexts/onboarding/enable_biometrics/view.cljs +++ b/src/status_im2/contexts/onboarding/enable_biometrics/view.cljs @@ -27,7 +27,7 @@ [insets] (let [supported-biometric-type (rf/sub [:biometric/supported-type]) bio-type-label (biometric/get-label-by-type supported-biometric-type) - profile-color (or (:color (rf/sub [:onboarding-2/profile])) + profile-color (or (:color (rf/sub [:onboarding/profile])) (rf/sub [:profile/customization-color])) syncing-results? (= :syncing-results @state/root-id)] [rn/view {:style (style/buttons insets)} @@ -36,7 +36,7 @@ :accessibility-label :enable-biometrics-button :icon-left :i/face-id :customization-color profile-color - :on-press #(rf/dispatch [:onboarding-2/enable-biometrics]) + :on-press #(rf/dispatch [:onboarding/enable-biometrics]) :button-label (i18n/label :t/biometric-enable-button {:bio-type-label bio-type-label})}] [quo/button {:accessibility-label :maybe-later-button @@ -45,7 +45,7 @@ :on-press #(rf/dispatch (if syncing-results? [:navigate-to-within-stack [:enable-notifications :enable-biometrics]] - [:onboarding-2/create-account-and-login])) + [:onboarding/create-account-and-login])) :container-style {:margin-top 12}} (i18n/label :t/maybe-later)]])) diff --git a/src/status_im2/contexts/onboarding/enable_notifications/view.cljs b/src/status_im2/contexts/onboarding/enable_notifications/view.cljs index 974b3489ab8..805d4097216 100644 --- a/src/status_im2/contexts/onboarding/enable_notifications/view.cljs +++ b/src/status_im2/contexts/onboarding/enable_notifications/view.cljs @@ -20,7 +20,7 @@ (defn enable-notification-buttons [{:keys [insets]}] - (let [profile-color (rf/sub [:onboarding-2/customization-color])] + (let [profile-color (rf/sub [:onboarding/customization-color])] [rn/view {:style (style/buttons insets)} [quo/button {:on-press (fn [] diff --git a/src/status_im2/contexts/onboarding/enter_seed_phrase/view.cljs b/src/status_im2/contexts/onboarding/enter_seed_phrase/view.cljs index a0c413ccf8f..f03b02c3644 100644 --- a/src/status_im2/contexts/onboarding/enter_seed_phrase/view.cljs +++ b/src/status_im2/contexts/onboarding/enter_seed_phrase/view.cljs @@ -103,7 +103,7 @@ (reset! seed-phrase new-phrase)) on-submit (fn [] (swap! seed-phrase clean-seed-phrase) - (rf/dispatch [:onboarding-2/seed-phrase-entered + (rf/dispatch [:onboarding/seed-phrase-entered (security/mask-data @seed-phrase) set-invalid-seed-phrase]))] (let [words-coll (mnemonic/passphrase->words @seed-phrase) diff --git a/src/status_im2/contexts/onboarding/events.cljs b/src/status_im2/contexts/onboarding/events.cljs index 3295513428a..b9ea1f9ddc3 100644 --- a/src/status_im2/contexts/onboarding/events.cljs +++ b/src/status_im2/contexts/onboarding/events.cljs @@ -24,57 +24,57 @@ (on-success mnemonic keyUID))))))) (rf/defn profile-data-set - {:events [:onboarding-2/profile-data-set]} + {:events [:onboarding/profile-data-set]} [{:keys [db]} onboarding-data] - {:db (update db :onboarding-2/profile merge onboarding-data) + {:db (update db :onboarding/profile merge onboarding-data) :dispatch [:navigate-to-within-stack [:create-profile-password :new-to-status]]}) (rf/defn enable-biometrics - {:events [:onboarding-2/enable-biometrics]} + {:events [:onboarding/enable-biometrics]} [_] - {:biometric/authenticate {:on-success #(rf/dispatch [:onboarding-2/biometrics-done]) - :on-fail #(rf/dispatch [:onboarding-2/biometrics-fail %])}}) + {:biometric/authenticate {:on-success #(rf/dispatch [:onboarding/biometrics-done]) + :on-fail #(rf/dispatch [:onboarding/biometrics-fail %])}}) (rf/defn navigate-to-enable-notifications - {:events [:onboarding-2/navigate-to-enable-notifications]} + {:events [:onboarding/navigate-to-enable-notifications]} [{:keys [db]}] (let [key-uid (get-in db [:profile/profile :key-uid])] - {:db (dissoc db :onboarding-2/profile) + {:db (dissoc db :onboarding/profile) :dispatch [:navigate-to-within-stack [:enable-notifications :enable-biometrics]]})) (rf/defn biometrics-done - {:events [:onboarding-2/biometrics-done]} + {:events [:onboarding/biometrics-done]} [{:keys [db]}] - (let [syncing? (get-in db [:onboarding-2/profile :syncing?])] - {:db (assoc-in db [:onboarding-2/profile :auth-method] constants/auth-method-biometric) + (let [syncing? (get-in db [:onboarding/profile :syncing?])] + {:db (assoc-in db [:onboarding/profile :auth-method] constants/auth-method-biometric) :dispatch (if syncing? - [:onboarding-2/finalize-setup] - [:onboarding-2/create-account-and-login])})) + [:onboarding/finalize-setup] + [:onboarding/create-account-and-login])})) (rf/defn biometrics-fail - {:events [:onboarding-2/biometrics-fail]} + {:events [:onboarding/biometrics-fail]} [cofx code] (biometric/show-message cofx code)) (rf/defn create-account-and-login - {:events [:onboarding-2/create-account-and-login]} + {:events [:onboarding/create-account-and-login]} [{:keys [db] :as cofx}] (let [{:keys [display-name seed-phrase password image-path color] :as profile} - (:onboarding-2/profile db)] + (:onboarding/profile db)] (rf/merge cofx {:dispatch [:navigate-to-within-stack [:generating-keys :new-to-status]] :dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms - :dispatch [:onboarding-2/navigate-to-identifiers]}] + :dispatch [:onboarding/navigate-to-identifiers]}] :db (-> db (dissoc :profile/login) (dissoc :auth-method) - (assoc :onboarding-2/new-account? true))} + (assoc :onboarding/new-account? true))} (if seed-phrase (profile.recover/recover-profile-and-login profile) (profile.create/create-profile-and-login profile))))) (rf/defn on-delete-profile-success - {:events [:onboarding-2/on-delete-profile-success]} + {:events [:onboarding/on-delete-profile-success]} [{:keys [db]} key-uid] (let [multiaccounts (dissoc (:profile/profiles-overview db) key-uid)] (merge @@ -83,18 +83,18 @@ {:set-root :intro})))) (rf/defn password-set - {:events [:onboarding-2/password-set]} + {:events [:onboarding/password-set]} [{:keys [db]} password] (let [supported-type (:biometric/supported-type db)] {:db (-> db - (assoc-in [:onboarding-2/profile :password] password) - (assoc-in [:onboarding-2/profile :auth-method] constants/auth-method-password)) + (assoc-in [:onboarding/profile :password] password) + (assoc-in [:onboarding/profile :auth-method] constants/auth-method-password)) :dispatch (if supported-type [:navigate-to-within-stack [:enable-biometrics :new-to-status]] - [:onboarding-2/create-account-and-login])})) + [:onboarding/create-account-and-login])})) (rf/defn navigate-to-enable-biometrics - {:events [:onboarding-2/navigate-to-enable-biometrics]} + {:events [:onboarding/navigate-to-enable-biometrics]} [{:keys [db]}] (let [supported-type (:biometric/supported-type db)] {:dispatch (if supported-type @@ -102,16 +102,16 @@ [:open-modal :enable-notifications])})) (rf/defn seed-phrase-entered - {:events [:onboarding-2/seed-phrase-entered]} + {:events [:onboarding/seed-phrase-entered]} [_ seed-phrase on-error] {:multiaccount/validate-mnemonic [seed-phrase (fn [mnemonic key-uid] - (re-frame/dispatch [:onboarding-2/seed-phrase-validated + (re-frame/dispatch [:onboarding/seed-phrase-validated mnemonic key-uid])) on-error]}) (rf/defn seed-phrase-validated - {:events [:onboarding-2/seed-phrase-validated]} + {:events [:onboarding/seed-phrase-validated]} [{:keys [db]} seed-phrase key-uid] (if (contains? (:profile/profiles-overview db) key-uid) {:utils/show-confirmation @@ -123,25 +123,25 @@ (re-frame/dispatch [:profile/profile-selected key-uid])) :on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}} - {:db (assoc-in db [:onboarding-2/profile :seed-phrase] seed-phrase) + {:db (assoc-in db [:onboarding/profile :seed-phrase] seed-phrase) :dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]})) (rf/defn navigate-to-create-profile - {:events [:onboarding-2/navigate-to-create-profile]} + {:events [:onboarding/navigate-to-create-profile]} [{:keys [db]}] ;; Restart the flow - {:db (dissoc db :onboarding-2/profile) + {:db (dissoc db :onboarding/profile) :dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]}) (rf/defn onboarding-new-account-finalize-setup - {:events [:onboarding-2/finalize-setup]} + {:events [:onboarding/finalize-setup]} [{:keys [db]}] - (let [masked-password (get-in db [:onboarding-2/profile :password]) + (let [masked-password (get-in db [:onboarding/profile :password]) key-uid (get-in db [:profile/profile :key-uid]) - syncing? (get-in db [:onboarding-2/profile :syncing?]) - biometric-enabled? (= (get-in db [:onboarding-2/profile :auth-method]) + syncing? (get-in db [:onboarding/profile :syncing?]) + biometric-enabled? (= (get-in db [:onboarding/profile :auth-method]) constants/auth-method-biometric)] - (cond-> {:db (assoc db :onboarding-2/generated-keys? true)} + (cond-> {:db (assoc db :onboarding/generated-keys? true)} biometric-enabled? (assoc :keychain/save-password-and-auth-method {:key-uid key-uid @@ -150,16 +150,16 @@ (security/hash-masked-password masked-password)) :on-success (fn [] (if syncing? - (rf/dispatch [:onboarding-2/navigate-to-enable-notifications]) + (rf/dispatch [:onboarding/navigate-to-enable-notifications]) (log/error "successfully saved biometrics"))) :on-error #(log/error "failed to save biometrics" {:key-uid key-uid :error %})})))) (rf/defn navigate-to-identifiers - {:events [:onboarding-2/navigate-to-identifiers]} + {:events [:onboarding/navigate-to-identifiers]} [{:keys [db]}] - (if (:onboarding-2/generated-keys? db) + (if (:onboarding/generated-keys? db) {:dispatch [:navigate-to-within-stack [:identifiers :new-to-status]]} {:dispatch-later [{:ms constants/onboarding-generating-keys-navigation-retry-ms - :dispatch [:onboarding-2/navigate-to-identifiers]}]})) + :dispatch [:onboarding/navigate-to-identifiers]}]})) diff --git a/src/status_im2/contexts/onboarding/identifiers/view.cljs b/src/status_im2/contexts/onboarding/identifiers/view.cljs index 04bb760acd3..fba930de595 100644 --- a/src/status_im2/contexts/onboarding/identifiers/view.cljs +++ b/src/status_im2/contexts/onboarding/identifiers/view.cljs @@ -28,7 +28,7 @@ drag-amount (atom nil) {:keys [emoji-hash display-name compressed-key public-key]} (rf/sub [:profile/profile]) - {:keys [color]} (rf/sub [:onboarding-2/profile]) + {:keys [color]} (rf/sub [:onboarding/profile]) photo-path (rf/sub [:chats/photo-path public-key]) emoji-string (string/join emoji-hash)] (carousel.animation/use-initialize-animation progress paused? true is-dragging? drag-amount) diff --git a/src/status_im2/contexts/onboarding/new_to_status/view.cljs b/src/status_im2/contexts/onboarding/new_to_status/view.cljs index 1d4817751cd..82c2b485e74 100644 --- a/src/status_im2/contexts/onboarding/new_to_status/view.cljs +++ b/src/status_im2/contexts/onboarding/new_to_status/view.cljs @@ -30,7 +30,7 @@ (* 2 56) ;; two other list items (* 2 16) ;; spacing between items 220) ;; extra spacing (top bar) - :on-press #(rf/dispatch [:onboarding-2/navigate-to-create-profile])}] + :on-press #(rf/dispatch [:onboarding/navigate-to-create-profile])}] [rn/view {:style style/subtitle-container} [quo/text {:style style/subtitle diff --git a/src/status_im2/contexts/onboarding/syncing/progress/view.cljs b/src/status_im2/contexts/onboarding/syncing/progress/view.cljs index e8f08dcb697..6df263dd277 100644 --- a/src/status_im2/contexts/onboarding/syncing/progress/view.cljs +++ b/src/status_im2/contexts/onboarding/syncing/progress/view.cljs @@ -39,7 +39,7 @@ (defn view [in-onboarding?] (let [pairing-status (rf/sub [:pairing/pairing-status]) - profile-color (:color (rf/sub [:onboarding-2/profile]))] + profile-color (:color (rf/sub [:onboarding/profile]))] [rn/view {:style (style/page-container in-onboarding?)} (when-not in-onboarding? [background/view true]) [quo/page-nav {:type :no-title :background :blur}] diff --git a/src/status_im2/contexts/onboarding/syncing/results/view.cljs b/src/status_im2/contexts/onboarding/syncing/results/view.cljs index 9c9b9fb1f61..982b793eb8e 100644 --- a/src/status_im2/contexts/onboarding/syncing/results/view.cljs +++ b/src/status_im2/contexts/onboarding/syncing/results/view.cljs @@ -54,7 +54,7 @@ {:on-press (fn [] (when on-press (on-press)) - (rf/dispatch [:onboarding-2/navigate-to-enable-biometrics])) + (rf/dispatch [:onboarding/navigate-to-enable-biometrics])) :accessibility-label :continue-button :customization-color profile-color :container-style style/continue-button} diff --git a/src/status_im2/contexts/onboarding/welcome/view.cljs b/src/status_im2/contexts/onboarding/welcome/view.cljs index aae30b2e8f0..09a4c3e7c79 100644 --- a/src/status_im2/contexts/onboarding/welcome/view.cljs +++ b/src/status_im2/contexts/onboarding/welcome/view.cljs @@ -14,7 +14,7 @@ (defn page-title [] - (let [new-account? (rf/sub [:onboarding-2/new-account?])] + (let [new-account? (rf/sub [:onboarding/new-account?])] [quo/text-combinations {:container-style {:margin-top 12 :margin-horizontal 20} :title (i18n/label (if new-account? @@ -31,7 +31,7 @@ (defn view [] - (let [profile-color (rf/sub [:onboarding-2/customization-color]) + (let [profile-color (rf/sub [:onboarding/customization-color]) {:keys [status-type]} (rf/sub [:multiaccount/current-user-visibility-status]) window (rf/sub [:dimensions/window]) insets (safe-area/get-insets)] diff --git a/src/status_im2/contexts/profile/events.cljs b/src/status_im2/contexts/profile/events.cljs index 2490fd04048..d359f21bf02 100644 --- a/src/status_im2/contexts/profile/events.cljs +++ b/src/status_im2/contexts/profile/events.cljs @@ -43,10 +43,10 @@ {:keys [key-uid]} (first (sort-by :timestamp > (vals profiles)))] (rf/merge cofx (navigation/init-root :profiles) - (init-profiles-overview profiles key-uid) + (when key-uid (init-profiles-overview profiles key-uid)) ;;we check if biometric is available, and try to login with it, ;;if succeed "node.login" signal will be triggered - (profile.login/login-with-biometric-if-available key-uid))) + (when key-uid (profile.login/login-with-biometric-if-available key-uid)))) (navigation/init-root cofx :intro))) (rf/defn update-setting-from-backup diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index f9737409bcb..bf1c803e5c8 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -54,8 +54,8 @@ (let [{:keys [key-uid password]} (get-in db [:syncing :profile]) masked-password (security/mask-data password)] {:db (-> db - (assoc-in [:onboarding-2/profile :password] masked-password) - (assoc-in [:onboarding-2/profile :syncing?] true)) + (assoc-in [:onboarding/profile :password] masked-password) + (assoc-in [:onboarding/profile :syncing?] true)) ::login [key-uid password]})) (rf/defn redirect-to-root @@ -66,8 +66,8 @@ {:db (dissoc db :syncing) :dispatch [:init-root :syncing-results]} - (get db :onboarding-2/new-account?) - {:dispatch [:onboarding-2/finalize-setup]} + (get db :onboarding/new-account?) + {:dispatch [:onboarding/finalize-setup]} :else (rf/merge @@ -140,7 +140,7 @@ (switcher-cards-store/fetch-switcher-cards-rpc)))) (rf/defn login-node-signal - [{{:onboarding-2/keys [recovered-account? new-account?] :as db} :db :as cofx} + [{{:onboarding/keys [recovered-account? new-account?] :as db} :db :as cofx} {:keys [settings account ensUsernames error]}] (log/debug "[signals] node.login" "error" error) (if error diff --git a/src/status_im2/contexts/profile/profiles/view.cljs b/src/status_im2/contexts/profile/profiles/view.cljs index 8b9b44177f5..8022d8a8992 100644 --- a/src/status_im2/contexts/profile/profiles/view.cljs +++ b/src/status_im2/contexts/profile/profiles/view.cljs @@ -77,7 +77,7 @@ key-uid (fn [result] (let [{:keys [error]} (transforms/json->clj result)] - (rf/dispatch [:onboarding-2/on-delete-profile-success key-uid]) + (rf/dispatch [:onboarding/on-delete-profile-success key-uid]) (log/info "profile deleted: error" error)))))}]) (defn show-confirmation diff --git a/src/status_im2/contexts/profile/recover/events.cljs b/src/status_im2/contexts/profile/recover/events.cljs index c398da042a4..f2e5ebb90ae 100644 --- a/src/status_im2/contexts/profile/recover/events.cljs +++ b/src/status_im2/contexts/profile/recover/events.cljs @@ -16,7 +16,7 @@ {:events [:profile.recover/recover-and-login]} [{:keys [db]} {:keys [display-name password image-path color seed-phrase]}] {:db - (assoc db :onboarding-2/recovered-account? true) + (assoc db :onboarding/recovered-account? true) ::restore-profile-and-login (merge (profile.config/create) diff --git a/src/status_im2/contexts/profile/rpc.cljs b/src/status_im2/contexts/profile/rpc.cljs index a7c6a6d6b9e..528c65b8001 100644 --- a/src/status_im2/contexts/profile/rpc.cljs +++ b/src/status_im2/contexts/profile/rpc.cljs @@ -5,8 +5,10 @@ (defn rpc->profiles-overview [{:keys [customizationColor keycard-pairing] :as profile}] - (-> profile - (dissoc :customizationColor) - (assoc :customization-color (keyword customizationColor)) - (assoc :ens-name? (utils.ens/is-valid-eth-name? (:name profile))) - (assoc :keycard-pairing (when-not (string/blank? keycard-pairing) keycard-pairing)))) + (if (map? profile) + (-> profile + (dissoc :customizationColor) + (assoc :customization-color (keyword customizationColor)) + (assoc :ens-name? (utils.ens/is-valid-eth-name? (:name profile))) + (assoc :keycard-pairing (when-not (string/blank? keycard-pairing) keycard-pairing))) + profile)) diff --git a/src/status_im2/contexts/quo_preview/ios/drawer_bar.cljs b/src/status_im2/contexts/quo_preview/ios/drawer_bar.cljs new file mode 100644 index 00000000000..e46676e7168 --- /dev/null +++ b/src/status_im2/contexts/quo_preview/ios/drawer_bar.cljs @@ -0,0 +1,9 @@ +(ns status-im2.contexts.quo-preview.ios.drawer-bar + (:require + [quo.core :as quo] + [status-im2.contexts.quo-preview.preview :as preview])) + +(defn view + [] + [preview/preview-container {} + [quo/drawer-bar]]) diff --git a/src/status_im2/contexts/quo_preview/list_items/account.cljs b/src/status_im2/contexts/quo_preview/list_items/account.cljs index 37001f9c251..361a8f40968 100644 --- a/src/status_im2/contexts/quo_preview/list_items/account.cljs +++ b/src/status_im2/contexts/quo_preview/list_items/account.cljs @@ -9,8 +9,10 @@ :type :select :options [{:key :default} {:key :balance-positive} {:key :balance-neutral} {:key :balance-negative} {:key :tag} {:key :action}]} - {:key :selectable? :type :boolean} {:key :title-icon? :type :boolean} + {:key :state + :type :select + :options [{:key :active} {:key :selected}]} {:key :emoji :type :text} (preview/customization-color-option {:key :account-color}) @@ -20,8 +22,8 @@ (defn view [] (let [state (reagent/atom {:type :default - :selectable? false :title-icon? false + :state :default :customization-color :blue :account-color :purple :emoji "🍑" diff --git a/src/status_im2/contexts/quo_preview/main.cljs b/src/status_im2/contexts/quo_preview/main.cljs index 5cebbb7a8d9..3a9406f7e7a 100644 --- a/src/status_im2/contexts/quo_preview/main.cljs +++ b/src/status_im2/contexts/quo_preview/main.cljs @@ -78,6 +78,7 @@ recovery-phrase-input] [status-im2.contexts.quo-preview.inputs.search-input :as search-input] [status-im2.contexts.quo-preview.inputs.title-input :as title-input] + [status-im2.contexts.quo-preview.ios.drawer-bar :as drawer-bar] [status-im2.contexts.quo-preview.keycard.keycard :as keycard] [status-im2.contexts.quo-preview.links.link-preview :as link-preview] [status-im2.contexts.quo-preview.links.url-preview :as url-preview] @@ -309,6 +310,8 @@ :component search-input/view} {:name :title-input :component title-input/view}] + :ios [{:name :drawer-bar + :component drawer-bar/view}] :numbered-keyboard [{:name :keyboard-key :component keyboard-key/view} {:name :numbered-keyboard diff --git a/src/status_im2/contexts/shell/activity_center/events.cljs b/src/status_im2/contexts/shell/activity_center/events.cljs index ab1db10fb2b..e0274d66485 100644 --- a/src/status_im2/contexts/shell/activity_center/events.cljs +++ b/src/status_im2/contexts/shell/activity_center/events.cljs @@ -202,6 +202,12 @@ :utils/dispatch-later [{:dispatch [:activity-center.notifications/mark-all-as-read] :ms undo-time-limit-ms}]})) +(re-frame/reg-event-fx :activity-center.notifications/dismiss-community-overview + (fn [_ [community-id]] + {:json-rpc/call [{:method "wakuext_dismissActivityCenterNotificationsByCommunity" + :params [{:communityId community-id}] + :on-success [:activity-center.notifications/fetch-unread-count]}]})) + (rf/defn accept-notification {:events [:activity-center.notifications/accept]} [{:keys [db]} notification-id] diff --git a/src/status_im2/contexts/shell/activity_center/notification/community_kicked/view.cljs b/src/status_im2/contexts/shell/activity_center/notification/community_kicked/view.cljs index c09c027b13d..2584ce48a26 100644 --- a/src/status_im2/contexts/shell/activity_center/notification/community_kicked/view.cljs +++ b/src/status_im2/contexts/shell/activity_center/notification/community_kicked/view.cljs @@ -1,6 +1,7 @@ (ns status-im2.contexts.shell.activity-center.notification.community-kicked.view (:require [quo.core :as quo] + [react-native.gesture :as gesture] [status-im2.contexts.shell.activity-center.notification.common.style :as common-style] [status-im2.contexts.shell.activity-center.notification.common.view :as common] [utils.datetime :as datetime] @@ -26,18 +27,22 @@ community-name (:name community) community-image (get-in community [:images :thumbnail :uri])] [swipeable props - [quo/activity-log - {:title (i18n/label :t/community-kicked-heading) - :customization-color customization-color - :icon :i/placeholder - :on-layout set-swipeable-height - :timestamp (datetime/timestamp->relative timestamp) - :unread? (not read) - :context [[quo/text {:style common-style/user-avatar-tag-text} - (i18n/label :t/community-kicked-body)] - [quo/context-tag - {:type :community - :size 24 - :blur? true - :community-logo community-image - :community-name community-name}]]}]])) + [gesture/touchable-without-feedback + {:on-press (fn [] + (rf/dispatch [:navigate-back]) + (rf/dispatch [:activity-center.notifications/mark-as-read (:id notification)]))} + [quo/activity-log + {:title (i18n/label :t/community-kicked-heading) + :customization-color customization-color + :icon :i/placeholder + :on-layout set-swipeable-height + :timestamp (datetime/timestamp->relative timestamp) + :unread? (not read) + :context [[quo/text {:style common-style/user-avatar-tag-text} + (i18n/label :t/community-kicked-body)] + [quo/context-tag + {:type :community + :size 24 + :blur? true + :community-logo community-image + :community-name community-name}]]}]]])) diff --git a/src/status_im2/contexts/shell/activity_center/notification/community_request/view.cljs b/src/status_im2/contexts/shell/activity_center/notification/community_request/view.cljs index db17dd05607..b14ffc93082 100644 --- a/src/status_im2/contexts/shell/activity_center/notification/community_request/view.cljs +++ b/src/status_im2/contexts/shell/activity_center/notification/community_request/view.cljs @@ -1,6 +1,7 @@ (ns status-im2.contexts.shell.activity-center.notification.community-request.view (:require [quo.core :as quo] + [react-native.gesture :as gesture] [status-im2.constants :as constants] [status-im2.contexts.shell.activity-center.notification.common.style :as common-style] [status-im2.contexts.shell.activity-center.notification.common.view :as common] @@ -67,11 +68,15 @@ {:keys [header-text context]} (get-header-text-and-context community membership-status)] [swipeable props - [quo/activity-log - {:title header-text - :customization-color customization-color - :icon :i/communities - :on-layout set-swipeable-height - :timestamp (datetime/timestamp->relative timestamp) - :unread? (not read) - :context context}]])) + [gesture/touchable-without-feedback + {:on-press (fn [] + (rf/dispatch [:navigate-back]) + (rf/dispatch [:navigate-to :community-overview community-id]))} + [quo/activity-log + {:title header-text + :customization-color customization-color + :icon :i/communities + :on-layout set-swipeable-height + :timestamp (datetime/timestamp->relative timestamp) + :unread? (not read) + :context context}]]])) diff --git a/src/status_im2/contexts/wallet/account/tabs/about/view.cljs b/src/status_im2/contexts/wallet/account/tabs/about/view.cljs index 942d16bddaa..3b0e7168c5f 100644 --- a/src/status_im2/contexts/wallet/account/tabs/about/view.cljs +++ b/src/status_im2/contexts/wallet/account/tabs/about/view.cljs @@ -2,8 +2,8 @@ (:require [quo.core :as quo] [react-native.core :as rn] + [status-im2.contexts.profile.utils :as profile.utils] [status-im2.contexts.wallet.account.tabs.about.style :as style] - [status-im2.contexts.wallet.common.temp :as temp] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -34,9 +34,10 @@ (defn view [] - (let [{:keys [type address]} (rf/sub [:wallet/current-viewing-account]) - networks (rf/sub [:wallet/network-details]) - watch-only? (= type :watch)] + (let [{:keys [customization-color] :as profile} (rf/sub [:profile/profile-with-image]) + {:keys [type address path]} (rf/sub [:wallet/current-viewing-account]) + networks (rf/sub [:wallet/network-details]) + watch-only? (= type :watch)] [rn/view {:style style/about-tab} [quo/data-item {:description :default @@ -53,4 +54,12 @@ :format :long}]) :container-style {:margin-bottom 12} :on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])}] - (when (not watch-only?) [quo/account-origin temp/account-origin-state])])) + (when (not watch-only?) + [quo/account-origin + {:type :default-keypair + :stored :on-device + :profile-picture (profile.utils/photo profile) + :customization-color customization-color + :derivation-path path + :user-name (profile.utils/displayed-name profile) + :on-press #(js/alert "To be implemented")}])])) diff --git a/src/status_im2/contexts/wallet/common/account_switcher/view.cljs b/src/status_im2/contexts/wallet/common/account_switcher/view.cljs index aebbd0bcf5d..2bccfe55ceb 100644 --- a/src/status_im2/contexts/wallet/common/account_switcher/view.cljs +++ b/src/status_im2/contexts/wallet/common/account_switcher/view.cljs @@ -9,6 +9,7 @@ networks (rf/sub [:wallet/network-details])] [quo/page-nav {:icon-name :i/close + :background :blur :on-press on-press :accessibility-label accessibility-label :networks networks @@ -16,7 +17,6 @@ :right-side :account-switcher :account-switcher {:customization-color color :on-press #(rf/dispatch [:show-bottom-sheet - {:content account-options/view - :gradient-cover? true - :customization-color color}]) + {:content account-options/view + :hide-handle? true}]) :emoji emoji}}])) diff --git a/src/status_im2/contexts/wallet/common/sheets/account_options/style.cljs b/src/status_im2/contexts/wallet/common/sheets/account_options/style.cljs index e95dbad2649..77001a7ec65 100644 --- a/src/status_im2/contexts/wallet/common/sheets/account_options/style.cljs +++ b/src/status_im2/contexts/wallet/common/sheets/account_options/style.cljs @@ -4,3 +4,33 @@ {:padding-horizontal 20 :padding-top 12 :padding-bottom 8}) + +(def options-container + {:position :absolute + :top 0 + :left 0 + :right 0 + :z-index 1 + :overflow :hidden}) + +(defn blur-container + [height] + {:height height + :position :absolute + :top 0 + :left 0 + :right 0}) + +(def gradient-container + {:position :absolute + :top 0 + :left 0 + :right 0}) + +(def divider-label + {:margin-top 8}) + +(defn list-container + [padding-top] + {:padding-top padding-top + :margin-horizontal 8}) diff --git a/src/status_im2/contexts/wallet/common/sheets/account_options/view.cljs b/src/status_im2/contexts/wallet/common/sheets/account_options/view.cljs index 66470baf5c2..0904b9cc5bd 100644 --- a/src/status_im2/contexts/wallet/common/sheets/account_options/view.cljs +++ b/src/status_im2/contexts/wallet/common/sheets/account_options/view.cljs @@ -1,18 +1,46 @@ (ns status-im2.contexts.wallet.common.sheets.account-options.view - (:require [quo.core :as quo] + (:require [oops.core :as oops] + [quo.core :as quo] [quo.foundations.colors :as colors] quo.theme + [react-native.blur :as blur] [react-native.clipboard :as clipboard] [react-native.core :as rn] + [react-native.gesture :as gesture] + [react-native.platform :as platform] + [reagent.core :as reagent] [status-im2.contexts.wallet.common.sheets.account-options.style :as style] - [status-im2.contexts.wallet.common.temp :as temp] [utils.i18n :as i18n] [utils.re-frame :as rf])) -(defn- view-internal - [{:keys [theme]}] +(defn- render-account-item + [{:keys [color address] :as account}] + [quo/account-item + {:account-props (assoc account :customization-color color) + :on-press (fn [] + (rf/dispatch [:wallet/switch-current-viewing-account address]) + (rf/dispatch [:hide-bottom-sheet]))}]) + +(defn- options + [{:keys [theme show-account-selector? options-height]}] (let [{:keys [name color emoji address]} (rf/sub [:wallet/current-viewing-account])] - [:<> + [rn/view + {:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height")) + :style (when show-account-selector? style/options-container)} + (when show-account-selector? + [blur/view + {:style (style/blur-container @options-height) + :blur-radius (if platform/android? 20 10) + :blur-amount (if platform/ios? 20 10) + :blur-type (quo.theme/theme-value (if platform/ios? :light :xlight) :dark theme) + :overlay-color (quo.theme/theme-value colors/white-70-blur + colors/neutral-95-opa-70-blur + theme)}]) + [rn/view {:style style/gradient-container} + [quo/gradient-cover + {:customization-color color + :opacity 0.4}]] + [quo/drawer-bar] [quo/drawer-top {:title name :type :account @@ -39,17 +67,34 @@ {:icon :i/share :accessibility-label :share-account :label (i18n/label :t/share-account)} - {:icon :i/delete + {:add-divider? (not show-account-selector?) + :icon :i/delete :accessibility-label :remove-account :label (i18n/label :t/remove-account) :danger? true}]]] - [quo/divider-line {:container-style {:margin-top 8}}] - [quo/section-label - {:section (i18n/label :t/select-another-account) - :container-style style/drawer-section-label}] - [rn/flat-list - {:data temp/other-accounts - :render-fn (fn [account] [quo/account-item {:account-props account}]) - :style {:margin-horizontal 8}}]])) + (when show-account-selector? + [:<> + [quo/divider-line {:container-style style/divider-label}] + [quo/section-label + {:section (i18n/label :t/select-another-account) + :container-style style/drawer-section-label}]])])) + +(defn- view-internal + [] + (let [options-height (reagent/atom 0)] + (fn [{:keys [theme]}] + (let [accounts (rf/sub [:wallet/accounts-without-current-viewing-account]) + show-account-selector? (pos? (count accounts))] + [:<> + (when show-account-selector? + [gesture/flat-list + {:data accounts + :render-fn render-account-item + :content-container-style (style/list-container @options-height) + :shows-vertical-scroll-indicator false}]) + [options + {:show-account-selector? show-account-selector? + :theme theme + :options-height options-height}]])))) (def view (quo.theme/with-theme view-internal)) diff --git a/src/status_im2/contexts/wallet/common/temp.cljs b/src/status_im2/contexts/wallet/common/temp.cljs index 8362b37a340..ad4f6c20828 100644 --- a/src/status_im2/contexts/wallet/common/temp.cljs +++ b/src/status_im2/contexts/wallet/common/temp.cljs @@ -1,10 +1,8 @@ (ns status-im2.contexts.wallet.common.temp (:require - [clojure.string :as string] [quo.foundations.resources :as quo.resources] [react-native.core :as rn] [status-im2.common.resources :as status.resources] - [status-im2.constants :as constants] [utils.i18n :as i18n])) (defn wallet-overview-state @@ -48,112 +46,6 @@ (def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4") -(def data-item-state - {:description :default - :icon-right? true - :right-icon :i/options - :card? true - :label :none - :status :default - :size :default - :title "Address" - :customization-color :yellow}) - -(def account-origin-state - {:type :default-keypair - :stored :on-keycard - :profile-picture (status.resources/get-mock-image :user-picture-male5) - :derivation-path (string/replace constants/path-default-wallet #"/" " / ") - :user-name "Alisher Yakupov" - :on-press #(js/alert "pressed")}) - -(defn dapps-list - [{:keys [on-press-icon]}] - [{:dapp {:avatar (quo.resources/get-dapp :coingecko) - :name "Coingecko" - :value "coingecko.com"} - :state :default - :action :icon - :on-press-icon on-press-icon} - {:dapp {:avatar (quo.resources/get-dapp :uniswap) - :name "Uniswap" - :value "uniswap.org"} - :state :default - :action :icon - :on-press-icon on-press-icon}]) - -(def other-accounts - [{:customization-color :flamingo - :emoji "🍿" - :name "New House" - :address "0x21af6E0Ba4C4530735616e1Ee7ff5FbCB726f493" - :networks [{:network-name :ethereum :short-name "eth"} - {:network-name :optimism :short-name "opt"}]} - {:customization-color :blue - :emoji "🎮" - :name "My savings" - :address "0x43cf6E0Ba4C4530735616e1Ee7ff5FbCB726f98d" - :networks [{:network-name :ethereum :short-name "eth"}]}]) - -(def asset-snt - {:size 24 - :type :token - :token-name "SNT" - :amount 1500 - :token-logo (quo.resources/get-token :snt)}) - -(def piggy-bank - {:size 24 - :type :account - :account-name "Piggy bank" - :emoji "🐷"}) - -(def aretha-gosling - {:size 24 - :type :default - :full-name "Aretha Gosling" - :profile-picture (status.resources/mock-images :user-picture-female2)}) - -(def mainnet - {:size 24 - :type :network - :network-logo (quo.resources/get-network :ethereum) - :network-name "Mainnet"}) - -(def activity-list - [{:date "Today" - :transaction :send - :timestamp "Today 22:20" - :status :pending - :counter 1 - :first-tag asset-snt - :second-tag-prefix :t/from - :second-tag piggy-bank - :third-tag-prefix :t/to - :third-tag aretha-gosling - :fourth-tag-prefix :t/via - :fourth-tag mainnet - :blur? false} - {:date "Yesterday" - :transaction :receive - :timestamp "Yesterday 22:20" - :status :pending - :counter 1 - :first-tag asset-snt - :second-tag-prefix :t/from - :second-tag piggy-bank - :third-tag-prefix :t/to - :third-tag aretha-gosling - :fourth-tag-prefix :t/via - :fourth-tag mainnet - :blur? false}]) - -(def collectible-list - [(status.resources/get-mock-image :collectible1) - (status.resources/get-mock-image :collectible2) - (status.resources/get-mock-image :collectible3) - (status.resources/get-mock-image :collectible4)]) - (def buy-tokens-list [{:title "Ramp" :description :text diff --git a/src/status_im2/contexts/wallet/events.cljs b/src/status_im2/contexts/wallet/events.cljs index 8394d46d92e..63547567445 100644 --- a/src/status_im2/contexts/wallet/events.cljs +++ b/src/status_im2/contexts/wallet/events.cljs @@ -45,6 +45,10 @@ :ms 300}]] [:dispatch [:wallet/show-account-created-toast address]]]})) +(rf/reg-event-fx :wallet/switch-current-viewing-account + (fn [{:keys [db]} [address]] + {:db (assoc-in db [:wallet :current-viewing-account-address] address)})) + (rf/reg-event-fx :wallet/close-account-page (fn [{:keys [db]}] {:db (update db :wallet dissoc :current-viewing-account-address) diff --git a/src/status_im2/subs/onboarding.cljs b/src/status_im2/subs/onboarding.cljs index e37b0e60243..815331d0c33 100644 --- a/src/status_im2/subs/onboarding.cljs +++ b/src/status_im2/subs/onboarding.cljs @@ -3,10 +3,10 @@ [re-frame.core :as re-frame])) (re-frame/reg-sub - :onboarding-2/customization-color - :<- [:onboarding-2/profile] + :onboarding/customization-color + :<- [:onboarding/profile] :<- [:profile/customization-color] - :<- [:onboarding-2/new-account?] + :<- [:onboarding/new-account?] (fn [[{:keys [color]} customization-color new-account?]] (if new-account? color diff --git a/src/status_im2/subs/root.cljs b/src/status_im2/subs/root.cljs index c8b1eb1658d..19100c2f7a5 100644 --- a/src/status_im2/subs/root.cljs +++ b/src/status_im2/subs/root.cljs @@ -61,9 +61,9 @@ (reg-root-key-sub :initials-avatar-font-file :initials-avatar-font-file) ;;onboarding -(reg-root-key-sub :onboarding-2/generated-keys? :onboarding-2/generated-keys?) -(reg-root-key-sub :onboarding-2/new-account? :onboarding-2/new-account?) -(reg-root-key-sub :onboarding-2/profile :onboarding-2/profile) +(reg-root-key-sub :onboarding/generated-keys? :onboarding/generated-keys?) +(reg-root-key-sub :onboarding/new-account? :onboarding/new-account?) +(reg-root-key-sub :onboarding/profile :onboarding/profile) ;;shell (reg-root-key-sub :shell/switcher-cards :shell/switcher-cards) diff --git a/src/status_im2/subs/wallet/wallet.cljs b/src/status_im2/subs/wallet/wallet.cljs index d95f3f9a3ad..a3e712b5381 100644 --- a/src/status_im2/subs/wallet/wallet.cljs +++ b/src/status_im2/subs/wallet/wallet.cljs @@ -86,5 +86,16 @@ (string/starts-with? (string/lower-case (:symbol %)) (string/lower-case query))) sorted-tokens)] - (println filtered-tokens "3421342342432") filtered-tokens))) + +(rf/reg-sub + :wallet/current-viewing-account-address + :<- [:wallet] + :-> :current-viewing-account-address) + +(rf/reg-sub + :wallet/accounts-without-current-viewing-account + :<- [:wallet/accounts] + :<- [:wallet/current-viewing-account-address] + (fn [[accounts current-viewing-account-address]] + (remove #(= (:address %) current-viewing-account-address) accounts))) diff --git a/src/status_im2/subs/wallet/wallet_test.cljs b/src/status_im2/subs/wallet/wallet_test.cljs index 5f690f8b2a1..1a2aa321b3c 100644 --- a/src/status_im2/subs/wallet/wallet_test.cljs +++ b/src/status_im2/subs/wallet/wallet_test.cljs @@ -193,3 +193,40 @@ (testing "watch address activity state with has-activity value" (swap! rf-db/app-db #(assoc-in % [:wallet :ui :watch-address-activity-state] :has-activity)) (is (= :has-activity (rf/sub [sub-name]))))) + +(h/deftest-sub :wallet/current-viewing-account-address + [sub-name] + (testing "returns the address of the current viewing account" + (swap! rf-db/app-db #(assoc-in % [:wallet :current-viewing-account-address] "0x1")) + (is (= "0x1" (rf/sub [sub-name]))))) + +(h/deftest-sub :wallet/accounts-without-current-viewing-account + [sub-name] + (testing "returns the accounts list without the current viewing account in it" + (swap! rf-db/app-db + #(-> % + (assoc-in [:wallet :accounts] accounts) + (assoc-in [:wallet :current-viewing-account-address] "0x2"))) + (is + (= (list + {:path "m/44'/60'/0'/0/0" + :emoji "😃" + :key-uid "0x2f5ea39" + :address "0x1" + :wallet false + :name "Account One" + :type :generated + :chat false + :test-preferred-chain-ids #{5 420 421613} + :color :blue + :hidden false + :prod-preferred-chain-ids #{1 10 42161} + :position 0 + :clock 1698945829328 + :created-at 1698928839000 + :operable "fully" + :mixedcase-address "0x7bcDfc75c431" + :public-key "0x04371e2d9d66b82f056bc128064" + :removed false + :tokens tokens-0x1}) + (rf/sub [sub-name]))))) diff --git a/status-go-version.json b/status-go-version.json index 7c6e1db2f2e..6607cf86c8f 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.171.26", - "commit-sha1": "d92284edcee9f2af5d7f34644796fa5492892720", - "src-sha256": "0gjnw0jcwj37a5hmvhc56dm29dcyargmjb0bz9bdbdhdrsjfw9yp" + "version": "v0.171.27", + "commit-sha1": "76b6745666b945f8d6336e2a5fc6e5705985273d", + "src-sha256": "1amak99bpsx6j8grzm2kzwd3si34gg4r8kbxqmnkfsrkm2nzvbx1" } diff --git a/yarn.lock b/yarn.lock index 1f1e4a537be..d93b9281ee6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9657,10 +9657,10 @@ shadow-cljs-jar@1.3.4: resolved "https://registry.yarnpkg.com/shadow-cljs-jar/-/shadow-cljs-jar-1.3.4.tgz#0939d91c468b4bc5eab5a958f79e7ef5696fdf62" integrity sha512-cZB2pzVXBnhpJ6PQdsjO+j/MksR28mv4QD/hP/2y1fsIa9Z9RutYgh3N34FZ8Ktl4puAXaIGlct+gMCJ5BmwmA== -shadow-cljs@2.25.0: - version "2.25.0" - resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.25.0.tgz#b100254ce2a04e0eb085babdc8d59da8a4435a7c" - integrity sha512-q0TEMUZC5FPuB2fmFZY7nvy+b2pvlOx1C6g9Qx6sckYT24NMqCsALk7Q/c0rC+fySP8mh3HoUU0tAdF5LqqG0w== +shadow-cljs@2.26.2: + version "2.26.2" + resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.26.2.tgz#c9d443940d679c33696009598b01e02a176f6a67" + integrity sha512-xBJxBxSpfoVQLSDA+WN+ZgtnyA5qYf3EE4ARZpov0JOz0YBTdIQajnNYMs5+5OzCbbNfhWGLybyu/Pj4dIwsWw== dependencies: node-libs-browser "^2.2.1" readline-sync "^1.4.7"