From 73bbfa7d3116a3199df95dc6e0f339b4f95038f9 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Thu, 17 Nov 2022 21:19:54 +0400 Subject: [PATCH] =?UTF-8?q?Fix=20Metro=20Warnings=20=E2=9A=A0=EF=B8=8F=20(?= =?UTF-8?q?#14389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: metro warnings ⚠️ --- .../images/icons2/32x32/identicon-ring@2x.png | Bin 0 -> 1775 bytes .../images/icons2/32x32/identicon-ring@3x.png | Bin 0 -> 2469 bytes src/quo2/components/avatars/user_avatar.cljs | 6 +- .../components/drawers/action_drawers.cljs | 108 +++++++++--------- src/quo2/components/icons/icons.clj | 3 +- src/react_native/navigation.cljs | 3 + src/status_im/ui2/screens/chat/actions.cljs | 54 +++++---- .../components/message_home_item/view.cljs | 6 +- .../ui2/screens/chat/components/reply.cljs | 8 +- src/status_im/ui2/screens/chat/home.cljs | 2 +- src/status_im2/navigation/core.cljs | 5 + src/status_im2/navigation/events.cljs | 3 +- src/status_im2/setup/dev.cljs | 19 ++- 13 files changed, 124 insertions(+), 93 deletions(-) create mode 100644 resources/images/icons2/32x32/identicon-ring@2x.png create mode 100644 resources/images/icons2/32x32/identicon-ring@3x.png diff --git a/resources/images/icons2/32x32/identicon-ring@2x.png b/resources/images/icons2/32x32/identicon-ring@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..5142b86d37fb8566e211690c2e0def6a0c67a7e2 GIT binary patch literal 1775 zcmVO?hjE7}l9#9p5pcLqVL_h+50R)Wg=vc0UH<# zOH~N$)_`64LMtFfe=8<6Obmua6c%Hd0jQ__3krs$M92csrm&aL9gj3=h+5?tRU05H zobGOzKKkJRdbkKg+~gJ28lox#ocu@*2@PR5Bs`z2N4$GPL{K3W8Q?QYY;J*ZI#f{y zupycx1}gCe1!cm$PU3$WnNmI2aFw)$CqNgeh~-{9uXs@H!qPd zj>&P(@K^(If_&$QI8ajCQW}ko$QbQ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ybI{w3yEint`&~%^M>jr zDROZXo8MkyYk7r|UZ_~Bl3tj&u-7wCFP>0RiOfCUKV8yyo+ZCA!k!?cR`bMI)C(j| zl+yEA%6?}^Ju^Ejh2V0zW=mavfmlvLP-dXUqpzbMyxK8DM!s~ zedUVRuS6B7XVM`l6!wMy9Hv#w;LFFhCECQyNF~CvRQ=+l`dvCeNrw%=YwrSZ2AZ>I zC!qL7dH#YbsM-KomJFfV=@Ej%PHGcY2sivq>ruZ=t8ghHI_#BIF2T`7gC5$_bIa)K z%~4p4Ee0^6dqzeH(tiq4%I)RX=jpUx=6T7Y(52VsrI>=u#Hf9g=OwU_{{fyOl)|eD RVvhg-002ovPDHLkV1hpBI$Zz& literal 0 HcmV?d00001 diff --git a/resources/images/icons2/32x32/identicon-ring@3x.png b/resources/images/icons2/32x32/identicon-ring@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..3da71b20f3341dd53eedd45f89466618385936d3 GIT binary patch literal 2469 zcmV;W30n4vP)zgP;+QY1nV29^gbg_IBgd{ux5eM`fvrf`b?nuWI%*sHD% z8YuXw3||!RW=>`Ke|{C-3%xmnB{FdJ#T+fcV?0wp)!I2WpK~F+ID)eB$Ay=EOL=&N zCklAuHFb_HEQiL#8A!ZTgsTdWP{VO{A*dGL2`?1kiUQ0gq=p6l1=ENC+w$;DN-}Gff8Nz(R@&-pbc8)0Ek2#eZAlwLRtnU`_ zhCzjsPJ|>4eey<5r4xkPyG8hd{MHH^ocwn5NnZ-M^qM-u3F}-D+77#azqAy%Bi07UQan-yJIzvm>mp-^S{VZ*D~o^0pfD88#oE0O{ez!ncpe%B%|5yS6dMNKpc7;gbR0Pb5v;dQELw%dr2gwGpdatH&uXX{c-4V43TB4dXd)R zj@bGgMq`;uf2!ep{fXH6T|=f?&eor7^nlpmVEg@x3_@Q0@m<2KpaWSrPJZ5Y`fANnWO^l|+E!B=sIk5Bo1jPqy$B$Y{d&z#6{0_qKU_xH-YfIEK6Y8Y{y=$efNpZ@q;Te%J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KQ25~v`v0t-JG zEx==ZQ9uA%w1V#b%$P7I^ddLc)G)PNv?{iYN_~Q0>N?Eh^>Syki$r>;!%N789?Fw5s jw_;QgiIHMZ1YXZ)JBR&mlskx-00000NkvXXu0mjfGclP_ literal 0 HcmV?d00001 diff --git a/src/quo2/components/avatars/user_avatar.cljs b/src/quo2/components/avatars/user_avatar.cljs index 5c78b66fe5..3f2629578a 100644 --- a/src/quo2/components/avatars/user_avatar.cljs +++ b/src/quo2/components/avatars/user_avatar.cljs @@ -126,10 +126,8 @@ :height outer-dimensions :border-radius outer-dimensions}} (when (and ring? identicon?) - [icons/icon :main-icons/identicon-ring {:width outer-dimensions - :height outer-dimensions - :size outer-dimensions - :no-color true}]) + [icons/icon :i/identicon-ring {:size outer-dimensions + :no-color true}]) (if profile-picture ;; display image [fast-image/fast-image {:source {:uri profile-picture} diff --git a/src/quo2/components/drawers/action_drawers.cljs b/src/quo2/components/drawers/action_drawers.cljs index 427cf96fc9..22f8f504c5 100644 --- a/src/quo2/components/drawers/action_drawers.cljs +++ b/src/quo2/components/drawers/action_drawers.cljs @@ -9,54 +9,6 @@ (colors/theme-colors colors/danger-50 colors/danger-60) (colors/theme-colors colors/neutral-50 colors/neutral-40))) -(defn action [{:keys [icon - label - sub-label - right-icon - danger? - on-press] :as action-props}] - (when action-props - [rn/touchable-opacity {:on-press on-press} - [rn/view {:style - {:height (if sub-label 56 47) - :margin-horizontal 20 - :flex-direction :row}} - [rn/view {:style - {:height 20 - :margin-top :auto - :margin-bottom :auto - :margin-right 12 - :width 20}} - [icon/icon icon - {:color (get-icon-color danger?) - :size 20}]] - [rn/view - {:style - {:flex 1 - :justify-content :center}} - [text/text - {:size :paragraph-1 - :weight :medium - :style {:color - (when danger? - (colors/theme-colors colors/danger-50 colors/danger-60))}} - label] - (when sub-label - [text/text - {:size :paragraph-2 - :style {:color - (colors/theme-colors colors/neutral-50 colors/neutral-40)}} - sub-label])] - (when right-icon - [rn/view {:style - {:height 20 - :margin-top :auto - :margin-bottom :auto - :width 20}} - [icon/icon right-icon - {:color (get-icon-color danger?) - :size 20}]])]])) - (defn divider [] [rn/view {:style {:border-top-width 1 :border-top-color (colors/theme-colors colors/neutral-10 colors/neutral-80) @@ -65,10 +17,60 @@ :align-items :center :flex-direction :row}}]) +(defn action [{:keys [icon + label + sub-label + right-icon + danger? + on-press + add-divider?] :as action-props}] + (when action-props + [:<> {:key label} + (when add-divider? [divider]) + [rn/touchable-opacity {:on-press on-press} + [rn/view {:style + {:height (if sub-label 56 47) + :margin-horizontal 20 + :flex-direction :row}} + [rn/view {:style + {:height 20 + :margin-top :auto + :margin-bottom :auto + :margin-right 12 + :width 20}} + [icon/icon icon + {:color (get-icon-color danger?) + :size 20}]] + [rn/view + {:style + {:flex 1 + :justify-content :center}} + [text/text + {:size :paragraph-1 + :weight :medium + :style {:color + (when danger? + (colors/theme-colors colors/danger-50 colors/danger-60))}} + label] + (when sub-label + [text/text + {:size :paragraph-2 + :style {:color + (colors/theme-colors colors/neutral-50 colors/neutral-40)}} + sub-label])] + (when right-icon + [rn/view {:style + {:height 20 + :margin-top :auto + :margin-bottom :auto + :width 20}} + [icon/icon right-icon + {:color (get-icon-color danger?) + :size 20}]])]]])) + (defn action-drawer [sections] - [:<> {:style - {:flex 1}} - (interpose - [divider] + [:<> + (doall (for [actions sections] - (map action actions)))]) + (doall + (map action actions))))]) diff --git a/src/quo2/components/icons/icons.clj b/src/quo2/components/icons/icons.clj index 7fbe9b0a21..1bf6fb833a 100644 --- a/src/quo2/components/icons/icons.clj +++ b/src/quo2/components/icons/icons.clj @@ -30,4 +30,5 @@ (get-icons 12) (get-icons 16) (get-icons 20) - (get-icons 24))) + (get-icons 24) + (get-icons 32))) diff --git a/src/react_native/navigation.cljs b/src/react_native/navigation.cljs index 7e7f2d81ee..9c756455b3 100644 --- a/src/react_native/navigation.cljs +++ b/src/react_native/navigation.cljs @@ -27,6 +27,9 @@ (defn show-overlay [comp] (.showOverlay Navigation (clj->js comp))) +(defn pop-to-root [tab] + (.popToRoot Navigation (clj->js tab))) + (defn dissmiss-overlay [comp] (.catch (.dismissOverlay Navigation comp) #())) diff --git a/src/status_im/ui2/screens/chat/actions.cljs b/src/status_im/ui2/screens/chat/actions.cljs index 640a881aa7..03f5d1ec0d 100644 --- a/src/status_im/ui2/screens/chat/actions.cljs +++ b/src/status_im/ui2/screens/chat/actions.cljs @@ -8,18 +8,19 @@ [status-im.constants :as constants] [quo2.components.drawers.action-drawers :as drawer])) -(defn- entry [{:keys [icon label on-press danger? sub-label chevron?]}] +(defn- entry [{:keys [icon label on-press danger? sub-label chevron? add-divider?]}] {:pre [(keyword? icon) (string? label) (fn? on-press) (boolean? danger?) (boolean? chevron?)]} - {:icon icon - :label label - :on-press on-press - :danger? danger? - :sub-label sub-label - :right-icon (when chevron? :i/chevron-right)}) + {:icon icon + :label label + :on-press on-press + :danger? danger? + :sub-label sub-label + :right-icon (when chevron? :i/chevron-right) + :add-divider? add-divider?}) (defn hide-sheet-and-dispatch [event] (rf/dispatch [:bottom-sheet/hide]) @@ -91,20 +92,22 @@ :chevron? true}))) (defn mark-as-read-entry [chat-id] - (entry {:icon :i/correct - :label (i18n/label :t/mark-as-read) - :on-press #(mark-all-read-action chat-id) - :danger? false - :sub-label nil - :chevron? false})) + (entry {:icon :i/correct + :label (i18n/label :t/mark-as-read) + :on-press #(mark-all-read-action chat-id) + :danger? false + :sub-label nil + :chevron? false + :add-divider? true})) (defn clear-history-entry [chat-id] - (entry {:icon :i/delete - :label (i18n/label :t/clear-history) - :on-press #(clear-history-action chat-id) - :danger? true - :sub-label nil - :chevron? false})) + (entry {:icon :i/delete + :label (i18n/label :t/clear-history) + :on-press #(clear-history-action chat-id) + :danger? true + :sub-label nil + :chevron? false + :add-divider? true})) (defn delete-chat-entry [item] (entry {:icon :i/delete @@ -203,12 +206,13 @@ :chevron? false})) (defn mark-untrustworthy-entry [] - (entry {:icon :i/alert - :label (i18n/label :t/mark-untrustworthy) - :on-press #(js/alert "TODO: to be implemented, requires status-go impl.") - :danger? true - :sub-label nil - :chevron? false})) + (entry {:icon :i/alert + :label (i18n/label :t/mark-untrustworthy) + :on-press #(js/alert "TODO: to be implemented, requires status-go impl.") + :danger? true + :sub-label nil + :chevron? false + :add-divider? true})) (defn block-user-entry [item] (entry {:icon :i/block diff --git a/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs b/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs index 77715e6428..47074a86a2 100644 --- a/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs +++ b/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs @@ -91,9 +91,9 @@ (if group-chat [quo2/group-avatar {:color color :size :medium}] - [quo2/user-avatar {:full-name display-name - :profile-picture photo-path - :size :small}])) + [quo2/user-avatar {:full-name display-name + :profile-picture photo-path + :size :small}])) (defn messages-home-item [item] (let [{:keys [chat-id diff --git a/src/status_im/ui2/screens/chat/components/reply.cljs b/src/status_im/ui2/screens/chat/components/reply.cljs index 0762ecb2b5..5b9ee199d7 100644 --- a/src/status_im/ui2/screens/chat/components/reply.cljs +++ b/src/status_im/ui2/screens/chat/components/reply.cljs @@ -68,11 +68,11 @@ :size :label :weight :regular :accessibility-label :quoted-message + :ellipsize-mode :tail :style (merge - {:ellipsize-mode :tail - :text-transform :none - :margin-left 4 - :margin-top 2} + {:text-transform :none + :margin-left 4 + :margin-top 2} (when (or (= constants/content-type-image content-type) (= constants/content-type-sticker content-type) (= constants/content-type-audio content-type)) diff --git a/src/status_im/ui2/screens/chat/home.cljs b/src/status_im/ui2/screens/chat/home.cljs index bd50a9a7de..6af3939c60 100644 --- a/src/status_im/ui2/screens/chat/home.cljs +++ b/src/status_im/ui2/screens/chat/home.cljs @@ -195,7 +195,7 @@ {:id :sent :label (i18n/label :t/sent)}]}] [list/flat-list - {:key-fn :first + {:key-fn :chat-id :data (if (= @selected-requests-tab :received) received-requests sent-requests) :render-fn received-cr-item/received-cr-item}]]))]) diff --git a/src/status_im2/navigation/core.cljs b/src/status_im2/navigation/core.cljs index 24d26dea3c..df03f7651b 100644 --- a/src/status_im2/navigation/core.cljs +++ b/src/status_im2/navigation/core.cljs @@ -325,3 +325,8 @@ :change-root-status-bar-style-fx (fn [style] (navigation/merge-options "shell-stack" {:statusBar {:style style}}))) + +(re-frame/reg-fx + :pop-to-root-tab-fx + (fn [tab] + (navigation/pop-to-root tab))) diff --git a/src/status_im2/navigation/events.cljs b/src/status_im2/navigation/events.cljs index bf2e9ce0b9..249baa69d9 100644 --- a/src/status_im2/navigation/events.cljs +++ b/src/status_im2/navigation/events.cljs @@ -40,7 +40,8 @@ (rf/defn change-tab {:events [:navigate-change-tab]} [_ tab] - {:change-tab-fx tab}) + ;{:change-tab-fx tab} ; TODO: effect needs to be implemented (may not be possible: https://github.com/wix/react-native-navigation/issues/4837) + ) (rf/defn navigate-replace {:events [:navigate-replace]} diff --git a/src/status_im2/setup/dev.cljs b/src/status_im2/setup/dev.cljs index 89f75969fb..6ea9afca40 100644 --- a/src/status_im2/setup/dev.cljs +++ b/src/status_im2/setup/dev.cljs @@ -4,7 +4,24 @@ [status-im.ethereum.json-rpc :as json-rpc] ["react-native" :refer (DevSettings LogBox)])) -(.ignoreAllLogs LogBox) +;; Only ignore warnings/errors that cannot be fixed for the time being. +;; When you add a warning to be ignored explain below why it is ignored and how it can be fixed. +;; When a warning is fixed make sure to remove it from here. +(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')" + "Cannot read property 'message' of undefined" + "InternalError Metro has encountered an error" + "undefined Unable to resolve module `parse-svg-path`" + "group12"])) + +;; List of ignored warnings/errors: +;; 1. "evaluating 'e.message'": Not sure why this error is happening, but it is coming from here +;; @walletconnect/jsonrpc-utils/dist/esm/error.js parseConnectionError() method +;; 2. "Cannot read property 'message' of undefined": same as 1, but for Android +;; 3. "InternalError Metro has encountered an error": an error that happens when losing connection to metro, can be safely ignored +;; 4. "undefined Unable to resolve module `parse-svg-path`": an error that happens when losing connection to metro, can be safely ignored +;; 5. "group12": referring to the group-icon size 12x12. Currently, it is not available. When the design team adds it to the +;; icon set it will be added to project. + (defn setup [] (rf/set-mergeable-keys #{:filters/load-filters