diff --git a/doc/README.md b/doc/README.md index a4eeefaa09..6f10ce415f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -33,7 +33,7 @@ ## Misc -- [Importing icons from Figma into project](export-icons.md) +- [Importing assets from Figma into project](import-assets.md) - [Updating Status APK builds for the F-Droid Android application catalogue](fdroid.md) - [Troubleshooting for known errors](troubleshooting.md) diff --git a/doc/export-icons.md b/doc/import-assets.md similarity index 77% rename from doc/export-icons.md rename to doc/import-assets.md index 9d12f5cab4..fb973da3b3 100644 --- a/doc/export-icons.md +++ b/doc/import-assets.md @@ -1,6 +1,6 @@ -# new icons +# Importing assets from Figma into project -## Export icons +## Icons ![](images/export-icons/export-icons.gif) @@ -13,3 +13,11 @@ ``` 2x@2x 4. If you want platform specific icon use `.android` or `.ios` suffixes. Example `icon_name@2x.android.png`.:w + +## Images + +Make sure to compress images before using into project. +``` +make shell +./scrips/compress_image.sh image_path +``` diff --git a/nix/shell.nix b/nix/shell.nix index 9601a79c1b..4c387e4e2c 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -24,6 +24,8 @@ in mkShell { clojure maven watchman # other nice to have stuff yarn nodejs python310 maestro + # Required for /scripts/compress_image.sh script + imagemagick ] # and some special cases ++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl idb-companion ] ++ appleSDKFrameworks) ++ lib.optionals (!stdenv.isDarwin) [ gcc8 ] diff --git a/resources/images/ui2/preparing-status@2x.png b/resources/images/ui2/preparing-status@2x.png index 057fc44fca..b90b8947ac 100644 Binary files a/resources/images/ui2/preparing-status@2x.png and b/resources/images/ui2/preparing-status@2x.png differ diff --git a/resources/images/ui2/preparing-status@3x.png b/resources/images/ui2/preparing-status@3x.png index 1fd01822d6..0fe535a0c5 100644 Binary files a/resources/images/ui2/preparing-status@3x.png and b/resources/images/ui2/preparing-status@3x.png differ diff --git a/scripts/compress_image.sh b/scripts/compress_image.sh new file mode 100755 index 0000000000..c79e1226b1 --- /dev/null +++ b/scripts/compress_image.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +input_file="$1" +backup_file="${input_file%.png}.bak.png" +output_file="$input_file" + +cp "$input_file" "$backup_file" + +magick "$input_file" -quality 100 -define png:compression-level=9 -strip -colors 256 "$output_file" + +if [ $? -eq 0 ]; then + echo "Image compression completed: $input_file" + echo "Backup created: $backup_file" +else + mv "$backup_file" "$input_file" + echo "Error during image compression" + exit 1 +fi diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 87b1b86a9d..c30899def9 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -161,10 +161,12 @@ :as token} (rf/sub [:wallet/wallet-send-token]) send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts]) - {token-balance :total-balance - :as token-by-symbol} (rf/sub [:wallet/token-by-symbol + {:keys [total-balance] + :as token-by-symbol} (rf/sub [:wallet/token-by-symbol (str token-symbol) enabled-from-chain-ids]) + token-balance (or default-limit-crypto total-balance) + usd-conversion-rate (utils/token-usd-price token) currency (rf/sub [:profile/currency]) conversion-rate (-> token :market-values-per-currency @@ -174,18 +176,21 @@ utils/token-usd-price utils/one-cent-value utils/calc-max-crypto-decimals) - [input-state set-input-state] (rn/use-state - (-> controlled-input/init-state - (controlled-input/set-upper-limit - (utils/cut-crypto-decimals-to-fit-usd-cents - (or default-limit-crypto token-balance) - conversion-rate)))) + [input-state set-input-state] (rn/use-state controlled-input/init-state) clear-input! #(set-input-state controlled-input/delete-all) currency-symbol (rf/sub [:profile/currency-symbol]) loading-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) route (rf/sub [:wallet/wallet-send-route]) crypto-decimals (or token-decimals default-crypto-decimals) + max-limit (if crypto-currency? + (utils/cut-crypto-decimals-to-fit-usd-cents + token-balance + usd-conversion-rate) + (-> (money/crypto->fiat + token-balance + conversion-rate) + utils/cut-fiat-balance-to-two-decimals)) input-value (controlled-input/input-value input-state) valid-input? (not (or (controlled-input/empty-value? input-state) (controlled-input/input-error input-state))) @@ -286,6 +291,10 @@ app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)] #(.remove app-keyboard-listener)))) (hot-reload/use-safe-unmount on-navigate-back) + (rn/use-effect + (fn [] + (set-input-state #(controlled-input/set-upper-limit % max-limit))) + [max-limit]) (rn/use-effect (fn [] (when input-error (debounce/clear-all)) diff --git a/src/status_im/contexts/wallet/sheets/account_origin/view.cljs b/src/status_im/contexts/wallet/sheets/account_origin/view.cljs index b0626de2ae..0e09367986 100644 --- a/src/status_im/contexts/wallet/sheets/account_origin/view.cljs +++ b/src/status_im/contexts/wallet/sheets/account_origin/view.cljs @@ -5,7 +5,8 @@ [react-native.core :as rn] [status-im.constants :as const] [status-im.contexts.wallet.sheets.account-origin.style :as style] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (defn- header [text] @@ -41,5 +42,5 @@ :size 24 :icon-left :i/info :container-style style/action-container - :on-press #(rn/open-url const/create-account-link)} + :on-press #(rf/dispatch [:open-url const/create-account-link])} (i18n/label :t/read-more)]]) diff --git a/src/status_im/contexts/wallet/sheets/buy_token/view.cljs b/src/status_im/contexts/wallet/sheets/buy_token/view.cljs index 8ec15f48ea..b5d00f1694 100644 --- a/src/status_im/contexts/wallet/sheets/buy_token/view.cljs +++ b/src/status_im/contexts/wallet/sheets/buy_token/view.cljs @@ -9,7 +9,8 @@ (defn- crypto-on-ramp-item [{:keys [name description fees logo-url site-url recurrent-site-url]} _ _ {:keys [tab]}] (let [open-url (rn/use-callback (fn [] - (rn/open-url (if (= tab :recurrent) recurrent-site-url site-url))) + (rf/dispatch [:open-url + (if (= tab :recurrent) recurrent-site-url site-url)])) [site-url recurrent-site-url tab])] [quo/settings-item {:title name diff --git a/src/status_im/contexts/wallet/wallet_connect/events/session_responses.cljs b/src/status_im/contexts/wallet/wallet_connect/events/session_responses.cljs index 29f4a467f7..31ad394a4b 100644 --- a/src/status_im/contexts/wallet/wallet_connect/events/session_responses.cljs +++ b/src/status_im/contexts/wallet/wallet_connect/events/session_responses.cljs @@ -148,7 +148,7 @@ :sessionJson transforms/json->clj data-store/get-dapp-redirect-url))] - {:fx [[:open-url redirect-url]]}))) + {:fx [[:effects/open-url redirect-url]]}))) (rf/reg-event-fx :wallet-connect/dismiss-request-modal diff --git a/src/status_im/contexts/wallet/wallet_connect/events/session_responses_test.cljs b/src/status_im/contexts/wallet/wallet_connect/events/session_responses_test.cljs index e25ecd643b..4c390ed5bc 100644 --- a/src/status_im/contexts/wallet/wallet_connect/events/session_responses_test.cljs +++ b/src/status_im/contexts/wallet/wallet_connect/events/session_responses_test.cljs @@ -23,5 +23,5 @@ data-store/get-dapp-redirect-url (fn [_] "native://redirect-url")] - (is (match? {:fx [[:open-url "native://redirect-url"]]} + (is (match? {:fx [[:effects/open-url "native://redirect-url"]]} (dispatch [event-id])))))) diff --git a/src/status_im/navigation/events.cljs b/src/status_im/navigation/events.cljs index 3aff05c62c..55fa4ea746 100644 --- a/src/status_im/navigation/events.cljs +++ b/src/status_im/navigation/events.cljs @@ -146,8 +146,12 @@ (rf/reg-event-fx :open-share open-share) +(rf/reg-event-fx :open-url + (fn [_ [url]] + {:fx [[:effects/open-url url]]})) + (rf/reg-fx - :open-url + :effects/open-url (fn [url] (when (not (string/blank? url)) (.openURL ^js react/linking (url/normalize-url url)))))