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 ## 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) - [Updating Status APK builds for the F-Droid Android application catalogue](fdroid.md)
- [Troubleshooting for known errors](troubleshooting.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) ![](images/export-icons/export-icons.gif)
@ -13,3 +13,11 @@
``` ```
2x@2x 2x@2x
4. If you want platform specific icon use `.android` or `.ios` suffixes. Example `icon_name@2x.android.png`.:w 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 clojure maven watchman
# other nice to have stuff # other nice to have stuff
yarn nodejs python310 maestro yarn nodejs python310 maestro
# Required for /scripts/compress_image.sh script
imagemagick
] # and some special cases ] # and some special cases
++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl idb-companion ] ++ appleSDKFrameworks) ++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl idb-companion ] ++ appleSDKFrameworks)
++ lib.optionals (!stdenv.isDarwin) [ gcc8 ] ++ 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 :as
token} (rf/sub [:wallet/wallet-send-token]) token} (rf/sub [:wallet/wallet-send-token])
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts]) send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
{token-balance :total-balance {:keys [total-balance]
:as token-by-symbol} (rf/sub [:wallet/token-by-symbol :as token-by-symbol} (rf/sub [:wallet/token-by-symbol
(str token-symbol) (str token-symbol)
enabled-from-chain-ids]) 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]) currency (rf/sub [:profile/currency])
conversion-rate (-> token conversion-rate (-> token
:market-values-per-currency :market-values-per-currency
@ -174,18 +176,21 @@
utils/token-usd-price utils/token-usd-price
utils/one-cent-value utils/one-cent-value
utils/calc-max-crypto-decimals) utils/calc-max-crypto-decimals)
[input-state set-input-state] (rn/use-state [input-state set-input-state] (rn/use-state controlled-input/init-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))))
clear-input! #(set-input-state controlled-input/delete-all) clear-input! #(set-input-state controlled-input/delete-all)
currency-symbol (rf/sub [:profile/currency-symbol]) currency-symbol (rf/sub [:profile/currency-symbol])
loading-routes? (rf/sub loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?]) [:wallet/wallet-send-loading-suggested-routes?])
route (rf/sub [:wallet/wallet-send-route]) route (rf/sub [:wallet/wallet-send-route])
crypto-decimals (or token-decimals default-crypto-decimals) 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) input-value (controlled-input/input-value input-state)
valid-input? (not (or (controlled-input/empty-value? input-state) valid-input? (not (or (controlled-input/empty-value? input-state)
(controlled-input/input-error input-state))) (controlled-input/input-error input-state)))
@ -286,6 +291,10 @@
app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)] app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)]
#(.remove app-keyboard-listener)))) #(.remove app-keyboard-listener))))
(hot-reload/use-safe-unmount on-navigate-back) (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 (rn/use-effect
(fn [] (fn []
(when input-error (debounce/clear-all)) (when input-error (debounce/clear-all))

View File

@ -5,7 +5,8 @@
[react-native.core :as rn] [react-native.core :as rn]
[status-im.constants :as const] [status-im.constants :as const]
[status-im.contexts.wallet.sheets.account-origin.style :as style] [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 (defn- header
[text] [text]
@ -41,5 +42,5 @@
:size 24 :size 24
:icon-left :i/info :icon-left :i/info
:container-style style/action-container :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)]]) (i18n/label :t/read-more)]])

View File

@ -9,7 +9,8 @@
(defn- crypto-on-ramp-item (defn- crypto-on-ramp-item
[{:keys [name description fees logo-url site-url recurrent-site-url]} _ _ {:keys [tab]}] [{:keys [name description fees logo-url site-url recurrent-site-url]} _ _ {:keys [tab]}]
(let [open-url (rn/use-callback (fn [] (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])] [site-url recurrent-site-url tab])]
[quo/settings-item [quo/settings-item
{:title name {:title name

View File

@ -148,7 +148,7 @@
:sessionJson :sessionJson
transforms/json->clj transforms/json->clj
data-store/get-dapp-redirect-url))] data-store/get-dapp-redirect-url))]
{:fx [[:open-url redirect-url]]}))) {:fx [[:effects/open-url redirect-url]]})))
(rf/reg-event-fx (rf/reg-event-fx
:wallet-connect/dismiss-request-modal :wallet-connect/dismiss-request-modal

View File

@ -23,5 +23,5 @@
data-store/get-dapp-redirect-url data-store/get-dapp-redirect-url
(fn [_] "native://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])))))) (dispatch [event-id]))))))

View File

@ -146,8 +146,12 @@
(rf/reg-event-fx :open-share open-share) (rf/reg-event-fx :open-share open-share)
(rf/reg-event-fx :open-url
(fn [_ [url]]
{:fx [[:effects/open-url url]]}))
(rf/reg-fx (rf/reg-fx
:open-url :effects/open-url
(fn [url] (fn [url]
(when (not (string/blank? url)) (when (not (string/blank? url))
(.openURL ^js react/linking (url/normalize-url url))))) (.openURL ^js react/linking (url/normalize-url url)))))