Compare commits

..
Author SHA1 Message Date
Richard Ramos 301b2bc6f7 refactor: do not keep active conn to storenodes 2023-12-05 08:44:40 -04:00
frank d039864dca fix: Duplicate 'Contact Added' Notifications When Pair-Device User Accepts Request (#17975)
https://github.com/status-im/status-go/compare/4cc53630...d7e7792b
2023-12-05 19:12:31 +08:00
Alexander a4f1f23d3c Style fixes for pinned messages (#18061)
* Style fixes for pinned messages

* Small code style update
2023-12-05 11:31:45 +01:00
flexsurfer fe20fa4e99 move transport (#18062) 2023-12-05 09:35:17 +01:00
Omar Basem 5c30fd847a Wallet: account real data (#17821)
* wallet: account real data
2023-12-05 10:56:37 +04:00
John Ngei 64de325678 update scan qr code page
* update scan qr code page

* update scan qr code page

* fixed: populate the search input with new identity

* dismiss keyboard when scan qr page is activated
2023-12-05 02:56:27 +03:00
Volodymyr Kozieiev 489557c1a3 Match the changes in collectibles api in status-go (#18033) 2023-12-04 16:44:56 +00:00
Icaro Motta 439fdfa12c Rename effects to :effects.*/* and move them to separate namespaces (#18047) 2023-12-04 12:55:57 -03:00
Mohsen f695dbf115 [#17909] fix: unhandled error when app launched in offline mode (#17973) 2023-12-04 17:48:45 +03:00
flexsurfer 7c45b1e075 update deps (#18056) 2023-12-04 14:49:51 +01:00
flexsurfer 64453716b0 rename onboarding 2 (#18060) 2023-12-04 14:49:05 +01:00
Mohamed Javid 56d135f1f8 Implemented Wallet - Account Switcher (#18003)
This commit:

- Implements the Wallet Account Switcher for easy switching between wallet accounts
- Updates the About tab in the accounts screen to display the correct account address and derivation path along with the profile.
- Updates the account-item component to pass the state from the parent and refactors the depreciated color functions
- Moves the handle-bar in the bottom sheet to a standalone component 
- Adds customization-color in account-origin component

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-12-04 18:47:03 +05:30
Mohsen a7178a4950 [#17572] fix: 'Join Community' notification is not getting dismissed (#17834) 2023-12-04 15:24:06 +03:00
Siddarth Kumar 3cd302b271 fix: get rid of :redef-in-file warning (#18053) 2023-12-04 14:18:43 +05:30
yqrashawn 1e797273b6 fix: change system time backward break image server (#17989) 2023-12-04 16:12:50 +08:00
frank 8ff67bf344 fix: Cannot mark as read messages in communities (#18029)
* fix: Cannot mark as read messages in communities

* rename messenger-response to _messenger-response
2023-12-02 09:05:21 +08:00
Ulises Manuel 3fee21c73a [#17923] text combinations - standard title component (#17939)
* Simplify tag components by turning them to from-1

* Add standard-title component, preview screen and tests
2023-12-01 15:49:49 -06:00
Jamie Caprani f9f328107d chore: add ability to create watch address & some related ui changes on account page (#17868) 2023-12-01 04:29:01 -08:00
Yevheniia Berdnyk 04dee8be45 e2e: updated data for waku backup test 2023-12-01 12:28:26 +02:00
Alexander 52f7fc59ee Updated data-item, monospaced & aligned address (#18008)
* Upd

* Fix
2023-12-01 10:03:08 +01:00
Mohamed Javid b5202b4d28 [Feature] Added activity check on entered watch address (#17970)
This commit 
 - implements the activity check for the entered watch address.
 - added warning colors
 - fixes bottom inset in add address to watch screen

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-12-01 00:28:09 +05:30
Andrea Maria Piana 210cf64ce0 Fix panic syncing community token gated
https://github.com/status-im/status-go/compare/8a4c2d8d...8206ffc7
2023-11-30 13:49:47 +00:00
Lungu Cristian ed270b2162 Enabling biometry without password during sync (#17960)
* feat: added migration for the keychain hashed password

* feat: added sync biometry without password entry

* fix: biometry typo from develop

* ref: moved migration side-effects outside the event

* ref: some renaming for keychain migration

* ref: addressed @cammellos' review comments

* ref: removed unnecessary anon fn

* fix: addressed @ilmotta's review comments

* ref: removed theme from enable-biometrics

* ref: addressed J-Son89's review comments

* test: added tests for mask-data and hash-masked-password

* test: added schema to hash-masked-password and fixed test

* fix: forgot the threading

* ref: improved the masked data schema

* fix: no biometry error when canceled by user

* fix: biometry error wasn't propagated during login

* fix: alert dismiss button not passed properly

* fix: show biometrics NOT_ENROLLED error only once

* lint: removed unused require
2023-11-30 13:40:29 +02:00
Andrea Maria Piana d412fa3c63 Set up skeleton for communities request to join 2023-11-30 09:49:43 +00:00
Yevheniia Berdnyk b7f675aa5c e2e: fix for deep links test 2023-11-30 01:09:42 +02:00
Volodymyr Kozieiev bfa23c182f Add requirement for component tests (#18015) 2023-11-29 18:50:49 +00:00
Mohsen 6b721265af [#17986] feat: implement new settings ui, header section (#17991) 2023-11-29 20:54:11 +03:00
Jamie CapraniandRende11 589a581298 chore(wallet): add ui for send page (#17786) - merged in (#18017)
---------
Co-authored-by: Rende11 <artamonovn@gmail.com>
2023-11-29 05:12:21 -08:00
Yevheniia Berdnyk 0546a87e9a e2e: deep links tests added 2023-11-29 14:09:31 +02:00
Parvesh Monu e5ce7fed3a fix position of the last item in the community chat list and the position of the jump-to button (#17999) 2023-11-29 16:45:30 +05:30
Siddarth Kumar 58d5c3d7a5 don't restrict diawi upload for iOS release builds (#18016)
This commit removes the restriction of uploading iOS release builds to Diawi

Its helpful to have the status app uploaded to Diawi to test release builds on our iPhones.

The installer is very straightforward and makes life easier when we want to try out release builds.
2023-11-28 22:46:58 +05:30
Ibrahem Khalil 6ccea1ddb2 Continue button is invisible behind keyboard in Add Address To Watch … (#17940) 2023-11-28 18:38:06 +02:00
Alex Tumanov a9a17aaae8 Implement dropdown-input based on the original dropdown component (#17927) 2023-11-28 15:21:15 +00:00
194 changed files with 3649 additions and 1874 deletions
-1
View File
@@ -95,7 +95,6 @@ react-native.fs/unlink
react-native.fs/file-exists?
status-im.ui.components.colors/white
status-im.ui.components.colors/black
status-im.transport.core-test/messages
status-im.ui.components.core/animated-header
status-im.ui.components.core/safe-area-provider
status-im.ui.components.core/safe-area-consumer
+1
View File
@@ -32,6 +32,7 @@
"letsubs" :binding
"with-let" "let"
"reg-event-fx" :arg1-pair
"reg-fx" :arg1-pair
"testing" :arg1-body
"deftest-sub" :arg1-body
"wait-for" :arg1-body
@@ -27,18 +27,23 @@ class StatusOkHttpClientFactory implements OkHttpClientFactory {
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 @@ class StatusOkHttpClientFactory implements OkHttpClientFactory {
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 "";
}
}
}
-1
View File
@@ -77,7 +77,6 @@ pipeline {
}
}
stage('Upload') {
when { expression { !utils.isReleaseBuild() } }
steps { script {
env.DIAWI_URL = ios.uploadToDiawi()
env.PKG_URL = env.DIAWI_URL
+1 -1
View File
@@ -716,7 +716,7 @@ src
- `src/js`: Raw Javascript files, e.g. React Native Reanimated worklets.
- `src/mocks`: Plumbing configuration to be able to run tests.
- `src/quo/`: The component library for Status Mobile.
- `src/quo/`: The component library for Status Mobile. [Read more...](../src/quo/README.md)
- `src/react_native/`: Contains only low-level constructs to help React Native
work in tandem with Clojure(Script).
- `src/status_im2/`: Directory where we try to be as strict as possible about
+1 -1
View File
@@ -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",
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+3 -2
View File
@@ -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.
+11
View File
@@ -116,6 +116,17 @@ rendered. We use [React Native Testing Library](https://callstack.github.io/reac
There are dozens of examples in the repository, so use them as a reference. A
good and complete example is [quo.components.avatars.user-avatar.component-spec](/src/quo/components/avatars/user_avatar/component_spec.cljs)
### No-props test
When writing tests for the component that has props, please add one test that covers situation when props aren't passed. Because even if component not showing anything meaningful without props, it shouldn't crash.
```clojure
(h/describe "Transaction Progress"
(h/test "component renders without props"
(h/render [quo/transaction-progress {}])
(h/is-truthy (h/get-by-label-text :transaction-progress)))
```
## Do not couple the library with re-frame
Don't use re-frame inside this library (e.g. dispatch & subscribe). If a
@@ -30,6 +30,6 @@
{:accessibility-label :account-emoji
:adjusts-font-size-to-fit true
:style {:font-size emoji-size}}
(string/trim emoji)]]))
(when emoji (string/trim emoji))]]))
(def view (quo.theme/with-theme view-internal))
@@ -67,7 +67,7 @@
[rn/text
{:style (style/emoji-size size)
:accessibility-label :emoji}
(string/trim emoji)])
(when emoji (string/trim emoji))])
[lock locked? size theme]])
(def view (quo.theme/with-theme view-internal))
@@ -56,6 +56,6 @@
:size (:font-size (size properties))
:weight (if monospace? :monospace (:font-weight (size properties)))
:style (style/text customization-color neutral? theme)}
(if lowercase? (string/lower-case initials) initials)]]))
(if (and initials lowercase?) (string/lower-case initials) initials)]]))
(def wallet-user-avatar (quo.theme/with-theme view-internal))
@@ -0,0 +1,56 @@
(ns quo.components.dropdowns.dropdown-input.component-spec
(:require
[quo.components.dropdowns.dropdown-input.view :as dropdown-input]
[test-helpers.component :as h]))
(h/describe "Dropdown Input"
(h/test "default render"
(let [header-label "Label"
label "Dropdown"]
(h/render [dropdown-input/view
{:label? true
:header-label
header-label} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-text header-label))
(h/is-truthy (h/get-by-text label))))
(h/test "render with icon"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:icon? true
:icon-name
:i/wallet
:label? true}
label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-label-text :left-icon))
(h/is-truthy (h/get-by-text label))))
(h/test "render in active state"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:state :active
:label?
true} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-label-text :right-icon "Expecting active state icon"))))
(h/test "render in disabled state"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:state :disabled
:label? true} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-disabled (h/get-by-text label "Dropdown should be disabled in disabled state"))))
(h/test "on-press"
(let [event (h/mock-fn)
label "Dropdown"]
(h/render [dropdown-input/view
{:on-press event
:label?
true} label])
(h/fire-event :press (h/get-by-text label))
(h/was-called event))))
@@ -0,0 +1,49 @@
(ns quo.components.dropdowns.dropdown-input.properties
(:require
[quo.foundations.colors :as colors]))
(def icon-size 20)
(defn- grey-blur
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-70 theme)
:right-icon-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-80-opa-20
colors/white-opa-40
theme)
(colors/theme-colors colors/neutral-80-opa-10
colors/white-opa-10
theme))})
(defn- outline
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:right-icon-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(colors/theme-colors colors/neutral-30 colors/neutral-70 theme))})
(defn- grey
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:right-icon-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(colors/theme-colors colors/neutral-20
colors/neutral-60
theme))})
(defn get-colors
[{:keys [theme state blur?]}]
(let [active? (= state :active)]
(cond
blur? (grey-blur theme active?)
(= theme :dark) (outline theme active?)
(= theme :light) (grey theme active?))))
@@ -0,0 +1,62 @@
(ns quo.components.dropdowns.dropdown-input.style
(:require
[quo.foundations.colors :as colors]))
(def gap 8)
(def blur-view
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0})
(def left-icon
{:margin-right gap})
(defn right-icon
[theme]
{:color (colors/theme-colors colors/neutral-100 colors/white theme)
:margin-right gap})
(defn header-label
[theme blur?]
{:color (if blur?
(colors/theme-colors colors/neutral-80-opa-40
colors/white-opa-70
theme)
(colors/theme-colors colors/neutral-50
colors/neutral-40
theme))
:margin-bottom gap})
(def root-container
{:width "100%"
:height 40})
(defn container
[{:keys [background-color border-color]}
{:keys [icon? state]}]
(cond-> {:align-items :center
:justify-content :space-between
:flex-direction :row
:padding-vertical 9
:padding-left 16
:padding-right 12
:overflow :hidden
:background-color background-color
:border-radius 12}
icon?
(assoc :padding-left 12)
border-color
(assoc :border-color border-color
:border-width 1)
(= state :disabled)
(assoc :opacity 0.3)))
(def right-half-container
{:flex-direction :row
:align-items :center})
@@ -0,0 +1,68 @@
(ns quo.components.dropdowns.dropdown-input.view
(:require
[quo.components.dropdowns.dropdown-input.properties :as properties]
[quo.components.dropdowns.dropdown-input.style :as style]
[quo.components.icon :as icon]
[quo.components.markdown.text :as text]
[quo.theme :as theme]
[react-native.core :as rn]))
(defn- view-internal
[{:keys [state theme on-press icon?
label? blur?
accessibility-label header-label]
:or {state :default
icon? true
label? true
blur? false
header-label "Label"}
:as props}
label]
(let [{:keys [left-icon-color right-icon-color right-icon-color-2]
:as colors} (properties/get-colors props)
right-icon (if (= state :active) :i/pullup :i/dropdown)]
[rn/view
{:style style/root-container}
(when label?
[text/text
{:size :paragraph-2
:weight :medium
:align :left
:style (style/header-label theme blur?)} header-label])
[rn/pressable
{:accessibility-label (or accessibility-label :dropdown)
:disabled (= state :disabled)
:on-press on-press
:style (style/container colors props)}
[rn/view
{:style style/right-half-container}
(when icon?
[icon/icon
:i/placeholder
{:accessibility-label :left-icon
:color left-icon-color
:size properties/icon-size
:container-style style/left-icon}])
[text/text
{:size :paragraph-1
:weight :regular
:number-of-lines 1
:style (style/right-icon theme)}
label]]
[icon/icon
right-icon
{:size properties/icon-size
:accessibility-label :right-icon
:color right-icon-color
:color-2 right-icon-color-2}]]]))
(def view
"Props:
- state: :default (default) | :active | :disabled
- label: string
- header-label: string
- icon?: boolean
- label?: boolean
- blur?: boolean
- on-press: function"
(theme/with-theme view-internal))
@@ -11,6 +11,7 @@
(case k
:success (colors/resolve-color :success theme)
:error (colors/resolve-color :danger theme)
:warning (colors/resolve-color :warning theme)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)))
(defn view-internal
@@ -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})
@@ -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))
@@ -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"
@@ -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
+35 -55
View File
@@ -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))}]])
(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]
:or {customization-color :blue
type :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])]]))))
(colors/resolve-color customization-color theme))}]])
(defn- internal-view
[props]
[:f> f-internal-view props])
[_]
(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}]
[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]
(= 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))
@@ -36,7 +36,7 @@
:blur? false
:type :digit} 1])
(h/is-truthy (h/query-by-label-text :text-label))
(h/fire-event :press (h/query-by-label-text :keyboard-key))
(h/fire-event :press (h/query-by-label-text :keyboard-key-1))
(h/was-called on-press)))
(h/test "Is not pressable when disabled is true"
@@ -47,5 +47,5 @@
:blur? false
:type :digit} 1])
(h/is-truthy (h/query-by-label-text :text-label))
(h/fire-event :press (h/query-by-label-text :keyboard-key))
(h/fire-event :press (h/query-by-label-text :keyboard-key-1))
(h/was-not-called on-press))))
@@ -7,6 +7,11 @@
[react-native.core :as rn]
[reagent.core :as reagent]))
(defn- label->accessibility-label
[label]
(let [label-name (if (keyword? label) (name label) label)]
(keyword (str "keyboard-key-" label-name))))
(defn- view-internal
[]
(let [pressed? (reagent/atom false)]
@@ -14,9 +19,11 @@
(let [label-color (style/get-label-color disabled? theme blur?)
background-color (style/toggle-background-color @pressed? blur? theme)]
[rn/pressable
{:accessibility-label :keyboard-key
{:accessibility-label (label->accessibility-label label)
:disabled (or disabled? (not label))
:on-press (fn [] (on-press label))
:on-press (fn []
(when on-press
(on-press label)))
:on-press-in #(reset! pressed? true)
:on-press-out #(reset! pressed? false)
:style (style/container background-color)}
@@ -1,7 +1,7 @@
(ns quo.components.numbered-keyboard.numbered-keyboard.style)
(def container
{:flex 1
{:display :flex
:padding-top 8
:padding-horizontal 48})
@@ -17,13 +17,17 @@
(defn- view-internal
[]
(fn [{:keys [disabled? theme blur? left-action delete-key? on-press]}]
(fn [{:keys [disabled? theme blur? left-action delete-key? on-press on-delete
container-style]
:or {left-action :none}}]
[rn/view
{:style style/container}
{:style (merge style/container
container-style)}
(for [row-index (range 1 4)]
^{:key row-index}
[rn/view {:style style/row-container}
(for [column-index (range 1 4)]
^{:key (str row-index column-index)}
[keyboard-item
{:item (+ (* (dec row-index) 3) column-index)
:type :digit
@@ -58,10 +62,10 @@
:theme theme}]
(if delete-key?
[keyboard-item
{:item :i/delete
{:item :i/backspace
:type :key
:disabled? disabled?
:on-press on-press
:on-press on-delete
:blur? blur?
:theme theme}]
[keyboard-item])]]))
+22
View File
@@ -0,0 +1,22 @@
(ns quo.components.overlay.style
(:require [quo.foundations.colors :as colors]))
(defn overlay-background
[type]
(let [background-color (case type
:shell colors/neutral-80-opa-80-blur
:drawer colors/neutral-100-opa-70-blur
nil)]
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0
:background-color background-color}))
(def container
{:flex 1})
(def blur-container
{:flex 1
:background-color :transparent})
+20
View File
@@ -0,0 +1,20 @@
(ns quo.components.overlay.view
(:require
[quo.components.overlay.style :as style]
[react-native.blur :as blur]
[react-native.core :as rn]))
(defn view
[{:keys [type]} & children]
[rn/view {:style (style/overlay-background type)}
(if (= type :shell)
[blur/view
{:blur-amount 20
:blur-radius 25
:blur-type :transparent
:overlay-color :transparent
:style style/container}
[rn/view {:style style/blur-container}
children]]
[rn/view {:style style/container}
children])])
@@ -10,14 +10,14 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? true
:label :none
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -27,14 +27,14 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? false
:label :none
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -45,14 +45,14 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? true
:label :none
:status :default
:size :small
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -63,14 +63,14 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? true
:label :none
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -81,31 +81,31 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? true
:label :none
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
(h/is-truthy (h/get-by-text "Description")))
(h/is-truthy (h/get-by-text "Subtitle")))
(h/test "right icon is not visible when icon-right? is false"
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? false
:card? true
:label :none
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -115,7 +115,6 @@
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? true
:right-icon :i/chevron-right
:card? true
@@ -123,17 +122,17 @@
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
(h/is-truthy (h/query-by-label-text :icon-right)))
(h/test "description icon is visible when description is icon"
(h/test "icon is visible when subtitle type is icon"
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :icon
:icon-right? true
:right-icon :i/chevron-right
:card? true
@@ -141,17 +140,17 @@
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :icon
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
(h/is-truthy (h/query-by-label-text :description-icon)))
(h/is-truthy (h/query-by-label-text :subtitle-type-icon)))
(h/test "description image is visible when description is network"
(h/test "image is visible when subtitle type is network"
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :network
:icon-right? true
:right-icon :i/chevron-right
:card? true
@@ -159,18 +158,18 @@
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :network
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow
:network-image (quo.resources/get-network :ethereum)}])
(h/is-truthy (h/query-by-label-text :description-image)))
(h/is-truthy (h/query-by-label-text :subtitle-type-image)))
(h/test "description emoji is visible when description is account"
(h/test "emoji is visible when subtitle type is account"
(h/render [quo/data-item
{:on-press (h/mock-fn)
:blur? false
:description :account
:icon-right? true
:right-icon :i/chevron-right
:card? true
@@ -178,7 +177,8 @@
:status :default
:size :default
:title "Label"
:subtitle "Description"
:subtitle "Subtitle"
:subtitle-type :account
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
@@ -37,8 +37,8 @@
:align-items :center})
(defn subtitle-icon-container
[description]
{:margin-right (when (not= :default description) 4)
[subtitle-type]
{:margin-right (when (not= :default subtitle-type) 4)
:justify-content :center})
(defn title
+11 -11
View File
@@ -16,14 +16,15 @@
[rn/view {:style (style/loading-container size blur? theme)}])
(defn- left-subtitle
[{:keys [theme size description icon icon-color blur? subtitle customization-color emoji
network-image]}]
[{:keys [theme size subtitle-type icon icon-color blur? subtitle customization-color emoji
network-image]
:or {subtitle-type :default}}]
[rn/view {:style style/subtitle-container}
(when (not= :small size)
[rn/view {:style (style/subtitle-icon-container description)}
(case description
[rn/view {:style (style/subtitle-icon-container subtitle-type)}
(case subtitle-type
:icon [icons/icon icon
{:accessibility-label :description-icon
{:accessibility-label :subtitle-type-icon
:size 16
:color icon-color}]
:account [account-avatar/view
@@ -32,7 +33,7 @@
:emoji emoji
:type :default}]
:network [rn/image
{:accessibility-label :description-image
{:accessibility-label :subtitle-type-image
:source network-image
:style style/image}]
nil)])
@@ -58,10 +59,9 @@
(i18n/label :t/days)])])
(defn- left-side
"The description can either be given as a string `description` or a component `custom-subtitle`"
[{:keys [theme title status size blur? description custom-subtitle icon subtitle label icon-color
customization-color network-image
emoji]
"The description can either be given as a string `subtitle-type` or a component `custom-subtitle`"
[{:keys [theme title status size blur? custom-subtitle icon subtitle subtitle-type label icon-color
customization-color network-image emoji]
:as props}]
[rn/view {:style style/left-side}
[left-title
@@ -79,7 +79,7 @@
[left-subtitle
{:theme theme
:size size
:description description
:subtitle-type subtitle-type
:icon icon
:icon-color icon-color
:blur? blur?
+18 -27
View File
@@ -17,30 +17,21 @@
{:width size})))
(defn base-tag
[_]
(fn
[{:keys [id
size
disabled?
border-color
border-width
background-color
on-press
accessibility-label
type
labelled?]
:or {size 32}} children]
[rn/touchable-without-feedback
(merge {:disabled disabled?
:accessibility-label accessibility-label}
(when on-press
{:on-press #(on-press id)}))
[rn/view
{:style (merge (style-container size
disabled?
border-color
border-width
background-color
labelled?
type))}
children]]))
[{:keys [id size disabled? border-color border-width background-color on-press
accessibility-label type labelled?]
:or {size 32}}
children]
[rn/touchable-without-feedback
(merge {:disabled disabled?
:accessibility-label accessibility-label}
(when on-press
{:on-press #(on-press id)}))
[rn/view
{:style (merge (style-container size
disabled?
border-color
border-width
background-color
labelled?
type))}
children]])
+30 -39
View File
@@ -4,7 +4,7 @@
[quo.components.markdown.text :as text]
[quo.components.tags.base-tag :as base-tag]
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[quo.theme]
[react-native.core :as rn]))
(def themes
@@ -66,54 +66,45 @@
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
- `labelled` boolean: is true if tag has label else false"
[_ _]
(fn
[{:keys [id
on-press
disabled?
size
active
accessibility-label
label
resource
type
labelled?
blurred?
icon-color
override-theme]
:or {size 32}}]
(let [state (cond disabled? :disabled
active :active
:else :default)
{:keys [border-color blurred-border-color text-color]}
(get-in themes [(or override-theme (theme/get-theme)) state])]
[rn/view {:style {:align-items :center}}
[base-tag/base-tag
{:id id
:size size
:border-width 1
:border-color (if blurred?
blurred-border-color
border-color)
:on-press on-press
:accessibility-label accessibility-label
:disabled? disabled?
:type type
:labelled? (if (= type :label) true labelled?)}
[tag-resources size type resource icon-color label text-color labelled?]]])))
[{:keys [id on-press disabled? size active accessibility-label label resource type
labelled? blurred? icon-color theme]
:or {size 32}}]
(let [state (cond
disabled? :disabled
active :active
:else :default)
{:keys [border-color
blurred-border-color
text-color]} (get-in themes [theme state])]
[rn/view {:style {:align-items :center}}
[base-tag/base-tag
{:id id
:size size
:border-width 1
:border-color (if blurred?
blurred-border-color
border-color)
:on-press on-press
:accessibility-label accessibility-label
:disabled? disabled?
:type type
:labelled? (if (= type :label) true labelled?)}
[tag-resources size type resource icon-color label text-color labelled?]]]))
(def tag (quo.theme/with-theme tag-internal))
@@ -0,0 +1,51 @@
(ns quo.components.text-combinations.standard-title.component-spec
(:require [quo.components.text-combinations.standard-title.view :as standard-title]
[test-helpers.component :as h]))
(h/describe "Text combinations - Standard title"
(h/test "Default render"
(h/render [standard-title/view {:title "This is a title"}])
(h/is-truthy (h/get-by-text "This is a title")))
(h/test "Counter variant"
(h/render [standard-title/view
{:title "This is a title"
:right :counter
:counter-left 50
:counter-right 100}])
(h/is-truthy (h/get-by-text "50/100")))
(h/describe "Action variant"
(h/test "Default render"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :action
:on-press on-press-fn}])
(h/is-truthy (h/get-by-text "This is a title"))))
(h/test "Action fired"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :action
:on-press on-press-fn}])
(h/fire-event :on-press (h/get-by-label-text :standard-title-action))
(h/was-called-times on-press-fn 1))))
(h/describe "Tag variant"
(h/test "Default render"
(h/render [standard-title/view
{:title "This is a title"
:right :tag}])
(h/is-truthy (h/get-by-text "This is a title")))
(h/test "Tag callback fired"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :tag
:on-press on-press-fn}])
(h/fire-event :on-press (h/get-by-label-text :standard-title-tag))
(h/was-called-times on-press-fn 1)))))
@@ -0,0 +1,24 @@
(ns quo.components.text-combinations.standard-title.style
(:require [quo.foundations.colors :as colors]))
(def container
{:flex-direction :row
:justify-content :space-between})
(def right-container {:margin-left 20})
(def right-counter
{:padding-top 12
:padding-bottom 2})
(defn right-counter-text
[blur? theme]
{:color (if blur?
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40 theme)
(colors/theme-colors colors/neutral-40 colors/neutral-50 theme))})
(defn right-tag-icon-color
[blur? theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)))
@@ -0,0 +1,68 @@
(ns quo.components.text-combinations.standard-title.view
(:require [clojure.string :as string]
[quo.components.buttons.button.view :as button]
[quo.components.markdown.text :as text]
[quo.components.tags.tag :as tag]
[quo.components.text-combinations.standard-title.style :as style]
[quo.theme]
[react-native.core :as rn]
[utils.number]))
(defn- get-counter-number
[n]
(let [parsed-number (utils.number/parse-int n)]
(if (< n 10)
(str "0" parsed-number)
parsed-number)))
(defn- right-counter
[{:keys [blur? theme counter-left counter-right]}]
[rn/view {:style style/right-counter}
[text/text
{:size :paragraph-2
:weight :regular
:style (style/right-counter-text blur? theme)}
(str (get-counter-number counter-left)
"/"
(get-counter-number counter-right))]])
(defn- right-action
[{:keys [customization-color on-press icon]
:or {icon :i/placeholder}}]
[button/button
{:accessibility-label :standard-title-action
:size 32
:icon-only? true
:customization-color customization-color
:on-press on-press}
icon])
(defn- right-tag
[{:keys [theme blur? on-press icon label]
:or {icon :i/placeholder}}]
(let [labelled? (not (string/blank? label))]
[tag/tag
{:accessibility-label :standard-title-tag
:size 32
:type :icon
:resource icon
:on-press on-press
:labelled? labelled?
:label (when labelled? label)
:blurred? blur?
:icon-color (style/right-tag-icon-color blur? theme)}]))
(defn- view-internal
[{:keys [title right] :as props}]
[rn/view {:style style/container}
[text/text {:size :heading-1 :weight :semi-bold}
title]
(when right
[rn/view {:style style/right-container}
(case right
:counter [right-counter props]
:action [right-action props]
:tag [right-tag props]
nil)])])
(def view (quo.theme/with-theme view-internal))
@@ -9,3 +9,8 @@
(def description-description-text
{:margin-top 8})
(def emoji-hash
{:margin-top 8
:letter-spacing 0.5
:line-height 20.5})
@@ -27,7 +27,8 @@
description-accessibility-label
button-icon
button-on-press
customization-color]}]
customization-color
emoji-hash]}]
[rn/view {:style container-style}
[rn/view
{:style {:flex-direction :row
@@ -55,6 +56,11 @@
:weight :regular
:size :paragraph-1
:style style/description-description-text}
description])])
description])
(when emoji-hash
[text/text
{:number-of-lines 1
:style style/emoji-hash}
emoji-hash])])
(def view (theme/with-theme view-internal))
@@ -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))
@@ -133,7 +133,7 @@
| key | description |
| -------------|-------------|
| `:account-name` | A value representing the account name (default `nil`)
| `:account` | A value that represents if the account is a `:watched-account` or a `:default` account. (default `nil`)
| `:account` | A value that represents if the account is a `:watched-address` or a `:default` account. (default `nil`)
| `:time-frame` | A value that represents the type of the timeframe, Can be from a preset of time frames. `[:1-week :1-month :3-months :1-year :custom]` (default `nil`) if custom is set, We expect a start time and if there's a space between two times that are in `time-frame-string` we'll split them with an arrow to the right icon
| `:loading?` | A value that indicates that component is loading data. (default `nil`)
| `:metrics` | A value that indicates if the account value have increased can be `:positive` or `:negative` (default `nil`)
+42 -22
View File
@@ -15,18 +15,26 @@
(defn calc-value
[crypto? currency token value conversion]
(if crypto?
(str (get common/currency-label currency) (.toFixed (* value conversion) 2))
(str (.toFixed (/ value conversion) 2) " " (string/upper-case (clj->js token)))))
(let [num-value (if (string? value) (parse-double (or value "0")) value)]
(if crypto?
(str (get common/currency-label currency) (.toFixed (* num-value conversion) 2))
(str (.toFixed (/ num-value conversion) 2) " " (string/upper-case (or (clj->js token) ""))))))
(defn- view-internal
[]
(let [width (:width (rn/get-window))
value (reagent/atom 0)
crypto? (reagent/atom true)
input-ref (atom nil)]
(fn [{:keys [theme token currency conversion networks title customization-color]}]
[rn/view {:style (style/main-container width)}
[{external-value :value}]
(let [width (:width (rn/get-window))
value (reagent/atom nil)
crypto? (reagent/atom true)
input-ref (atom nil)
controlled-input? (some? external-value)]
(fn [{:keys [theme token currency conversion networks title customization-color
on-change-text on-swap container-style show-keyboard?]
:or {show-keyboard? true}
external-value :value}]
[rn/view
{:style (merge
(style/main-container width)
container-style)}
[rn/view {:style style/amount-container}
[rn/pressable
{:on-press #(when @input-ref (.focus ^js @input-ref))
@@ -37,27 +45,39 @@
{:style style/token
:source (resources/get-token token)}]
[rn/text-input
{:ref #(reset! input-ref %)
:placeholder "0"
:placeholder-text-color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)
:keyboard-type :numeric
:max-length 12
:default-value @value
:on-change-text #(reset! value %)
:style (style/text-input theme)
:selection-color customization-color}]
(cond-> {:auto-focus true
:ref #(reset! input-ref %)
:placeholder "0"
:placeholder-text-color (colors/theme-colors colors/neutral-40
colors/neutral-50
theme)
:keyboard-type :numeric
:max-length 12
:on-change-text (fn [v]
(when-not controlled-input?
(reset! value v))
(when on-change-text
(on-change-text v)))
:style (style/text-input theme)
:selection-color customization-color
:show-soft-input-on-focus show-keyboard?}
controlled-input? (assoc :value external-value)
(not controlled-input?) (assoc :default-value @value))]
[text/text
{:size :paragraph-2
:weight :semi-bold
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:margin-right 8
:padding-bottom 2}}
(string/upper-case (clj->js (if @crypto? token currency)))]]
(string/upper-case (or (clj->js (if @crypto? token currency)) ""))]]
[button/button
{:icon true
:icon-only? true
:size 32
:on-press #(swap! crypto? not)
:on-press (fn []
(swap! crypto? not)
(when on-swap
(on-swap @crypto?)))
:type :outline
:accessibility-label :reorder}
:i/reorder]]
@@ -68,6 +88,6 @@
{:size :paragraph-2
:weight :medium
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(calc-value @crypto? currency token @value conversion)]]])))
(calc-value @crypto? currency token (or external-value @value) conversion)]]])))
(def view (quo.theme/with-theme view-internal))
+13 -1
View File
@@ -48,6 +48,7 @@
quo.components.drawers.drawer-buttons.view
quo.components.drawers.drawer-top.view
quo.components.drawers.permission-context.view
quo.components.dropdowns.dropdown-input.view
quo.components.dropdowns.dropdown.view
quo.components.dropdowns.network-dropdown.view
quo.components.empty-state.empty-state.view
@@ -65,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
@@ -100,6 +102,7 @@
quo.components.numbered-keyboard.keyboard-key.view
quo.components.numbered-keyboard.numbered-keyboard.view
quo.components.onboarding.small-option-card.view
quo.components.overlay.view
quo.components.password.tips.view
quo.components.profile.collectible.view
quo.components.profile.profile-card.view
@@ -137,6 +140,7 @@
quo.components.tags.tiny-tag.view
quo.components.tags.token-tag.view
quo.components.text-combinations.channel-name.view
quo.components.text-combinations.standard-title.view
quo.components.text-combinations.view
quo.components.wallet.account-card.view
quo.components.wallet.account-origin.view
@@ -232,6 +236,7 @@
;;;; Dropdowns
(def dropdown quo.components.dropdowns.dropdown.view/view)
(def dropdown-input quo.components.dropdowns.dropdown-input.view/view)
(def network-dropdown quo.components.dropdowns.network-dropdown.view/view)
;;;; Empty State
@@ -264,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)
@@ -314,6 +322,9 @@
(def notification quo.components.notifications.notification.view/notification)
(def toast quo.components.notifications.toast.view/toast)
;;;; Overlay
(def overlay quo.components.overlay.view/view)
;;;; Password
(def tips quo.components.password.tips.view/view)
@@ -369,8 +380,9 @@
(def token-tag quo.components.tags.token-tag.view/view)
;;;; Text combinations
(def text-combinations quo.components.text-combinations.view/view)
(def channel-name quo.components.text-combinations.channel-name.view/view)
(def standard-title quo.components.text-combinations.standard-title.view/view)
(def text-combinations quo.components.text-combinations.view/view)
;;;; Wallet
(def account-card quo.components.wallet.account-card.view/view)
+1
View File
@@ -26,6 +26,7 @@
[quo.components.drawers.drawer-buttons.component-spec]
[quo.components.drawers.drawer-top.component-spec]
[quo.components.drawers.permission-context.component-spec]
[quo.components.dropdowns.dropdown-input.component-spec]
[quo.components.dropdowns.dropdown.component-spec]
[quo.components.dropdowns.network-dropdown.component-spec]
[quo.components.gradient.gradient-cover.component-spec]
+16 -2
View File
@@ -148,7 +148,9 @@
(def black-opa-30 (alpha black 0.3))
(def black-opa-60 (alpha black 0.6))
(def onboarding-header-black "#000716")
(def border-avatar-light
"Simulates a blurred, transparent border for avatars in light mode"
"#475060")
;;;;Primary
;;Solid
@@ -201,6 +203,16 @@
(def danger-50-opa-30 (alpha danger-50 0.3))
(def danger-50-opa-40 (alpha danger-50 0.4))
;;;;Warning
(def warning-50 "#FF7D46")
(def warning-60 "#CC6438")
;;50 with transparency
(def warning-50-opa-5 (alpha warning-50 0.05))
(def warning-50-opa-10 (alpha warning-50 0.1))
(def warning-50-opa-20 (alpha warning-50 0.2))
(def warning-50-opa-30 (alpha warning-50 0.3))
(def warning-50-opa-40 (alpha warning-50 0.4))
;; Colors for customizing users account
(def customization
@@ -254,7 +266,9 @@
:danger {50 danger-50
60 danger-60}
:success {50 success-50
60 success-60}}
60 success-60}
:warning {50 warning-50
60 warning-60}}
customization
networks))
+10 -8
View File
@@ -58,14 +58,16 @@
(defn save-credentials
"Stores the credentials for the address to the Keychain"
[server username password callback]
(-> (.setInternetCredentials ^js react-native-keychain
(string/lower-case server)
username
password
keychain-secure-hardware
keychain-restricted-availability)
(.then callback)))
([server username password]
(save-credentials server username password identity))
([server username password callback]
(-> (.setInternetCredentials ^js react-native-keychain
(string/lower-case server)
username
password
keychain-secure-hardware
keychain-restricted-availability)
(.then callback))))
(defn get-credentials
"Gets the credentials for a specified server from the Keychain"
+18 -17
View File
@@ -5,11 +5,11 @@
[goog.object :as object]
[re-frame.core :as re-frame]
[status-im.chat.models.mentions :as mentions]
[status-im.chat.models.message :as chat.message]
[status-im.chat.models.message-content :as message-content]
[status-im.data-store.messages :as data-store-messages]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.link-preview.events :as link-preview]
[status-im2.contexts.chat.messages.transport.events :as messages.transport]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
@@ -205,7 +205,7 @@
(rf/merge cofx
(clean-input (:current-chat-id db))
(link-preview/reset-unfurled)
(chat.message/send-messages messages)))))
(messages.transport/send-chat-messages messages)))))
(rf/defn send-audio-message
[{:keys [db] :as cofx} audio-path duration current-chat-id]
@@ -214,25 +214,26 @@
(when-not (string/blank? audio-path)
(rf/merge
{:db (assoc-in db [:chat/inputs current-chat-id :metadata :responding-to-message] nil)}
(chat.message/send-message
(merge
{:chat-id current-chat-id
:content-type constants/content-type-audio
:audio-path audio-path
:audio-duration-ms duration
:text (i18n/label :t/update-to-listen-audio {"locale" "en"})}
(when message-id
{:response-to message-id})))))))
(messages.transport/send-chat-messages
[(merge
{:chat-id current-chat-id
:content-type constants/content-type-audio
:audio-path audio-path
:audio-duration-ms duration
:text (i18n/label :t/update-to-listen-audio {"locale" "en"})}
(when message-id
{:response-to message-id}))])))))
(rf/defn send-sticker-message
[cofx {:keys [hash packID pack]} current-chat-id]
(when-not (or (string/blank? hash) (and (string/blank? packID) (string/blank? pack)))
(chat.message/send-message cofx
{:chat-id current-chat-id
:content-type constants/content-type-sticker
:sticker {:hash hash
:pack (int (if (string/blank? packID) pack packID))}
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
(messages.transport/send-chat-messages
cofx
[{:chat-id current-chat-id
:content-type constants/content-type-sticker
:sticker {:hash hash
:pack (int (if (string/blank? packID) pack packID))}
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})}])))
(rf/defn send-edited-message
[{:keys [db]
+2 -2
View File
@@ -76,9 +76,9 @@
(rf/defn handle-mark-all-read-in-community-successful
{:events [::mark-all-read-in-community-successful]}
[{:keys [db] :as cofx} chat-ids]
[{:keys [db] :as cofx} {:keys [chats] :as _messenger-response}]
(rf/merge cofx
{:db (reduce mark-chat-all-read db chat-ids)
{:db (reduce mark-chat-all-read db (map :id chats))
:dispatch [:activity-center.notifications/fetch-unread-count]}))
(rf/defn handle-mark-all-read
-15
View File
@@ -5,7 +5,6 @@
[react-native.platform :as platform]
[status-im.chat.models.loading :as chat.loading]
[status-im.data-store.messages :as data-store.messages]
[status-im.transport.message.protocol :as protocol]
[status-im.utils.deprecated-types :as types]
[status-im2.contexts.chat.messages.delete-message.events :as delete-message]
[status-im2.contexts.chat.messages.list.events :as message-list]
@@ -21,12 +20,6 @@
[db chat-id clock-value]
(>= (get-in db [:chats chat-id :deleted-at-clock-value]) clock-value))
(defn add-timeline-message
[acc chat-id message-id message]
(-> acc
(update-in [:db :messages chat-id] assoc message-id message)
(update-in [:db :message-lists chat-id] message-list/add message)))
(defn hide-message
"Hide chat message, rebuild message-list"
[{:keys [db]} chat-id message-id]
@@ -145,14 +138,6 @@
:on-error #(log/error "failed to re-send message" %)}]}
(update-message-status chat-id message-id :sending)))
(rf/defn send-message
[cofx message]
(protocol/send-chat-messages cofx [message]))
(rf/defn send-messages
[cofx messages]
(protocol/send-chat-messages cofx messages))
(rf/defn handle-removed-messages
{:events [::handle-removed-messages]}
[{:keys [db] :as cofx} removed-messages]
-18
View File
@@ -2,7 +2,6 @@
(:require
[re-frame.core :as re-frame]
[status-im.data-store.reactions :as data-store.reactions]
[status-im.transport.message.protocol :as message.protocol]
[status-im2.constants :as constants]
[taoensso.timbre :as log]
[utils.re-frame :as rf]
@@ -63,23 +62,6 @@
(let [reactions-w-chat-id (map #(assoc % :chat-id chat-id) reactions)]
{:db (update db :reactions (process-reactions (:chats db)) reactions-w-chat-id)})))
;; Send reactions
(rf/defn send-emoji-reaction
{:events [:models.reactions/send-emoji-reaction]}
[{{:keys [current-chat-id]} :db :as cofx} reaction]
(message.protocol/send-reaction cofx
(update reaction :chat-id #(or % current-chat-id))))
(rf/defn send-retract-emoji-reaction
{:events [:models.reactions/send-emoji-reaction-retraction]}
[{{:keys [current-chat-id]} :db :as cofx} reaction]
(message.protocol/send-retract-reaction cofx
(update reaction :chat-id #(or % current-chat-id))))
(defn message-reactions
[current-public-key reactions]
(reduce
+4 -6
View File
@@ -32,9 +32,7 @@
status-im.pairing.core
status-im.profile.core
status-im.search.core
status-im.signals.core
status-im.stickers.core
status-im.transport.core
status-im.ui.components.invite.events
[status-im.ui.components.react :as react]
status-im.ui.screens.notifications-settings.events
@@ -136,7 +134,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
@@ -194,9 +192,9 @@
(rf/merge cofx
(cond
(= :chat view-id)
{:async-storage-set {:chat-id (get-in cofx [:db :current-chat-id])
:key-uid (get-in cofx [:db :profile/profile :key-uid])}
:db (assoc db :screens/was-focused-once? true)}
{:effects.async-storage/set {:chat-id (get-in cofx [:db :current-chat-id])
:key-uid (get-in cofx [:db :profile/profile :key-uid])}
:db (assoc db :screens/was-focused-once? true)}
(not (get db :screens/was-focused-once?))
{:db (assoc db :screens/was-focused-once? true)})
+23 -23
View File
@@ -141,14 +141,14 @@
(let [pin (get-in db [:keycard :pin :original])
puk-restore? (get-in db [:keycard :pin :puk-restore?])]
(rf/merge cofx
{:db (assoc-in db
[:keycard :pin]
{:status nil
:login pin
:confirmation []
:error-label nil})
:utils/show-popup {:title ""
:content (i18n/label :t/pin-changed)}}
{:db (assoc-in db
[:keycard :pin]
{:status nil
:login pin
:confirmation []
:error-label nil})
:effects.utils/show-popup {:title ""
:content (i18n/label :t/pin-changed)}}
(common/hide-connection-sheet)
(if puk-restore?
(navigation/navigate-to :multiaccounts nil)
@@ -160,14 +160,14 @@
{:events [:keycard.callback/on-change-puk-success]}
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc-in db
[:keycard :pin]
{:status nil
:puk-original []
:puk-confirmation []
:error-label nil})
:utils/show-popup {:title ""
:content (i18n/label :t/puk-changed)}}
{:db (assoc-in db
[:keycard :pin]
{:status nil
:puk-original []
:puk-confirmation []
:error-label nil})
:effects.utils/show-popup {:title ""
:content (i18n/label :t/puk-changed)}}
(common/hide-connection-sheet)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
@@ -175,13 +175,13 @@
{:events [:keycard.callback/on-change-pairing-success]}
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc-in db
[:keycard :pin]
{:status nil
:pairing-code nil
:error-label nil})
:utils/show-popup {:title ""
:content (i18n/label :t/pairing-changed)}}
{:db (assoc-in db
[:keycard :pin]
{:status nil
:pairing-code nil
:error-label nil})
:effects.utils/show-popup {:title ""
:content (i18n/label :t/pairing-changed)}}
(common/hide-connection-sheet)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
+4 -4
View File
@@ -293,14 +293,14 @@
(rf/defn show-wrong-keycard-alert
[_]
(log/debug "show-wrong-keycard-alert")
{:utils/show-popup {:title (i18n/label :t/wrong-card)
:content (i18n/label :t/wrong-card-text)}})
{:effects.utils/show-popup {:title (i18n/label :t/wrong-card)
:content (i18n/label :t/wrong-card-text)}})
(rf/defn unauthorized-operation
[cofx]
(rf/merge cofx
{:utils/show-popup {:title ""
:content (i18n/label :t/keycard-unauthorized-operation)}}
{:effects.utils/show-popup {:title ""
:content (i18n/label :t/keycard-unauthorized-operation)}}
(clear-on-card-connected)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
+11 -10
View File
@@ -24,12 +24,12 @@
(rf/defn show-keycard-has-multiaccount-alert
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc-in db [:keycard :setup-step] nil)
:utils/show-confirmation {:title nil
:content (i18n/label
:t/keycard-has-multiaccount-on-it)
:cancel-button-text ""
:confirm-button-text :t/okay}}))
{:db (assoc-in db [:keycard :setup-step] nil)
:effects.utils/show-confirmation {:title nil
:content (i18n/label
:t/keycard-has-multiaccount-on-it)
:cancel-button-text ""
:confirm-button-text :t/okay}}))
(rf/defn load-pin-screen
[{:keys [db] :as cofx}]
@@ -548,10 +548,11 @@
(rf/defn show-no-keycard-applet-alert
[_]
{:utils/show-confirmation {:title (i18n/label :t/no-keycard-applet-on-card)
:content (i18n/label :t/keycard-applet-install-instructions)
:cancel-button-text ""
:confirm-button-text :t/okay}})
{:effects.utils/show-confirmation {:title (i18n/label :t/no-keycard-applet-on-card)
:content (i18n/label
:t/keycard-applet-install-instructions)
:cancel-button-text ""
:confirm-button-text :t/okay}})
;; NOTE: Maybe replaced by multiple events based on on flow to make it easier to maintain.
;; Because there are many execution paths it is harder to follow all possible states.
+2 -2
View File
@@ -35,8 +35,8 @@
(do
(log/debug (str "Cannot start keycard installation from state: " card-state))
(rf/merge cofx
{:utils/show-popup {:title (i18n/label :t/error)
:content (i18n/label :t/something-went-wrong)}}
{:effects.utils/show-popup {:title (i18n/label :t/error)
:content (i18n/label :t/something-went-wrong)}}
(navigation/navigate-to :keycard-authentication-method nil))))))
(rf/defn load-preparing-screen
+6 -7
View File
@@ -221,12 +221,12 @@
(rf/defn on-backup-success
[{:keys [db] :as cofx} backup-type]
(rf/merge cofx
{:utils/show-popup {:title (i18n/label (if (= backup-type :recovery-card)
:t/keycard-access-reset
:t/keycard-backup-success-title))
:content (i18n/label (if (= backup-type :recovery-card)
:t/keycard-can-use-with-new-passcode
:t/keycard-backup-success-body))}}
{:effects.utils/show-popup {:title (i18n/label (if (= backup-type :recovery-card)
:t/keycard-access-reset
:t/keycard-backup-success-title))
:content (i18n/label (if (= backup-type :recovery-card)
:t/keycard-can-use-with-new-passcode
:t/keycard-backup-success-body))}}
(cond
(multiaccounts.model/logged-in? db)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])
@@ -373,4 +373,3 @@
cofx
{:on-card-connected :keycard/load-recovering-key-screen
:handler (common/dispatch-event :keycard/import-multiaccount)}))
+4 -5
View File
@@ -83,7 +83,7 @@
:error-label nil
:on-verified nil}))
:keycard/persist-pairings (dissoc pairings (keyword instance-uid))
:utils/show-popup {:title ""
:effects.utils/show-popup {:title ""
:content (i18n/label :t/card-unpaired)}}
(common/clear-on-card-connected)
(remove-pairing-from-multiaccount nil)
@@ -100,7 +100,7 @@
:error-label nil
:on-verified nil})
:keycard/get-application-info nil
:utils/show-popup {:title ""
:effects.utils/show-popup {:title ""
:content (i18n/label :t/something-went-wrong)}}
(common/clear-on-card-connected)
(navigation/navigate-to :keycard-settings nil)))
@@ -139,15 +139,14 @@
:error-label nil
:on-verified nil}))
:keycard/persist-pairings (dissoc pairings (keyword instance-uid))
:utils/show-popup {:title (i18n/label (if keys-removed-from-card?
:effects.utils/show-popup {:title (i18n/label (if keys-removed-from-card?
:t/profile-deleted-title
:t/database-reset-title))
:content (i18n/label (if keys-removed-from-card?
:t/profile-deleted-keycard
:t/database-reset-content))
:on-dismiss #(re-frame/dispatch [:logout])}}
;;should be reimplemented
;;:key-storage/delete-profile {:key-uid key-uid
;;should be reimplemented :key-storage/delete-profile {:key-uid key-uid
;;:on-success #(log/debug "[keycard] remove account ok")
;; :on-error #(log/warn "[keycard] remove account: " %)}
(common/clear-on-card-connected)
+16 -3
View File
@@ -194,7 +194,7 @@
{:events [:mailserver.ui/request-error-pressed]}
[{:keys [db]}]
(let [mailserver-error (:mailserver/request-error db)]
{:utils/show-confirmation
{:effects.utils/show-confirmation
{:title (i18n/label :t/mailserver-request-error-title)
:content (i18n/label :t/mailserver-request-error-content
{:error mailserver-error})
@@ -290,8 +290,7 @@
[{:method "mailservers_addMailserver"
:params [(mailserver->rpc mailserver current-fleet)]
:on-success (fn []
;; we naively logout if the user is connected to
;; the edited mailserver
;; we naively logout if the user is connected to the edited mailserver
(when current
(re-frame/dispatch
[:multiaccounts.logout.ui/logout-confirmed]))
@@ -413,3 +412,17 @@
(rf/merge cofx
{:db (dissoc db :mailserver.edit/mailserver)}
(navigation/navigate-to :edit-mailserver nil)))
(defn add-mailservers
[db mailservers]
(reduce (fn [db {:keys [fleet id name] :as mailserver}]
(let [updated-mailserver
(-> mailserver
(update :id keyword)
(assoc :name (if (seq name) name id))
(dissoc :fleet))]
(assoc-in db
[:mailserver/mailservers (keyword fleet) (keyword id)]
updated-mailserver)))
db
mailservers))
+1 -1
View File
@@ -31,7 +31,7 @@
(rf/merge cofx
{:set-root :progress
:chat.ui/clear-inputs nil
:shell/reset-state nil
:effects.shell/reset-state nil
:hide-popover nil
::logout nil
:profile.settings/webview-debug-changed false
+1 -1
View File
@@ -89,7 +89,7 @@
(rf/defn connect-failure
{:events [::connect-failure]}
[_ reason]
{:utils/show-popup
{:effects.utils/show-popup
{:title (i18n/label :t/error)
:content (str reason)}})
+4 -4
View File
@@ -31,8 +31,8 @@
(let [old-network-status (:network-status db)
old-network-type (:network/type db)
connectivity-status (if isConnected :online :offline)
status-changed? (not= connectivity-status old-network-status)
type-changed? (not= type old-network-type)]
status-changed? (= connectivity-status old-network-status)
type-changed? (= type old-network-type)]
(log/debug "[net-info]"
"old-network-status" old-network-status
"old-network-type" old-network-type
@@ -40,9 +40,9 @@
"type" type
"details" details)
(rf/merge cofx
(when status-changed?
(when-not status-changed?
(change-network-status isConnected))
(when type-changed?
(when-not type-changed?
(change-network-type old-network-type type (:is-connection-expensive details))))))
(defn add-net-info-listener
+2 -2
View File
@@ -165,9 +165,9 @@
(if (< (count (filter :enabled? (vals (get-in cofx [:db :pairing/installations]))))
(inc config/max-installations))
{:pairing/enable-installation [installation-id]}
{:utils/show-popup {:title (i18n/label :t/pairing-maximum-number-reached-title)
{:effects.utils/show-popup {:title (i18n/label :t/pairing-maximum-number-reached-title)
:content (i18n/label :t/pairing-maximum-number-reached-content)}}))
:content (i18n/label :t/pairing-maximum-number-reached-content)}}))
(rf/defn disable-fx
{:events [:pairing.ui/disable-installation-pressed]}
+8 -8
View File
@@ -49,8 +49,8 @@
[{:keys [db] :as cofx} {:keys [chat-id]}]
(if-not (own-public-key? db chat-id)
{:dispatch [:chat.ui/start-chat chat-id]}
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/can-not-add-yourself)}}))
{:effects.utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/can-not-add-yourself)}}))
(rf/defn handle-group-chat
[cofx params]
@@ -71,9 +71,9 @@
(navigation/navigate-back))
:else
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/ens-name-not-found)
:on-dismiss #(re-frame/dispatch [:pop-to-root :shell-stack])}})))
{:effects.utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/ens-name-not-found)
:on-dismiss #(re-frame/dispatch [:pop-to-root :shell-stack])}})))
(rf/defn handle-eip681
[cofx data]
@@ -103,9 +103,9 @@
(log/info "Unable to find matcher for scanned value"
{:type type
:event ::match-scanned-value})
{:dispatch [:navigate-back]
:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:on-dismiss #(re-frame/dispatch [:pop-to-root :shell-stack])}})))
{:dispatch [:navigate-back]
:effects.utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:on-dismiss #(re-frame/dispatch [:pop-to-root :shell-stack])}})))
(rf/defn on-scan
{:events [::on-scan-success]}
+3 -3
View File
@@ -78,9 +78,9 @@
[{:keys [db]} data typed? result]
(let [{:keys [result error]} (types/json->clj result)]
(if error
{:dispatch [:signing.ui/cancel-is-pressed]
:utils/show-popup {:title (i18n/label :t/sign-request-failed)
:content (:message error)}}
{:dispatch [:signing.ui/cancel-is-pressed]
:effects.utils/show-popup {:title (i18n/label :t/sign-request-failed)
:content (:message error)}}
{:db (update db
:keycard assoc
:hash result
-58
View File
@@ -1,58 +0,0 @@
(ns ^{:doc "API to init and stop whisper messaging"} status-im.transport.core
(:require
[re-frame.core :as re-frame]
[status-im.pairing.core :as pairing]
[status-im.stickers.core :as stickers]
status-im.transport.shh
[status-im2.common.universal-links :as universal-links]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/defn set-node-info
{:events [:transport.callback/node-info-fetched]}
[{:keys [db]} node-info]
{:db (assoc db :node-info node-info)})
(rf/defn fetch-node-info-fx
[_]
{:json-rpc/call [{:method "admin_nodeInfo"
:on-success #(re-frame/dispatch [:transport.callback/node-info-fetched %])
:on-error #(log/error "node-info: failed error" %)}]})
(defn add-mailservers
[db mailservers]
(reduce (fn [db {:keys [fleet id name] :as mailserver}]
(let [updated-mailserver
(-> mailserver
(update :id keyword)
(assoc :name (if (seq name) name id))
(dissoc :fleet))]
(assoc-in db
[:mailserver/mailservers (keyword fleet) (keyword id)]
updated-mailserver)))
db
mailservers))
(rf/defn start-messenger
"We should only start receiving messages/processing topics once all the
initializiation is completed, otherwise we might receive messages/topics
when the state has not been properly initialized."
[_]
{:json-rpc/call [{:method "wakuext_startMessenger"
:on-success #(re-frame/dispatch [::messenger-started %])
:on-error #(log/error "failed to start messenger")}]})
(rf/defn messenger-started
{:events [::messenger-started]}
[{:keys [db] :as cofx} {:keys [mailservers] :as response}]
(log/info "Messenger started")
(let [new-account? (get db :onboarding-2/new-account?)]
(rf/merge cofx
{:db (-> db
(assoc :messenger/started? true)
(add-mailservers mailservers))}
(fetch-node-info-fx)
(pairing/init)
(stickers/load-packs)
(when-not new-account?
(universal-links/process-stored-event)))))
@@ -1,59 +0,0 @@
(ns ^{:doc "Protocol API and protocol utils"} status-im.transport.message.protocol
(:require
[clojure.set :as set]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(defn- link-preview->rpc
[preview]
(update preview
:thumbnail
(fn [thumbnail]
(set/rename-keys thumbnail {:data-uri :dataUri}))))
(defn build-message
[msg]
(-> msg
(update :link-previews #(map link-preview->rpc %))
(set/rename-keys
{:album-id :albumId
:audio-duration-ms :audioDurationMs
:audio-path :audioPath
:chat-id :chatId
:community-id :communityId
:content-type :contentType
:ens-name :ensName
:image-height :imageHeight
:image-path :imagePath
:image-width :imageWidth
:link-previews :linkPreviews
:response-to :responseTo
:sticker :sticker
:text :text})))
(rf/defn send-chat-messages
[_ messages]
{:json-rpc/call [{:method "wakuext_sendChatMessages"
:params [(mapv build-message messages)]
:js-response true
:on-success #(re-frame/dispatch [:transport/message-sent %])
:on-error #(do
(log/warn "failed to send a message" %)
(js/alert (str "failed to send a message: " %)))}]})
(rf/defn send-reaction
[_ {:keys [message-id chat-id emoji-id]}]
{:json-rpc/call [{:method "wakuext_sendEmojiReaction"
:params [chat-id message-id emoji-id]
:js-response true
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])
:on-error #(log/error "failed to send a reaction" %)}]})
(rf/defn send-retract-reaction
[_ {:keys [emoji-reaction-id]}]
{:json-rpc/call [{:method "wakuext_sendEmojiReactionRetraction"
:params [emoji-reaction-id]
:js-response true
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])
:on-error #(log/error "failed to send a reaction retraction" %)}]})
-35
View File
@@ -1,35 +0,0 @@
(ns ^{:doc "Whisper API and events for managing keys and posting messages"} status-im.transport.shh
(:require
[re-frame.core :as re-frame]
[status-im2.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]))
(defn generate-sym-key-from-password
[{:keys [password on-success on-error]}]
(json-rpc/call {:method "waku_generateSymKeyFromPassword"
:params [password]
:on-success on-success
:on-error on-error}))
(defn get-sym-key
[{:keys [sym-key-id on-success on-error]}]
(json-rpc/call {:method "waku_getSymKey"
:params [sym-key-id]
:on-success on-success
:on-error on-error}))
(defn log-error
[error]
(log/error :shh/get-new-sym-key-error error))
(re-frame/reg-fx
:shh/generate-sym-key-from-password
(fn [{:keys [password on-success]}]
(generate-sym-key-from-password
{:password password
:on-success (fn [sym-key-id]
(get-sym-key {:sym-key-id sym-key-id
:on-success (fn [sym-key]
(on-success sym-key sym-key-id))
:on-error log-error}))
:on-error log-error})))
-18
View File
@@ -1,18 +0,0 @@
(ns ^{:doc "Utils for transport layer"} status-im.transport.utils
(:require
[clojure.string :as string]))
(defn extract-enode-id
[enode]
(-> enode
(string/split #"/")
(get 2 "")
(string/split #":")
(get 0 "")
(string/split "@")
(get 0)))
(defn extract-url-components
[address]
(when address
(rest (re-matches #"enode://(.*?)@(.*):(.*)" address))))
@@ -56,7 +56,7 @@
{:events [::on-delete-profile-success]}
[cofx]
(log/info "[delete-profile] on-success")
{:utils/show-popup
{:effects.utils/show-popup
{:title (i18n/label :t/profile-deleted-title)
:content (i18n/label :t/profile-deleted-content)
:on-dismiss #(re-frame/dispatch [:logout])}})
@@ -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
+10 -6
View File
@@ -7,7 +7,6 @@
[react-native.mail :as react-native-mail]
[react-native.platform :as platform]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.transport.utils :as transport.utils]
[status-im.ui.components.react :as react]
[status-im.utils.build :as build]
[status-im.utils.deprecated-types :as types]
@@ -38,6 +37,11 @@
{:json-rpc/call [{:method "web3_clientVersion"
:on-success #(re-frame/dispatch [:logging/store-web3-client-version %])}]})
(defn extract-url-components
[address]
(when address
(rest (re-matches #"enode://(.*?)@(.*):(.*)" address))))
(defn email-body
"logs attached"
[{:keys [:web3-node-version :mailserver/current-id
@@ -46,7 +50,7 @@
build-version (str build/version " (" build-number ")")
separator (string/join (take 40 (repeat "-")))
[enode-id ip-address port]
(transport.utils/extract-url-components (:enode node-info))]
(extract-url-components (:enode node-info))]
(string/join
"\n"
(concat [(i18n/label :t/report-bug-email-template
@@ -68,7 +72,7 @@
(mapcat
(fn [{:keys [enode]}]
(let [[enode-id ip-address port]
(transport.utils/extract-url-components enode)]
(extract-url-components enode)]
[(str "id: " enode-id)
(str "ip: " ip-address)
(str "port: " port)
@@ -151,15 +155,15 @@
(rf/defn show-client-error
{:events [:show-client-error]}
[_]
{:utils/show-popup {:title (i18n/label :t/cant-report-bug)
:content (i18n/label :t/mail-should-be-configured)}})
{:effects.utils/show-popup {:title (i18n/label :t/cant-report-bug)
:content (i18n/label :t/mail-should-be-configured)}})
(rf/defn show-logs-dialog
{:events [:shake-event]}
[{:keys [db]}]
(when-not (:logging/dialog-shown? db)
{:db (assoc db :logging/dialog-shown? true)
:utils/show-confirmation
:effects.utils/show-confirmation
(cond-> {:title (i18n/label :t/send-logs)
:content (i18n/label :t/send-logs-to
{:email report-email})
+4 -5
View File
@@ -359,8 +359,8 @@
(let [deleted-address (:address account)
dapps-address (get-in cofx [:db :profile/profile :dapps-address])]
(if (= (string/lower-case dapps-address) (string/lower-case deleted-address))
{:utils/show-popup {:title (i18n/label :t/warning)
:content (i18n/label :t/account-is-used)}}
{:effects.utils/show-popup {:title (i18n/label :t/warning)
:content (i18n/label :t/account-is-used)}}
{:key-storage/delete-imported-key
{:key-uid (get-in db [:profile/profile :key-uid])
:address (:address account)
@@ -379,8 +379,8 @@
(assoc-in [:add-account :scanned-address] address)
(assoc-in [:add-account :address] address))}
(when-not address
{:utils/show-popup {:title (i18n/label :t/error)
:content (i18n/label :t/invalid-address-qr-code)}}))
{:effects.utils/show-popup {:title (i18n/label :t/error)
:content (i18n/label :t/invalid-address-qr-code)}}))
(navigation/navigate-back))))
(re-frame/reg-fx
@@ -392,4 +392,3 @@
{:events [:wallet-legacy.accounts/share]}
[_ address]
{:list.selection/open-share {:message (eip55/address->checksum address)}})
+10 -11
View File
@@ -246,8 +246,8 @@
assets (get visible-tokens chain)
tokens (->> (vals all-tokens)
(remove #(or (:hidden? %)
;;if not scan-all-tokens? remove not
;;visible tokens
;;if not scan-all-tokens? remove
;;not visible tokens
(and (not scan-all-tokens?)
(not (get assets (:symbol %))))))
(reduce (fn [acc {:keys [address symbol]}]
@@ -822,8 +822,8 @@
(rf/defn get-buy-crypto-preference
{:events [::get-buy-crypto]}
[_]
{:async-storage-get {:keys [:buy-crypto-hidden]
:cb #(re-frame/dispatch [::store-buy-crypto-preference %])}})
{:effects.async-storage/get {:keys [:buy-crypto-hidden]
:cb #(re-frame/dispatch [::store-buy-crypto-preference %])}})
(rf/defn wallet-will-focus
{:events [::wallet-stack]}
@@ -844,8 +844,8 @@
(rf/defn hide-buy-crypto
{:events [::hide-buy-crypto]}
[{:keys [db]}]
{:db (assoc db :wallet-legacy/buy-crypto-hidden true)
:async-storage-set {:buy-crypto-hidden true}})
{:db (assoc db :wallet-legacy/buy-crypto-hidden true)
:effects.async-storage/set {:buy-crypto-hidden true}})
(rf/defn store-buy-crypto
{:events [::store-buy-crypto-preference]}
@@ -1023,8 +1023,8 @@
(rf/defn switch-transactions-management-enabled
{:events [:multiaccounts.ui/switch-transactions-management-enabled]}
[{:keys [db]} enabled?]
{:async-storage-set {:transactions-management-enabled? enabled?}
:db (assoc db :wallet-legacy/transactions-management-enabled? enabled?)})
{:effects.async-storage/set {:transactions-management-enabled? enabled?}
:db (assoc db :wallet-legacy/transactions-management-enabled? enabled?)})
(re-frame/reg-fx
:wallet-legacy/initialize-transactions-management-enabled
@@ -1072,9 +1072,8 @@
true])}))
2000)))
(re-frame/reg-fx
;;TODO: this could be replaced by a single API call on status-go side
:wallet-legacy/initialize-wallet
;;TODO: this could be replaced by a single API call on status-go side
(re-frame/reg-fx :wallet-legacy/initialize-wallet
(fn [[network-id network callback]]
(-> (js/Promise.all
(clj->js
+2 -2
View File
@@ -65,8 +65,8 @@
(rf/defn not-supported
{:events [:wallet-legacy.custom-token/not-supported]}
[{:keys [db]}]
{:db (assoc-in db [:wallet-legacy/custom-token-screen :in-progress?] nil)
:utils/show-popup {:content (i18n/label :t/contract-isnt-supported)}})
{:db (assoc-in db [:wallet-legacy/custom-token-screen :in-progress?] nil)
:effects.utils/show-popup {:content (i18n/label :t/contract-isnt-supported)}})
(rf/defn add-custom-token
{:events [:wallet-legacy.custom-token.ui/add-pressed]}
@@ -1,8 +1,8 @@
(ns status-im2.common.alert.events
(ns status-im2.common.alert.effects
(:require
[re-frame.core :as re-frame]
[react-native.core :as rn]
[utils.i18n :as i18n]))
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn show-popup
([title content]
@@ -22,12 +22,11 @@
(vector
action-button
dismiss-button)
dismiss-button)
(vector dismiss-button))
(when on-dismiss
{:cancelable false})))))
(re-frame/reg-fx
:utils/show-popup
(rf/reg-fx :effects.utils/show-popup
(fn [{:keys [title content on-dismiss]}]
(show-popup title content on-dismiss)))
@@ -50,8 +49,7 @@
(or extra-options nil))
{:cancelable false}))
(re-frame/reg-fx
:utils/show-confirmation
(rf/reg-fx :effects.utils/show-confirmation
(fn [{:keys [title content confirm-button-text on-accept on-cancel cancel-button-text extra-options]}]
(show-confirmation {:title title
:content content
@@ -60,18 +58,3 @@
:on-accept on-accept
:on-cancel on-cancel
:extra-options extra-options})))
(defn show-question
([title content on-accept]
(show-question title content on-accept nil))
([title content on-accept on-cancel]
(rn/alert
title
content
(vector (merge {:text (i18n/label :t/no)
:accessibility-label :no-button}
(when on-cancel {:onPress on-cancel}))
{:text (i18n/label :t/yes)
:onPress on-accept
:accessibility-label :yes-button})
nil)))
-8
View File
@@ -1,8 +0,0 @@
(ns status-im2.common.async-storage
(:require
[re-frame.core :as re-frame]
react-native.async-storage))
(re-frame/reg-fx :async-storage-set (react-native.async-storage/set-item-factory))
(re-frame/reg-fx :async-storage-get
(fn [{ks :keys cb :cb}] (react-native.async-storage/get-items ks cb)))
@@ -0,0 +1,11 @@
(ns status-im2.common.async-storage.effects
(:require
[react-native.async-storage :as async-storage]
[utils.re-frame :as rf]))
(rf/reg-fx :effects.async-storage/set
(async-storage/set-item-factory))
(rf/reg-fx :effects.async-storage/get
(fn [{ks :keys cb :cb}]
(async-storage/get-items ks cb)))
+52 -6
View File
@@ -2,9 +2,11 @@
(:require
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[react-native.async-storage :as async-storage]
[react-native.platform :as platform]
[react-native.touch-id :as touch-id]
[status-im2.common.keychain.events :as keychain]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -41,16 +43,60 @@
{:db (assoc db :biometric/supported-type supported-type)})
(rf/defn show-message
{:events [:biometric/show-message]}
[_ code]
(let [content (if (#{"NOT_AVAILABLE" "NOT_ENROLLED"} code)
(i18n/label :t/grant-face-id-permissions)
(when-not (or (= code "USER_CANCELED") (= code "USER_FALLBACK"))
(i18n/label :t/biometric-auth-error {:code code})))]
(when content
{:utils/show-popup
(let [handle-error? (and code
(not (contains? #{"USER_CANCELED" "USER_FALLBACK"} code)))
content (if (#{"NOT_AVAILABLE" "NOT_ENROLLED"} code)
(i18n/label :t/grant-face-id-permissions)
(i18n/label :t/biometric-auth-error {:code code}))]
(when handle-error?
{:effects.utils/show-popup
{:title (i18n/label :t/biometric-auth-login-error-title)
:content content}})))
(defn- supress-biometry-error-key
[key-uid]
(keyword (str "biometric/supress-not-enrolled-error-" key-uid)))
;; NOTE: if the account had biometrics registered, but it's not enrolled at the moment,
;; we should show the error message only once and supress further "NOT_ENROLLED" errors
;; until biometry is enrolled again. Note that we can only know that when :biometric/authenticate
;; is dispatched and fails with "NOT_ENROLLED", since :biometric/get-supported-biometric-type
;; only tells us what kind of biometric is available on the device, but it doesn't know of its
;; enrollment status.
(re-frame/reg-fx
:biometric/supress-not-enrolled-error
(fn [[key-uid dispatch-event]]
(let [storage-key (supress-biometry-error-key key-uid)]
(-> (async-storage/get-item storage-key identity)
(.then (fn [item]
(when (not item)
(rf/dispatch dispatch-event)
(async-storage/set-item! storage-key true))))
(.catch (fn [err]
(log/error "Couldn't supress biometry NOT_ENROLLED error"
{:key-uid key-uid
:event :biometric/supress-not-enrolled-error
:error err})))))))
;; NOTE: when biometrics is re-enrolled, we erase the flag in async-storage to assure
;; the "NOT_ENROLLED" error message will be shown again if biometrics is un-enrolled
;; in the future.
(re-frame/reg-fx
:biometric/reset-not-enrolled-error
(fn [key-uid]
(let [storage-key (supress-biometry-error-key key-uid)]
(-> (async-storage/get-item storage-key identity)
(.then (fn [supress?]
(when supress?
(async-storage/set-item! storage-key nil))))
(.catch (fn [err]
(log/error "Couldn't reset supressing biometry NOT_ENROLLED error"
{:key-uid key-uid
:event :biometric/reset-not-enrolled-error
:error err})))))))
(re-frame/reg-fx
:biometric/authenticate
(fn [options]
@@ -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
+4 -3
View File
@@ -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)
@@ -117,12 +117,13 @@
[rn/view
{:style (style/sheet-content theme padding-bottom-override insets shell? bottom-margin)
:on-layout #(reset! sheet-height (.-nativeEvent.layout.height ^js %))}
(when gradient-cover?
(when (and gradient-cover? customization-color)
[rn/view {:style style/gradient-bg}
[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
+8
View File
@@ -0,0 +1,8 @@
(ns status-im2.common.font.effects
(:require
utils.image-server
[utils.re-frame :as rf]))
(rf/reg-fx :effects.font/get-font-file-for-initials-avatar
(fn [callback]
(utils.image-server/get-font-file-ready callback)))
@@ -1,15 +1,9 @@
(ns status-im2.common.font
(ns status-im2.common.font.events
(:require
[clojure.string :as string]
[re-frame.core :as re-frame]
utils.image-server
status-im2.common.font.effects
[utils.re-frame :as rf]))
(re-frame/reg-fx
:font/get-font-file-for-initials-avatar
(fn [callback]
(utils.image-server/get-font-file-ready callback)))
(rf/defn init-abs-root-path
{:events [:font/init-font-file-for-initials-avatar]}
[{:keys [db]} initials-avatar-font-file]
+68 -14
View File
@@ -49,16 +49,15 @@
(defn save-auth-method!
[key-uid method]
(keychain/save-credentials
(str key-uid "-auth")
key-uid
method
#(when-not %
(log/error
(str "Error while saving auth method."
" "
"The app will continue to work normally, "
"but you will have to login again next time you launch it.")))))
(-> (keychain/save-credentials
(str key-uid "-auth")
key-uid
method)
(.catch (fn [err]
(log/error "Failed to save auth method in the keychain"
{:error err
:key-uid key-uid
:auth-method method})))))
(re-frame/reg-fx
:keychain/save-auth-method
@@ -79,27 +78,59 @@
(if can-save?
(keychain/get-credentials
(str key-uid "-auth")
#(callback (if % (oops/oget % "password") auth-method-none)))
(fn [value]
(callback (if value (oops/oget value "password") auth-method-none))))
(callback nil))))))
(defn save-user-password!
[key-uid password]
(keychain/save-credentials key-uid key-uid (security/safe-unmask-data password) #()))
(defn get-user-password!
[key-uid callback]
(keychain/get-credentials key-uid
(fn [value]
(callback (when value
(-> value
(oops/oget "password")
(security/mask-data)))))))
(re-frame/reg-fx
:keychain/get-user-password
(fn [[key-uid callback]]
(keychain/get-credentials
key-uid
#(if % (callback (security/mask-data (oops/oget % "password"))) (callback nil)))))
(get-user-password! key-uid callback)))
(rf/defn get-user-password
[_ key-uid callback]
{:keychain/get-user-password [key-uid callback]})
(defn- password-migration-key-name
[key-uid]
(str key-uid "-password-migration"))
(defn save-password-migration!
[key-uid]
(-> (keychain/save-credentials
(password-migration-key-name key-uid)
key-uid
;; NOTE: using the key-uid as the password, but we don't really care about the
;; value, we only care that it's there
key-uid)
(.catch (fn [error]
(log/error "Failed to get the keychain password migration flag"
{:error error
:key-uid key-uid})))))
(defn get-password-migration!
[key-uid callback]
(keychain/get-credentials
(password-migration-key-name key-uid)
(comp callback boolean)))
(re-frame/reg-fx
:keychain/clear-user-password
(fn [key-uid]
(keychain/reset-credentials (password-migration-key-name key-uid))
(keychain/reset-credentials key-uid)))
(re-frame/reg-fx
@@ -107,5 +138,28 @@
(fn [{:keys [key-uid masked-password on-success on-error]}]
(-> (save-user-password! key-uid masked-password)
(.then #(save-auth-method! key-uid auth-method-biometric))
(.then #(save-password-migration! key-uid))
(.then #(when on-success (on-success)))
(.catch #(when on-error (on-error %))))))
;; NOTE: migrating the plaintext password in the keychain
;; with the hashed one. Added due to the sync onboarding
;; flow, where the password arrives already hashed.
(re-frame/reg-fx
:keychain/password-hash-migration
(fn [{:keys [key-uid callback]
:or {callback identity}}]
(-> (get-password-migration! key-uid identity)
(.then (fn [migrated?]
(if migrated?
(callback)
(-> (get-user-password! key-uid identity)
(.then security/hash-masked-password)
(.then #(save-user-password! key-uid %))
(.then #(save-password-migration! key-uid))
(.then callback)))))
(.catch (fn [err]
(log/error "Failed to migrate the keychain password"
{:error err
:key-uid key-uid
:event :keychain/password-hash-migration}))))))
+65
View File
@@ -0,0 +1,65 @@
(ns status-im2.common.pairing.events
(:require
[quo.foundations.colors :as colors]
[status-im2.constants :as constants]
[status-im2.contexts.communities.discover.events]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/defn handle-local-pairing-signals
[{:keys [db]} {:keys [type action data error] :as event}]
(log/info "local pairing signal received"
{:event event})
(let [{:keys [account password]} data
role (get-in db [:syncing :role])
receiver? (= role constants/local-pairing-role-receiver)
sender? (= role constants/local-pairing-role-sender)
connection-success? (and (= type
constants/local-pairing-event-connection-success)
(= action
constants/local-pairing-action-connect))
error-on-pairing? (contains? constants/local-pairing-event-errors type)
completed-pairing? (and (= type
constants/local-pairing-event-transfer-success)
(= action
constants/local-pairing-action-pairing-installation))
received-account? (and (= type
constants/local-pairing-event-received-account)
(= action
constants/local-pairing-action-pairing-account)
(and (some? account) (some? password)))
multiaccount-data (when received-account?
(merge account {:password password}))
navigate-to-syncing-devices? (and (or connection-success? error-on-pairing?) receiver?)
user-in-syncing-devices-screen? (or (= (:view-id db) :syncing-progress)
(= (:view-id db) :syncing-progress-intro))
user-in-sign-in-intro-screen? (= (:view-id db) :sign-in-intro)]
(merge {:db (cond-> db
connection-success?
(assoc-in [:syncing :pairing-status] :connected)
received-account?
(assoc-in [:syncing :profile] multiaccount-data)
error-on-pairing?
(assoc-in [:syncing :pairing-status] :error)
completed-pairing?
(assoc-in [:syncing :pairing-status] :completed))}
(cond
(and navigate-to-syncing-devices? (not user-in-syncing-devices-screen?))
{:dispatch (if user-in-sign-in-intro-screen?
[:navigate-to-within-stack [:syncing-progress-intro :sign-in-intro]]
[:navigate-to :syncing-progress])}
(and completed-pairing? sender?)
{:dispatch [:syncing/clear-states]}
(and completed-pairing? receiver?)
{:dispatch [:profile.login/local-paired-user]}
(and error-on-pairing? (some? error))
{:dispatch [:toasts/upsert
{:icon :i/alert
:icon-color colors/danger-50
:text error}]}))))
@@ -38,10 +38,11 @@
:padding-horizontal screen-padding
:margin-vertical 12})
(def header-text
(defn header-text
[bottom-padding?]
{:padding-horizontal screen-padding
:padding-top 12
:padding-bottom 8
:padding-bottom (when bottom-padding? 8)
:color colors/white})
(def header-sub-text
@@ -53,7 +54,7 @@
:margin-top 20})
(def scan-qr-code-container
{:margin-top 19})
{:margin-top 20})
(def qr-view-finder
{:margin-horizontal screen-padding
+17 -15
View File
@@ -35,13 +35,14 @@
[quo/text
{:size :heading-1
:weight :semi-bold
:style style/header-text}
:style (style/header-text (when subtitle true))}
title]
[quo/text
{:size :paragraph-1
:weight :regular
:style style/header-sub-text}
subtitle]])
(when subtitle
[quo/text
{:size :paragraph-1
:weight :regular
:style style/header-sub-text}
subtitle])])
(defn get-labels-and-on-press-method
[]
@@ -109,21 +110,22 @@
[white-border :bottom-right]]])
(defn- viewfinder
[qr-view-finder]
[qr-view-finder helper-text?]
(let [layout-size (+ (:width qr-view-finder) 2)]
[rn/view {:style (style/viewfinder-container qr-view-finder)}
[white-square layout-size]
[quo/text
{:size :paragraph-2
:weight :regular
:style style/viewfinder-text}
(i18n/label :t/ensure-qr-code-is-in-focus-to-scan)]]))
(when helper-text?
[quo/text
{:size :paragraph-2
:weight :regular
:style style/viewfinder-text}
(i18n/label :t/ensure-qr-code-is-in-focus-to-scan)])]))
(defn- scan-qr-code-tab
[qr-view-finder]
[qr-view-finder helper-text?]
(if (and @camera-permission-granted?
(boolean (not-empty qr-view-finder)))
[viewfinder qr-view-finder]
[viewfinder qr-view-finder helper-text?]
[camera-permission-view]))
(defn- check-qr-code-and-navigate
@@ -223,7 +225,7 @@
[:<>
[rn/view {:style style/scan-qr-code-container}]
[qr-scan-hole-area qr-view-finder]])
[scan-qr-code-tab @qr-view-finder]
[scan-qr-code-tab @qr-view-finder (when subtitle true)]
[rn/view {:style style/flex-spacer}]
(when show-camera?
[quo.theme/provider {:theme :light}
@@ -1,13 +1,12 @@
(ns status-im.signals.core
(ns status-im2.common.signals.events
(:require
[quo.foundations.colors :as colors]
[status-im.chat.models.message :as models.message]
[status-im.ethereum.subscriptions :as ethereum.subscriptions]
[status-im.mailserver.core :as mailserver]
[status-im.transport.message.core :as transport.message]
[status-im.visibility-status-updates.core :as visibility-status-updates]
[status-im2.constants :as constants]
[status-im2.common.pairing.events :as pairing]
[status-im2.contexts.chat.messages.link-preview.events :as link-preview]
[status-im2.contexts.chat.messages.transport.events :as messages.transport]
[status-im2.contexts.communities.discover.events]
[status-im2.contexts.profile.login.events :as profile.login]
[status-im2.contexts.push-notifications.local.events :as local-notifications]
@@ -29,64 +28,6 @@
[{:keys [db]} peer-stats]
{:db (assoc db :peer-stats peer-stats :peers-count (count (:peers peer-stats)))})
(rf/defn handle-local-pairing-signals
[{:keys [db]} {:keys [type action data error] :as event}]
(log/info "local pairing signal received"
{:event event})
(let [{:keys [account password]} data
role (get-in db [:syncing :role])
receiver? (= role constants/local-pairing-role-receiver)
sender? (= role constants/local-pairing-role-sender)
connection-success? (and (= type
constants/local-pairing-event-connection-success)
(= action
constants/local-pairing-action-connect))
error-on-pairing? (contains? constants/local-pairing-event-errors type)
completed-pairing? (and (= type
constants/local-pairing-event-transfer-success)
(= action
constants/local-pairing-action-pairing-installation))
received-account? (and (= type
constants/local-pairing-event-received-account)
(= action
constants/local-pairing-action-pairing-account)
(and (some? account) (some? password)))
multiaccount-data (when received-account?
(merge account {:password password}))
navigate-to-syncing-devices? (and (or connection-success? error-on-pairing?) receiver?)
user-in-syncing-devices-screen? (or (= (:view-id db) :syncing-progress)
(= (:view-id db) :syncing-progress-intro))
user-in-sign-in-intro-screen? (= (:view-id db) :sign-in-intro)]
(merge {:db (cond-> db
connection-success?
(assoc-in [:syncing :pairing-status] :connected)
received-account?
(assoc-in [:syncing :profile] multiaccount-data)
error-on-pairing?
(assoc-in [:syncing :pairing-status] :error)
completed-pairing?
(assoc-in [:syncing :pairing-status] :completed))}
(cond
(and navigate-to-syncing-devices? (not user-in-syncing-devices-screen?))
{:dispatch (if user-in-sign-in-intro-screen?
[:navigate-to-within-stack [:syncing-progress-intro :sign-in-intro]]
[:navigate-to :syncing-progress])}
(and completed-pairing? sender?)
{:dispatch [:syncing/clear-states]}
(and completed-pairing? receiver?)
{:dispatch [:profile.login/local-paired-user]}
(and error-on-pairing? (some? error))
{:dispatch [:toasts/upsert
{:icon :i/alert
:icon-color colors/danger-50
:text error}]}))))
(rf/defn process
{:events [:signals/signal-received]}
[{:keys [db] :as cofx} event-str]
@@ -101,18 +42,18 @@
"backup.performed" {:db (assoc-in db
[:profile/profile :last-backup]
(.-lastBackup event-js))}
"envelope.sent" (transport.message/update-envelopes-status cofx
(:ids
(js->clj event-js
:keywordize-keys
true))
:sent)
"envelope.expired" (transport.message/update-envelopes-status cofx
(:ids
(js->clj event-js
:keywordize-keys
true))
:not-sent)
"envelope.sent" (messages.transport/update-envelopes-status cofx
(:ids
(js->clj event-js
:keywordize-keys
true))
:sent)
"envelope.expired" (messages.transport/update-envelopes-status cofx
(:ids
(js->clj event-js
:keywordize-keys
true))
:not-sent)
"message.delivered" (let [{:keys [chatID messageID]} (js->clj event-js
:keywordize-keys
true)]
@@ -126,9 +67,9 @@
"discovery.summary" (summary cofx (js->clj event-js :keywordize-keys true))
"mediaserver.started" {:db (assoc db :mediaserver/port (.-port event-js))}
"wakuv2.peerstats" (wakuv2-peer-stats cofx (js->clj event-js :keywordize-keys true))
"messages.new" (transport.message/sanitize-messages-and-process-response cofx
event-js
true)
"messages.new" (messages.transport/sanitize-messages-and-process-response cofx
event-js
true)
"wallet" (ethereum.subscriptions/new-wallet-event cofx
(js->clj event-js
:keywordize-keys
@@ -141,7 +82,7 @@
"status.updates.timedout" (visibility-status-updates/handle-visibility-status-updates
cofx
(js->clj event-js :keywordize-keys true))
"localPairing" (handle-local-pairing-signals
"localPairing" (pairing/handle-local-pairing-signals
cofx
(js->clj event-js :keywordize-keys true))
"curated.communities.update" (rf/dispatch [:fetched-contract-communities
+2 -2
View File
@@ -44,8 +44,8 @@
(when chat-id
(if-not (own-public-key? db chat-id)
{:dispatch [:chat.ui/start-chat chat-id]}
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/can-not-add-yourself)}})))
{:effects.utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (i18n/label :t/can-not-add-yourself)}})))
(rf/defn handle-community-requests
[cofx {:keys [community-id]}]
+2
View File
@@ -170,3 +170,5 @@
(def default-kdf-iterations 3200)
(def shell-navigation-disabled? false)
(def community-accounts-selection-enabled? false)
+2
View File
@@ -372,7 +372,9 @@
;; wallet
(def ^:const mainnet-chain-id 1)
(def ^:const optimism-chain-id 10)
(def ^:const optimism-test-chain-id 420)
(def ^:const arbitrum-chain-id 42161)
(def ^:const arbitrum-test-chain-id 421613)
(def ^:const goerli-chain-id 5)
(def ^:const mainnet-short-name "eth")
@@ -0,0 +1,22 @@
(ns status-im2.contexts.add-new-contact.effects
(:require
[native-module.core :as native-module]
[status-im.ethereum.ens :as ens]
[status-im2.constants :as constants]
[utils.re-frame :as rf]
[utils.transforms :as transforms]))
(rf/reg-fx :effects.contacts/decompress-public-key
(fn [{:keys [compressed-key on-success on-error]}]
(native-module/compressed-key->public-key
compressed-key
constants/deserialization-key
(fn [resp]
(let [{:keys [error]} (transforms/json->clj resp)]
(if error
(on-error error)
(on-success (str "0x" (subs resp 5)))))))))
(rf/reg-fx :effects.contacts/resolve-public-key-from-ens
(fn [{:keys [chain-id ens on-success on-error]}]
(ens/pubkey chain-id ens on-success on-error)))
@@ -1,17 +1,13 @@
(ns status-im2.contexts.add-new-contact.events
(:require
[clojure.string :as string]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[status-im.ethereum.ens :as ens]
[status-im2.constants :as constants]
status-im2.contexts.add-new-contact.effects
[status-im2.contexts.contacts.events :as data-store.contacts]
[status-im2.navigation.events :as navigation]
[utils.ens.stateofus :as stateofus]
[utils.ethereum.chain :as chain]
[utils.re-frame :as rf]
[utils.string :as utils.string]
[utils.transforms :as transforms]
[utils.validators :as validators]))
(defn init-contact
@@ -108,14 +104,14 @@
:empty {:db (dissoc db :contacts/new-identity)}
(:valid :invalid) {:db (assoc db :contacts/new-identity contact)}
:decompress-key {:db (assoc db :contacts/new-identity contact)
:contacts/decompress-public-key
:effects.contacts/decompress-public-key
{:compressed-key id
:on-success
(dispatcher :contacts/set-new-identity-success input)
:on-error
(dispatcher :contacts/set-new-identity-error input)}}
:resolve-ens {:db (assoc db :contacts/new-identity contact)
:contacts/resolve-public-key-from-ens
:effects.contacts/resolve-public-key-from-ens
{:chain-id (chain/chain-id db)
:ens ens
:on-success
@@ -123,22 +119,7 @@
:on-error
(dispatcher :contacts/set-new-identity-error input)}})))
(re-frame/reg-fx
:contacts/decompress-public-key
(fn [{:keys [compressed-key on-success on-error]}]
(native-module/compressed-key->public-key
compressed-key
constants/deserialization-key
(fn [resp]
(let [{:keys [error]} (transforms/json->clj resp)]
(if error
(on-error error)
(on-success (str "0x" (subs resp 5)))))))))
(re-frame/reg-fx
:contacts/resolve-public-key-from-ens
(fn [{:keys [chain-id ens on-success on-error]}]
(ens/pubkey chain-id ens on-success on-error)))
(rf/defn build-contact
{:events [:contacts/build-contact]}
@@ -115,7 +115,7 @@
:ens ens-stateofus-eth
:public-key nil ; not yet...
:state :resolve-ens}))
:contacts/resolve-public-key-from-ens
:effects.contacts/resolve-public-key-from-ens
{:chain-id 1
:ens ens-stateofus-eth
:on-success [:contacts/set-new-identity-success ens]
@@ -131,7 +131,7 @@
:type :compressed-key
:public-key nil ; not yet...
:state :decompress-key}))
:contacts/decompress-public-key
:effects.contacts/decompress-public-key
{:compressed-key user-ckey
:on-success [:contacts/set-new-identity-success user-ckey]
:on-error [:contacts/set-new-identity-error user-ckey]}})))
@@ -0,0 +1,20 @@
(ns status-im2.contexts.add-new-contact.scan.scan-profile-qr-page
(:require [react-native.core :as rn]
[react-native.hooks :as hooks]
[status-im2.common.scan-qr-code.view :as scan-qr-code]
[utils.debounce :as debounce]
[utils.i18n :as i18n]))
(defn- f-internal-view
[]
(let [{:keys [keyboard-shown]} (hooks/use-keyboard)]
[:<>
(when keyboard-shown
(rn/dismiss-keyboard!))
[scan-qr-code/view
{:title (i18n/label :t/scan-qr)
:on-success-scan #(debounce/debounce-and-dispatch [:contacts/set-new-identity % %] 300)}]]))
(defn view
[]
[:f> f-internal-view])
@@ -4,7 +4,6 @@
[react-native.clipboard :as clipboard]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.qr-scanner.core :as qr-scanner]
[status-im2.contexts.add-new-contact.style :as style]
[utils.address :as address]
[utils.debounce :as debounce]
@@ -96,8 +95,7 @@
{:type :outline
:icon-only? true
:size 40
:on-press #(rf/dispatch [::qr-scanner/scan-code
{:handler :contacts/qr-code-scanned}])}
:on-press #(rf/dispatch [:open-modal :scan-profile-qr-code])}
:i/scan]]])
(finally
(rf/dispatch [:contacts/clear-new-identity]))))
@@ -7,7 +7,7 @@
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[reagent.core :as reagent]
[status-im2.common.alert.events :as alert]
[status-im2.common.alert.effects :as alert.effects]
[status-im2.common.device-permissions :as device-permissions]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.actions.style :as style]
@@ -146,7 +146,7 @@
:on-denied
#(js/setTimeout
(fn []
(alert/show-popup
(alert.effects/show-popup
(i18n/label :t/audio-recorder-error)
(i18n/label
:t/audio-recorder-permissions-error)
@@ -198,9 +198,9 @@
(reanimated/get-shared-value height)])
(rf/dispatch [:open-modal :photo-selector {:insets insets}]))
:on-denied (fn []
(alert/show-popup (i18n/label :t/error)
(i18n/label
:t/external-storage-denied)))}))
(alert.effects/show-popup (i18n/label :t/error)
(i18n/label
:t/external-storage-denied)))}))
(defn image-button
[props animations insets edit]
@@ -246,6 +246,6 @@
[:f> send-button props state animations window-height images edit send-btn-opacity
scroll-to-bottom-fn]
(when (and (not edit) (not images))
;; TODO(alwx): needs to be replaced with an `audio-button` later.
;; See https://github.com/status-im/status-mobile/issues/16084 for more details.
;; TODO(alwx): needs to be replaced with an `audio-button` later. See
;; https://github.com/status-im/status-mobile/issues/16084 for more details.
[:f> disabled-audio-button audio-btn-opacity])]))
+18
View File
@@ -0,0 +1,18 @@
(ns status-im2.contexts.chat.effects
(:require
[react-native.async-storage :as async-storage]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[utils.re-frame :as rf]))
(rf/reg-fx :effects.chat/open-last-chat
(fn [key-uid]
(async-storage/get-item
:chat-id
(fn [chat-id]
(when chat-id
(async-storage/get-item
:key-uid
(fn [stored-key-uid]
(when (= stored-key-uid key-uid)
(rf/dispatch [:chat/navigate-to-chat chat-id
shell.constants/open-screen-without-animation])))))))))
+7 -22
View File
@@ -3,7 +3,6 @@
[clojure.set :as set]
[quo.foundations.colors :as colors]
[re-frame.core :as re-frame]
[react-native.async-storage :as async-storage]
[reagent.core :as reagent]
[status-im.chat.models.loading :as loading]
[status-im.data-store.chats :as chats-store]
@@ -11,11 +10,11 @@
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.link-preview.events :as link-preview]
status-im2.contexts.chat.effects
[status-im2.contexts.chat.messages.delete-message-for-me.events :as delete-for-me]
[status-im2.contexts.chat.messages.delete-message.events :as delete-message]
[status-im2.contexts.chat.messages.list.state :as chat.state]
[status-im2.contexts.contacts.events :as contacts-store]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.datetime :as datetime]
@@ -172,11 +171,11 @@
(chat.state/reset-visible-item)
(rf/merge cofx
(merge
{:db (-> db
(dissoc :current-chat-id)
(assoc-in [:chat/inputs chat-id :focused?] false))
:async-storage-set {:chat-id nil
:key-uid nil}}
{:db (-> db
(dissoc :current-chat-id)
(assoc-in [:chat/inputs chat-id :focused?] false))
:effects.async-storage/set {:chat-id nil
:key-uid nil}}
(let [community-id (get-in db [:chats chat-id :community-id])]
;; When navigating back from community chat to community, update switcher card
;; A close chat event is also called while opening any chat.
@@ -431,21 +430,7 @@
[{:keys [db]} value]
{:db (assoc db :lightbox/scale value)})
(re-frame/reg-fx
:chat/open-last-chat
(fn [key-uid]
(async-storage/get-item
:chat-id
(fn [chat-id]
(when chat-id
(async-storage/get-item
:key-uid
(fn [stored-key-uid]
(when (= stored-key-uid key-uid)
(re-frame/dispatch [:chat/navigate-to-chat chat-id
shell.constants/open-screen-without-animation])))))))))
(rf/defn check-last-chat
{:events [:chat/check-last-chat]}
[{:keys [db]}]
{:chat/open-last-chat (get-in db [:profile/profile :key-uid])})
{:effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])})
@@ -1,11 +1,12 @@
(ns status-im2.contexts.chat.menus.pinned-messages.style
(:require
[quo.foundations.colors :as colors]))
[quo.foundations.colors :as colors]
[react-native.platform :as platform]))
(defn heading
[community?]
{:margin-horizontal 20
:margin-bottom (when-not community? 24)})
{:padding-horizontal 20
:margin-bottom (when-not community? 12)})
(defn heading-container
[]
@@ -31,23 +32,28 @@
:margin-right 8
:color (colors/theme-colors colors/neutral-60 colors/neutral-20)})
(defn list-footer
[bottom-inset]
{:height bottom-inset})
(defn no-pinned-messages-container
[bottom-inset]
(def no-pinned-messages-container
{:justify-content :center
:align-items :center
:margin-top 20
:margin-bottom bottom-inset})
:margin 12
:margin-bottom (when platform/android? 12)})
(def no-pinned-messages-icon
{:width 120
:height 120
{:width 80
:height 80
:justify-content :center
:align-items :center
:border-width 1})
(def no-pinned-messages-content
{:margin-top 12})
(def no-pinned-messages-title
{:text-align :center})
(def no-pinned-messages-text
{:margin-top 20})
{:text-align :center
:margin-top 2})
(def list-footer
{:height (when platform/android? 12)})
@@ -5,7 +5,6 @@
[react-native.core :as rn]
[react-native.fast-image :as fast-image]
[react-native.gesture :as gesture]
[react-native.safe-area :as safe-area]
[status-im2.contexts.chat.menus.pinned-messages.style :as style]
[status-im2.contexts.chat.messages.content.view :as message]
[utils.i18n :as i18n]
@@ -24,6 +23,25 @@
[message _ _ context]
[message/message message context (atom false)])
(defn empty-pinned-messages-state
[{:keys [community?]}]
[rn/view {:style style/no-pinned-messages-container}
[rn/view {:style style/no-pinned-messages-icon}
[quo/icon :i/placeholder]]
[rn/view {:style style/no-pinned-messages-content}
[quo/text
{:size :paragraph-1
:weight :semi-bold
:style style/no-pinned-messages-title}
(i18n/label :t/no-pinned-messages)]
[quo/text
{:size :paragraph-2
:style style/no-pinned-messages-text}
(i18n/label
(if community?
:t/no-pinned-messages-community-desc
:t/no-pinned-messages-desc))]]])
(defn pinned-messages
[chat-id]
(let [pinned (rf/sub [:chats/pinned-sorted-list chat-id])
@@ -31,10 +49,10 @@
current-chat (rf/sub [:chat-by-id chat-id])
{:keys [community-id]} current-chat
community (rf/sub [:communities/community community-id])
bottom-inset (safe-area/get-bottom)
community-images (rf/sub [:community/images community-id])]
[gesture/scroll-view
{:accessibility-label :pinned-messages-menu}
{:accessibility-label :pinned-messages-menu
:bounces false}
[:<>
[quo/text
{:size :heading-2
@@ -61,18 +79,8 @@
{:data pinned
:render-data render-data
:render-fn message-render-fn
:footer [rn/view {:style (style/list-footer bottom-inset)}]
:footer [rn/view {:style style/list-footer}]
:key-fn list-key-fn
:separator [quo/separator {:style {:margin-vertical 8}}]}]
[rn/view {:style (style/no-pinned-messages-container bottom-inset)}
[rn/view {:style style/no-pinned-messages-icon}
[quo/icon :i/placeholder]]
[quo/text
{:weight :semi-bold
:style style/no-pinned-messages-text}
(i18n/label :t/no-pinned-messages)]
[quo/text {:size :paragraph-2}
(i18n/label
(if community
:t/no-pinned-messages-community-desc
:t/no-pinned-messages-desc))]])]))
[empty-pinned-messages-state
{:community? (boolean community)}])]))

Some files were not shown because too many files have changed in this diff Show More