Compare commits

..
Author SHA1 Message Date
Volodymyr Kozieiev 7b858e3dd0 Gating on Status community 2023-02-16 14:19:47 +00:00
250 changed files with 3232 additions and 3836 deletions
+1 -5
View File
@@ -16,11 +16,7 @@
;; respect blank line
;; https://github.com/kkinnear/zprint/blob/main/doc/reference.md#respect-bl
:respect-bl
;; hang multiline left-hand-thing
;; https://github.com/kkinnear/zprint/issues/273
:multi-lhs-hang]
:respect-bl]
:fn-map
{"reg-sub" :arg1-pair
"h/describe" :arg1-body
+2 -2
View File
@@ -349,8 +349,8 @@ component-test-watch: ##@ Watch tests and re-run no changes to cljs files
component-test: export TARGET := clojure
component-test: export COMPONENT_TEST := true
component-test: export BABEL_ENV := test
component-test: ##@test Run component tests once in NodeJS
yarn install
component-test: ##@test Run tests once in NodeJS
# Here we create the gyp bindings for nodejs
yarn shadow-cljs compile component-test && \
jest --config=test/jest/jest.config.js
-8
View File
@@ -68,14 +68,6 @@ pipeline {
}
}
}
stage('Component Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make component-test 2>&1 | tee -a ${LOG_FILE}
"""
}
}
stage('Upload') {
steps {
script {
+3 -17
View File
@@ -1,4 +1,4 @@
# Code Style Guidelines
# Guidelines
>The goal of this document is to help all contributors (core and external) to
>write code in _unison_ and help establish good practices that serve the Status
@@ -77,21 +77,7 @@ Joshua Comeau.
[rn/view {:style {:padding-horizontal 20}}]
```
### Don't prepend booleans with is-
It is a common practice in JavaScript and other languages to prepend boolean variable names with `is-*`.
In ClojureScript it is common practice to suffix boolean variable names with a `?`.
There is no need for both of these and so it is preferable to stick with the latter.
```clojure
;; bad
(let [is-open? true] ...)
;; good
(let [open? true] ...)
```
### Styles def vs defn
#### Styles def vs defn
Always use `def` over `defn`, unless the style relies on dynamic values, such as
deref'ed atoms.
@@ -184,7 +170,7 @@ Use the simple `defn` to declare components. Don't use `utils.views/defview` and
(do-something window-width)))
```
### Use `[]` instead of `()` in Reagent components
#### Use `[]` instead of `()` in Reagent components
- The `()` version [does NOT work with Form-2 and
Form-3](https://github.com/reagent-project/reagent/blob/master/doc/UsingSquareBracketsInsteadOfParens.md#a-further-significant-why)
+2 -16
View File
@@ -18,6 +18,8 @@ Also test watcher can be launched. It will re-run the entire test suite when any
Developers can also manually change the shadow-cljs option `:ns-regex` to control which namespaces the test runner should pick.
## Testing with REPL
The most convenient way to develop and run test locally is using REPL:
@@ -50,19 +52,3 @@ In the video below, you can see two buffers side-by-side. On the left the source
Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right pane the output coming from running the make target).
[2022-12-19 13-17.webm](https://user-images.githubusercontent.com/46027/208471199-1909c446-c82d-42a0-9350-0c15ca562713.webm)
## Component tests
To run tests:
```
make component-test
```
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
```
make component-test-watch
```
Check [component tests doc](./component-tests-overview.md) for more.
@@ -797,7 +797,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
final JSONObject jsonConfig = new JSONObject(configJSON);
final String keyStorePath = pathCombine(this.getNoBackupDirectory(), "/keystore");
jsonConfig.put("keystorePath", keyStorePath);
jsonConfig.put("rootDataDir", this.getNoBackupDirectory());
executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
}
@@ -329,13 +329,12 @@ RCT_EXPORT_METHOD(inputConnectionStringForBootstrapping:(NSString *)cs
NSDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *rootDataDir = rootUrl.path;
NSURL *multiaccountKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
NSString *keystoreDir = multiaccountKeystoreDir.path;
[configDict setValue:keystoreDir forKey:@"keystorePath"];
[configDict setValue:rootDataDir forKey:@"rootDataDir"];
NSString *modifiedConfigJSON = [configDict bv_jsonStringWithPrettyPrint:NO];
NSString *result = StatusgoInputConnectionStringForBootstrapping(cs,modifiedConfigJSON);
callback(@[result]);
}
-12
View File
@@ -32,18 +32,6 @@ in {
# For parsing gradle.properties into an attrset
gradlePropParser = callPackage ./tools/gradlePropParser.nix { };
# Clojure formatting tool
zprint = super.zprint.override rec {
buildGraalvmNativeImage = args: super.buildGraalvmNativeImage ( args // rec {
inherit (args) pname;
version = "1.2.5";
src = self.fetchurl {
url = "https://github.com/kkinnear/${pname}/releases/download/${version}/${pname}-filter-${version}";
sha256 = "sha256-PWdR5jqyzvTk9HoxqDldwtZNik34dmebBtZZ5vtva4A=";
};
});
};
# Package version adjustments
gradle = super.gradle_5;
nodejs = super.nodejs-16_x;
+1 -1
View File
@@ -19,7 +19,7 @@
"@babel/preset-typescript": "^7.17.12",
"@react-native-async-storage/async-storage": "^1.17.9",
"@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur#refs/tags/v4.3.1-status",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur#refs/tags/v4.3.0-status",
"@react-native-community/cameraroll": "git+https://github.com/status-im/react-native-cameraroll.git#refs/tags/v4.0.4-status.0",
"@react-native-community/clipboard": "^1.2.2",
"@react-native-community/hooks": "^2.5.1",
+50 -50
View File
@@ -1,64 +1,64 @@
;; shadow-cljs configuration
{:source-paths ["src" "test/cljs"]
{:source-paths ["src" "test/cljs"]
:dependencies [[reagent "1.0.0"]
[re-frame "0.12.0"]
[binaryage/oops "0.7.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[status-im/timbre "4.10.0-2-status"]
[com.taoensso/encore "2.105.0"]
[hickory "0.7.1"]
[cljs-bean "1.3.0"]
[com.cognitect/transit-cljs "0.8.248"]
[mvxcvi/alphabase "1.0.0"]
[camel-snake-kebab "0.4.3"]
;; dev dependencies
[refactor-nrepl "2.5.0"]
[cider/cider-nrepl "0.25.3"]
[cider/piggieback "0.4.1"]
[re-frisk-remote "1.6.0"]
;; routing
[bidi "2.1.6"]
;; test dependencies
[day8.re-frame/test "0.1.5"]
[com.taoensso/tufte "2.1.0"]]
:dependencies [[reagent "1.0.0"]
[re-frame "0.12.0"]
[binaryage/oops "0.7.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[status-im/timbre "4.10.0-2-status"]
[com.taoensso/encore "2.105.0"]
[hickory "0.7.1"]
[cljs-bean "1.3.0"]
[com.cognitect/transit-cljs "0.8.248"]
[mvxcvi/alphabase "1.0.0"]
[camel-snake-kebab "0.4.3"]
;; dev dependencies
[refactor-nrepl "2.5.0"]
[cider/cider-nrepl "0.25.3"]
[cider/piggieback "0.4.1"]
[re-frisk-remote "1.6.0"]
;; routing
[bidi "2.1.6"]
;; test dependencies
[day8.re-frame/test "0.1.5"]
[com.taoensso/tufte "2.1.0"]]
;; port and middleware for repl in development
:nrepl {:port 7888
:middleware [cider.piggieback/wrap-cljs-repl
refactor-nrepl.middleware/wrap-refactor]}
:nrepl {:port 7888
:middleware [cider.piggieback/wrap-cljs-repl
refactor-nrepl.middleware/wrap-refactor]}
;; shadow-cljs web interface
:http {:port 3449
:host "0.0.0.0"}
:http {:port 3449
:host "0.0.0.0"}
:cache-blockers #{status-im.utils.js-resources status-im.ui.components.icons.icons}
:builds
{:mobile
{:target :react-native
{:target :react-native
:output-dir "app"
:init-fn status-im2.core/init
:init-fn status-im2.core/init
;; When false, the Shadow-CLJS watcher won't automatically refresh
;; the target files (a.k.a hot reload). When false, you can manually
;; reload by calling `shadow.cljs.devtools.api/watch-compile-all!`.
:devtools {:autobuild #shadow/env ["SHADOW_AUTOBUILD_ENABLED" :default true :as :bool]}
:dev {:devtools {:after-load status-im2.setup.hot-reload/reload
:build-notify status-im2.setup.hot-reload/build-notify
:preloads [re-frisk-remote.preload]}
:closure-defines
{status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
status-im2.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"}
:compiler-options {:output-feature-set :es5
:closure-defines
{re-frame.trace/trace-enabled? true}
:source-map false
:infer-externs true}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
;; it will use the right interface
:local-ip #shadow/env "SHADOW_HOST"}
:chunks {:fleets status-im.fleet.default-fleet/default-fleets}
:devtools {:autobuild #shadow/env ["SHADOW_AUTOBUILD_ENABLED" :default true :as :bool]}
:dev {:devtools {:after-load status-im2.setup.hot-reload/reload
:build-notify status-im2.setup.hot-reload/build-notify
:preloads [re-frisk-remote.preload]}
:closure-defines
{status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
status-im2.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"}
:compiler-options {:output-feature-set :es5
:closure-defines
{re-frame.trace/trace-enabled? true}
:source-map false
:infer-externs true}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
;; it will use the right interface
:local-ip #shadow/env "SHADOW_HOST"}
:chunks {:fleets status-im.fleet.default-fleet/default-fleets}
:release
{:closure-defines
{status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
@@ -77,10 +77,10 @@
;; produced by the target :mocks below and redefines node require
;; function to use the mocks instead of the rn libraries
:test
{:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :simple
:target :node-test
{:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :simple
:target :node-test
;; When running tests without a REPL you can uncomment below line to `make test-watch` a specific file
;; :ns-regexp "status-im2.subs.chat.messages-test$"
:main
+68 -69
View File
@@ -33,64 +33,63 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
(def svg #js {})
(def react-native
(clj->js
{:NativeModules {:RNGestureHandlerModule {:Direction (fn [])}
:PushNotifications {}
:Status utils.test/status
:ReanimatedModule {:configureProps (fn [])}}
(clj->js {:NativeModules {:RNGestureHandlerModule {:Direction (fn [])}
:PushNotifications {}
:Status utils.test/status
:ReanimatedModule {:configureProps (fn [])}}
:View {}
:RefreshControl {}
:AppState {}
:Alert {:alert (fn [])}
:FlatList {}
:SectionList {}
:Text {}
:StatusBar {}
:ScrollView {}
:KeyboardAvoidingView {}
:TextInput {}
:Image {}
:Picker {:Item {}}
:Switch {}
:Modal {}
:Keyboard {:dismiss (fn [])}
:Linking {}
:TouchableWithoutFeedback {}
:TouchableHighlight {}
:Pressable {}
:TouchableOpacity {}
:ActivityIndicator {}
:StyleSheet {:create (fn [])}
:Animated {:createAnimatedComponent identity
:Value (fn [])
:ValueXY (fn [])
:View {}
:FlatList {}
:ScrollView {}
:Text {}}
:Easing {:bezier (fn [])
:poly (fn [])
:out (fn [])
:in (fn [])
:inOut (fn [])}
:DeviceEventEmitter {:addListener (fn [])}
:Dimensions {:get (fn []) :addEventListener identity}
:useWindowDimensions {}
:Platform {:select (fn [])}
:I18nManager {:isRTL ""}
:NativeEventEmitter (fn [])
:LayoutAnimation {:Presets #js
{:easeInEaseOut nil
:linear nil
:spring nil}
:Types #js {}
:Properties #{}
:create (fn [])
:configureNext (fn [])}
:requireNativeComponent (fn [] {:propTypes ""})
:Appearance {:getColorScheme (fn [])
:addChangeListener (fn [])}}))
:View {}
:RefreshControl {}
:AppState {}
:Alert {:alert (fn [])}
:FlatList {}
:SectionList {}
:Text {}
:StatusBar {}
:ScrollView {}
:KeyboardAvoidingView {}
:TextInput {}
:Image {}
:Picker {:Item {}}
:Switch {}
:Modal {}
:Keyboard {:dismiss (fn [])}
:Linking {}
:TouchableWithoutFeedback {}
:TouchableHighlight {}
:Pressable {}
:TouchableOpacity {}
:ActivityIndicator {}
:StyleSheet {:create (fn [])}
:Animated {:createAnimatedComponent identity
:Value (fn [])
:ValueXY (fn [])
:View {}
:FlatList {}
:ScrollView {}
:Text {}}
:Easing {:bezier (fn [])
:poly (fn [])
:out (fn [])
:in (fn [])
:inOut (fn [])}
:DeviceEventEmitter {:addListener (fn [])}
:Dimensions {:get (fn []) :addEventListener identity}
:useWindowDimensions {}
:Platform {:select (fn [])}
:I18nManager {:isRTL ""}
:NativeEventEmitter (fn [])
:LayoutAnimation {:Presets #js
{:easeInEaseOut nil
:linear nil
:spring nil}
:Types #js {}
:Properties #{}
:create (fn [])
:configureNext (fn [])}
:requireNativeComponent (fn [] {:propTypes ""})
:Appearance {:getColorScheme (fn [])
:addChangeListener (fn [])}}))
(set! js/ReactNative react-native)
@@ -176,19 +175,19 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
(def react-native-navigation
#js
{:Navigation #js
{:constants (fn [] #js {:then identity})
:setDefaultOptions identity
:setRoot identity
:dismissOverlay #(js/Promise.resolve)
:showOverlay identity
{:constants (fn [] #js {:then identity})
:setDefaultOptions identity
:setRoot identity
:dismissOverlay #(js/Promise.resolve)
:showOverlay identity
:setLazyComponentRegistrator identity
:pop identity
:push identity
:mergeOptions identity
:popToRoot identity
:showModal identity
:dismissModal identity
:registerComponent identity
:pop identity
:push identity
:mergeOptions identity
:popToRoot identity
:showModal identity
:dismissModal identity
:registerComponent identity
:events
(fn []
#js
+6 -6
View File
@@ -66,15 +66,15 @@
border-radius 8
haptic-type :selection}}
children]
(let [theme' (cond
disabled :disabled
:else theme)
(let [theme' (cond
disabled :disabled
:else theme)
{:keys [icon-color background-color text-color border-color]}
(themes theme')
optional-haptic (fn []
(when haptic-feedback
(haptic/trigger haptic-type)))]
optional-haptic (fn []
(when haptic-feedback
(haptic/trigger haptic-type)))]
[animation/pressable
(merge {:bg-color background-color
:border-radius border-radius
+18 -18
View File
@@ -14,24 +14,24 @@
(fn [props]
(let [{:keys [value onChange disabled]}
(bean/bean props)
state (animated/use-value 0)
tap-state (animated/use-value (:undetermined gh/states))
tap-handler (animated/on-gesture {:state tap-state})
hold (react/use-memo
(fn []
(animated/with-timing-transition
(animated/eq tap-state (:began gh/states))
{}))
[])
transition (react/use-memo
(fn []
(animated/with-spring-transition state
(:lazy
animated/springs)))
[])
press-end (fn []
(when (and (not disabled) onChange)
(onChange (not value))))]
state (animated/use-value 0)
tap-state (animated/use-value (:undetermined gh/states))
tap-handler (animated/on-gesture {:state tap-state})
hold (react/use-memo
(fn []
(animated/with-timing-transition
(animated/eq tap-state (:began gh/states))
{}))
[])
transition (react/use-memo
(fn []
(animated/with-spring-transition state
(:lazy
animated/springs)))
[])
press-end (fn []
(when (and (not disabled) onChange)
(onChange (not value))))]
(animated/code!
(fn []
(animated/cond* (animated/eq tap-state (:end gh/states))
+8 -8
View File
@@ -102,7 +102,7 @@
(into [rn/view {:style header-actions-style}]
(map header-action accessories))
component component
component component
:else
[rn/view {:style header-action-placeholder}])])
@@ -111,7 +111,7 @@
[{:keys [title subtitle component title-align]}]
[:<>
(cond
component component
component component
(and title subtitle)
[:<>
@@ -125,12 +125,12 @@
:number-of-lines 1}
subtitle]]
title [text/text
{:weight :bold
:number-of-lines 0
:align title-align
:size :large}
title])])
title [text/text
{:weight :bold
:number-of-lines 0
:align title-align
:size :large}
title])])
(defn header
[{:keys [left-width right-width]}]
+14 -14
View File
@@ -227,22 +227,22 @@
animated platform/ios?
active-background-enabled true
haptic-type :selection}}]
(let [theme (if disabled :disabled theme)
(let [theme (if disabled :disabled theme)
{:keys [text-color active-background passive-background]}
(themes theme)
icon-color (or icon-color
(:icon-color (themes theme)))
icon-bg-color (or icon-bg-color
(:icon-bg-color (themes theme)))
optional-haptic (fn []
(when haptic-feedback
(haptic/trigger haptic-type)))
component (cond
(and (not on-press)
(not on-long-press))
rn/view
animated animated/pressable
:else rn/touchable-highlight)]
icon-color (or icon-color
(:icon-color (themes theme)))
icon-bg-color (or icon-bg-color
(:icon-bg-color (themes theme)))
optional-haptic (fn []
(when haptic-feedback
(haptic/trigger haptic-type)))
component (cond
(and (not on-press)
(not on-long-press))
rn/view
animated animated/pressable
:else rn/touchable-highlight)]
[rn/view
{:background-color (cond (not= background-color nil)
background-color
+3 -6
View File
@@ -47,10 +47,7 @@
(into [component
(merge {:style (text-style props)}
(dissoc props
:style
:size
:weight
:color
:align
:animated?))]
:style :size
:weight :color
:align :animated?))]
(reagent/children this))))
+7 -10
View File
@@ -186,7 +186,7 @@
{:icon :main-icons/show
:on-press #(reset! visible true)}
:else after)
:else after)
secure (boolean (and secure-text-entry (not @visible))) ; must be a boolean to work on
; iOS
auto-complete (cond
@@ -259,15 +259,12 @@
(when (and platform/ios? (not after))
{:clear-button-mode :while-editing})
(dissoc props
:style
:keyboard-type
:on-focus
:on-blur
:secure-text-entry
:ref
:get-ref
:auto-correct
:auto-complete-type))]
:style
:keyboard-type :on-focus
:on-blur
:secure-text-entry
:ref :get-ref
:auto-correct :auto-complete-type))]
(when after
[accessory-element after])]
(when (and show-cancel
+3 -3
View File
@@ -61,9 +61,9 @@
:justify-content :center}
[quo/button
(merge (dissoc @state
:theme
:before
:after)
:theme
:before
:after)
{:on-press #(println "Hello world!")}
(when @theme
{:theme @theme})
+2 -2
View File
@@ -121,8 +121,8 @@
:property (:opacity layout-animation-properties)}}})
(defonce enable-layout-animations
(when platform/android?
(.setLayoutAnimationEnabledExperimental ^js ui-manager true)))
(when platform/android?
(.setLayoutAnimationEnabledExperimental ^js ui-manager true)))
(def activity-indicator (reagent/adapt-react-class (.-ActivityIndicator ^js rn)))
@@ -1,16 +1,16 @@
(ns quo2.components.animated-header-flatlist.view
(:require
[quo2.core :as quo]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[quo2.foundations.colors :as colors]
[status-im.ui.components.fast-image :as fast-image]
[quo2.components.animated-header-flatlist.style :as style]
[oops.core :as oops]
[utils.re-frame :as rf]))
[quo2.core :as quo]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[quo2.foundations.colors :as colors]
[status-im.ui.components.fast-image :as fast-image]
[quo2.components.animated-header-flatlist.style :as style]
[oops.core :as oops]
[utils.re-frame :as rf]))
(def header-height 234)
(def cover-height 192)
+1 -1
View File
@@ -256,7 +256,7 @@
(if (= state :pressed)
(colors/theme-colors colors/neutral-100 colors/white)
:transparent)
:width width}
:width width}
style)}
[rn/view
{:style (merge
+23 -27
View File
@@ -90,36 +90,32 @@
(defn token-requirement-list
[props community-color]
(let [{:keys [gate token-requirements-changed?
required-tokens-lost?]} props
(let [{:keys [gate token-requirements-changed? required-tokens-lost?]} props
[gate-type token-requirement-lists] gate
multiple-token-requirements? (multiple-token-requirements? token-requirement-lists)
is-sufficient? (are-multiple-token-requirements-met?
token-requirement-lists)
you-must-hold-label (if (= gate-type :join)
(cond
token-requirements-changed? :t/you-must-now-hold
required-tokens-lost? :t/you-must-always-hold
:else :t/you-must-hold)
:t/you-must-hold)
message-label (cond
(= gate-type :join)
(cond
token-requirements-changed?
:t/community-join-requirements-changed
required-tokens-lost?
:t/community-join-requirements-tokens-lost
:else (if is-sufficient?
multiple-token-requirements? (multiple-token-requirements? token-requirement-lists)
is-sufficient? (are-multiple-token-requirements-met? token-requirement-lists)
you-must-hold-label (if (= gate-type :join)
(cond
token-requirements-changed? :t/you-must-now-hold
required-tokens-lost? :t/you-must-always-hold
:else :t/you-must-hold)
:t/you-must-hold)
message-label (cond
(= gate-type :join)
(cond
token-requirements-changed? :t/community-join-requirements-changed
required-tokens-lost? :t/community-join-requirements-tokens-lost
:else (if is-sufficient?
:t/community-join-requirements-met
:t/community-join-requirements-not-met))
(= gate-type :read)
(if is-sufficient?
:t/community-channel-read-requirements-met
:t/community-channel-read-requirements-not-met)
(= gate-type :write)
(if is-sufficient?
:t/community-channel-write-requirements-met
:t/community-channel-write-requirements-not-met))]
(= gate-type :read)
(if is-sufficient?
:t/community-channel-read-requirements-met
:t/community-channel-read-requirements-not-met)
(= gate-type :write)
(if is-sufficient?
:t/community-channel-write-requirements-met
:t/community-channel-write-requirements-not-met))]
[rn/view
[rn/view {:style (get styles :token-requirement-text-spacing)}
[text/text
@@ -6,10 +6,10 @@
[quo2.components.drawers.action-drawers.style :as style]))
(defn- get-icon-color
[danger? override-theme]
[danger?]
(if danger?
colors/danger-50
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)))
(colors/theme-colors colors/neutral-50 colors/neutral-40)))
(def divider
[rn/view
@@ -25,7 +25,6 @@
danger?
on-press
add-divider?
override-theme
accessibility-label]
:as action-props}]
(when action-props
@@ -34,7 +33,7 @@
[rn/touchable-highlight
{:accessibility-label accessibility-label
:style (style/container sub-label)
:underlay-color (colors/theme-colors colors/neutral-5 colors/neutral-90 override-theme)
:underlay-color (colors/theme-colors colors/neutral-5 colors/neutral-90)
:on-press on-press}
[rn/view
{:style (style/row-container sub-label)}
@@ -43,7 +42,7 @@
:accessible true
:style style/left-icon}
[icon/icon icon
{:color (get-icon-color danger? override-theme)
{:color (get-icon-color danger?)
:size 20}]]
[rn/view
{:style style/text-container}
@@ -51,15 +50,14 @@
{:size :paragraph-1
:weight :medium
:style {:color
(cond
danger? (colors/theme-colors colors/danger-50 colors/danger-60 override-theme)
:else (colors/theme-colors colors/neutral-100 colors/white override-theme))}}
(when danger?
(colors/theme-colors colors/danger-50 colors/danger-60))}}
label]
(when sub-label
[text/text
{:size :paragraph-2
:style {:color
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)}}
(colors/theme-colors colors/neutral-50 colors/neutral-40)}}
sub-label])]
(when right-icon
[rn/view
@@ -67,7 +65,7 @@
:accessible true
:accessibility-label :right-icon-for-action}
[icon/icon right-icon
{:color (get-icon-color danger? override-theme)
{:color (get-icon-color danger?)
:size 20}]])]]]))
(defn action-drawer
@@ -1,70 +0,0 @@
(ns quo2.components.drawers.drawer-buttons.component-spec
(:require [quo2.components.drawers.drawer-buttons.view :as drawer-buttons]
[react-native.core :as rn]
[test-helpers.component :as h]))
(h/describe "drawer-buttons"
(h/test "the top heading and subheading render"
(h/render [drawer-buttons/view
{:top-card {:heading :top-heading}
:bottom-card {:heading :bottom-heading}}
:top-sub-heading
:bottom-sub-heading])
(-> (js/expect (h/get-by-text "top-heading"))
(.toBeTruthy))
(-> (js/expect (h/get-by-text "top-sub-heading"))
(.toBeTruthy)))
(h/test "the bottom heading and subheading render"
(h/render [drawer-buttons/view
{:top-card {:heading :top-heading}
:bottom-card {:heading :bottom-heading}}
:top-sub-heading
:bottom-sub-heading])
(-> (js/expect (h/get-by-text "bottom-heading"))
(.toBeTruthy))
(-> (js/expect (h/get-by-text "bottom-sub-heading"))
(.toBeTruthy)))
(h/test "it clicks the top card"
(let [event (h/mock-fn)]
(h/render [drawer-buttons/view
{:top-card {:on-press event
:heading :top-heading}
:bottom-card {:heading :bottom-heading}}
:top-sub-heading
:bottom-sub-heading])
(h/fire-event :press (h/get-by-text "top-heading"))
(-> (js/expect event)
(.toHaveBeenCalled))))
(h/test "it clicks the bottom card"
(let [event (h/mock-fn)]
(h/render [drawer-buttons/view
{:top-card {:heading :top-heading}
:bottom-card {:on-press event
:heading :bottom-heading}}
:top-sub-heading
:bottom-sub-heading])
(h/fire-event :press (h/get-by-text "bottom-heading"))
(-> (js/expect event)
(.toHaveBeenCalled))))
(h/test "the top card child renders with a render prop"
(h/render [drawer-buttons/view
{:top-card {:heading :top-heading}
:bottom-card {:heading :bottom-heading}}
[rn/text :top-render-fn]
:bottom-sub-heading])
(-> (js/expect (h/get-by-text "top-render-fn"))
(.toBeTruthy)))
(h/test "the bottom card child renders with a render prop"
(h/render [drawer-buttons/view
{:top-card {:heading :top-heading}
:bottom-card {:heading :bottom-heading}}
:top-sub-heading
[rn/text :bottom-render-fn]])
(-> (js/expect (h/get-by-text "bottom-render-fn"))
(.toBeTruthy))))
@@ -1,48 +0,0 @@
(ns quo2.components.drawers.drawer-buttons.style
(:require [quo2.foundations.colors :as colors]))
(def outer-container {:height 216})
(def top-card
{:flex 1
:padding-vertical 12
:padding-horizontal 20
:border-radius 20
:background-color colors/neutral-80})
(def bottom-card
{:position :absolute
:top 80
:left 0
:right 0
:bottom 0
:padding-vertical 12
:padding-horizontal 20
:border-radius 20
:background-color (colors/alpha colors/white 0.05)})
(def bottom-container
{:flex-direction :row
:justify-content :space-between})
(def bottom-icon
{:border-radius 40
:border-width 1
:margin-left 24
:height 28
:width 28
:justify-content :center
:align-items :center
:border-color (colors/alpha colors/white 0.05)})
(def bottom-text
{:flex 1
:color (colors/alpha colors/white 0.7)})
(def top-text
{:color (colors/alpha colors/white 0.7)})
(defn heading-text
[gap]
{:color colors/white
:margin-bottom gap})
@@ -1,80 +0,0 @@
(ns quo2.components.drawers.drawer-buttons.view
(:require [react-native.core :as rn]
[quo2.components.icon :as icon]
[quo2.components.markdown.text :as text]
[quo2.foundations.colors :as colors]
[quo2.components.drawers.drawer-buttons.style :as style]))
(defn render-bottom
[children]
[rn/view {:style style/bottom-container}
children
[rn/view
{:style style/bottom-icon}
[icon/icon :arrow-right
{:color colors/white
:size 20}]]])
(defn label? [el] (or (string? el) (keyword? el)))
(defn render-children-bottom
[children]
(if (label? children)
[render-bottom
[text/text
{:size :paragraph-2
:style style/bottom-text
:weight :semi-bold}
children]]
[render-bottom children]))
(defn render-children-top
[children]
(if (label? children)
[text/text
{:size :paragraph-2
:style style/top-text
:weight :semi-bold}
children]
children))
(defn card
[{:keys [on-press style heading gap top?]} children]
[rn/touchable-highlight
{:on-press on-press
:border-radius 20
:style style
:underlay-color (:background-color style)}
[rn/view {}
[text/text
{:size :heading-1
:style (style/heading-text gap)
:weight :semi-bold}
heading]
(if top?
[render-children-top children]
[render-children-bottom children])]])
(defn view
"[view opts]
opts
{:container-style style-object
:top-card { :on-press event
:heading string}
:bottom-card { :on-press event
:heading string}}
child-1 string, keyword or hiccup
child-2 string, keyword or hiccup
"
[{:keys [container-style top-card bottom-card]} child-1 child-2]
[rn/view
{:style (merge container-style style/outer-container)}
[card
(merge {:gap 4
:top? true
:style style/top-card}
top-card) child-1]
[card
(merge {:style style/bottom-card
:gap 20}
bottom-card) child-2]])
+8 -8
View File
@@ -103,7 +103,7 @@
(into [rn/view {:style header-actions-style}]
(map header-action accessories))
component component
component component
:else
[rn/view {:style header-action-placeholder}])])
@@ -112,7 +112,7 @@
[{:keys [title subtitle component title-align]}]
[:<>
(cond
component component
component component
(and title subtitle)
[:<>
@@ -126,12 +126,12 @@
:number-of-lines 1}
subtitle]]
title [text/text
{:weight :bold
:number-of-lines 0
:align title-align
:size :large}
title])])
title [text/text
{:weight :bold
:number-of-lines 0
:align title-align
:size :large}
title])])
(defn header
[{:keys [left-width right-width]}]
+1 -1
View File
@@ -24,6 +24,6 @@
container-style)
:accessibility-label accessibility-label
:source (icons/icon-source (str (name icon-name) size))}])))
:source (icons/icon-source (str (name icon-name) size))}])))
(def icon (memoize memo-icon-fn))
@@ -173,7 +173,7 @@
(utils/truncate-str (:info content) 24)])]]]])
(defn system-message
[{:keys [type style non-pressable? animate-landing? labels on-long-press] :as message}]
[{:keys [type style non-pressable? animate-landing? labels] :as message}]
[:f>
(fn []
(let [sv-color (reanimated/use-shared-value
@@ -186,17 +186,16 @@
:linear
1000))
[reanimated/touchable-opacity
{:on-press #(when-not non-pressable?
(reanimated/set-shared-value sv-color (get-color :bg :pressed type)))
:on-long-press on-long-press
:style (reanimated/apply-animations-to-style
{:background-color sv-color}
(merge
{:flex-direction :row
:flex 1
:border-radius 16
:padding-vertical 9
:padding-horizontal 11
:background-color sv-color}
style))}
{:on-press #(when-not non-pressable?
(reanimated/set-shared-value sv-color (get-color :bg :pressed type)))
:style (reanimated/apply-animations-to-style
{:background-color sv-color}
(merge
{:flex-direction :row
:flex 1
:border-radius 16
:padding-vertical 9
:padding-horizontal 11
:background-color sv-color}
style))}
[sm-render message labels]]))])
+11 -15
View File
@@ -18,8 +18,8 @@
:light {:background-color :colors/white-opa-5}}})
(defn- merge-theme-style
[component-key styles override-theme]
(merge (get-in themes [component-key (or override-theme (theme/get-theme))]) styles))
[component-key styles]
(merge (get-in themes [component-key (theme/get-theme)]) styles))
(defn toast-action-container
[{:keys [on-press style]} & children]
@@ -41,17 +41,17 @@
children]])
(defn toast-undo-action
[duration on-press override-theme]
[duration on-press]
[toast-action-container
{:on-press on-press :accessibility-label :toast-undo-action}
[rn/view {:style {:margin-right 5}}
[count-down-circle/circle-timer {:duration duration}]]
[text/text
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {} override-theme)}
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {})}
[i18n/label :t/undo]]])
(defn- toast-container
[{:keys [left middle right container-style override-theme]}]
[{:keys [left middle right container-style]}]
[rn/view {:style (merge {:padding-left 12 :padding-right 12} container-style)}
[rn/view
{:style (merge-theme-style :container
@@ -62,31 +62,27 @@
:padding-vertical 8
:padding-left 10
:padding-right 8
:border-radius 12}
override-theme)}
:border-radius 12})}
[rn/view {:style {:padding 2}} left]
[rn/view {:style {:padding 4 :flex 1}}
[text/text
{:size :paragraph-2
:weight :medium
:style (merge-theme-style :text {} override-theme)
:style (merge-theme-style :text {})
:accessibility-label :toast-content}
middle]]
(when right right)]])
(defn toast
[{:keys [icon icon-color text action undo-duration undo-on-press container-style override-theme]}]
[{:keys [icon icon-color text action undo-duration undo-on-press container-style]}]
[toast-container
{:left (when icon
[icon/icon icon
{:container-style {:width 20 :height 20}
:color (or icon-color
(get-in themes
[:icon (or override-theme (theme/get-theme))
:color]))}])
(get-in themes [:icon (theme/get-theme) :color]))}])
:middle text
:right (if undo-duration
[toast-undo-action undo-duration undo-on-press override-theme]
[toast-undo-action undo-duration undo-on-press]
action)
:container-style container-style
:override-theme override-theme}])
:container-style container-style}])
@@ -1,12 +1,12 @@
(ns quo2.components.profile.profile-card.view
(:require
[quo2.components.profile.profile-card.style :as style]
[quo2.foundations.colors :as colors]
[quo2.components.avatars.user-avatar :as user-avatar]
[quo2.components.icon :as icon]
[quo2.components.markdown.text :as text]
[quo2.components.buttons.button :as button]
[react-native.core :as rn]))
[quo2.components.profile.profile-card.style :as style]
[quo2.foundations.colors :as colors]
[quo2.components.avatars.user-avatar :as user-avatar]
[quo2.components.icon :as icon]
[quo2.components.markdown.text :as text]
[quo2.components.buttons.button :as button]
[react-native.core :as rn]))
(defn profile-card
@@ -71,7 +71,7 @@
(cond
@ready-to-send?
(start-y-animation)
@recording? (reset-y-animation)))
@recording? (reset-y-animation)))
[@ready-to-send?])
[:<>
[reanimated/view {:style (style/send-button-container opacity)}
@@ -157,28 +157,28 @@
[{:keys [on-start-recording on-send on-cancel on-reviewing-audio]}]
[:f>
(fn []
(let [recording? (reagent/atom false)
locked? (reagent/atom false)
ready-to-send? (reagent/atom false)
ready-to-lock? (reagent/atom false)
ready-to-delete? (reagent/atom false)
reviewing-audio? (reagent/atom false)
playing-audio? (reagent/atom false)
recording-length-ms (reagent/atom 0)
audio-current-time-ms (reagent/atom 0)
seeking-audio? (reagent/atom false)
clear-timeout (atom nil)
(let [recording? (reagent/atom false)
locked? (reagent/atom false)
ready-to-send? (reagent/atom false)
ready-to-lock? (reagent/atom false)
ready-to-delete? (reagent/atom false)
reviewing-audio? (reagent/atom false)
playing-audio? (reagent/atom false)
recording-length-ms (reagent/atom 0)
audio-current-time-ms (reagent/atom 0)
seeking-audio? (reagent/atom false)
clear-timeout (atom nil)
record-button-at-initial-position? (atom true)
record-button-is-animating? (atom false)
idle? (atom false)
touch-active? (atom false)
recording-timer (atom nil)
playing-timer (atom nil)
recorder-ref (atom nil)
player-ref (atom nil)
record-audio-permission-granted (atom true)
output-file (atom nil)
reached-max-duration? (atom false)
record-button-is-animating? (atom false)
idle? (atom false)
touch-active? (atom false)
recording-timer (atom nil)
playing-timer (atom nil)
recorder-ref (atom nil)
player-ref (atom nil)
record-audio-permission-granted (atom true)
output-file (atom nil)
reached-max-duration? (atom false)
check-audio-permission
(fn []
(permissions/permission-granted?
+6 -6
View File
@@ -145,12 +145,12 @@
[rn/flat-list
(merge
(dissoc props
:default-active
:fade-end-percentage
:fade-end?
:on-change
:scroll-on-press?
:size)
:default-active
:fade-end-percentage
:fade-end?
:on-change
:scroll-on-press?
:size)
(when scroll-on-press?
{:initial-scroll-index (utils.collection/first-index #(= @active-tab-id (:id %)) data)})
{:ref #(reset! flat-list-ref %)
+3 -3
View File
@@ -85,9 +85,9 @@
(fn [{:keys [id on-press disabled? size resource active accessibility-label
label type labelled? blurred? icon-color]
:or {size 32}}]
(let [state (cond disabled? :disabled
active :active
:else :default)
(let [state (cond disabled? :disabled
active :active
:else :default)
{:keys [border-color blurred-border-color text-color]}
(get-in themes [(theme/get-theme) state])]
[rn/view {:style {:align-items :center}}
+6 -6
View File
@@ -95,12 +95,12 @@
[rn/flat-list
(merge
(dissoc props
:default-active
:fade-end-percentage
:fade-end?
:on-change
:scroll-on-press?
:size)
:default-active
:fade-end-percentage
:fade-end?
:on-change
:scroll-on-press?
:size)
(when scroll-on-press?
{:initial-scroll-index (utils.collection/first-index #(= @active-tab-id (:id %)) data)})
{:ref #(reset! flat-list-ref %)
+4 -4
View File
@@ -57,11 +57,11 @@
:margin-right (get-value-from-size size 8 6)}
token-img-style)}]
[text/text
{:weight :medium
{:weight :medium
:number-of-lines 1
:style
{:margin-right (get-value-from-size size 12 11)}
:size (get-value-from-size size :paragraph-2 :label)} label]
:size (get-value-from-size size :paragraph-2 :label)} label]
overlay]]))
(defn token-tag
@@ -82,9 +82,9 @@
{size :small border-color (colors/custom-color-by-theme :purple 50 60)}}]
[tag
{:size size
{:size size
:token-img-src token-img-src
:border-color (when is-required border-color)
:border-color (when is-required border-color)
:overlay
(when (or is-required is-purchasable)
[rn/view
+58 -60
View File
@@ -1,65 +1,64 @@
(ns quo2.core
(:refer-clojure :exclude [filter])
(:require
quo2.components.avatars.account-avatar
quo2.components.avatars.channel-avatar
quo2.components.avatars.group-avatar
quo2.components.avatars.icon-avatar
quo2.components.avatars.user-avatar
quo2.components.avatars.wallet-user-avatar
quo2.components.banners.banner.view
quo2.components.buttons.button
quo2.components.buttons.dynamic-button
quo2.components.community.community-card-view
quo2.components.community.community-list-view
quo2.components.community.community-view
quo2.components.community.discover-card
quo2.components.community.icon
quo2.components.community.token-gating
quo2.components.counter.counter
quo2.components.dividers.date
quo2.components.dividers.divider-label
quo2.components.dividers.new-messages
quo2.components.drawers.action-drawers.view
quo2.components.drawers.drawer-buttons.view
quo2.components.drawers.permission-context.view
quo2.components.dropdowns.dropdown
quo2.components.header
quo2.components.icon
quo2.components.info.info-message
quo2.components.info.information-box
quo2.components.list-items.channel
quo2.components.list-items.menu-item
quo2.components.list-items.preview-list
quo2.components.loaders.skeleton
quo2.components.markdown.text
quo2.components.messages.author.view
quo2.components.messages.gap
quo2.components.messages.system-message
quo2.components.navigation.floating-shell-button
quo2.components.navigation.page-nav
quo2.components.notifications.activity-log.view
quo2.components.notifications.count-down-circle
quo2.components.notifications.info-count
quo2.components.notifications.notification-dot
quo2.components.notifications.toast
quo2.components.profile.profile-card.view
quo2.components.reactions.reaction
quo2.components.selectors.disclaimer.view
quo2.components.selectors.filter.view
quo2.components.selectors.selectors
quo2.components.separator
quo2.components.settings.accounts.view
quo2.components.settings.privacy-option
quo2.components.onboarding.small-option-card.view
quo2.components.tabs.account-selector
quo2.components.tabs.tabs
quo2.components.tags.context-tags
quo2.components.tags.status-tags
quo2.components.tags.permission-tag
quo2.components.tags.tag
quo2.components.tags.tags
quo2.components.tags.token-tag))
quo2.components.avatars.account-avatar
quo2.components.avatars.channel-avatar
quo2.components.avatars.group-avatar
quo2.components.avatars.icon-avatar
quo2.components.avatars.user-avatar
quo2.components.avatars.wallet-user-avatar
quo2.components.banners.banner.view
quo2.components.buttons.button
quo2.components.buttons.dynamic-button
quo2.components.community.community-card-view
quo2.components.community.community-list-view
quo2.components.community.community-view
quo2.components.community.discover-card
quo2.components.community.icon
quo2.components.community.token-gating
quo2.components.counter.counter
quo2.components.dividers.date
quo2.components.dividers.divider-label
quo2.components.dividers.new-messages
quo2.components.drawers.action-drawers.view
quo2.components.drawers.permission-context.view
quo2.components.dropdowns.dropdown
quo2.components.header
quo2.components.icon
quo2.components.info.info-message
quo2.components.info.information-box
quo2.components.list-items.channel
quo2.components.list-items.menu-item
quo2.components.list-items.preview-list
quo2.components.loaders.skeleton
quo2.components.markdown.text
quo2.components.messages.author.view
quo2.components.messages.gap
quo2.components.messages.system-message
quo2.components.navigation.floating-shell-button
quo2.components.navigation.page-nav
quo2.components.notifications.activity-log.view
quo2.components.notifications.count-down-circle
quo2.components.notifications.info-count
quo2.components.notifications.notification-dot
quo2.components.notifications.toast
quo2.components.profile.profile-card.view
quo2.components.reactions.reaction
quo2.components.selectors.disclaimer.view
quo2.components.selectors.filter.view
quo2.components.selectors.selectors
quo2.components.separator
quo2.components.settings.accounts.view
quo2.components.settings.privacy-option
quo2.components.onboarding.small-option-card.view
quo2.components.tabs.account-selector
quo2.components.tabs.tabs
quo2.components.tags.context-tags
quo2.components.tags.status-tags
quo2.components.tags.permission-tag
quo2.components.tags.tag
quo2.components.tags.tags
quo2.components.tags.token-tag))
(def toast quo2.components.notifications.toast/toast)
(def button quo2.components.buttons.button/button)
@@ -127,7 +126,6 @@
;;;; DRAWERS
(def action-drawer quo2.components.drawers.action-drawers.view/action-drawer)
(def drawer-buttons quo2.components.drawers.drawer-buttons.view/view)
(def permission-context quo2.components.drawers.permission-context.view/view)
;;;; LIST ITEMS
-1
View File
@@ -4,7 +4,6 @@
[quo2.components.counter.--tests--.counter-component-spec]
[quo2.components.dividers.--tests--.divider-label-component-spec]
[quo2.components.drawers.action-drawers.component-spec]
[quo2.components.drawers.drawer-buttons.component-spec]
[quo2.components.drawers.permission-context.component-spec]
[quo2.components.markdown.--tests--.text-component-spec]
[quo2.components.onboarding.small-option-card.component-spec]
+1 -1
View File
@@ -168,7 +168,7 @@
;; Colors for customizing profiles and communities themes
(def customization
{:primary {50 primary-50 ;; User can also use primary color as customisation color
{:primary {50 primary-50 ;; User can also use primary color as customisation color
60 primary-60}
:purple {50 "#8661C1"
60 "#5E478C"}
+2 -2
View File
@@ -131,5 +131,5 @@
(.-RNSelectableTextInputManager ^js (.-NativeModules ^js react-native))))
(defonce selectable-text-input
(reagent/adapt-react-class
(.requireNativeComponent ^js react-native "RNSelectableTextInput")))
(reagent/adapt-react-class
(.requireNativeComponent ^js react-native "RNSelectableTextInput")))
+6 -6
View File
@@ -125,8 +125,8 @@
(let [cofx {:db {:networks/current-network "mainnet_rpc"
:multiaccount {:custom-bootnodes
{"mainnet_rpc"
{"a" {:id "a"
:name "name"
{"a" {:id "a"
:name "name"
:address
"enode://old-id:old-password@url:port"}}}}}}]
(is (model/fetch cofx "a")))))
@@ -154,8 +154,8 @@
(let [cofx {:db {:networks/current-network "mainnet_rpc"
:multiaccount {:custom-bootnodes
{"mainnet_rpc"
{"a" {:id "a"
:name "name"
{"a" {:id "a"
:name "name"
:address
"enode://old-id:old-password@url:port"}}}
:custom-bootnodes-enabled?
@@ -167,8 +167,8 @@
(let [cofx {:db {:networks/current-network "mainnet_rpc"
:multiaccount {:custom-bootnodes
{"mainnet_rpc"
{"a" {:id "a"
:name "name"
{"a" {:id "a"
:name "name"
:address
"enode://old-id:old-password@url:port"}}}
:custom-bootnodes-enabled?
+30 -31
View File
@@ -1,31 +1,31 @@
(ns status-im.browser.core
(:require
["eth-phishing-detect" :as eth-phishing-detect]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.browser.eip3085 :as eip3085]
[status-im.browser.eip3326 :as eip3326]
[status-im.browser.permissions :as browser.permissions]
[status-im.browser.webview-ref :as webview-ref]
[status-im2.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens]
[utils.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status]
[status-im.signing.core :as signing]
[status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf]
[status-im.utils.http :as http]
[status-im.utils.platform :as platform]
[status-im.utils.random :as random]
[status-im.utils.types :as types]
[status-im.utils.universal-links.utils :as links]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.debounce :as debounce]
[utils.security.core :as security]))
["eth-phishing-detect" :as eth-phishing-detect]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.browser.eip3085 :as eip3085]
[status-im.browser.eip3326 :as eip3326]
[status-im.browser.permissions :as browser.permissions]
[status-im.browser.webview-ref :as webview-ref]
[status-im2.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens]
[utils.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status]
[status-im.signing.core :as signing]
[status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf]
[status-im.utils.http :as http]
[status-im.utils.platform :as platform]
[status-im.utils.random :as random]
[status-im.utils.types :as types]
[status-im.utils.universal-links.utils :as links]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.debounce :as debounce]
[utils.security.core :as security]))
(rf/defn update-browser-option
[{:keys [db]} option-key option-value]
@@ -201,8 +201,8 @@
{:db (-> (update db
:browser/options
assoc
:url (str gateway path)
:resolving? false)
:url (str gateway path)
:resolving? false)
(assoc-in [:browser/options :resolved-ens host] gateway))})))
(rf/defn resolve-ens-multihash-error
@@ -384,9 +384,8 @@
(not (vector? params)))
;; We don't use signer argument for keycard sign-typed-data
["0x0" params]
message? (normalize-sign-message-params params
typed?)
:else [nil nil])]
message? (normalize-sign-message-params params typed?)
:else [nil nil])]
(when (or (not message?) (and address data))
(signing/sign cofx
(merge
+2 -2
View File
@@ -42,10 +42,10 @@
{:dispatch [:bottom-sheet/show-sheet
{:content (fn []
[sheet/permissions-panel dapp-name message-id params])}]}))
{:browser/send-to-bridge {:type constants/web3-send-async-callback
{:browser/send-to-bridge {:type constants/web3-send-async-callback
:messageId message-id
:error
{:code 4902
{:code 4902
:message
(str
"Unrecognized chain ID: "
+3 -3
View File
@@ -135,9 +135,9 @@
(when-not (string/blank? input-text)
(let [{:keys [message-id]}
(get-in db [:chat/inputs current-chat-id :metadata :responding-to-message])
preferred-name (get-in db [:multiaccount :preferred-name])
emoji? (message-content/emoji-only-content? {:text input-text
:response-to message-id})]
preferred-name (get-in db [:multiaccount :preferred-name])
emoji? (message-content/emoji-only-content? {:text input-text
:response-to message-id})]
{:chat-id current-chat-id
:content-type (if emoji?
constants/content-type-emoji
+6 -6
View File
@@ -118,7 +118,7 @@
(when-not (and (get-in db [:pagination-info chat-id :messages-initialized?])
(not= session-id
(get-in db [:pagination-info chat-id :messages-initialized?])))
(let [already-loaded-messages (get-in db [:messages chat-id])
(let [already-loaded-messages (get-in db [:messages chat-id])
;; We remove those messages that are already loaded, as we might get some duplicates
{:keys [all-messages new-messages senders contacts]}
(reduce (fn [{:keys [all-messages] :as acc}
@@ -138,11 +138,11 @@
:contacts {}
:new-messages []}
messages)
current-clock-value (get-in db
[:pagination-info chat-id
:cursor-clock-value])
clock-value (when cursor (cursor->clock-value cursor))
new-messages (map mark-album new-messages)]
current-clock-value (get-in db
[:pagination-info chat-id
:cursor-clock-value])
clock-value (when cursor (cursor->clock-value cursor))
new-messages (map mark-album new-messages)]
{:dispatch [:chat/add-senders-to-chat-users (vals senders)]
:db (-> db
(update-in [:pagination-info chat-id :cursor-clock-value]
+43 -44
View File
@@ -163,7 +163,7 @@
(inc idx))
code-tag?
(let [len (code-tag-len idxs idx)
(let [len (code-tag-len idxs idx)
{:keys [data next-idx]}
(apply-style-tag data idx pos c len true true)]
(recur data next-idx))
@@ -175,7 +175,7 @@
(apply-style-tag data idx pos c len can-be-start? can-be-end?)]
(recur data next-idx))
:else (recur data (inc idx)))))))))
:else (recur data (inc idx)))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -273,7 +273,7 @@
(= chat-type constants/public-chat-type)
(merge mentionable-users (select-keys mentionable-contacts (keys mentionable-users)))
:else mentionable-users)))
:else mentionable-users)))
(def ending-chars "[\\s\\.,;:]")
(def ending-chars-regex (re-pattern ending-chars))
@@ -431,36 +431,35 @@
{:from idx
:checked? false})
new-idxs)
(let [diff (- new-text-len old-text-len)
(let [diff (- new-text-len old-text-len)
{:keys [state added?]}
(->> at-idxs
(keep
(fn [{:keys [from to] :as entry}]
(let [to+1 (inc to)]
(cond
;; starts after change
(>= from old-end)
(assoc entry
:from (+ from diff)
:to (+ to diff))
(keep (fn [{:keys [from to] :as entry}]
(let [to+1 (inc to)]
(cond
;; starts after change
(>= from old-end)
(assoc entry
:from (+ from diff)
:to (+ to diff))
;; starts and end before change
(and
(< from start)
(or
;; is not checked yet
(not to+1)
(< to+1 start)))
entry
;; starts and end before change
(and
(< from start)
(or
;; is not checked yet
(not to+1)
(< to+1 start)))
entry
;; starts before change intersects with it
(and (< from start)
(>= to+1 start))
{:from from
:checked? false}
;; starts before change intersects with it
(and (< from start)
(>= to+1 start))
{:from from
:checked? false}
;; starts in changed part of text
:else nil))))
;; starts in changed part of text
:else nil))))
(reduce
(fn [{:keys [state added?] :as acc} {:keys [from] :as entry}]
(if (and last-new-idx
@@ -596,11 +595,11 @@
(rf/defn calculate-suggestions
{:events [::calculate-suggestions]}
[{:keys [db]} mentionable-users]
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
{:keys [new-text at-idxs start end] :as state}
(get-in db [:chats/mentions chat-id :mentions])
new-text (or new-text text)]
new-text (or new-text text)]
(log/debug "[mentions] calculate suggestions"
"state"
state)
@@ -609,17 +608,17 @@
(assoc-in [:chats/mention-suggestions chat-id] nil)
(assoc-in [:chats/mentions chat-id :mentions :at-idxs] nil)
(assoc-in [:chat/inputs-with-mentions chat-id] [[:text text]]))}
(let [new-at-idxs (check-idx-for-mentions
text
at-idxs
mentionable-users)
(let [new-at-idxs (check-idx-for-mentions
text
at-idxs
mentionable-users)
calculated-input (calculate-input text new-at-idxs)
addition? (<= start end)
end (if addition?
(+ start (count new-text))
start)
at-sign-idx (string/last-index-of text at-sign start)
searched-text (string/lower-case (subs text (inc at-sign-idx) end))
addition? (<= start end)
end (if addition?
(+ start (count new-text))
start)
at-sign-idx (string/last-index-of text at-sign start)
searched-text (string/lower-case (subs text (inc at-sign-idx) end))
mentions
(when (and (not (> at-sign-idx start))
(not (> (- end at-sign-idx) 100)))
@@ -643,8 +642,8 @@
(defn new-input-text-with-mention
[{:keys [db]} {:keys [name]}]
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
{:keys [mention-end at-sign-idx]}
(get-in db [:chats/mentions chat-id :mentions])]
(log/debug "[mentions] clear suggestions"
@@ -689,7 +688,7 @@
[{:keys [db] :as cofx}
{:keys [start end] :as selection}
mentionable-users]
(let [chat-id (:current-chat-id db)
(let [chat-id (:current-chat-id db)
{:keys [mention-end at-idxs]}
(get-in db [:chats/mentions chat-id :mentions])]
(when (seq at-idxs)
+2 -2
View File
@@ -117,14 +117,14 @@
(defn receive-many
[{:keys [db]} ^js response-js]
(let [messages-js ^js (.splice (.-messages response-js) 0 (if platform/low-device? 3 10))
(let [messages-js ^js (.splice (.-messages response-js) 0 (if platform/low-device? 3 10))
{:keys [db senders]}
(reduce reduce-js-messages
{:db db :chats #{} :senders {} :transactions #{}}
messages-js)]
;;we want to render new messages as soon as possible
;;so we dispatch later all other events which can be handled async
{:db db
{:db db
:utils/dispatch-later
(concat [{:ms 20 :dispatch [:process-response response-js]}]
(when (and (:current-chat-id db) (= "active" (:app-state db)))
+7 -7
View File
@@ -36,11 +36,11 @@
{:messages-initialized? true
:cursor
"00000000000000000000000000000000000000000000000000090x0000000000000000000000000000000000000000000000000000000000000000"
:cursor-clock-value 9}}}}
:cursor-clock-value 9}}}}
(dissoc (message/receive-many
cofx
#js {:messages (to-array [message])})
:utils/dispatch-later)))))
:utils/dispatch-later)))))
;; <- cursor
;; <- first-hidden-item
;; <- message
@@ -56,11 +56,11 @@
{:messages-initialized? true
:cursor
"00000000000000000000000000000000000000000000000000090x0000000000000000000000000000000000000000000000000000000000000000"
:cursor-clock-value 9}}}}
:cursor-clock-value 9}}}}
(dissoc (message/receive-many
cofx
#js {:messages (to-array [message])})
:utils/dispatch-later)))))
:utils/dispatch-later)))))
;; <- cursor
;; <- message
;; <- first-hidden-item
@@ -70,7 +70,7 @@
(let [result (dissoc (message/receive-many
cofx
#js {:messages (to-array [message])})
:utils/dispatch-later)]
:utils/dispatch-later)]
(testing "it sets all-loaded? to false"
(is (not (get-in result [:db :pagination-info chat-id :all-loaded?]))))
(testing "it updates cursor-clock-value & cursor"
@@ -89,7 +89,7 @@
:cursor
:cursor-clock-value)
#js {:messages (to-array [message])})
:utils/dispatch-later)]
:utils/dispatch-later)]
(testing "it sets all-loaded? to false"
(is (not (get-in result [:db :pagination-info chat-id :all-loaded?]))))
(testing "it updates cursor-clock-value & cursor"
@@ -112,7 +112,7 @@
result (dissoc (message/receive-many
cofx
#js {:messages (to-array [message])})
:utils/dispatch-later)]
:utils/dispatch-later)]
(testing "it sets all-loaded? to false"
(is (not (get-in result [:db :pagination-info chat-id :all-loaded?]))))
(testing "it does not update cursor-clock-value & cursor"
+11 -10
View File
@@ -14,7 +14,8 @@
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.common.toasts.events :as toasts]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]))
[taoensso.timbre :as log]
[status-im.communities.mock :as mock]))
(def crop-size 1000)
@@ -100,10 +101,10 @@
(rf/defn handle-communities
{:events [::fetched]}
[{:keys [db]} communities]
{:db (reduce (fn [db {:keys [id] :as community}]
(assoc-in db [:communities id] (<-rpc community)))
db
communities)})
{:db (mock/add-mock-data (reduce (fn [db {:keys [id] :as community}]
(assoc-in db [:communities id] (<-rpc community)))
db
communities))})
(rf/defn handle-response
[_ response-js]
@@ -210,11 +211,11 @@
(rf/defn chat-created
{:events [::chat-created]}
[_ community-id user-pk]
{:json-rpc/call [{:method "wakuext_sendChatMessage"
:params [{:chatId user-pk
:text "Upgrade here to see an invitation to community"
:communityId community-id
:contentType constants/content-type-community}]
{:json-rpc/call [{:method "wakuext_sendChatMessage"
:params [{:chatId user-pk
:text "Upgrade here to see an invitation to community"
:communityId community-id
:contentType constants/content-type-community}]
:js-response true
:on-success
#(re-frame/dispatch [:transport/message-sent %])
+42
View File
@@ -0,0 +1,42 @@
(ns status-im.communities.mock
(:require [status-im2.constants :as constants]))
(def status-channel-to-mock "5c328f54-4d40-4984-ae96-b946247d8dba")
(def community-gates
{:join [[{:token "KNC"
:amount 200}
{:token "MANA"
:amount 10}
{:token "RARE"
:amount 50}]
[{:token "KNC"
:amount 200}
{:token "MANA"
:amount 50}]]})
(def channel-gates
{:read [[{:token "KNC"
:amount 100}
{:token "RARE"
:amount 50}]
[{:token "KNC"
:amount 200}
{:token "MANA"
:amount 50}]]
:write [[{:token "KNC"
:amount 400}]
[{:token "KNC"
:amount 100}
{:token "RARE"
:amount 50}]]})
(defn add-mock-data
[db]
(if (get-in db [:communities constants/status-community-id])
(-> db
(assoc-in [:communities constants/status-community-id :gates] community-gates)
(assoc-in [:communities constants/status-community-id :status] :gated)
(assoc-in [:communities constants/status-community-id :chats status-channel-to-mock :gates]
channel-gates))
db))
+5 -5
View File
@@ -43,11 +43,11 @@
(types/js->clj chats)))]
(apply rf/merge
cofx
{:db (-> db
(update :chats dissoc public-key)
(update :chats-home-list disj public-key)
(assoc-in [:contacts/contacts public-key :added] false))
:dispatch [:shell/close-switcher-card public-key]
{:db (-> db
(update :chats dissoc public-key)
(update :chats-home-list disj public-key)
(assoc-in [:contacts/contacts public-key :added] false))
:dispatch [:shell/close-switcher-card public-key]
:clear-message-notifications
[[public-key] (get-in db [:multiaccount :remote-push-notifications-enabled?])]}
(activity-center/notifications-fetch-unread-count)
+4 -4
View File
@@ -66,10 +66,10 @@
(defn get-all-contacts-in-group-chat
[members admins contacts {:keys [public-key] :as current-account}]
(let [current-contact (some->
current-account
(select-keys [:name :preferred-name :public-key :identicon :images])
(set/rename-keys {:name :alias
:preferred-name :name}))
current-account
(select-keys [:name :preferred-name :public-key :identicon :images])
(set/rename-keys {:name :alias
:preferred-name :name}))
all-contacts (cond-> contacts
current-contact
(assoc public-key current-contact))]
+16 -16
View File
@@ -19,17 +19,17 @@
contacts
{"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"
{:last-updated 0
:name "User B"
:identicon "photo1"
:last-online 0
:name "User B"
:identicon "photo1"
:last-online 0
:public-key
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
current-multiaccount
{:last-updated 0
:signed-up? true
{:last-updated 0
:signed-up? true
:sharing-usage-data? false
:name "User A"
:identicon "photo2"
:name "User A"
:identicon "photo2"
:public-key
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}]
(is
@@ -38,19 +38,19 @@
admins
contacts
current-multiaccount)
[{:name "generated"
:identicon "generated"
:alias "generated"
:admin? true
[{:name "generated"
:identicon "generated"
:alias "generated"
:admin? true
:public-key
"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
{:alias "User A"
:identicon "photo2"
{:alias "User A"
:identicon "photo2"
:public-key
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}
{:last-updated 0
:name "User B"
:identicon "photo1"
:last-online 0
:name "User B"
:identicon "photo1"
:last-online 0
:public-key
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}]))))))
-4
View File
@@ -4,10 +4,6 @@
[status-im.data-store.messages :as messages]
[status-im2.contexts.activity-center.notification-types :as notification-types]))
(defn mark-notifications-as-read
[notifications]
(map #(assoc % :read true) notifications))
(defn- rpc->type
[{:keys [type name] :as chat}]
(case type
+32 -33
View File
@@ -27,39 +27,38 @@
(dissoc :last-message :message :reply-message)))))
(testing "transforms messages from RPC response"
(is
(= {:last-message {:quoted-message nil
:outgoing-status nil
:command-parameters nil
:content {:sticker nil
:rtl? nil
:ens-name nil
:parsed-text nil
:response-to nil
:chat-id nil
:image nil
:line-count nil
:links nil
:text nil}
:outgoing false}
:message nil
:reply-message {:quoted-message nil
:outgoing-status nil
:command-parameters nil
:content {:sticker nil
:rtl? nil
:ens-name nil
:parsed-text nil
:response-to nil
:chat-id nil
:image nil
:line-count nil
:links nil
:text nil}
:outgoing false}}
(-> raw-notification
store/<-rpc
(select-keys [:last-message :message :reply-message])))))
(is (= {:last-message {:quoted-message nil
:outgoing-status nil
:command-parameters nil
:content {:sticker nil
:rtl? nil
:ens-name nil
:parsed-text nil
:response-to nil
:chat-id nil
:image nil
:line-count nil
:links nil
:text nil}
:outgoing false}
:message nil
:reply-message {:quoted-message nil
:outgoing-status nil
:command-parameters nil
:content {:sticker nil
:rtl? nil
:ens-name nil
:parsed-text nil
:response-to nil
:chat-id nil
:image nil
:line-count nil
:links nil
:text nil}
:outgoing false}}
(-> raw-notification
store/<-rpc
(select-keys [:last-message :message :reply-message])))))
(testing "augments notification based on its type"
(is (= {:chat-name chat-name
+4 -4
View File
@@ -39,10 +39,10 @@
(defn- unmarshal-members
[{:keys [members chat-type] :as chat}]
(cond
(= constants/public-chat-type chat-type) (assoc chat
:contacts #{}
:admins #{}
:members-joined #{})
(= constants/public-chat-type chat-type) (assoc chat
:contacts #{}
:admins #{}
:members-joined #{})
(= constants/private-group-chat-type chat-type) (merge chat
(reduce members-reducer
{:admins #{}
+23 -24
View File
@@ -18,30 +18,29 @@
(defn <-rpc
[message]
(-> message
(set/rename-keys
{:id :message-id
:whisperTimestamp :whisper-timestamp
:compressedKey :compressed-key
:editedAt :edited-at
:contactVerificationState :contact-verification-state
:contactRequestState :contact-request-state
:commandParameters :command-parameters
:gapParameters :gap-parameters
:messageType :message-type
:localChatId :chat-id
:communityId :community-id
:contentType :content-type
:clock :clock-value
:quotedMessage :quoted-message
:outgoingStatus :outgoing-status
:audioDurationMs :audio-duration-ms
:deleted :deleted?
:deletedForMe :deleted-for-me?
:deletedBy :deleted-by
:albumId :album-id
:imageWidth :image-width
:imageHeight :image-height
:new :new?})
(set/rename-keys {:id :message-id
:whisperTimestamp :whisper-timestamp
:compressedKey :compressed-key
:editedAt :edited-at
:contactVerificationState :contact-verification-state
:contactRequestState :contact-request-state
:commandParameters :command-parameters
:gapParameters :gap-parameters
:messageType :message-type
:localChatId :chat-id
:communityId :community-id
:contentType :content-type
:clock :clock-value
:quotedMessage :quoted-message
:outgoingStatus :outgoing-status
:audioDurationMs :audio-duration-ms
:deleted :deleted?
:deletedForMe :deleted-for-me?
:deletedBy :deleted-by
:albumId :album-id
:imageWidth :image-width
:imageHeight :image-height
:new :new?})
(update :quoted-message
set/rename-keys
+1 -1
View File
@@ -170,7 +170,7 @@
(let [{:keys [username]}
(:ens/registration db)
{:keys [public-key]} (:multiaccount db)
chain-id (ethereum/chain-id db)]
chain-id (ethereum/chain-id db)]
(ens/register-prepare-tx
chain-id
address
+6 -6
View File
@@ -107,14 +107,14 @@
(def all-tokens
{:mainnet {"0x744d70fdbe2ba4cf95131626614a1763df805b9e" {:address
"0x744d70fdbe2ba4cf95131626614a1763df805b9e"
:name "Status Network Token"
:symbol :SNT
:name "Status Network Token"
:symbol :SNT
:decimals 18}}
:goerli {"0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"
{:address
"0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"
:name "Status Test Token"
:symbol :STT
:name "Status Test Token"
:symbol :STT
:decimals 18}}})
(deftest generate-erc20-uri
@@ -209,8 +209,8 @@
:function-arguments {:uint256 1000 :address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"}}
{"0x744d70fdbe2ba4cf95131626614a1763df805b9e" {:address
"0x744d70fdbe2ba4cf95131626614a1763df805b9e"
:name "Status Network Token"
:symbol :SNT
:name "Status Network Token"
:symbol :SNT
:decimals 18}})]
(is (.equals (money/bignumber 1000) value))
(is (= :SNT symbol))
+10 -10
View File
@@ -31,16 +31,16 @@
(log/debug "[wallet-subs] recent-history-fetching-ended"
"accounts" accounts
"block" blockNumber)
{:db (-> db
(assoc :ethereum/current-block blockNumber)
(update-in [:wallet :accounts]
wallet/remove-transactions-since-block
blockNumber)
(transactions/update-fetching-status accounts :recent? false)
(dissoc :wallet/waiting-for-recent-history?
:wallet/refreshing-history?
:wallet/fetching-error
:wallet/recent-history-fetching-started?))
{:db (-> db
(assoc :ethereum/current-block blockNumber)
(update-in [:wallet :accounts]
wallet/remove-transactions-since-block
blockNumber)
(transactions/update-fetching-status accounts :recent? false)
(dissoc :wallet/waiting-for-recent-history?
:wallet/refreshing-history?
:wallet/fetching-error
:wallet/recent-history-fetching-started?))
:transactions/get-transfers
{:chain-tokens (:wallet/all-tokens db)
:addresses (reduce
+24 -27
View File
@@ -185,7 +185,7 @@
(rf/defn set-lowest-fetched-block
[{:keys [db]} address transfers]
(let [checksum (eip55/address->checksum address)
(let [checksum (eip55/address->checksum address)
{:keys [min-block min-block-transfers-count]}
(reduce
(fn [{:keys [min-block] :as acc}
@@ -295,32 +295,29 @@
(rf/defn check-ens-transactions
[{:keys [db] :as cofx} transfers]
(let [set-of-transactions-hash (reduce (fn [acc {:keys [hash]}] (conj acc hash)) #{} transfers)
registrations (filter
(fn [[hash {:keys [state]}]]
(and
(or (= state :dismissed) (= state :submitted))
(contains? set-of-transactions-hash hash)))
(get db :ens/registrations))
fxs (map
(fn [[hash {:keys [username custom-domain?]}]]
(let [transfer (first (filter (fn [transfer]
(let [transfer-hash
(get transfer
:hash)]
(= transfer-hash hash)))
transfers))
type (get transfer :type)
transaction-success (get transfer :transfer)]
(cond
(= transaction-success true)
(rf/merge cofx
(ens/clear-ens-registration hash)
(ens/save-username custom-domain? username false))
(= type :failed)
(ens/update-ens-tx-state :failure username custom-domain? hash)
:else
nil)))
registrations)]
registrations (filter
(fn [[hash {:keys [state]}]]
(and
(or (= state :dismissed) (= state :submitted))
(contains? set-of-transactions-hash hash)))
(get db :ens/registrations))
fxs (map (fn [[hash {:keys [username custom-domain?]}]]
(let [transfer (first (filter (fn [transfer]
(let [transfer-hash (get transfer :hash)]
(= transfer-hash hash)))
transfers))
type (get transfer :type)
transaction-success (get transfer :transfer)]
(cond
(= transaction-success true)
(rf/merge cofx
(ens/clear-ens-registration hash)
(ens/save-username custom-domain? username false))
(= type :failed)
(ens/update-ens-tx-state :failure username custom-domain? hash)
:else
nil)))
registrations)]
(apply rf/merge cofx fxs)))
(rf/defn new-transfers
+59 -59
View File
@@ -1,64 +1,64 @@
(ns status-im.events
(:require
clojure.set
[re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage]
status-im.backup.core
status-im.bootnodes.core
status-im.browser.core
status-im.browser.permissions
status-im.chat.models
status-im.chat.models.images
status-im.chat.models.input
status-im.chat.models.loading
status-im.chat.models.transport
[status-im2.constants :as constants]
status-im.contact.block
status-im.contact.chat
status-im.contact.core
status-im.currency.core
status-im.ethereum.subscriptions
status-im.fleet.core
status-im.http.core
[utils.i18n :as i18n]
[status-im.keycard.core :as keycard]
status-im.log-level.core
status-im.mailserver.constants
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.biometric.core :as biometric]
status-im.multiaccounts.login.core
status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model]
status-im.multiaccounts.update.core
[status-im.native-module.core :as status]
status-im.network.net-info
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.permissions :as permissions]
[status-im.ui.components.react :as react]
status-im.ui.screens.privacy-and-security-settings.events
[status-im.utils.dimensions :as dimensions]
[utils.re-frame :as rf]
status-im.utils.logging.core
[status-im.utils.universal-links.core :as universal-links]
[status-im.utils.utils :as utils]
status-im.visibility-status-popover.core
status-im.visibility-status-updates.core
status-im.waku.core
status-im.wallet-connect-legacy.core
status-im.wallet-connect.core
status-im.wallet.accounts.core
status-im.wallet.choose-recipient.core
[status-im.wallet.core :as wallet]
status-im.wallet.custom-tokens.core
status-im2.contexts.activity-center.events
status-im2.contexts.shell.events
status-im.chat.models.gaps
[status-im2.navigation.events :as navigation]))
clojure.set
[re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage]
status-im.backup.core
status-im.bootnodes.core
status-im.browser.core
status-im.browser.permissions
status-im.chat.models
status-im.chat.models.images
status-im.chat.models.input
status-im.chat.models.loading
status-im.chat.models.transport
[status-im2.constants :as constants]
status-im.contact.block
status-im.contact.chat
status-im.contact.core
status-im.currency.core
status-im.ethereum.subscriptions
status-im.fleet.core
status-im.http.core
[utils.i18n :as i18n]
[status-im.keycard.core :as keycard]
status-im.log-level.core
status-im.mailserver.constants
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.biometric.core :as biometric]
status-im.multiaccounts.login.core
status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model]
status-im.multiaccounts.update.core
[status-im.native-module.core :as status]
status-im.network.net-info
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.permissions :as permissions]
[status-im.ui.components.react :as react]
status-im.ui.screens.privacy-and-security-settings.events
[status-im.utils.dimensions :as dimensions]
[utils.re-frame :as rf]
status-im.utils.logging.core
[status-im.utils.universal-links.core :as universal-links]
[status-im.utils.utils :as utils]
status-im.visibility-status-popover.core
status-im.visibility-status-updates.core
status-im.waku.core
status-im.wallet-connect-legacy.core
status-im.wallet-connect.core
status-im.wallet.accounts.core
status-im.wallet.choose-recipient.core
[status-im.wallet.core :as wallet]
status-im.wallet.custom-tokens.core
status-im2.contexts.activity-center.events
status-im2.contexts.shell.events
status-im.chat.models.gaps
[status-im2.navigation.events :as navigation]))
(re-frame/reg-fx
:dismiss-keyboard
+4 -4
View File
@@ -37,13 +37,13 @@
{:events [:fleet.ui/fleet-selected]}
[_ fleet]
{:ui/show-confirmation
{:title (i18n/label :t/close-app-title)
:content (i18n/label :t/change-fleet
{:fleet fleet})
{:title (i18n/label :t/close-app-title)
:content (i18n/label :t/change-fleet
{:fleet fleet})
:confirm-button-text (i18n/label :t/close-app-button)
:on-accept
#(re-frame/dispatch [:fleet.ui/save-fleet-confirmed (keyword fleet)])
:on-cancel nil}})
:on-cancel nil}})
(defn nodes->fleet
[nodes]
+1 -1
View File
@@ -310,7 +310,7 @@
(deftest add-contact-test
(log/info "========= add-contact-test ==================")
(let
[compressed-key "zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA"
[compressed-key "zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA"
public-key
"0x048a6773339d11ccf5fd81677b7e54daeec544a1287bd92b725047ad6faa9a9b9f8ea86ed5a226d2a994f5f46d0b43321fd8de7b7997a166e67905c8c73cd37cea"
three-words-name "Rich Total Pondskater"]
+3 -3
View File
@@ -61,9 +61,9 @@
{:db (-> db
(update :intro-wizard
assoc
:root-key root-data
:derived derived-data
:recovering? true
:root-key root-data
:derived derived-data
:recovering? true
:selected-storage-type :advanced)
(assoc-in [:keycard :flow] :recovery)
(update :multiaccounts/key-storage dissoc :seed-phrase))
+6 -6
View File
@@ -7,9 +7,9 @@
[taoensso.timbre :as log]))
(defonce card
(if config/keycard-test-menu-enabled?
(simulated-keycard/SimulatedKeycard.)
(real-keycard/RealKeycard.)))
(if config/keycard-test-menu-enabled?
(simulated-keycard/SimulatedKeycard.)
(real-keycard/RealKeycard.)))
(defn check-nfc-support
[]
@@ -153,7 +153,7 @@
(log/debug "[keycard] init-card")
(keycard/init-card
card
{:pin pin
{:pin pin
:on-success
(fn [response]
(log/debug "[keycard response succ] init-card")
@@ -171,7 +171,7 @@
(log/debug "[keycard] install-applet-and-init-card")
(keycard/install-applet-and-init-card
card
{:pin pin
{:pin pin
:on-success
(fn [response]
(log/debug "[keycard response succ] install-applet-and-init-card")
@@ -508,7 +508,7 @@
(log/debug "[keycard] sign-typed-data")
(keycard/sign-typed-data
card
{:hash hash
{:hash hash
:on-success
(fn [response]
(log/debug "[keycard response succ] sign-typed-data")
+4 -4
View File
@@ -73,7 +73,7 @@
(onboarding/load-preparing-screen cofx)
(common/show-connection-sheet
cofx
{:sheet-options {:on-cancel [::on-cancel]}
{:sheet-options {:on-cancel [::on-cancel]}
:on-card-connected :keycard/change-pin
:handler
(fn [{:keys [db] :as cofx}]
@@ -83,7 +83,7 @@
(get-in db [:keycard :pin :current]))]
(rf/merge
cofx
{:db (assoc-in db [:keycard :pin :status] :verifying)
{:db (assoc-in db [:keycard :pin :status] :verifying)
:keycard/change-pin
{:new-pin new-pin
@@ -94,7 +94,7 @@
[{:keys [db] :as cofx}]
(common/show-connection-sheet
cofx
{:sheet-options {:on-cancel [::on-cancel]}
{:sheet-options {:on-cancel [::on-cancel]}
:on-card-connected :keycard/change-puk
:handler
(fn [{:keys [db] :as cofx}]
@@ -113,7 +113,7 @@
[{:keys [db] :as cofx}]
(common/show-connection-sheet
cofx
{:sheet-options {:on-cancel [::on-cancel]}
{:sheet-options {:on-cancel [::on-cancel]}
:on-card-connected :keycard/change-pairing
:handler
(fn [{:keys [db] :as cofx}]
+1 -1
View File
@@ -297,7 +297,7 @@
(let [puk (common/vector->string (get-in db [:keycard :pin :puk]))
pin (common/vector->string (get-in db [:keycard :pin :reset]))
key-uid (get-in db [:keycard :application-info :key-uid])]
{:db (assoc-in db [:keycard :pin :status] :verifying)
{:db (assoc-in db [:keycard :pin :status] :verifying)
:keycard/unblock-pin
{:puk puk
:new-pin pin}}))}))
+6 -6
View File
@@ -55,23 +55,23 @@
:status ""
:db {}}
#js
{"whisper-private-key" "f342f3ef17ce86abfa92b912b3a108a4546cfc687fd8e0f02fedf87a60ee4c0f"
{"whisper-private-key" "f342f3ef17ce86abfa92b912b3a108a4546cfc687fd8e0f02fedf87a60ee4c0f"
"whisper-public-key"
"04de2e21f1642ebee03b9aa4bf1936066124cc89967eaf269544c9b90c539fd5c980166a897d06dd4d3732b38116239f63c89395a8d73eac72881fab802010cb56"
"encryption-public-key"
"04f2a432677a1b7c4f1bb22078135821d1d10fce23422297b5c808a545f2b61cdba38ee7394762172fc6ff5e9e28db7535e555efe2812905ffd4e0c25e82a98ae8"
"whisper-address" "87df2285f90b71221fab6267b7cb37532fedbb1f"
"wallet-address" "7e92236392a850980d00d0cd2a4b92886bd7fe7b"})
"whisper-address" "87df2285f90b71221fab6267b7cb37532fedbb1f"
"wallet-address" "7e92236392a850980d00d0cd2a4b92886bd7fe7b"})
[:db :keycard :multiaccount])
[:whisper-private-key
:whisper-public-key
:encryption-public-key
:wallet-address
:whisper-address]))
{:whisper-private-key "f342f3ef17ce86abfa92b912b3a108a4546cfc687fd8e0f02fedf87a60ee4c0f"
{:whisper-private-key "f342f3ef17ce86abfa92b912b3a108a4546cfc687fd8e0f02fedf87a60ee4c0f"
:whisper-public-key
"0x04de2e21f1642ebee03b9aa4bf1936066124cc89967eaf269544c9b90c539fd5c980166a897d06dd4d3732b38116239f63c89395a8d73eac72881fab802010cb56"
:encryption-public-key
"04f2a432677a1b7c4f1bb22078135821d1d10fce23422297b5c808a545f2b61cdba38ee7394762172fc6ff5e9e28db7535e555efe2812905ffd4e0c25e82a98ae8"
:whisper-address "87df2285f90b71221fab6267b7cb37532fedbb1f"
:wallet-address "7e92236392a850980d00d0cd2a4b92886bd7fe7b"}))
:whisper-address "87df2285f90b71221fab6267b7cb37532fedbb1f"
:wallet-address "7e92236392a850980d00d0cd2a4b92886bd7fe7b"}))
+13 -13
View File
@@ -263,19 +263,19 @@
{:keys [selected-id multiaccounts]}
(:intro-wizard db)
multiaccount (or (->> multiaccounts
(filter #(= (:id %) selected-id))
first)
(assoc (get-in db [:intro-wizard :root-key])
:derived
(get-in db [:intro-wizard :derived])))
recovery-mnemonic (get-in db [:intro-wizard :passphrase])
mnemonic (or (:mnemonic multiaccount)
recovery-mnemonic)
pin' (or pin
(common/vector->string (get-in db
[:keycard :pin
:current])))]
multiaccount (or (->> multiaccounts
(filter #(= (:id %) selected-id))
first)
(assoc (get-in db [:intro-wizard :root-key])
:derived
(get-in db [:intro-wizard :derived])))
recovery-mnemonic (get-in db [:intro-wizard :passphrase])
mnemonic (or (:mnemonic multiaccount)
recovery-mnemonic)
pin' (or pin
(common/vector->string (get-in db
[:keycard :pin
:current])))]
{:keycard/generate-and-load-key
{:mnemonic mnemonic
:pin pin'
+3 -3
View File
@@ -10,9 +10,9 @@
[taoensso.timbre :as log]))
(defonce event-emitter
(if platform/ios?
(new (.-NativeEventEmitter rn) status-keycard)
(.-DeviceEventEmitter rn)))
(if platform/ios?
(new (.-NativeEventEmitter rn) status-keycard)
(.-DeviceEventEmitter rn)))
(defonce active-listeners (atom []))
+11 -11
View File
@@ -107,7 +107,7 @@
(update :keycard
dissoc
:secrets
:card-state :multiaccount-wallet-address
:card-state :multiaccount-wallet-address
:multiaccount-whisper-public-key
:application-info)
(assoc-in [:keycard :setup-step] :begin)
@@ -123,7 +123,7 @@
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (update db
:keycard dissoc
:keycard dissoc
:multiaccount-wallet-address
:multiaccount-whisper-public-key)}
(navigation/navigate-to-cofx (if platform/android?
@@ -337,13 +337,13 @@
(assoc :multiaccounts/new-installation-id (random-guid-generator)))}
(common/remove-listener-to-hardware-back-button)
(common/hide-connection-sheet)
(cond backup? (on-backup-success backup?)
migration? (migrate-account)
(cond backup? (on-backup-success backup?)
migration? (migrate-account)
(get-in db [:keycard :delete-account?])
(delete-multiaccount)
:else (create-keycard-multiaccount)))))
:else (create-keycard-multiaccount)))))
(rf/defn on-generate-and-load-key-error
{:events [:keycard.callback/on-generate-and-load-key-error]}
@@ -364,12 +364,12 @@
pairing' (or pairing (common/get-pairing db key-uid))
pin (common/vector->string (get-in db [:keycard :pin :import-multiaccount]))]
(rf/merge cofx
{:db (-> db
(assoc-in [:keycard :multiaccount :instance-uid] instance-uid)
(assoc-in [:keycard :pin :status] :verifying)
(assoc-in [:keycard :secrets]
{:pairing pairing'
:paired-on (datetime/timestamp)}))
{:db (-> db
(assoc-in [:keycard :multiaccount :instance-uid] instance-uid)
(assoc-in [:keycard :pin :status] :verifying)
(assoc-in [:keycard :secrets]
{:pairing pairing'
:paired-on (datetime/timestamp)}))
:keycard/import-keys
{:pin pin
:on-success :keycard.callback/on-generate-and-load-key-success}})))
+3 -3
View File
@@ -76,9 +76,9 @@
[:sign/send-accept-transaction-message message-id tx-hash signature]
[:sign/send-transaction-message chat-id value contract tx-hash signature])
:signing/show-transaction-result nil
:db (-> db
(assoc-in [:keycard :pin :sign] [])
(assoc-in [:keycard :pin :status] nil))}
:db (-> db
(assoc-in [:keycard :pin :sign] [])
(assoc-in [:keycard :pin :status] nil))}
(common/clear-on-card-connected)
(common/get-application-info nil)
(common/hide-connection-sheet)))
+32 -32
View File
@@ -34,17 +34,17 @@
[]
(swap! state assoc
:application-info
{:free-pairing-slots 5
:app-version "3.0"
{:free-pairing-slots 5
:app-version "3.0"
:secure-channel-pub-key
"04c3071768912a515c00aeab7ceb8a5bfda91d036f4a4e60b7944cee3ca7fb67b6d118e8df1e2480b87fd636c6615253245bbbc93a6a407f155f2c58f76c96ef0e"
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? true
:has-master-key? true
:initialized? true
:pin-retry-counter 3
:puk-retry-counter 5
:key-uid (get-in @re-frame.db/app-db [:multiaccounts/login :key-uid])})
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? true
:has-master-key? true
:initialized? true
:pin-retry-counter 3
:puk-retry-counter 5
:key-uid (get-in @re-frame.db/app-db [:multiaccounts/login :key-uid])})
(swap! state assoc :pin default-pin :puk default-puk :password kk1-password)
(connect-card))
@@ -55,17 +55,17 @@
(reset! initialization false)
(swap! state assoc
:application-info
{:free-pairing-slots 5
:app-version "3.0"
{:free-pairing-slots 5
:app-version "3.0"
:secure-channel-pub-key
"04c3071768912a515c00aeab7ceb8a5bfda91d036f4a4e60b7944cee3ca7fb67b6d118e8df1e2480b87fd636c6615253245bbbc93a6a407f155f2c58f76c96ef0e"
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? false
:has-master-key? true
:initialized? true
:pin-retry-counter 3
:puk-retry-counter 5
:key-uid "0x16839e8b1b8a395acb18100c7e2b161701c225adf31eefa02114099b4d81a30b"})
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? false
:has-master-key? true
:initialized? true
:pin-retry-counter 3
:puk-retry-counter 5
:key-uid "0x16839e8b1b8a395acb18100c7e2b161701c225adf31eefa02114099b4d81a30b"})
(swap! state assoc :pin default-pin :puk default-puk :password kk1-password)
(connect-card))
@@ -195,17 +195,17 @@
(reset! initialization true)
(swap! state assoc
:application-info
{:free-pairing-slots 5
:app-version "3.0"
{:free-pairing-slots 5
:app-version "3.0"
:secure-channel-pub-key
"04c3071768912a515c00aeab7ceb8a5bfda91d036f4a4e60b7944cee3ca7fb67b6d118e8df1e2480b87fd636c6615253245bbbc93a6a407f155f2c58f76c96ef0e"
:key-uid ""
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? false
:has-master-key? false
:pin-retry-counter 3
:puk-retry-counter 5
:initialized? true})
:key-uid ""
:instance-uid "1b360b10a9a68b7d494e8f059059f118"
:paired? false
:has-master-key? false
:pin-retry-counter 3
:puk-retry-counter 5
:initialized? true})
(swap! state assoc :pin pin :puk default-puk :password kk1-password)
(later
#(on-success {:password kk1-password
@@ -393,11 +393,11 @@
on-failure
#(let [{:keys [key-uid wallet-root-address]}
(get @re-frame.db/app-db :multiaccount)
accounts (get @re-frame.db/app-db :multiaccount/accounts)
hashed-password account-password
path-num (inc (get-in @re-frame.db/app-db
[:multiaccount :latest-derived-path]))
path (str "m/" path-num)]
accounts (get @re-frame.db/app-db :multiaccount/accounts)
hashed-password account-password
path-num (inc (get-in @re-frame.db/app-db
[:multiaccount :latest-derived-path]))
path (str "m/" path-num)]
(status/multiaccount-load-account
wallet-root-address
hashed-password
+14 -14
View File
@@ -281,10 +281,10 @@
(:value name)
(:value url))
current (connected? db (:id mailserver))]
{:db (-> db
(dissoc :mailserver.edit/mailserver)
(assoc-in [:mailserver/mailservers current-fleet (:id mailserver)]
mailserver))
{:db (-> db
(dissoc :mailserver.edit/mailserver)
(assoc-in [:mailserver/mailservers current-fleet (:id mailserver)]
mailserver))
:json-rpc/call
[{:method "mailservers_addMailserver"
:params [(mailserver->rpc mailserver current-fleet)]
@@ -296,7 +296,7 @@
[:multiaccounts.logout.ui/logout-confirmed]))
(log/debug "saved mailserver" id "successfuly"))
:on-failure #(log/error "failed to save mailserver" id %)}]
:dispatch [:navigate-back]}))))
:dispatch [:navigate-back]}))))
(defn can-delete?
[db id]
@@ -307,18 +307,18 @@
{:events [:mailserver.ui/delete-confirmed]}
[{:keys [db] :as cofx} id]
(if (can-delete? db id)
{:db (-> db
(update-in
[:mailserver/mailservers (node/current-fleet-key db)]
dissoc
id)
(dissoc :mailserver.edit/mailserver))
{:db (-> db
(update-in
[:mailserver/mailservers (node/current-fleet-key db)]
dissoc
id)
(dissoc :mailserver.edit/mailserver))
:json-rpc/call
[{:method "mailservers_deleteMailserver"
:params [(name id)]
:on-success #(log/debug "deleted mailserver" id)
:on-failure #(log/error "failed to delete mailserver" id %)}]
:dispatch [:navigate-back]}
:dispatch [:navigate-back]}
{:dispatch [:navigate-back]}))
(rf/defn show-connection-confirmation
@@ -326,7 +326,7 @@
[{:keys [db]} mailserver-id]
(let [current-fleet (node/current-fleet-key db)]
{:ui/show-confirmation
{:title (i18n/label :t/close-app-title)
{:title (i18n/label :t/close-app-title)
:content
(i18n/label :t/connect-mailserver-content
{:name (get-in db
@@ -336,7 +336,7 @@
:on-accept
#(re-frame/dispatch
[:mailserver.ui/connect-confirmed current-fleet mailserver-id])
:on-cancel nil}}))
:on-cancel nil}}))
(rf/defn show-delete-confirmation
{:events [:mailserver.ui/delete-pressed]}
+2 -2
View File
@@ -52,12 +52,12 @@
([sync?] (apply-settings sync? :default))
([sync? remember?]
(fn [{:keys [db] :as cofx}]
(let [network (:network/type db)
(let [network (:network/type db)
remember-choice?
(if (not= :default remember?)
remember?
(:mobile-network/remember-choice? db))
cellular? (utils/cellular? network)]
cellular? (utils/cellular? network)]
(log/info "apply mobile network settings"
"sunc?" sync?
"remember?" remember?
+3 -4
View File
@@ -66,16 +66,15 @@
(assoc contact' :two-names (contact-two-names contact' true))))
(defn displayed-name
"Use preferred name, display-name, name or alias in that order"
[{:keys [name display-name preferred-name alias public-key ens-verified]}]
"Use preferred name, name or alias in that order"
[{:keys [name preferred-name alias public-key ens-verified]}]
(let [ens-name (or preferred-name
display-name
name)]
;; Preferred name is our own otherwise we make sure it's verified
(if (or preferred-name (and ens-verified name))
(let [username (stateofus/username ens-name)]
(or username ens-name))
(or display-name alias (gfycat/generate-gfy public-key)))))
(or alias (gfycat/generate-gfy public-key)))))
(defn contact-by-identity
[contacts identity]
+7 -7
View File
@@ -54,19 +54,19 @@
(= [random-name short-compressed-key]
(ma/contact-two-names
(dissoc contact
:nickname
:name
:display-name)
:nickname
:name
:display-name)
public-key)))))
(testing "public-key is the least favorite"
(is
(= [random-name short-public-key]
(ma/contact-two-names
(dissoc contact
:nickname
:name
:compressed-key
:display-name)
:nickname
:name
:compressed-key
:display-name)
public-key))))
(testing "names is provided"
(let [names {:nickname override-nickname
+13 -13
View File
@@ -192,31 +192,31 @@
(cond->
(merge
{;; address of the master key
:address address
:address address
;; sha256 of master public key
:key-uid key-uid
:key-uid key-uid
;; The address from which we derive any wallet
:wallet-root-address
(get-in multiaccount
[:derived
constants/path-wallet-root-keyword
:address])
:name name
:identicon identicon
:name name
:identicon identicon
;; public key of the chat account
:public-key public-key
:public-key public-key
;; compressed key of the chat account
:compressed-key compressed-key
:compressed-key compressed-key
;; default address for Dapps
:dapps-address (:address wallet-account)
:latest-derived-path 0
:signing-phrase signing-phrase
:dapps-address (:address wallet-account)
:latest-derived-path 0
:signing-phrase signing-phrase
:send-push-notifications? true
:backup-enabled? true
:installation-id (random-guid-generator)
:backup-enabled? true
:installation-id (random-guid-generator)
;; default mailserver (history node) setting
:use-mailservers? true
:recovered recovered}
:use-mailservers? true
:recovered recovered}
config/default-multiaccount)
;; The address from which we derive any chat
;; account/encryption keys
@@ -173,7 +173,7 @@ We don't need to take the exact steps, just set the required state and redirect
"
(rf/defn import-multiaccount
[{:keys [db] :as cofx}]
{:dispatch [:bottom-sheet/hide]
{:dispatch [:bottom-sheet/hide]
::multiaccounts.recover/import-multiaccount
{:passphrase (get-in db [:multiaccounts/key-storage :seed-phrase])
:password nil
@@ -235,9 +235,9 @@ We don't need to take the exact steps, just set the required state and redirect
{:db (-> db
(update :intro-wizard
assoc
:root-key root-data
:derived derived-data
:recovering? true
:root-key root-data
:derived derived-data
:recovering? true
:selected-storage-type :advanced)
(assoc-in [:keycard :flow] :recovery)
(assoc-in [:keycard :from-key-storage-and-migration?] true)
+65 -64
View File
@@ -1,51 +1,51 @@
(ns status-im.multiaccounts.login.core
(:require
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage]
[status-im.communities.core :as communities]
[status-im.contact.core :as contact]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.data-store.settings :as data-store.settings]
[status-im.data-store.switcher-cards :as switcher-cards-store]
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.tokens :as tokens]
[status-im.ethereum.transactions.core :as transactions]
[status-im.fleet.core :as fleet]
[utils.i18n :as i18n]
[status-im.keycard.common :as keycard.common]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.notifications.core :as notifications]
[status-im.popover.core :as popover]
[status-im.signing.eip1559 :as eip1559]
[status-im.transport.core :as transport]
[status-im.ui.components.react :as react]
[status-im2.config :as config]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.utils.wallet-connect :as wallet-connect]
[status-im.wallet-connect-legacy.core :as wallet-connect-legacy]
[status-im.wallet.core :as wallet]
[status-im.wallet.prices :as prices]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.contexts.chat.messages.link-preview.events :as link-preview]
[status-im2.navigation.events :as navigation]
[status-im2.common.log :as logging]
[taoensso.timbre :as log]
[utils.security.core :as security]
[status-im2.contexts.emoji-hash.events :as emoji-hash]))
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage]
[status-im.communities.core :as communities]
[status-im.contact.core :as contact]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.data-store.settings :as data-store.settings]
[status-im.data-store.switcher-cards :as switcher-cards-store]
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.tokens :as tokens]
[status-im.ethereum.transactions.core :as transactions]
[status-im.fleet.core :as fleet]
[utils.i18n :as i18n]
[status-im.keycard.common :as keycard.common]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.notifications.core :as notifications]
[status-im.popover.core :as popover]
[status-im.signing.eip1559 :as eip1559]
[status-im.transport.core :as transport]
[status-im.ui.components.react :as react]
[status-im2.config :as config]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.utils.wallet-connect :as wallet-connect]
[status-im.wallet-connect-legacy.core :as wallet-connect-legacy]
[status-im.wallet.core :as wallet]
[status-im.wallet.prices :as prices]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.contexts.chat.messages.link-preview.events :as link-preview]
[status-im2.navigation.events :as navigation]
[status-im2.common.log :as logging]
[taoensso.timbre :as log]
[utils.security.core :as security]
[status-im2.contexts.emoji-hash.events :as emoji-hash]))
(re-frame/reg-fx
::initialize-communities-enabled
@@ -270,7 +270,7 @@
(rf/defn check-network-version
[_ network-id]
{:json-rpc/call
[{:method "net_version"
[{:method "net_version"
:on-success
(fn [fetched-network-id]
(when (not= network-id (str (int fetched-network-id)))
@@ -412,7 +412,8 @@
(communities/fetch)
(logging/set-log-level (:log-level multiaccount))
(activity-center/notifications-fetch-unread-contact-requests)
(activity-center/notifications-fetch-unread-count))))
(activity-center/notifications-fetch-unread-count)
#_(communities/resolve-mock-community-info))))
(re-frame/reg-fx
::open-last-chat
@@ -447,9 +448,9 @@
{:events [::get-chats-callback]}
[{:keys [db] :as cofx}]
(let [{:networks/keys [current-network networks]} db
notifications-enabled? (get-in db [:multiaccount :notifications-enabled?])
network-id (str (get-in networks
[current-network :config :NetworkId]))
notifications-enabled? (get-in db [:multiaccount :notifications-enabled?])
network-id (str (get-in networks
[current-network :config :NetworkId]))
remote-push-notifications-enabled?
(get-in db [:multiaccount :remote-push-notifications-enabled?])]
(rf/merge cofx
@@ -462,7 +463,7 @@
(fn [accounts tokens custom-tokens favourites]
(re-frame/dispatch [::initialize-wallet
accounts tokens custom-tokens favourites]))]
::open-last-chat (get-in db [:multiaccount :key-uid])}
::open-last-chat (get-in db [:multiaccount :key-uid])}
(or notifications-enabled? remote-push-notifications-enabled?)
(assoc ::notifications/enable remote-push-notifications-enabled?))
(transport/start-messenger)
@@ -503,7 +504,7 @@
"auth-method" auth-method
"new-auth-method" new-auth-method)
(rf/merge cofx
{:db (assoc db :chats/loading? true)
{:db (assoc db :chats/loading? true)
:json-rpc/call
[{:method "settings_getSettings"
:on-success #(do (re-frame/dispatch [::get-settings-callback %])
@@ -552,7 +553,7 @@
(-> db
(dissoc :connectivity/ui-status-properties)
(update :keycard dissoc :from-key-storage-and-migration?)
(update :keycard dissoc
(update :keycard dissoc
:on-card-read
:card-read-in-progress?
:pin
@@ -569,20 +570,20 @@
(let [{:keys [key-uid password save-password? creating?]}
(:multiaccounts/login db)
multiaccounts (:multiaccounts/multiaccounts db)
recovered-account? (get db :recovered-account?)
login-only? (not (or creating?
recovered-account?
(keycard-setup? cofx)))
from-migration? (get-in db
[:keycard
:from-key-storage-and-migration?])
nodes nil]
multiaccounts (:multiaccounts/multiaccounts db)
recovered-account? (get db :recovered-account?)
login-only? (not (or creating?
recovered-account?
(keycard-setup? cofx)))
from-migration? (get-in db
[:keycard
:from-key-storage-and-migration?])
nodes nil]
(log/debug "[multiaccount] multiaccount-login-success"
"login-only?" login-only?
"recovered-account?" recovered-account?)
(rf/merge cofx
{:db (on-login-update-db db login-only? now)
{:db (on-login-update-db db login-only? now)
:json-rpc/call
[{:method "web3_clientVersion"
:on-success #(re-frame/dispatch [::initialize-web3-client-version %])}]}
@@ -2,22 +2,22 @@
(def all-contacts
[{:last-updated 1547185503000
:tags #{}
:address "2f88d65f3cb52605a54a833ae118fb1363acccd2"
:name "Darkviolet Lightgreen Halcyon"
:tags #{}
:address "2f88d65f3cb52605a54a833ae118fb1363acccd2"
:name "Darkviolet Lightgreen Halcyon"
:identicon
"data:image/png;base64iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAADAFBMVEX///+M2KwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5UBARL8TK8AAAAASUVORK5CYII="
:added true
:last-online 0
:added true
:last-online 0
:public-key
"0x04d6e56a475cd35f512d6ce0bf76c2c2af435c85ff48c2b9bdefd129f620e051a436f50961eae5717b2a750e59c3f5b60647d927da46d0b8b11621640b5678fc24"}
{:last-updated 1547271764000
:address "b267ff8336ac10b3a1986c04a70ff91fb03d0b78"
:name "rv"
:address "b267ff8336ac10b3a1986c04a70ff91fb03d0b78"
:name "rv"
:identicon
"data:image/png;base64iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAADAFBMVEX////VjNgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6IYA4bRtf+EAAAAASUVORK5CYII="
:added true
:last-online 0
:added true
:last-online 0
:public-key
"0x043ae31038ff45a31b096a91d3f8290e079366fbbae76a00fbbd349cd0e5b8d7598965d206772ec4504f68908649a08383cdc51a52cdae5e9ccc744ace4d37020f"}])
@@ -40,74 +40,74 @@
:chat-id "status"
:timestamp 1547361080397
:deleted-at-clock-value nil}
{:updated-at nil
:tags #{}
:color "#d37ef4"
{:updated-at nil
:tags #{}
:color "#d37ef4"
:contacts
#{"0x043ae31038ff45a31b096a91d3f8290e079366fbbae76a00fbbd349cd0e5b8d7598965d206772ec4504f68908649a08383cdc51a52cdae5e9ccc744ace4d37020f"}
:last-clock-value 154727176928001
:admins #{}
:members-joined #{}
:name "rv"
:membership-updates ()
:unviewed-messages-count 0
:last-clock-value 154727176928001
:admins #{}
:members-joined #{}
:name "rv"
:membership-updates ()
:unviewed-messages-count 0
:last-message-content-type "text/plain"
:last-message-content
{:chat-id
"0x04173f7cdea0076a7998abb674cc79fe61337c42db77043c01d5b0f3e3ac1e5a45bca0c93bb9f3c3d38b7cc9a7337cd64f9f9b2114fe4bbdfe1ae2633ba14d8c9c"
:text "Hey"}
:debug? false
:group-chat false
:public? false
:text "Hey"}
:debug? false
:group-chat false
:public? false
:chat-id
"0x043ae31038ff45a31b096a91d3f8290e079366fbbae76a00fbbd349cd0e5b8d7598965d206772ec4504f68908649a08383cdc51a52cdae5e9ccc744ace4d37020f"
:timestamp 1547271770816
:deleted-at-clock-value nil}
{:updated-at nil
:tags #{}
:color "#7cda00"
:timestamp 1547271770816
:deleted-at-clock-value nil}
{:updated-at nil
:tags #{}
:color "#7cda00"
:contacts
#{"0x04d6e56a475cd35f512d6ce0bf76c2c2af435c85ff48c2b9bdefd129f620e051a436f50961eae5717b2a750e59c3f5b60647d927da46d0b8b11621640b5678fc24"}
:last-clock-value 154718689430301
:admins #{}
:members-joined #{}
:name "Darkviolet Lightgreen Halcyon"
:membership-updates ()
:unviewed-messages-count 0
:last-clock-value 154718689430301
:admins #{}
:members-joined #{}
:name "Darkviolet Lightgreen Halcyon"
:membership-updates ()
:unviewed-messages-count 0
:last-message-content-type "text/plain"
:last-message-content
{:chat-id
"0x04173f7cdea0076a7998abb674cc79fe61337c42db77043c01d5b0f3e3ac1e5a45bca0c93bb9f3c3d38b7cc9a7337cd64f9f9b2114fe4bbdfe1ae2633ba14d8c9c"
:text "Djndjd"}
:debug? false
:group-chat false
:public? false
:text "Djndjd"}
:debug? false
:group-chat false
:public? false
:chat-id
"0x04d6e56a475cd35f512d6ce0bf76c2c2af435c85ff48c2b9bdefd129f620e051a436f50961eae5717b2a750e59c3f5b60647d927da46d0b8b11621640b5678fc24"
:timestamp 1547186895328
:deleted-at-clock-value nil}])
:timestamp 1547186895328
:deleted-at-clock-value nil}])
(def multiaccount
{:last-updated 0
:address "7540c34d6c4082391f12468580a9a4e0724c6755"
:mnemonic "tumble gorilla neglect dumb budget involve tennis ocean diary eagle lady ring"
:custom-bootnodes {}
:signing-phrase "bull exam weed"
:signed-up? true
:name "name"
:last-request nil
{:last-updated 0
:address "7540c34d6c4082391f12468580a9a4e0724c6755"
:mnemonic "tumble gorilla neglect dumb budget involve tennis ocean diary eagle lady ring"
:custom-bootnodes {}
:signing-phrase "bull exam weed"
:signed-up? true
:name "name"
:last-request nil
:wallet/visible-tokens {:mainnet #{:SNT}
:goerli #{:STT}
:xdai #{}}
:preview-privacy? true
:fleet :eth.prod
:preview-privacy? true
:fleet :eth.prod
:identicon
"data:image/png;base64iVBORw0K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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAloYA4a9rBHIAAAAASUVORK5CYII="
:wallet-set-up-passed? false
:public-key
"0x04173f7cdea0076a7998abb674cc79fe61337c42db77043c01d5b0f3e3ac1e5a45bca0c93bb9f3c3d38b7cc9a7337cd64f9f9b2114fe4bbdfe1ae2633ba14d8c9c"
:keycard-key-uid nil
:installation-id "618ec020-13c8-5505-8aa6-9c5444317e7f"})
:keycard-key-uid nil
:installation-id "618ec020-13c8-5505-8aa6-9c5444317e7f"})
(def multiaccounts
{"address" multiaccount})
@@ -40,18 +40,18 @@
#_(deftest login
(testing "login with keycard"
(let
[wpk "c56c7ac797c27b3790ce02c2459e9957c5d20d7a2c55320535526ce9e4dcbbef"
[wpk "c56c7ac797c27b3790ce02c2459e9957c5d20d7a2c55320535526ce9e4dcbbef"
epk
"04f43da85ff1c333f3e7277b9ac4df92c9120fbb251f1dede7d41286e8c055acfeb845f6d2654821afca25da119daff9043530b296ee0e28e202ba92ec5842d617"
db
{:keycard
{:multiaccount
{:encryption-public-key epk
:whisper-private-key wpk
:wallet-address "83278851e290d2488b6add2a257259f5741a3b7d"
:whisper-private-key wpk
:wallet-address "83278851e290d2488b6add2a257259f5741a3b7d"
:whisper-public-key
"0x04491c1272149d7fa668afa45968c9914c0661641ace7dbcbc585c15070257840a0b4b1f71ce66c2147e281e1a44d6231b4731a26f6cc0a49e9616bbc7fc2f1a93"
:whisper-address "b8bec30855ff20c2ddab32282e2b2c8c8baca70d"}}}
:whisper-address "b8bec30855ff20c2ddab32282e2b2c8c8baca70d"}}}
result (login.core/login {:db db})]
(is (= (-> result (get :keycard/login-with-keycard) keys count)
3))
@@ -137,9 +137,9 @@
{:db (update db
:intro-wizard
assoc
:root-key root-data
:derived derived-data
:step :recovery-success)}
:root-key root-data
:derived derived-data
:step :recovery-success)}
(when (existing-account? multiaccounts key-uid)
(show-existing-multiaccount-alert key-uid))
(navigation/navigate-to-cofx :recover-multiaccount-success nil))))
@@ -199,14 +199,14 @@
(if (= step :enter-phrase)
{:db (dissoc db :intro-wizard)}
{:db (update db
:intro-wizard assoc
:intro-wizard assoc
:step
(case step
:recovery-success :enter-phrase
:select-key-storage :recovery-success
:create-code :select-key-storage)
:confirm-failure? false
:key-code nil)})))
:key-code nil)})))
(rf/defn cancel-pressed
{:events [:multiaccounts.recover/cancel-pressed]}
@@ -243,7 +243,7 @@
{:db (update db
:intro-wizard
assoc
:step :select-key-storage
:step :select-key-storage
:selected-storage-type :default)}
(if (nfc/nfc-supported?)
(navigation/navigate-to-cofx :select-key-storage nil)
@@ -17,7 +17,7 @@
(= {:db {:intro-wizard
{:passphrase
"game buzz method pretty olympic fat quit display velvet unveil marine crater"
:passphrase-error nil
:passphrase-error nil
:next-button-disabled? false}}}
(models/set-phrase
{:db {}}
@@ -27,7 +27,7 @@
(= {:db {:intro-wizard
{:passphrase
"game buzz method pretty olympic fat quit display velvet unveil marine crater"
:passphrase-error nil
:passphrase-error nil
:next-button-disabled? false}}}
(models/set-phrase
{:db {}}
@@ -36,7 +36,7 @@
(is
(= {:db {:intro-wizard {:passphrase
"game buzz method pretty zeus fat quit display velvet unveil marine crater"
:passphrase-error nil
:passphrase-error nil
:next-button-disabled? false}}}
(models/set-phrase {:db {}}
(security/mask-data
@@ -46,7 +46,7 @@
{:db {:intro-wizard
{:passphrase
" game\t buzz method pretty olympic fat quit\t display velvet unveil marine crater "
:passphrase-error nil
:passphrase-error nil
:next-button-disabled? false}}}
(models/set-phrase
{:db {}}
@@ -55,7 +55,7 @@
(is
(= {:db {:intro-wizard {:passphrase
"game buzz method pretty 1234 fat quit display velvet unveil marine crater"
:passphrase-error nil
:passphrase-error nil
:next-button-disabled? false}}}
(models/set-phrase
{:db {}}
+3 -3
View File
@@ -26,9 +26,9 @@
(js/Error.
"Please shake the phone to report this error and restart the app. multiaccount is currently empty, which means something went wrong when trying to update it with"))
(rf/merge cofx
{:db (if setting-value
(assoc-in db [:multiaccount setting] setting-value)
(update db :multiaccount dissoc setting))
{:db (if setting-value
(assoc-in db [:multiaccount setting] setting-value)
(update db :multiaccount dissoc setting))
:json-rpc/call
[{:method "settings_saveSetting"
:params [setting setting-value]
+4 -4
View File
@@ -116,9 +116,9 @@
(.logout ^js (status)))
(defonce listener
(.addListener ^js react-native-utils/device-event-emitter
"gethEvent"
#(re-frame/dispatch [:signals/signal-received (.-jsonEvent ^js %)])))
(.addListener ^js react-native-utils/device-event-emitter
"gethEvent"
#(re-frame/dispatch [:signals/signal-received (.-jsonEvent ^js %)])))
(defn multiaccount-load-account
"NOTE: beware, the password has to be sha3 hashed
@@ -466,7 +466,7 @@
(callback true))
;; in unknown scenarios we also consider the device rooted to avoid degrading security
:else (callback true)))
:else (callback true)))
(defn generate-gfycat
"Generate a 3 words random name based on the user public-key, synchronously"
+111 -111
View File
@@ -21,7 +21,7 @@
(def splash-screen (-> rn .-NativeModules .-SplashScreen))
(defonce set-navigation-default-options
(.setDefaultOptions Navigation (clj->js {:layout {:orientation "portrait"}})))
(.setDefaultOptions Navigation (clj->js {:layout {:orientation "portrait"}})))
;; REGISTER COMPONENT (LAZY)
(defn reg-comp
@@ -33,7 +33,7 @@
(.registerComponent Navigation key (fn [] (gestureHandlerRootHOC screen)) (fn [] screen)))))
(defonce rset-lazy-reg
(.setLazyComponentRegistrator Navigation reg-comp))
(.setLazyComponentRegistrator Navigation reg-comp))
(defn dismiss-all-modals
[]
@@ -104,17 +104,17 @@
(.dismissModal Navigation (name (last @state/modals))))
(defonce register-nav-button-reg
(.registerNavigationButtonPressedListener
(.events Navigation)
(fn [^js evn]
(let [id (.-buttonId evn)]
(if (= "dismiss-modal" id)
(do
(when-let [event (get-in views/screens [(last @state/modals) :on-dissmiss])]
(re-frame/dispatch event))
(dissmissModal))
(when-let [handler (get-in views/screens [(keyword id) :right-handler])]
(handler)))))))
(.registerNavigationButtonPressedListener
(.events Navigation)
(fn [^js evn]
(let [id (.-buttonId evn)]
(if (= "dismiss-modal" id)
(do
(when-let [event (get-in views/screens [(last @state/modals) :on-dissmiss])]
(re-frame/dispatch event))
(dissmissModal))
(when-let [handler (get-in views/screens [(keyword id) :right-handler])]
(handler)))))))
(defn set-view-id
[view-id]
@@ -126,53 +126,53 @@
(re-frame/dispatch on-focus))))
(defonce register-modal-reg
(.registerModalDismissedListener
(.events Navigation)
(fn [_]
(if (> (count @state/modals) 1)
(let [new-modals (butlast @state/modals)]
(reset! state/modals (vec new-modals))
(set-view-id (last new-modals)))
(do
(reset! state/modals [])
(reset! state/curr-modal false)
(set-view-id @state/pushed-screen-id)))
(.registerModalDismissedListener
(.events Navigation)
(fn [_]
(if (> (count @state/modals) 1)
(let [new-modals (butlast @state/modals)]
(reset! state/modals (vec new-modals))
(set-view-id (last new-modals)))
(do
(reset! state/modals [])
(reset! state/curr-modal false)
(set-view-id @state/pushed-screen-id)))
(let [comp @state/dissmissing]
(reset! state/dissmissing false)
(when (keyword? comp)
(open-modal comp))))))
(let [comp @state/dissmissing]
(reset! state/dissmissing false)
(when (keyword? comp)
(open-modal comp))))))
;; SCREEN DID APPEAR
(defonce screen-appear-reg
(.registerComponentDidAppearListener
(.events Navigation)
(fn [^js evn]
(let [view-id (keyword (.-componentName evn))]
(log/debug "screen-appear-reg" view-id)
(when (get views/screens view-id)
(when (and (not= view-id :bottom-sheet)
(not= view-id :popover)
(not= view-id :visibility-status-popover))
(set-view-id view-id)
(when-not @state/curr-modal
(reset! state/pushed-screen-id view-id))))))))
(.registerComponentDidAppearListener
(.events Navigation)
(fn [^js evn]
(let [view-id (keyword (.-componentName evn))]
(log/debug "screen-appear-reg" view-id)
(when (get views/screens view-id)
(when (and (not= view-id :bottom-sheet)
(not= view-id :popover)
(not= view-id :visibility-status-popover))
(set-view-id view-id)
(when-not @state/curr-modal
(reset! state/pushed-screen-id view-id))))))))
;; SCREEN DID DISAPPEAR
(defonce screen-disappear-reg
(.registerComponentDidDisappearListener
(.events Navigation)
(fn [^js evn]
(let [view-id (keyword (.-componentName evn))]
(when-not (#{"popover" "bottom-sheet" "signing-sheet" "visibility-status-popover"
"wallet-connect-sheet" "wallet-connect-success-sheet"
"wallet-connect-app-management-sheet"}
(.-componentName evn))
(re-frame/dispatch [::view-disappeared view-id])
(doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs]
(.setNativeProps ^js ref (clj->js {:text value})))
(doseq [[^js text-input default-value] @react/text-input-refs]
(.setNativeProps text-input (clj->js {:text default-value}))))))))
(.registerComponentDidDisappearListener
(.events Navigation)
(fn [^js evn]
(let [view-id (keyword (.-componentName evn))]
(when-not (#{"popover" "bottom-sheet" "signing-sheet" "visibility-status-popover"
"wallet-connect-sheet" "wallet-connect-success-sheet"
"wallet-connect-app-management-sheet"}
(.-componentName evn))
(re-frame/dispatch [::view-disappeared view-id])
(doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs]
(.setNativeProps ^js ref (clj->js {:text value})))
(doseq [[^js text-input default-value] @react/text-input-refs]
(.setNativeProps text-input (clj->js {:text default-value}))))))))
;; SET ROOT
(re-frame/reg-fx
@@ -203,19 +203,19 @@
{:init-root-fx (if keycard-account? :multiaccounts-keycard :multiaccounts)}))
(defonce
rset-app-launched
(.registerAppLaunchedListener (.events Navigation)
(fn []
(reset! state/curr-modal false)
(reset! state/dissmissing false)
(if (or (= @state/root-id :multiaccounts)
(= @state/root-id :multiaccounts-keycard))
(re-frame/dispatch-sync [::set-multiaccount-root])
(when @state/root-id
(reset! state/root-comp-id @state/root-id)
(.setRoot Navigation (clj->js (get (roots/roots) @state/root-id)))
(re-frame/dispatch [::login-core/check-last-chat])))
(.hide ^js splash-screen))))
rset-app-launched
(.registerAppLaunchedListener (.events Navigation)
(fn []
(reset! state/curr-modal false)
(reset! state/dissmissing false)
(if (or (= @state/root-id :multiaccounts)
(= @state/root-id :multiaccounts-keycard))
(re-frame/dispatch-sync [::set-multiaccount-root])
(when @state/root-id
(reset! state/root-comp-id @state/root-id)
(.setRoot Navigation (clj->js (get (roots/roots) @state/root-id)))
(re-frame/dispatch [::login-core/check-last-chat])))
(.hide ^js splash-screen))))
(defn get-screen-component
[comp]
@@ -294,19 +294,19 @@
(.popToRoot Navigation (name comp))))
(defonce register-bottom-tab-reg
(.registerBottomTabSelectedListener
(.events Navigation)
(fn [^js evn]
(let [selected-tab-index (.-selectedTabIndex evn)
comp (get tab-root-ids selected-tab-index)
tab-key (get (set/map-invert tab-key-idx) selected-tab-index)]
(re-frame/dispatch [:set :current-tab tab-key])
(when (= @state/root-comp-id comp)
(when (= :chat tab-key)
(re-frame/dispatch [:chat/close]))
(when platform/android?
(.popToRoot Navigation (name comp))))
(reset! state/root-comp-id comp)))))
(.registerBottomTabSelectedListener
(.events Navigation)
(fn [^js evn]
(let [selected-tab-index (.-selectedTabIndex evn)
comp (get tab-root-ids selected-tab-index)
tab-key (get (set/map-invert tab-key-idx) selected-tab-index)]
(re-frame/dispatch [:set :current-tab tab-key])
(when (= @state/root-comp-id comp)
(when (= :chat tab-key)
(re-frame/dispatch [:chat/close]))
(when platform/android?
(.popToRoot Navigation (name comp))))
(reset! state/root-comp-id comp)))))
;; OVERLAY (Popover and bottom sheets)
(defn dissmiss-overlay
@@ -331,20 +331,20 @@
;; POPOVER
(defonce popover-reg
(.registerComponent Navigation
"popover"
(fn [] (gestureHandlerRootHOC views/popover-comp))
(fn [] views/popover-comp)))
(.registerComponent Navigation
"popover"
(fn [] (gestureHandlerRootHOC views/popover-comp))
(fn [] views/popover-comp)))
(re-frame/reg-fx :show-popover (fn [] (show-overlay "popover")))
(re-frame/reg-fx :hide-popover (fn [] (dissmiss-overlay "popover")))
;; VISIBILITY STATUS POPOVER
(defonce visibility-status-popover-reg
(.registerComponent Navigation
"visibility-status-popover"
(fn [] (gestureHandlerRootHOC views/visibility-status-popover-comp))
(fn [] views/visibility-status-popover-comp)))
(.registerComponent Navigation
"visibility-status-popover"
(fn [] (gestureHandlerRootHOC views/visibility-status-popover-comp))
(fn [] views/visibility-status-popover-comp)))
(re-frame/reg-fx :show-visibility-status-popover
(fn [] (show-overlay "visibility-status-popover")))
@@ -353,10 +353,10 @@
;; BOTTOM SHEETS
(defonce bottom-sheet-reg
(.registerComponent Navigation
"bottom-sheet"
(fn [] (gestureHandlerRootHOC views/sheet-comp))
(fn [] views/sheet-comp)))
(.registerComponent Navigation
"bottom-sheet"
(fn [] (gestureHandlerRootHOC views/sheet-comp))
(fn [] views/sheet-comp)))
(re-frame/reg-fx :show-bottom-sheet-overlay (fn [] (show-overlay "bottom-sheet")))
(re-frame/reg-fx :dismiss-bottom-sheet-overlay (fn [] (dissmiss-overlay "bottom-sheet")))
@@ -364,22 +364,22 @@
;; WALLET CONNECT
(defonce wallet-connect-sheet-reg
(.registerComponent Navigation
"wallet-connect-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-comp))
(fn [] views/wallet-connect-comp)))
(.registerComponent Navigation
"wallet-connect-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-comp))
(fn [] views/wallet-connect-comp)))
(defonce wallet-connect-success-sheet-reg
(.registerComponent Navigation
"wallet-connect-success-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-success-comp))
(fn [] views/wallet-connect-success-comp)))
(.registerComponent Navigation
"wallet-connect-success-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-success-comp))
(fn [] views/wallet-connect-success-comp)))
(defonce wallet-connect-app-management-sheet-reg
(.registerComponent Navigation
"wallet-connect-app-management-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-app-management-comp))
(fn [] views/wallet-connect-app-management-comp)))
(.registerComponent Navigation
"wallet-connect-app-management-sheet"
(fn [] (gestureHandlerRootHOC views/wallet-connect-app-management-comp))
(fn [] views/wallet-connect-app-management-comp)))
(re-frame/reg-fx :show-wallet-connect-sheet (fn [] (show-overlay "wallet-connect-sheet")))
(re-frame/reg-fx :hide-wallet-connect-sheet (fn [] (dissmiss-overlay "wallet-connect-sheet")))
@@ -395,10 +395,10 @@
;; SIGNING
(defonce signing-sheet-reg
(.registerComponent Navigation
"signing-sheet"
(fn [] (gestureHandlerRootHOC views/signing-comp))
(fn [] views/signing-comp)))
(.registerComponent Navigation
"signing-sheet"
(fn [] (gestureHandlerRootHOC views/signing-comp))
(fn [] views/signing-comp)))
(re-frame/reg-fx :show-signing-sheet (fn [] (show-overlay "signing-sheet")))
(re-frame/reg-fx :hide-signing-sheet (fn [] (dissmiss-overlay "signing-sheet")))
@@ -407,10 +407,10 @@
;; TODO why is this not a regular bottom sheet ?
(defonce select-acc-sheet-reg
(.registerComponent Navigation
"select-acc-sheet"
(fn [] (gestureHandlerRootHOC views/select-acc-comp))
(fn [] views/select-acc-comp)))
(.registerComponent Navigation
"select-acc-sheet"
(fn [] (gestureHandlerRootHOC views/select-acc-comp))
(fn [] views/select-acc-comp)))
(re-frame/reg-fx :show-select-acc-sheet (fn [] (show-overlay "select-acc-sheet")))
(re-frame/reg-fx :hide-select-acc-sheet (fn [] (dissmiss-overlay "select-acc-sheet")))
+20 -21
View File
@@ -94,27 +94,26 @@
(deftest set-input-test
(testing "it updates and validate a field"
(is
(= {:db {:networks/manage {:url {:value "http://valid.com"
:error false}
:name {:value ""
:error true}
:symbol {:value "symbol"
:error false}
:chain {:value "mainnet"
:error false}
:network-id {:value nil
:error false}}}}
(network.core/set-input {:db {:networks/manage {:url {:value "something"
:error true}
:name {:value ""
:error false}
:symbol {:value "symbol"
:error false}
:chain {:value "mainnet"
:error false}}}}
:url
"http://valid.com")))))
(is (= {:db {:networks/manage {:url {:value "http://valid.com"
:error false}
:name {:value ""
:error true}
:symbol {:value "symbol"
:error false}
:chain {:value "mainnet"
:error false}
:network-id {:value nil
:error false}}}}
(network.core/set-input {:db {:networks/manage {:url {:value "something"
:error true}
:name {:value ""
:error false}
:symbol {:value "symbol"
:error false}
:chain {:value "mainnet"
:error false}}}}
:url
"http://valid.com")))))
(deftest not-save-invalid-url
(testing "it does not save a network with an invalid url"
+13 -13
View File
@@ -115,7 +115,7 @@
(let [ks (keys fleet)]
(some #(string/includes? (str %) "waku") ks)))
(defn get-multiaccount-node-config
(defn- get-multiaccount-node-config
[{:keys [multiaccount :networks/networks :networks/current-network]
:as db}]
(let [wakuv2-config (get multiaccount :wakuv2-config {})
@@ -139,8 +139,8 @@
current-fleet
(assoc :NoDiscovery wakuv2-enabled
:Rendezvous (if wakuv2-enabled false (boolean (seq rendezvous-nodes)))
:ClusterConfig {:Enabled true
:Fleet (name current-fleet-key)
:ClusterConfig {:Enabled true
:Fleet (name current-fleet-key)
:DiscV5BootstrapNodes
(if wakuv2-enabled
waku-nodes
@@ -155,22 +155,22 @@
(into (pick-nodes 2
(vals (:whisper current-fleet)))
(vals (:static current-fleet))))
:RendezvousNodes (if wakuv2-enabled [] rendezvous-nodes)
:WakuNodes (or waku-nodes [])})
:RendezvousNodes (if wakuv2-enabled [] rendezvous-nodes)
:WakuNodes (or waku-nodes [])})
:always
(assoc :LocalNotificationsConfig {:Enabled true}
:BrowsersConfig {:Enabled true}
:PermissionsConfig {:Enabled true}
:MailserversConfig {:Enabled true}
:EnableNTPSync true
:BrowsersConfig {:Enabled true}
:PermissionsConfig {:Enabled true}
:MailserversConfig {:Enabled true}
:EnableNTPSync true
:WakuConfig
{:Enabled true
:BloomFilterMode waku-bloom-filter-mode
:LightClient true
:MinimumPoW 0.000001}
:WakuV2Config (merge (assoc wakuv2-config :Enabled wakuv2-enabled)
wakuv2-default-config)
:WakuV2Config (merge (assoc wakuv2-config :Enabled wakuv2-enabled)
wakuv2-default-config)
:ShhextConfig
{:BackupDisabledDataDir (utils.platform/no-backup-directory)
:InstallationID installation-id
@@ -182,8 +182,8 @@
:VerifyTransactionChainID config/verify-transaction-chain-id
:DataSyncEnabled true
:PFSEnabled true}
:RequireTopics (get-topics current-network)
:StatusAccountsConfig {:Enabled true})
:RequireTopics (get-topics current-network)
:StatusAccountsConfig {:Enabled true})
(and
config/bootnodes-settings-enabled?
+8 -8
View File
@@ -224,13 +224,13 @@
"wakuext_enableSendingNotifications"
"wakuext_disableSendingNotifications")]
(rf/merge cofx
{:json-rpc/call [{:method method
:params []
{:json-rpc/call [{:method method
:params []
:on-success
#(log/info "[push-notifications] switch-send-notifications successful"
%)
:on-error #(re-frame/dispatch [::push-notifications-send-update-error
enabled? %])}]}
:on-error #(re-frame/dispatch [::push-notifications-send-update-error
enabled? %])}]}
(multiaccounts.update/optimistic :send-push-notifications? (boolean enabled?)))))
@@ -243,15 +243,15 @@
{:events [::add-server]}
[{:keys [db] :as cofx} public-key]
(rf/merge cofx
{:json-rpc/call [{:method "wakuext_addPushNotificationsServer"
:params [public-key]
{:json-rpc/call [{:method "wakuext_addPushNotificationsServer"
:params [public-key]
:on-success
#(do
(log/info "[push-notifications] switch-send-notifications successful"
%)
(re-frame/dispatch [::fetch-servers]))
:on-error #(re-frame/dispatch [::push-notifications-add-server-error
public-key %])}]}))
:on-error #(re-frame/dispatch [::push-notifications-add-server-error
public-key %])}]}))
(rf/defn handle-servers-fetched
{:events [::servers-fetched]}
+20 -21
View File
@@ -101,10 +101,9 @@
(rf/defn send-transaction
{:events [:signing.ui/sign-is-pressed]}
[{{:signing/keys [sign tx] :as db} :db :as cofx}]
(let [{:keys [in-progress? password]} sign
{:keys [tx-obj gas gasPrice maxPriorityFeePerGas
maxFeePerGas message nonce]} tx
hashed-password (ethereum/sha3 (security/safe-unmask-data password))]
(let [{:keys [in-progress? password]} sign
{:keys [tx-obj gas gasPrice maxPriorityFeePerGas maxFeePerGas message nonce]} tx
hashed-password (ethereum/sha3 (security/safe-unmask-data password))]
(if message
(sign-message cofx)
(let [tx-obj-to-send (merge tx-obj
@@ -295,7 +294,7 @@
:success-event :signing/update-estimated-gas-success
:error-event :signing/update-estimated-gas-error}})
(fn [cofx]
{:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true)
{:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true)
:signing/update-gas-price
{:success-callback #(re-frame/dispatch
[:wallet.send/update-gas-price-success :signing/tx % tx-obj])
@@ -312,12 +311,12 @@
(rf/defn send-transaction-message
{:events [:sign/send-transaction-message]}
[cofx chat-id value contract transaction-hash signature]
{:json-rpc/call [{:method "wakuext_sendTransaction"
{:json-rpc/call [{:method "wakuext_sendTransaction"
;; We make sure `value` is serialized as string, and not
;; as an integer or big-int
:params [chat-id (str value) contract transaction-hash
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]
:params [chat-id (str value) contract transaction-hash
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]
:js-response true
:on-success
#(re-frame/dispatch [:transport/message-sent %])}]})
@@ -325,10 +324,10 @@
(rf/defn send-accept-request-transaction-message
{:events [:sign/send-accept-transaction-message]}
[cofx message-id transaction-hash signature]
{:json-rpc/call [{:method "wakuext_acceptRequestTransaction"
:params [transaction-hash message-id
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]
{:json-rpc/call [{:method "wakuext_acceptRequestTransaction"
:params [transaction-hash message-id
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]
:js-response true
:on-success
#(re-frame/dispatch [:transport/message-sent %])}]})
@@ -357,7 +356,7 @@
(wallet/watch-tx (get from :address) transaction-hash)
(if (keycard.common/keycard-multiaccount? db)
(signing.keycard/hash-message
{:data data
{:data data
:on-completed
(fn [hash]
(re-frame/dispatch
@@ -371,9 +370,9 @@
hash]))})
(fn [_]
{:signing.fx/sign-message
{:params {:data data
:password hashed-password
:account from}
{:params {:data data
:password hashed-password
:account from}
:on-completed
(fn [res]
(re-frame/dispatch
@@ -414,9 +413,9 @@
{:db (update db
:signing/sign
assoc
:error (if (= 5 (:code error))
(i18n/label :t/wrong-password)
(:message error))
:error (if (= 5 (:code error))
(i18n/label :t/wrong-password)
(:message error))
:in-progress? false)}
(rf/merge cofx
(when-not (= (-> db :signing/sign :type) :pinless)
@@ -496,7 +495,7 @@
:chat-id identity
:command? true
:data (status/encode-transfer to-norm amount-hex)})}))
{:db db
{:db db
:json-rpc/call
[{:method "wakuext_requestAddressForTransaction"
:params [(:current-chat-id db)
+7 -7
View File
@@ -190,7 +190,7 @@
(assoc-in [:signing/edit-fee :selected-fee-option] option)
(update :signing/edit-fee
build-edit
:maxFeePerGas (money/wei->gwei fee))
:maxFeePerGas (money/wei->gwei fee))
(update :signing/edit-fee
build-edit
:maxPriorityFeePerGas (money/wei->gwei tip)))}))
@@ -200,12 +200,12 @@
[{:keys [db]} value]
(let [{:keys [maxFeePerGas maxPriorityFeePerGas]}
(get db :signing/edit-fee)
latest-base-fee (get db :wallet/current-base-fee)
max-fee-value (:value-number maxFeePerGas)
max-priority-fee-value (:value-number maxPriorityFeePerGas)
new-value (money/bignumber value)
fee-without-tip (money/sub max-fee-value max-priority-fee-value)
base-fee (money/wei->gwei (money/bignumber latest-base-fee))
latest-base-fee (get db :wallet/current-base-fee)
max-fee-value (:value-number maxFeePerGas)
max-priority-fee-value (:value-number maxPriorityFeePerGas)
new-value (money/bignumber value)
fee-without-tip (money/sub max-fee-value max-priority-fee-value)
base-fee (money/wei->gwei (money/bignumber latest-base-fee))
new-max-fee-value
(money/to-fixed
(if (money/greater-than base-fee fee-without-tip)
+3 -3
View File
@@ -57,15 +57,15 @@
[_ {:keys [v4 data typed? on-completed]}]
(if typed?
{::hash-typed-data
{:data data
:v4 v4
{:data data
:v4 v4
:on-completed
(or on-completed
#(re-frame/dispatch
[:signing.keycard.callback/hash-message-completed
data typed? %]))}}
{::hash-message
{:message data
{:message data
:on-completed
(or on-completed
#(re-frame/dispatch
+1 -1
View File
@@ -38,7 +38,7 @@
(assoc opts :repl true)
(string/starts-with? arg "--test=")
(let [test-arg (subs arg 7)
(let [test-arg (subs arg 7)
test-syms
(->> (string/split test-arg ",")
(map symbol))]
+25 -25
View File
@@ -1,29 +1,29 @@
(ns ^{:doc "Definition of the StatusMessage protocol"} status-im.transport.message.core
(:require
[clojure.string :as string]
[status-im.browser.core :as browser]
[status-im2.contexts.chat.events :as chat.events]
[status-im.chat.models.message :as models.message]
[status-im.chat.models.reactions :as models.reactions]
[status-im.communities.core :as models.communities]
[status-im2.constants :as constants]
[status-im.contact.core :as models.contact]
[status-im.data-store.activities :as data-store.activities]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.contacts :as data-store.contacts]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.data-store.messages :as data-store.messages]
[status-im.data-store.reactions :as data-store.reactions]
[status-im.group-chats.core :as models.group]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as update.core]
[status-im.pairing.core :as models.pairing]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
[status-im.visibility-status-updates.core :as models.visibility-status-updates]
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.contexts.chat.messages.pin.events :as messages.pin]))
[clojure.string :as string]
[status-im.browser.core :as browser]
[status-im2.contexts.chat.events :as chat.events]
[status-im.chat.models.message :as models.message]
[status-im.chat.models.reactions :as models.reactions]
[status-im.communities.core :as models.communities]
[status-im2.constants :as constants]
[status-im.contact.core :as models.contact]
[status-im.data-store.activities :as data-store.activities]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.contacts :as data-store.contacts]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.data-store.messages :as data-store.messages]
[status-im.data-store.reactions :as data-store.reactions]
[status-im.group-chats.core :as models.group]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as update.core]
[status-im.pairing.core :as models.pairing]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
[status-im.visibility-status-updates.core :as models.visibility-status-updates]
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.contexts.chat.messages.pin.events :as messages.pin]))
(rf/defn process-next
[cofx ^js response-js sync-handler]
@@ -243,7 +243,7 @@
{:events [:sanitize-messages-and-process-response]}
[{:keys [db] :as cofx} ^js response-js process-async]
(when response-js
(let [current-chat-id (:current-chat-id db)
(let [current-chat-id (:current-chat-id db)
{:keys [db messages transactions chats statuses]}
(reduce group-by-and-update-unviewed-counts
{:db db
@@ -103,7 +103,7 @@
(- (+ 17 @height))))
(react/copy-to-clipboard copied-text))]
[react/view
{:style (if container-style container-style {})
{:style (if container-style container-style {})
:on-layout
#(do
(reset! width (-> ^js % .-nativeEvent .-layout .-width))
@@ -105,7 +105,7 @@
(when on-press
(on-press)))]
[react/view
{:style (if container-style container-style {})
{:style (if container-style container-style {})
:on-layout
#(do
(reset! width (-> ^js % .-nativeEvent .-layout .-width))
@@ -18,12 +18,12 @@
node-version [:get-app-node-version]]
[react/scroll-view
[quo/list-item
{:size :small
:title (i18n/label :t/privacy-policy)
{:size :small
:title (i18n/label :t/privacy-policy)
:accessibility-label :privacy-policy
:on-press
#(re-frame/dispatch [:navigate-to :privacy-policy])
:chevron true}]
:chevron true}]
[quo/list-item
{:size :small
:title (i18n/label :t/terms-of-service)

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