Merge branch 'develop' into cl-fix-send-keyboard-closing

This commit is contained in:
Lungu Cristian 2024-09-23 17:10:03 +03:00 committed by GitHub
commit 4ace350cd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 65 additions and 17 deletions

View File

@ -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)

View File

@ -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
```

View File

@ -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 ]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 KiB

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 345 KiB

23
scripts/compress_image.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <input_image.png>"
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

View File

@ -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))

View File

@ -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)]])

View File

@ -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

View File

@ -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

View File

@ -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]))))))

View File

@ -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)))))