Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52d7d60751 | ||
|
|
37c25b9351 | ||
|
|
c917454b7d | ||
|
|
25d51aa929 | ||
|
|
5bb3cdc19e | ||
|
|
756e892acb | ||
|
|
0dcf4e7b14 |
@@ -36,5 +36,3 @@ SHOW_NOT_IMPLEMENTED_FEATURES=0
|
||||
ENABLE_ALERT_BANNER=0
|
||||
FLAG_WALLET_CONNECT_ENABLED=1
|
||||
API_LOGGING_ENABLED=1
|
||||
SENTRY_ENABLED=0
|
||||
SENTRY_ENVIRONMENT=ci-main
|
||||
|
||||
@@ -40,5 +40,3 @@ ENABLE_ALERT_BANNER=0
|
||||
FLAG_WALLET_CONNECT_ENABLED=1
|
||||
MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0
|
||||
API_LOGGING_ENABLED=1
|
||||
SENTRY_ENABLED=0
|
||||
SENTRY_ENVIRONMENT=ci-main
|
||||
|
||||
@@ -37,5 +37,3 @@ TEST_NETWORKS_ENABLED=1
|
||||
ENABLE_ALERT_BANNER=1
|
||||
FLAG_WALLET_CONNECT_ENABLED=1
|
||||
API_LOGGING_ENABLED=1
|
||||
SENTRY_ENABLED=0
|
||||
SENTRY_ENVIRONMENT=ci-main
|
||||
|
||||
@@ -24,5 +24,3 @@ TEST_NETWORKS_ENABLED=0
|
||||
ENABLE_ALERT_BANNER=1
|
||||
FLAG_WALLET_CONNECT_ENABLED=1
|
||||
API_LOGGING_ENABLED=1
|
||||
SENTRY_ENABLED=1
|
||||
SENTRY_ENVIRONMENT=ci-nightly
|
||||
|
||||
@@ -21,5 +21,3 @@ TEST_NETWORKS_ENABLED=0
|
||||
STATUS_PROXY_STAGE_NAME=prod
|
||||
FLAG_WALLET_CONNECT_ENABLED=1
|
||||
API_LOGGING_ENABLED=0
|
||||
SENTRY_ENABLED=1
|
||||
SENTRY_ENVIRONMENT=production
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.18'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
@@ -41,7 +41,6 @@ pipeline {
|
||||
BUILD_ENV = 'prod'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.18'
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
|
||||
@@ -134,3 +134,4 @@ def updateBucketJSON(urls, fileName) {
|
||||
writeFile(file: filePath, text: contentJson)
|
||||
return s5cmd.upload(filePath)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.18'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.18'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
@@ -41,7 +41,6 @@ pipeline {
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
BUNDLE_PATH = "${HOME}/.bundle"
|
||||
SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.18'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
agent { label 'macos' }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
agent { label params.AGENT_LABEL }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.9.20'
|
||||
library 'status-jenkins-lib@v1.9.13'
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
|
||||
@@ -35,11 +35,6 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
|
||||
return File(pubDirectory, gethLogFileName)
|
||||
}
|
||||
|
||||
private fun getPreLoginLogFile(): File {
|
||||
val pubDirectory = utils.getPublicStorageDirectory()
|
||||
return File(pubDirectory, preLoginLogFileName)
|
||||
}
|
||||
|
||||
fun prepareLogsFile(context: Context): File? {
|
||||
val logFile = getGethLogFile()
|
||||
|
||||
@@ -161,7 +156,6 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
|
||||
val statusLogFile = File(logsTempDir, statusLogFileName)
|
||||
val gethLogFile = getGethLogFile()
|
||||
val requestLogFile = getRequestLogFile()
|
||||
val preLoginLogFile = getPreLoginLogFile()
|
||||
|
||||
try {
|
||||
if (zipFile.exists() || zipFile.createNewFile()) {
|
||||
@@ -181,9 +175,6 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
|
||||
if (requestLogFile.exists()) {
|
||||
filesToZip.add(requestLogFile)
|
||||
}
|
||||
if (preLoginLogFile.exists()) {
|
||||
filesToZip.add(preLoginLogFile)
|
||||
}
|
||||
val zipped = zip(filesToZip.toTypedArray(), zipFile, errorList)
|
||||
if (zipped && zipFile.exists()) {
|
||||
zipFile.setReadable(true, false)
|
||||
@@ -214,7 +205,6 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
|
||||
private const val gethLogFileName = "geth.log"
|
||||
private const val statusLogFileName = "Status.log"
|
||||
private const val requestsLogFileName = "api.log"
|
||||
private const val preLoginLogFileName = "pre_login.log"
|
||||
private const val logsZipFileName = "Status-debug-logs.zip"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,15 +108,6 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va
|
||||
)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun intendedPanic(message: String) {
|
||||
StatusBackendClient.executeStatusGoRequest(
|
||||
endpoint = "IntendedPanic",
|
||||
requestBody = message,
|
||||
statusgoFunction = { Statusgo.intendedPanic(message) },
|
||||
)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun addCentralizedMetric(request: String, callback: Callback) {
|
||||
StatusBackendClient.executeStatusGoRequestWithCallback(
|
||||
|
||||
@@ -35,7 +35,6 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
|
||||
|
||||
NSURL *mainGethLogsFile = [rootUrl URLByAppendingPathComponent:@"geth.log"];
|
||||
NSURL *mainLogsFile = [logsFolderName URLByAppendingPathComponent:@"geth.log"];
|
||||
NSURL *preLoginLogFile = [rootUrl URLByAppendingPathComponent:@"pre_login.log"];
|
||||
|
||||
NSURL *requestsLogFile = [rootUrl URLByAppendingPathComponent:@"api.log"];
|
||||
|
||||
@@ -47,10 +46,6 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
|
||||
if ([fileManager fileExistsAtPath:requestsLogFile.path]) {
|
||||
[fileManager copyItemAtPath:requestsLogFile.path toPath:[logsFolderName URLByAppendingPathComponent:@"api.log"].path error:nil];
|
||||
}
|
||||
|
||||
if ([fileManager fileExistsAtPath:preLoginLogFile.path]) {
|
||||
[fileManager copyItemAtPath:preLoginLogFile.path toPath:[logsFolderName URLByAppendingPathComponent:@"pre_login.log"].path error:nil];
|
||||
}
|
||||
|
||||
[SSZipArchive createZipFileAtPath:zipFile.path withContentsOfDirectory:logsFolderName.path];
|
||||
[fileManager removeItemAtPath:logsFolderName.path error:nil];
|
||||
|
||||
@@ -109,17 +109,6 @@ RCT_EXPORT_METHOD(getNodeConfig:(RCTResponseSenderBlock)callback) {
|
||||
callback:callback];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(intendedPanic:(NSString *)message) {
|
||||
#if DEBUG
|
||||
NSLog(@"IntendedPanic() method called");
|
||||
#endif
|
||||
[StatusBackendClient executeStatusGoRequest:@"IntendedPanic"
|
||||
body:message
|
||||
statusgoFunction:^NSString *{
|
||||
return StatusgoIntendedPanic(message);
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(fleets) {
|
||||
return [StatusBackendClient executeStatusGoRequestWithResult:@"Fleets"
|
||||
body:@""
|
||||
|
||||
@@ -6,7 +6,6 @@ readonly FOOJAY_FALLBACK="0.5.0"
|
||||
readonly KOTLIN_FALLBACK="1.8.0"
|
||||
readonly TOOLS_FALLBACK="3.5.4"
|
||||
readonly HERMES_FALLBACK="0.73.5"
|
||||
readonly GRADLE_LINT_FALLBACK="31.1.1"
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
cd "${GIT_ROOT}"
|
||||
@@ -26,28 +25,16 @@ get_version() {
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
# https://github.com/googlesamples/android-custom-lint-rules/blob/be672cd747ecf13844918e1afccadb935f856a72/docs/api-guide/example.md.html#L112-L129
|
||||
get_gradle_lint_version() {
|
||||
gradlePluginVersion=$(get_version "./nix/pkgs/aapt2/default.nix" "version =" $GRADLE_LINT_FALLBACK)
|
||||
major=$(echo "$gradlePluginVersion" | grep -o "^[0-9]*")
|
||||
# lintVersion = gradlePluginVersion + 23.0.0
|
||||
major=$((major + 23))
|
||||
minor=$(echo "$gradlePluginVersion" | grep -o "\.[0-9]*\." | grep -o "[0-9]*")
|
||||
patch=$(echo "$gradlePluginVersion" | grep -o "[0-9]*$")
|
||||
|
||||
echo "$major.$minor.$patch"
|
||||
}
|
||||
|
||||
foojay_version=$(get_version "./node_modules/@react-native/gradle-plugin/settings.gradle.kts" "foojay.*version" "$FOOJAY_FALLBACK")
|
||||
kotlin_version=$(get_version "./node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml" "kotlin =" "$KOTLIN_FALLBACK")
|
||||
tools_version=$(get_version "./patches/BlurView-build.gradle.patch" "gradle:" "$TOOLS_FALLBACK")
|
||||
hermes_version=$(get_version "./node_modules/react-native/ReactAndroid/gradle.properties" "VERSION_NAME" "$HERMES_FALLBACK")
|
||||
lint_version=$(get_gradle_lint_version)
|
||||
|
||||
|
||||
cat << EOF
|
||||
org.gradle.toolchains.foojay-resolver-convention:org.gradle.toolchains.foojay-resolver-convention.gradle.plugin:$foojay_version
|
||||
org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:$kotlin_version
|
||||
com.android.tools.build:gradle:$tools_version
|
||||
com.facebook.react:hermes-android:$hermes_version
|
||||
com.android.tools.lint:lint-gradle:$lint_version
|
||||
com.android.tools.lint:lint-gradle:31.1.1
|
||||
EOF
|
||||
|
||||
@@ -10,7 +10,6 @@ let
|
||||
|
||||
pname = "aapt2";
|
||||
# Warning: This must be the same as gradlePluginVersion android/gradle.properties
|
||||
# also referenced in nix/deps/gradle/deps_hack.sh
|
||||
version = "8.1.1-10154469";
|
||||
|
||||
pkgPath = "com/android/tools/build/aapt2";
|
||||
|
||||
@@ -48,10 +48,6 @@ in buildGoPackage rec {
|
||||
# TODO: try removing when go is upgraded to 1.22
|
||||
GODEBUG = "netdns=cgo+2";
|
||||
|
||||
# Sentry for status-go
|
||||
SENTRY_CONTEXT_NAME = "status-mobile";
|
||||
SENTRY_CONTEXT_VERSION = version;
|
||||
|
||||
preBuild = ''
|
||||
echo 'Generate static files'
|
||||
pushd go/src/$goPackagePath
|
||||
|
||||
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 282 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 168 KiB |
|
Before Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 276 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 179 KiB |
|
Before Width: | Height: | Size: 327 KiB |
|
Before Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 229 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 269 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 428 KiB |
|
Before Width: | Height: | Size: 235 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 441 KiB After Width: | Height: | Size: 345 KiB |
@@ -45,9 +45,8 @@ SECRETS_ENV_VARS=(
|
||||
'INFURA_TOKEN_SECRET'
|
||||
'OPENSEA_API_KEY'
|
||||
'MIXPANEL_APP_ID'
|
||||
'MIXPANEL_APP_TOKEN'
|
||||
'MIXPANEL_TOKEN'
|
||||
'POKT_TOKEN'
|
||||
'SENTRY_DSN_STATUS_GO'
|
||||
)
|
||||
|
||||
# Secrets like this can't be passed via args or they end up in derivation.
|
||||
|
||||
@@ -77,13 +77,8 @@
|
||||
#shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX"
|
||||
status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env
|
||||
"STATUS_BACKEND_SERVER_ROOT_DATA_DIR"
|
||||
|
||||
;; Uncomment this line during development if you want to test the integration with Sentry.
|
||||
;;
|
||||
;; status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO"
|
||||
|
||||
status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID"
|
||||
status-im.config/MIXPANEL_APP_TOKEN #shadow/env "MIXPANEL_APP_TOKEN"
|
||||
status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN"
|
||||
status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"
|
||||
status-im.config/RARIBLE_MAINNET_API_KEY #shadow/env "RARIBLE_MAINNET_API_KEY"
|
||||
status-im.config/RARIBLE_TESTNET_API_KEY #shadow/env "RARIBLE_TESTNET_API_KEY"
|
||||
@@ -124,10 +119,9 @@
|
||||
status-im.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"
|
||||
status-im.config/STATUS_BUILD_PROXY_USER #shadow/env "STATUS_BUILD_PROXY_USER"
|
||||
status-im.config/STATUS_BUILD_PROXY_PASSWORD #shadow/env "STATUS_BUILD_PROXY_PASSWORD"
|
||||
status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO"
|
||||
status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"
|
||||
status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID"
|
||||
status-im.config/MIXPANEL_APP_TOKEN #shadow/env "MIXPANEL_APP_TOKEN"
|
||||
status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN"
|
||||
status-im.config/RARIBLE_MAINNET_API_KEY #shadow/env "RARIBLE_MAINNET_API_KEY"
|
||||
status-im.config/RARIBLE_TESTNET_API_KEY #shadow/env "RARIBLE_TESTNET_API_KEY"
|
||||
status-im.config/ALCHEMY_ETHEREUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ETHEREUM_MAINNET_TOKEN"
|
||||
@@ -174,7 +168,7 @@
|
||||
status-im.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"
|
||||
status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"
|
||||
status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID"
|
||||
status-im.config/MIXPANEL_APP_TOKEN #shadow/env "MIXPANEL_APP_TOKEN"
|
||||
status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN"
|
||||
status-im.config/RARIBLE_MAINNET_API_KEY #shadow/env "RARIBLE_MAINNET_API_KEY"
|
||||
status-im.config/RARIBLE_TESTNET_API_KEY #shadow/env "RARIBLE_TESTNET_API_KEY"
|
||||
status-im.config/ALCHEMY_ETHEREUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ETHEREUM_MAINNET_TOKEN"
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
(ns legacy.status-im.ui.screens.advanced-settings.views
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.ui.components.core :as components]
|
||||
[legacy.status-im.ui.components.list.item :as list.item]
|
||||
[legacy.status-im.ui.components.list.views :as list]
|
||||
[quo.core :as quo]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.config :as config]
|
||||
[status-im.feature-flags :as ff]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf])
|
||||
(:require-macros [legacy.status-im.utils.views :as views]))
|
||||
@@ -20,16 +17,7 @@
|
||||
peer-syncing-enabled?]}]
|
||||
(keep
|
||||
identity
|
||||
[(when (ff/enabled? ::ff/app-monitoring.intentional-crash)
|
||||
{:size :small
|
||||
:title (str "Force crash immediately"
|
||||
(when (string/blank? config/sentry-dsn-status-go)
|
||||
" (Sentry DSN is not set)"))
|
||||
:accessibility-label :intended-panic
|
||||
:on-press (fn []
|
||||
(re-frame/dispatch [:app-monitoring/intended-panic
|
||||
"status-mobile intentional panic"]))})
|
||||
{:size :small
|
||||
[{:size :small
|
||||
:title (i18n/label :t/log-level)
|
||||
:accessibility-label :log-level-settings-button
|
||||
:on-press
|
||||
|
||||
@@ -569,7 +569,3 @@
|
||||
(.createAccountFromPrivateKey ^js (account-manager)
|
||||
(types/clj->json {:privateKey private-key})
|
||||
callback)))
|
||||
|
||||
(defn intended-panic
|
||||
[message]
|
||||
(.intendedPanic ^js (status) message))
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
[rn/view (style/card-view-chat-icon 48 theme)
|
||||
[icon/community-icon {:images images} 48]]
|
||||
(when (= status :gated)
|
||||
[rn/view style/permission-tag-styles
|
||||
[rn/view (style/permission-tag-styles)
|
||||
[community-view/permission-tag-container
|
||||
{:locked? locked?
|
||||
:status status
|
||||
@@ -63,12 +63,10 @@
|
||||
[community-view/community-title
|
||||
{:title name
|
||||
:description description}]
|
||||
[rn/view {:style style/card-stats-position}
|
||||
[rn/view {:style (style/card-stats-position)}
|
||||
[community-view/community-stats-column
|
||||
{:type :card-view
|
||||
:members-count (:members-count community)
|
||||
:active-members-count (:active-members-count community)}]]
|
||||
[rn/view {:style style/community-tags-position}
|
||||
{:type :card-view}]]
|
||||
[rn/view {:style (style/community-tags-position)}
|
||||
[community-view/community-tags {:tags tags}]]]]]]))
|
||||
|
||||
(defn view
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
:style {:border-radius 12
|
||||
:margin-left 12}}
|
||||
props)
|
||||
[rn/view (merge style/membership-info-container style)
|
||||
[rn/view (merge (style/membership-info-container) style)
|
||||
[community-icon/community-icon
|
||||
{:images images} 32]
|
||||
[rn/view
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
[react-native.gesture :as gesture]))
|
||||
|
||||
(defn community-stats-column
|
||||
[{:keys [type members-count active-members-count]}]
|
||||
[rn/view (if (= type :card-view) style/card-stats-container style/list-stats-container)
|
||||
[{:keys [type members-count active-count]}]
|
||||
[rn/view
|
||||
(if (= type :card-view)
|
||||
(style/card-stats-container)
|
||||
(style/list-stats-container))
|
||||
[community-stat/view
|
||||
{:accessibility-label :stats-members-count
|
||||
:icon :i/group
|
||||
@@ -21,7 +24,7 @@
|
||||
[community-stat/view
|
||||
{:accessibility-label :stats-active-count
|
||||
:icon :i/active-members
|
||||
:value active-members-count}]])
|
||||
:value active-count}]])
|
||||
|
||||
(defn community-tags
|
||||
[{:keys [tags container-style last-item-style]}]
|
||||
|
||||
@@ -17,20 +17,24 @@
|
||||
(def detail-container
|
||||
{:flex 1})
|
||||
|
||||
(def card-stats-container
|
||||
(defn card-stats-container
|
||||
[]
|
||||
{:flex-direction :row})
|
||||
|
||||
(def list-stats-container
|
||||
(defn list-stats-container
|
||||
[]
|
||||
{:flex-direction :row
|
||||
:align-items :center})
|
||||
|
||||
(def card-stats-position
|
||||
(defn card-stats-position
|
||||
[]
|
||||
{:position :absolute
|
||||
:top 116
|
||||
:right 12
|
||||
:left 12})
|
||||
|
||||
(def community-tags-position
|
||||
(defn community-tags-position
|
||||
[]
|
||||
{:position :absolute
|
||||
:top 154
|
||||
:right 12
|
||||
@@ -64,7 +68,8 @@
|
||||
colors/neutral-90
|
||||
theme)})
|
||||
|
||||
(def membership-info-container
|
||||
(defn membership-info-container
|
||||
[]
|
||||
{:flex-direction :row
|
||||
:border-radius 16
|
||||
:align-items :center
|
||||
@@ -82,7 +87,8 @@
|
||||
:border-top-left-radius 20
|
||||
:background-color colors/primary-50-opa-20})
|
||||
|
||||
(def permission-tag-styles
|
||||
(defn permission-tag-styles
|
||||
[]
|
||||
{:position :absolute
|
||||
:top 8
|
||||
:right 8})
|
||||
@@ -140,14 +146,10 @@
|
||||
:background-color (colors/theme-colors colors/white colors/neutral-90 theme)})
|
||||
|
||||
(def loading-tags-container
|
||||
{:margin-top 20
|
||||
:flex-direction :row
|
||||
:align-items :center})
|
||||
{:margin-top 20 :flex-direction :row :align-items :center})
|
||||
|
||||
(def loading-stats-container
|
||||
{:margin-top 20
|
||||
:flex-direction :row
|
||||
:align-items :center})
|
||||
{:margin-top 20 :flex-direction :row :align-items :center})
|
||||
|
||||
(defn loading-stat-circle
|
||||
[theme margin-left]
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
(ns status-im.app.events
|
||||
(:require
|
||||
[status-im.app.use-case :as uc]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
||||
(def navigation-effects-tree
|
||||
{:uc-view-saved-addresses
|
||||
{:on-start [[:dispatch [:open-modal :screen/settings.saved-addresses]]]
|
||||
:uc-add-saved-address {:on-start [[:dispatch [:open-modal :screen/settings.add-address-to-save]]]
|
||||
:on-finish [[:dispatch [:navigate-back]]]}
|
||||
:on-finish [[:dispatch [:navigate-back]]]}})
|
||||
|
||||
|
||||
(def db-path-use-case-stack [:app :use-cases-stack])
|
||||
|
||||
(defn use-cases
|
||||
[db]
|
||||
(get-in db db-path-use-case-stack '()))
|
||||
|
||||
(defn current-use-case
|
||||
[db]
|
||||
(-> db
|
||||
use-cases
|
||||
first))
|
||||
|
||||
(defn- navigation-effects-for-key
|
||||
[db last-key]
|
||||
(let [path (-> db
|
||||
use-cases
|
||||
reverse
|
||||
vec
|
||||
(conj last-key))]
|
||||
(tap> {:in :navigation-effects-for-key
|
||||
:use-cases (use-cases db)})
|
||||
(get-in navigation-effects-tree path)))
|
||||
|
||||
(defn start-use-case-navigation-effects
|
||||
[db]
|
||||
(navigation-effects-for-key db :on-start))
|
||||
|
||||
(defn finish-use-case-navigation-effects
|
||||
[db]
|
||||
(navigation-effects-for-key db :on-finish))
|
||||
|
||||
|
||||
(rf/reg-event-fx :app/start-use-case
|
||||
(fn [{:keys [db]} [use-case-id]]
|
||||
(let [new-db (update-in db db-path-use-case-stack conj use-case-id)]
|
||||
#_(tap> {:in :app/start-use-case
|
||||
:effects (start-use-case-navigation-effects new-db)})
|
||||
{:db new-db
|
||||
:fx (start-use-case-navigation-effects new-db)})))
|
||||
|
||||
(rf/reg-event-fx :app/finish-use-case
|
||||
(fn [{:keys [db]} [use-case-to-finish]]
|
||||
(let [new-db (update-in db db-path-use-case-stack rest)]
|
||||
(if (= (current-use-case db) use-case-to-finish)
|
||||
{:db new-db
|
||||
:fx (finish-use-case-navigation-effects db)}
|
||||
;; TODO: kozieiev: replace with effect
|
||||
(log/error "Attempt to finish use case that is not current:" use-case-to-finish)))))
|
||||
|
||||
(rf/reg-event-fx :app/clear-use-cases-stack
|
||||
(fn [{:keys [db]}]
|
||||
{:db (assoc-in db db-path-use-case-stack '())}))
|
||||
|
||||
(comment
|
||||
(rf/dispatch [:app/start-use-case :uc-save-address])
|
||||
(rf/dispatch [:app/start-use-case :uc-edit-address])
|
||||
(rf/dispatch [:app/finish-use-case :uc-edit-address])
|
||||
(rf/dispatch [:app/finish-use-case :uc-save-address])
|
||||
|
||||
|
||||
(rf/dispatch [:app/clear-use-cases-stack])
|
||||
|
||||
(rf/sub [:app/use-case-active? :uc-edit-address])
|
||||
(rf/sub [:app/use-case-active? :uc-save-address])
|
||||
(rf/sub [:app/current-use-case])
|
||||
(rf/dispatch [:navigate-back])
|
||||
|
||||
(start-use-case-navigation-effects {:app {:use-cases-stack
|
||||
'(:uc-view-saved-addresses :uc-add-saved-address)}})
|
||||
(finish-use-case-navigation-effects {:app {:use-cases-stack
|
||||
'(:uc-view-saved-addresses :uc-add-saved-address)}})
|
||||
|
||||
(use-cases {:app {:use-cases-stack
|
||||
'(:uc-view-saved-addresses :uc-add-saved-address)}})
|
||||
|
||||
(-> {:app {:use-cases-stack '(:uc-view-saved-addresses :uc-add-saved-address)}}
|
||||
use-cases
|
||||
reverse
|
||||
vec
|
||||
(conj :on-exit))
|
||||
|
||||
|
||||
)
|
||||
|
||||
#_(rf/reg-event-fx
|
||||
:app/notify-user
|
||||
(fn [{:keys [db]} [{:keys [text type] :as message}]]
|
||||
(let [notification-id (-> db
|
||||
(get-in [:app :last-user-notification :id] 0)
|
||||
inc)]
|
||||
{;; whenever we need to publish notification we override the old and increment id
|
||||
:db (assoc-in db
|
||||
[:app :last-user-notification]
|
||||
(merge message
|
||||
{:id notification-id}))
|
||||
;; TODO: toasts are part of ui layer and they shouldn't be published here. Instead some part
|
||||
;; of ui should keep track of last user notification and generate toast
|
||||
:fx [#_[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type type
|
||||
:text text}]]]})))
|
||||
|
||||
#_(comment
|
||||
(rf/dispatch [:app/notify-user
|
||||
{:type :positive
|
||||
:text "This is a good news"}])
|
||||
(rf/dispatch [:app/notify-user
|
||||
{:type :negative
|
||||
:text "This is a bad news"}])
|
||||
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:text "This is a test notification3"}])
|
||||
)
|
||||
@@ -0,0 +1,97 @@
|
||||
(ns status-im.app.use-case)
|
||||
|
||||
(defmulti initial-state
|
||||
(fn [use-case-id]
|
||||
use-case-id))
|
||||
|
||||
(defmethod initial-state :default
|
||||
[_]
|
||||
{:use-case-id :default})
|
||||
|
||||
(defn start
|
||||
[use-case-id state-update]
|
||||
(merge (initial-state use-case-id)
|
||||
state-update))
|
||||
|
||||
(defn make-step
|
||||
[current-state state-update]
|
||||
(merge current-state state-update))
|
||||
|
||||
(defn finish
|
||||
[use-case-id state-update]
|
||||
(merge (initial-state use-case-id)
|
||||
state-update))
|
||||
|
||||
|
||||
;; -----------------------------------------------------
|
||||
|
||||
(defmethod initial-state :uc-view-saved-addresses
|
||||
[_]
|
||||
{:use-case-id :uc-view-saved-addresses})
|
||||
|
||||
(defmethod initial-state :uc-add-saved-address
|
||||
[_]
|
||||
{:use-case-id :uc-add-saved-address
|
||||
:address nil
|
||||
:ens nil
|
||||
:ens? false
|
||||
:name nil
|
||||
:customization-color nil})
|
||||
|
||||
;; -----------------------------------------------------
|
||||
|
||||
(defmulti navigation-start
|
||||
(fn [use-case-data]
|
||||
(:use-case-id use-case-data)))
|
||||
|
||||
(defmulti navigation-step
|
||||
(fn [use-case-data]
|
||||
(:use-case-id use-case-data)))
|
||||
|
||||
(defmethod navigation-step :default
|
||||
[]
|
||||
nil)
|
||||
|
||||
(defmulti navigation-finish
|
||||
(fn [use-case-data]
|
||||
(:use-case-id use-case-data)))
|
||||
|
||||
;; -----------------------------------------------------
|
||||
|
||||
(defmethod navigation-start :uc-view-saved-addresses
|
||||
[_]
|
||||
[[:dispatch [:open-modal :screen/settings.saved-addresses]]])
|
||||
|
||||
(defmethod navigation-finish :uc-view-saved-addresses
|
||||
[_]
|
||||
[[:dispatch [:navigate-back]]])
|
||||
|
||||
;; -----------------------------------------------------
|
||||
|
||||
(defmethod navigation-start :uc-add-saved-address
|
||||
[_]
|
||||
[[:dispatch [:open-modal :screen/settings.add-address-to-save]]])
|
||||
|
||||
(defmethod navigation-step :uc-add-saved-address
|
||||
[{:keys [address ens ens?] :as use-case-state}]
|
||||
[[:dispatch [:open-modal :screen/settings.add-address-to-save]]])
|
||||
|
||||
(defmethod navigation-finish :uc-add-saved-address
|
||||
[_]
|
||||
[[:dispatch [:navigate-back]]])
|
||||
|
||||
;; -----------------------------------------------------
|
||||
(comment
|
||||
(initial-state :uc-add-saved-address)
|
||||
(initial-state :uc-view-saved-addresses)
|
||||
(initial-state :unknown)
|
||||
|
||||
(navigation-start {:use-case-id :uc-add-saved-address})
|
||||
(navigation-finish {:use-case-id :uc-add-saved-address})
|
||||
(navigation-start {:use-case-id :uc-add-saved-address})
|
||||
|
||||
(-> :uc-add-saved-address
|
||||
initial-state
|
||||
(make-step {:address "0xasdfas"})))
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
(ns status-im.common.app-monitoring.effects
|
||||
(:require
|
||||
[native-module.core :as native-module]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(rf/reg-fx :effects.app-monitoring/intended-panic
|
||||
(fn [message]
|
||||
(native-module/intended-panic message)))
|
||||
@@ -1,8 +0,0 @@
|
||||
(ns status-im.common.app-monitoring.events
|
||||
(:require
|
||||
status-im.common.app-monitoring.effects
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(rf/reg-event-fx :app-monitoring/intended-panic
|
||||
(fn [_ [message]]
|
||||
{:fx [[:effects.app-monitoring/intended-panic message]]}))
|
||||
@@ -26,19 +26,9 @@
|
||||
:qr-code (js/require "../resources/images/ui2/qr-code.png")
|
||||
:keycard-logo (js/require "../resources/images/ui2/keycard-logo.png")
|
||||
:keycard-buy (js/require "../resources/images/ui2/keycard-buy.png")
|
||||
:keycard-backup-positive (js/require "../resources/images/ui2/keycard-backup-positive.png")
|
||||
:keycard-change-pin (js/require "../resources/images/ui2/keycard-change-pin.png")
|
||||
:keycard-change-pin-positive (js/require "../resources/images/ui2/keycard-change-pin-positive.png")
|
||||
:keycard-change-pin-negative (js/require "../resources/images/ui2/keycard-change-pin-negative.png")
|
||||
:keycard-migration (js/require "../resources/images/ui2/keycard-migration.png")
|
||||
:keycard-migration-failed (js/require "../resources/images/ui2/keycard-migration-failed.png")
|
||||
:keycard-migration-succeeded (js/require "../resources/images/ui2/keycard-migration-succeeded.png")
|
||||
:keycard-not-same (js/require "../resources/images/ui2/keycard-not-same.png")
|
||||
:keycard-not-empty (js/require "../resources/images/ui2/keycard-not-empty.png")
|
||||
:keycard-reset-positive (js/require "../resources/images/ui2/keycard-reset-positive.png")
|
||||
:keycard-reset-negative (js/require "../resources/images/ui2/keycard-reset-negative.png")
|
||||
:keycard-unblock (js/require "../resources/images/ui2/keycard-unblock.png")
|
||||
:keycard-unblock-positive (js/require "../resources/images/ui2/keycard-unblock-positive.png")
|
||||
:not-keycard (js/require "../resources/images/ui2/not-keycard.png")
|
||||
:discover (js/require "../resources/images/ui2/discover.png")
|
||||
:invite-friends (js/require "../resources/images/ui2/invite-friends.png")
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
|
||||
(defn outmost-transparent-container
|
||||
[]
|
||||
{:elevation 2
|
||||
:pointer-events :box-none
|
||||
:padding-top (+ (safe-area/get-top) 6)
|
||||
:flex-direction :column
|
||||
:justify-content :center
|
||||
:align-items :center})
|
||||
{:elevation 2
|
||||
:pointer-events :box-none
|
||||
:padding-top (+ (safe-area/get-top) 6)
|
||||
:flex-direction :column
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color :yellow})
|
||||
|
||||
(def each-toast-container
|
||||
{:width "100%"
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
(goog-define ALCHEMY_BASE_MAINNET_TOKEN "")
|
||||
(goog-define ALCHEMY_BASE_SEPOLIA_TOKEN "")
|
||||
(goog-define WALLET_CONNECT_PROJECT_ID "87815d72a81d739d2a7ce15c2cfdefb3")
|
||||
(goog-define MIXPANEL_APP_ID "3350627")
|
||||
(goog-define MIXPANEL_TOKEN "5c73bda2d36a9f688a5ee45641fb6775")
|
||||
(goog-define STATUS_BUILD_ETH_RPC_PROXY_USER "")
|
||||
(goog-define STATUS_BUILD_ETH_RPC_PROXY_PASSWORD "")
|
||||
(goog-define STATUS_BUILD_ETH_RPC_PROXY_URL "")
|
||||
(goog-define MIXPANEL_APP_ID "")
|
||||
(goog-define MIXPANEL_APP_TOKEN "")
|
||||
|
||||
(def mainnet-rpc-url (str "https://eth-archival.rpc.grove.city/v1/" POKT_TOKEN))
|
||||
(def sepolia-rpc-url (str "https://sepolia-archival.rpc.grove.city/v1/" POKT_TOKEN))
|
||||
@@ -53,16 +53,8 @@
|
||||
(def opensea-link "https://opensea.io")
|
||||
(def opensea-tesnet-link "https://testnets.opensea.io")
|
||||
|
||||
;; These MixPanel values should be injected via the CI since they vary depending
|
||||
;; on the environment, as we want to keep production and test/development
|
||||
;; metrics separate.
|
||||
;;
|
||||
;; We primarily use two MixPanel projects: the production project is named
|
||||
;; `status-im`, and the test project is `test.status-im`.
|
||||
;;
|
||||
;; During development, do not use the production app ID and token.
|
||||
(def mixpanel-app-id MIXPANEL_APP_ID)
|
||||
(def mixpanel-token MIXPANEL_APP_TOKEN)
|
||||
(def mixpanel-token MIXPANEL_TOKEN)
|
||||
|
||||
(def opensea-api-key OPENSEA_API_KEY)
|
||||
(def status-proxy-enabled? true)
|
||||
@@ -144,8 +136,3 @@
|
||||
|
||||
(def re-frisk-host (get-config :RE_FRISK_HOST "localhost"))
|
||||
(def re-frisk-port (get-config :RE_FRISK_PORT "4567"))
|
||||
;;;; Sentry
|
||||
;; Documentation: status-go/internal/sentry/README.md
|
||||
(goog-define SENTRY_DSN_STATUS_GO "")
|
||||
(def sentry-enabled? (enabled? (get-config :SENTRY_ENABLED "0")))
|
||||
(def sentry-dsn-status-go SENTRY_DSN_STATUS_GO)
|
||||
|
||||
@@ -443,10 +443,7 @@
|
||||
(def ^:const wallet-account-name-max-length 20)
|
||||
|
||||
|
||||
(def ^:const gas-rate-low 0)
|
||||
(def ^:const gas-rate-medium 1)
|
||||
(def ^:const gas-rate-high 2)
|
||||
(def ^:const gas-rate-custom 3)
|
||||
(def ^:const send-type-transfer 0)
|
||||
(def ^:const send-type-bridge 5)
|
||||
(def ^:const send-type-erc-721-transfer 6)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
[status-im.contexts.chat.messenger.messages.pin.events :as messages.pin]
|
||||
[status-im.contexts.communities.events :as communities]
|
||||
[status-im.contexts.shell.activity-center.events :as activity-center]
|
||||
[status-im.contexts.wallet.data-store :as wallet.data-store]
|
||||
[status-im.infra.transform :as infra.transform]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@@ -220,10 +220,10 @@
|
||||
current-visibility-status-clj)))
|
||||
|
||||
(seq saved-addresses-js)
|
||||
(let [saved-addresses (-> saved-addresses-js types/js->clj wallet.data-store/rpc->saved-addresses)]
|
||||
(let [saved-addresses (-> saved-addresses-js types/js->clj infra.transform/rpc->saved-addresses)]
|
||||
(js-delete response-js "savedAddresses")
|
||||
(rf/merge cofx
|
||||
{:fx [[:dispatch [:wallet/reconcile-saved-addresses saved-addresses]]]}
|
||||
{:fx [[:dispatch [:domain/reconcile-saved-addresses saved-addresses]]]}
|
||||
(process-next response-js sync-handler)))
|
||||
|
||||
(seq ens-username-details-js)
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
:params [{:id request-to-join-id}]
|
||||
:on-success #(rf/dispatch [:communities/cancel-request-to-join-success %])
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to cancel request to join community"
|
||||
request-to-join-id
|
||||
%)}]}))
|
||||
:on-error #(log/error "failed to cancel request to join community" request-to-join-id %)}]}))
|
||||
|
||||
(rf/reg-event-fx :communities/left
|
||||
(fn [_ [response-js]]
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
|
||||
(defn screen-title
|
||||
[]
|
||||
[rn/view {:style (style/screen-title-container (safe-area/get-top))}
|
||||
[rn/view
|
||||
{:style (style/screen-title-container (safe-area/get-top))}
|
||||
[quo/text
|
||||
{:accessibility-label :communities-screen-title
|
||||
:weight :semi-bold
|
||||
@@ -94,14 +95,14 @@
|
||||
|
||||
(defn featured-list
|
||||
[communities view-type]
|
||||
(let [view-size (reagent/atom 0)
|
||||
set-view-size (fn [e]
|
||||
(reset! view-size (- (oops/oget e "nativeEvent.layout.width") 40)))
|
||||
loaded? (and communities (pos? (count communities)))]
|
||||
(let [view-size (reagent/atom 0)
|
||||
loaded? (and communities (pos? (count communities)))]
|
||||
(fn []
|
||||
[rn/view
|
||||
{:style style/featured-list-container
|
||||
:on-layout set-view-size}
|
||||
:on-layout #(swap! view-size
|
||||
(fn [_]
|
||||
(- (oops/oget % "nativeEvent.layout.width") 40)))}
|
||||
(when-not (= @view-size 0)
|
||||
[rn/flat-list
|
||||
{:key-fn :id
|
||||
@@ -131,29 +132,32 @@
|
||||
[discover-communities-segments selected-tab false]])
|
||||
|
||||
(defn other-communities-list
|
||||
[{:keys [communities view-type]}]
|
||||
[{:keys [communities communities-ids view-type]}]
|
||||
[rn/view {:style style/other-communities-container}
|
||||
(if (seq communities)
|
||||
(map-indexed (fn [inner-index {community-id :id :as community}]
|
||||
(let [cover {:uri (-> community :images :banner :uri)}]
|
||||
[rn/view
|
||||
{:key (str inner-index community-id)
|
||||
:style {:margin-bottom 16}}
|
||||
(if (= view-type :card-view)
|
||||
[quo/community-card-view-item
|
||||
{:community (assoc community
|
||||
:cover cover
|
||||
:members-count (count (:members community)))
|
||||
:on-press #(rf/dispatch [:communities/navigate-to-community-overview
|
||||
community-id])}]
|
||||
[quo/community-list
|
||||
{:on-press (fn []
|
||||
(rf/dispatch [:dismiss-keyboard])
|
||||
(rf/dispatch [:communities/navigate-to-community-overview
|
||||
community-id]))
|
||||
:on-long-press #(js/alert "TODO: to be implemented")}
|
||||
community])]))
|
||||
communities)
|
||||
(if (and communities (pos? (count communities)))
|
||||
(map-indexed
|
||||
(fn [inner-index item]
|
||||
(let [community-id (when communities-ids item)
|
||||
community (if communities
|
||||
item
|
||||
(rf/sub [:communities/home-item community-id]))
|
||||
cover {:uri (get-in (:images item) [:banner :uri])}]
|
||||
[rn/view
|
||||
{:key (str inner-index (:id community))
|
||||
:margin-bottom 16}
|
||||
(if (= view-type :card-view)
|
||||
[quo/community-card-view-item
|
||||
{:community (assoc community :cover cover)
|
||||
:on-press #(rf/dispatch [:communities/navigate-to-community-overview (:id community)])}]
|
||||
|
||||
[quo/community-list
|
||||
{:on-press (fn []
|
||||
(rf/dispatch [:dismiss-keyboard])
|
||||
(rf/dispatch [:communities/navigate-to-community-overview
|
||||
(:id community)]))
|
||||
:on-long-press #(js/alert "TODO: to be implemented")}
|
||||
community])]))
|
||||
(if communities communities communities-ids))
|
||||
[:<>
|
||||
[rn/view {:margin-bottom 16} [quo/community-card-view-item {:loading? true}]]
|
||||
[rn/view {:margin-bottom 16} [quo/community-card-view-item {:loading? true}]]
|
||||
@@ -164,9 +168,8 @@
|
||||
[rn/view {:style {:flex 1}}
|
||||
(case @selected-tab
|
||||
:all
|
||||
[other-communities-list
|
||||
{:communities (rf/sub [:communities/other-contract-communities])
|
||||
:view-type view-type}]
|
||||
(other-communities-list {:communities (rf/sub [:communities/other-contract-communities])
|
||||
:view-type view-type})
|
||||
|
||||
:open
|
||||
[:<>]
|
||||
@@ -180,55 +183,60 @@
|
||||
(i18n/label :t/error)])])
|
||||
|
||||
(defn render-communities
|
||||
[{:keys [selected-tab featured-communities-count featured-communities view-type]}]
|
||||
[rn/view
|
||||
[discover-communities-header
|
||||
{:selected-tab selected-tab
|
||||
:view-type view-type
|
||||
:featured-communities-count featured-communities-count
|
||||
:featured-communities featured-communities}]
|
||||
[communities-lists selected-tab view-type]])
|
||||
[selected-tab
|
||||
featured-communities-count
|
||||
featured-communities
|
||||
view-type]
|
||||
(fn []
|
||||
[rn/view
|
||||
[discover-communities-header
|
||||
{:selected-tab selected-tab
|
||||
:view-type view-type
|
||||
:featured-communities-count featured-communities-count
|
||||
:featured-communities featured-communities}]
|
||||
[communities-lists selected-tab view-type]]))
|
||||
|
||||
(defn render-sticky-header
|
||||
[{:keys [selected-tab scroll-height]}]
|
||||
(when (> @scroll-height 360)
|
||||
[rn/view
|
||||
{:style (style/blur-tabs-header (safe-area/get-top))}
|
||||
[discover-communities-segments selected-tab true]]))
|
||||
(fn []
|
||||
(when (> @scroll-height 360)
|
||||
[rn/view
|
||||
{:style (style/blur-tabs-header (safe-area/get-top))}
|
||||
[discover-communities-segments selected-tab true]])))
|
||||
|
||||
(defn discover-screen-content
|
||||
[]
|
||||
(let [view-type (reagent/atom :card-view)
|
||||
selected-tab (reagent/atom :all)
|
||||
scroll-height (reagent/atom 0)]
|
||||
[featured-communities theme]
|
||||
(let [view-type (reagent/atom :card-view)
|
||||
selected-tab (reagent/atom :all)
|
||||
scroll-height (reagent/atom 0)
|
||||
featured-communities-count (count featured-communities)]
|
||||
(fn []
|
||||
(let [theme (quo.theme/use-theme)
|
||||
featured-communities (rf/sub [:communities/featured-contract-communities])
|
||||
featured-communities-count (count featured-communities)]
|
||||
[scroll-page/scroll-page
|
||||
{:on-scroll #(reset! scroll-height %)
|
||||
:page-nav-props {:background :blur}
|
||||
:navigate-back? :true
|
||||
:height (if (> @scroll-height 360)
|
||||
208
|
||||
148)
|
||||
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)
|
||||
:sticky-header [render-sticky-header
|
||||
{:selected-tab selected-tab
|
||||
:scroll-height scroll-height}]}
|
||||
[render-communities
|
||||
{:selected-tab selected-tab
|
||||
:featured-communities-count featured-communities-count
|
||||
:featured-communities featured-communities
|
||||
:view-type @view-type}]]))))
|
||||
[scroll-page/scroll-page
|
||||
{:on-scroll #(reset! scroll-height %)
|
||||
:page-nav-props {:background :blur}
|
||||
:navigate-back? :true
|
||||
:height (if (> @scroll-height 360)
|
||||
208
|
||||
148)
|
||||
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)
|
||||
:sticky-header [render-sticky-header
|
||||
{:selected-tab selected-tab
|
||||
:scroll-height scroll-height}]}
|
||||
|
||||
[render-communities
|
||||
selected-tab
|
||||
featured-communities-count
|
||||
featured-communities
|
||||
@view-type]])))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
featured-communities (rf/sub [:communities/featured-contract-communities])]
|
||||
(rn/use-mount #(rf/dispatch [:fetch-contract-communities]))
|
||||
[rn/view
|
||||
{:style (style/discover-screen-container (colors/theme-colors
|
||||
colors/white
|
||||
colors/neutral-95
|
||||
theme))}
|
||||
[discover-screen-content]]))
|
||||
[discover-screen-content featured-communities theme]]))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/ready-add-keypair-keycard)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-migration)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :keycard-migration)}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
@@ -33,11 +33,8 @@
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/backup-keycard-created)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-backup-positive)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/done)]]])
|
||||
|
||||
@@ -52,10 +49,7 @@
|
||||
{:title (i18n/label :t/keycard-not-empty)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/scan-empty-keycard)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-not-empty)}]
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[common.view/tips]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press on-press}
|
||||
@@ -71,10 +65,10 @@
|
||||
{:title (i18n/label :t/scan-empty-keycard)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/backup-empty-keycard-only)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :check-your-keycard)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :check-your-keycard)}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require [quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.events-helper :as events-helper]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.contexts.keycard.common.view :as common.view]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -33,10 +32,9 @@
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/ready-to-change-pin)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-change-pin)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
@@ -54,10 +52,9 @@
|
||||
{:title (i18n/label :t/keycard-pin-changed)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/keycard-pin-changed-description)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-change-pin-positive)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain}]]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
:button-one-label (i18n/label :t/done)
|
||||
@@ -73,10 +70,9 @@
|
||||
{:title (i18n/label :t/keycard-pin-change-failed)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/keycard-pin-change-failed-description)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-change-pin-negative)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
{:title (i18n/label :t/check-keycard)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/see-keycard-ready)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :check-your-keycard)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :check-your-keycard)}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require [quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.events-helper :as events-helper]
|
||||
[status-im.common.resources :as resources]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn view
|
||||
@@ -15,11 +14,8 @@
|
||||
{:title (i18n/label :t/different-keycard)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/scan-previous-keycard)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-not-same)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/try-again)]]])
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require [quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.events-helper :as events-helper]
|
||||
[status-im.common.resources :as resources]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@@ -49,11 +48,8 @@
|
||||
{:title (i18n/label :t/keycard-reset-success)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/keycard-empty-ready)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-reset-positive)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/done)]]])
|
||||
|
||||
@@ -65,11 +61,8 @@
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/keycard-reset-failed)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-reset-negative)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/try-again)]]])
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
:profile-picture profile-picture
|
||||
:customization-color customization-color}
|
||||
:container-style {:margin-top constants/page-nav-height}}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-migration-failed)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :keycard-migration-failed)}]]
|
||||
[quo/divider-label (i18n/label :t/what-you-can-do)]
|
||||
[quo/markdown-list {:description (i18n/label :t/keycard-migration-failed-instruction-1)}]
|
||||
[quo/markdown-list {:description (i18n/label :t/keycard-migration-failed-instruction-2)}]
|
||||
|
||||
@@ -27,7 +27,5 @@
|
||||
:callback
|
||||
(fn [{:keys [error]}]
|
||||
(if (string/blank? error)
|
||||
(do
|
||||
(rf/dispatch [:biometric/disable])
|
||||
(rf/dispatch [:navigate-to :screen/keycard.migrate.success]))
|
||||
(rf/dispatch [:navigate-to :screen/keycard.migrate.success])
|
||||
(rf/dispatch [:navigate-to :screen/keycard.migrate.fail])))}]]})))
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
:container-style {:margin-top constants/page-nav-height}}]
|
||||
[quo/text {:style {:padding-horizontal 20}}
|
||||
(i18n/label :t/do-not-quit)]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-migration)}]]))
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :keycard-migration)}]]]))
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
:container-style {:margin-top constants/page-nav-height}}]
|
||||
[quo/text {:style {:padding-horizontal 20}}
|
||||
(i18n/label :t/use-keycard-for-status)]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-migration-succeeded)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :keycard-migration-succeeded)}]]
|
||||
[quo/button
|
||||
{:on-press #(rf/dispatch [:profile/logout])
|
||||
:container-style {:margin-horizontal 20 :margin-vertical 12}}
|
||||
:container-style {:margin-horizontal 20}}
|
||||
(i18n/label :t/logout)]]))
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
:context-tag {:full-name profile-name
|
||||
:profile-picture profile-picture
|
||||
:customization-color customization-color}}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-migration)}]
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :keycard-migration)}]]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
{:title (i18n/label :t/oops-not-keycard)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/make-sure-keycard)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :not-keycard)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
[rn/view {:style {:flex 1 :align-items :center :justify-content :center}}
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:source (resources/get-image :not-keycard)}]]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/try-again)]]])
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require [quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.events-helper :as events-helper]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.contexts.keycard.common.view :as common.view]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -14,14 +13,9 @@
|
||||
{:icon-name :i/close
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/keycard-unblocked)
|
||||
:description :text
|
||||
:description-text (i18n/label :t/keycard-unblocked-description)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-unblock-positive)}]
|
||||
[rn/view {:style {:padding-horizontal 20 :padding-vertical 12}}
|
||||
{:title (i18n/label :t/keycard-unblocked)}]
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[rn/view {:style {:padding-horizontal 20}}
|
||||
[quo/button {:on-press events-helper/navigate-back}
|
||||
(i18n/label :t/done)]]])
|
||||
|
||||
@@ -33,10 +27,7 @@
|
||||
:on-press events-helper/navigate-back}]
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/ready-to-unblock-keycard)}]
|
||||
[rn/image
|
||||
{:resize-mode :contain
|
||||
:style {:flex 1 :width (:width (rn/get-window))}
|
||||
:source (resources/get-image :keycard-unblock)}]
|
||||
[rn/view {:style {:flex 1}}]
|
||||
[common.view/tips]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
{:dataDir (native-module/backup-disabled-data-dir)
|
||||
:mixpanelAppId config/mixpanel-app-id
|
||||
:mixpanelToken config/mixpanel-token
|
||||
:sentryDSN (if config/sentry-enabled? config/sentry-dsn-status-go "")
|
||||
:mediaServerEnableTLS (config/enabled? config/STATUS_BACKEND_SERVER_MEDIA_SERVER_ENABLE_TLS)
|
||||
:logEnabled (not (string/blank? config/log-level))
|
||||
:logLevel config/log-level
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
|
||||
(defn- navigate-back
|
||||
[]
|
||||
(rf/dispatch [:navigate-back]))
|
||||
(rf/dispatch [:app/finish-use-case :uc-add-saved-address])
|
||||
#_(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn- validate-input
|
||||
[account-addresses saved-addresses user-input]
|
||||
@@ -170,6 +171,10 @@
|
||||
:ens? ens-name?}]))
|
||||
[address ens-name? address-or-ens])]
|
||||
(rn/use-unmount #(rf/dispatch [:wallet/clean-scanned-address]))
|
||||
#_(rn/use-effect (fn []
|
||||
(when (rf/sub [:app/use-case-active? :uc-add-saved-addresses])
|
||||
(rf/dispatch [:navigate-back])))
|
||||
[(rf/sub [:app/use-case-active? :uc-add-saved-addresses])])
|
||||
[quo/overlay {:type :shell}
|
||||
[floating-button-page/view
|
||||
{:footer-container-padding 0
|
||||
|
||||
@@ -5,152 +5,97 @@
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn save-address
|
||||
[{:keys [db]}
|
||||
[{:keys [address name customization-color on-success on-error ens]}]]
|
||||
(let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))
|
||||
address-to-save {:address address
|
||||
:name name
|
||||
:colorId customization-color
|
||||
:ens ens
|
||||
:isTest test-networks-enabled?}]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_upsertSavedAddress"
|
||||
:params [address-to-save]
|
||||
:on-success on-success
|
||||
:on-error on-error}]]]}))
|
||||
(rf/reg-event-fx :app/save-address
|
||||
(fn [{:keys [db]}
|
||||
[{:keys [address name customization-color ens edit?]}]]
|
||||
(let [on-success (if edit?
|
||||
[:wallet/edit-saved-address-success]
|
||||
[:wallet/add-saved-address-success])
|
||||
test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))
|
||||
address-to-save {:address address
|
||||
:name name
|
||||
:colorId customization-color
|
||||
:ens ens
|
||||
:isTest test-networks-enabled?}]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_upsertSavedAddress"
|
||||
:params [address-to-save]
|
||||
:on-success on-success
|
||||
:on-error [:wallet/add-saved-address-failed]}]]]})))
|
||||
|
||||
(rf/reg-event-fx :wallet/save-address save-address)
|
||||
(rf/reg-event-fx :wallet/delete-saved-address-success
|
||||
(fn [{:keys [db]} [{:keys [address test-networks-enabled? toast-message]}]]
|
||||
(let [db-key (if test-networks-enabled? :test :prod)
|
||||
saved-address (get-in db [:wallet :saved-addresses db-key address])]
|
||||
{:fx [[:dispatch [:domain/reconcile-saved-addresses [(assoc saved-address :removed? true)]]]
|
||||
[:dispatch [:hide-bottom-sheet]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text toast-message}]}]]})))
|
||||
|
||||
(defn- update-saved-addresses
|
||||
[saved-addresses-db new-saved-addresses]
|
||||
(reduce
|
||||
(fn [acc {:keys [address removed? test?] :as saved-address}]
|
||||
(let [db-key (if test? :test :prod)]
|
||||
(if removed?
|
||||
(update acc db-key dissoc address)
|
||||
(assoc-in acc [db-key address] saved-address))))
|
||||
(or saved-addresses-db
|
||||
{:test {}
|
||||
:prod {}})
|
||||
new-saved-addresses))
|
||||
(rf/reg-event-fx :wallet/delete-saved-address-failed
|
||||
(fn [_ [error]]
|
||||
{:fx [[:dispatch [:hide-bottom-sheet]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text error}]}]]}))
|
||||
|
||||
(defn reconcile-saved-addresses
|
||||
[{:keys [db]} [saved-addresses]]
|
||||
{:db (update-in db [:wallet :saved-addresses] update-saved-addresses saved-addresses)})
|
||||
(rf/reg-event-fx :wallet/delete-saved-address
|
||||
(fn [{:keys [db]} [{:keys [address toast-message]}]]
|
||||
(let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_deleteSavedAddress"
|
||||
:params [address test-networks-enabled?]
|
||||
:on-success [:wallet/delete-saved-address-success
|
||||
{:address address
|
||||
:test-networks-enabled? test-networks-enabled?
|
||||
:toast-message toast-message}]
|
||||
:on-error [:wallet/delete-saved-address-failed]}]]]})))
|
||||
|
||||
(rf/reg-event-fx :wallet/reconcile-saved-addresses reconcile-saved-addresses)
|
||||
(rf/reg-event-fx :wallet/add-saved-address-success
|
||||
(fn [_]
|
||||
{:fx [[:dispatch [:infra/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.add-address-to-save]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.save-address]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text (i18n/label :t/address-saved)}]}]]}))
|
||||
|
||||
(defn get-saved-addresses-success
|
||||
[_ [raw-saved-addresses]]
|
||||
(let [saved-addresses (data-store/rpc->saved-addresses raw-saved-addresses)]
|
||||
{:fx [[:dispatch [:wallet/reconcile-saved-addresses saved-addresses]]]}))
|
||||
(rf/reg-event-fx :wallet/edit-saved-address-success
|
||||
(fn [_]
|
||||
{:fx [[:dispatch [:infra/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.edit-saved-address]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text (i18n/label :t/address-edited)}]}]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/get-saved-addresses-success get-saved-addresses-success)
|
||||
|
||||
(defn saved-addresses-rpc-error
|
||||
[_ [action error]]
|
||||
(log/warn (str "[wallet] [saved-addresses] Failed to " action)
|
||||
{:error error}))
|
||||
|
||||
(rf/reg-event-fx :wallet/saved-addresses-rpc-error saved-addresses-rpc-error)
|
||||
|
||||
(defn get-saved-addresses
|
||||
[_]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_getSavedAddresses"
|
||||
:on-success [:wallet/get-saved-addresses-success]
|
||||
:on-error [:wallet/saved-addresses-rpc-error :get-saved-addresses]}]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/get-saved-addresses get-saved-addresses)
|
||||
|
||||
(defn delete-saved-address-success
|
||||
[{:keys [db]} [{:keys [address test-networks-enabled? toast-message]}]]
|
||||
(let [db-key (if test-networks-enabled? :test :prod)
|
||||
saved-address (get-in db [:wallet :saved-addresses db-key address])]
|
||||
{:fx [[:dispatch [:wallet/reconcile-saved-addresses [(assoc saved-address :removed? true)]]]
|
||||
[:dispatch [:hide-bottom-sheet]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text toast-message}]}]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/delete-saved-address-success delete-saved-address-success)
|
||||
|
||||
(defn delete-saved-address-failed
|
||||
[_ [error]]
|
||||
{:fx [[:dispatch [:hide-bottom-sheet]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text error}]}]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/delete-saved-address-failed delete-saved-address-failed)
|
||||
|
||||
(defn delete-saved-address
|
||||
[{:keys [db]} [{:keys [address toast-message]}]]
|
||||
(let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_deleteSavedAddress"
|
||||
:params [address test-networks-enabled?]
|
||||
:on-success [:wallet/delete-saved-address-success
|
||||
{:address address
|
||||
:test-networks-enabled? test-networks-enabled?
|
||||
:toast-message toast-message}]
|
||||
:on-error [:wallet/delete-saved-address-failed]}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/delete-saved-address delete-saved-address)
|
||||
|
||||
(defn add-saved-address-success
|
||||
[_ [toast-message]]
|
||||
{:fx [[:dispatch [:wallet/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.add-address-to-save]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.save-address]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text toast-message}]}]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/add-saved-address-success add-saved-address-success)
|
||||
|
||||
(defn edit-saved-address-success
|
||||
[_]
|
||||
{:fx [[:dispatch [:wallet/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.edit-saved-address]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
:dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:theme :dark
|
||||
:text (i18n/label :t/address-edited)}]}]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/edit-saved-address-success edit-saved-address-success)
|
||||
|
||||
(defn add-saved-address-failed
|
||||
[_ [error]]
|
||||
{:fx [[:dispatch [:wallet/saved-addresses-rpc-error :add-save-address error]]
|
||||
[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text error}]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/add-saved-address-failed add-saved-address-failed)
|
||||
|
||||
(defn check-remaining-capacity-for-saved-addresses
|
||||
[{:keys [db]} [{:keys [on-success on-error]}]]
|
||||
(let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_remainingCapacityForSavedAddresses"
|
||||
:params [test-networks-enabled?]
|
||||
:on-success on-success
|
||||
:on-error on-error}]]]}))
|
||||
(rf/reg-event-fx :wallet/add-saved-address-failed
|
||||
(fn [_ [error]]
|
||||
{:fx [[:dispatch [:infra/saved-addresses-rpc-error :add-save-address error]]
|
||||
[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text error}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/check-remaining-capacity-for-saved-addresses
|
||||
check-remaining-capacity-for-saved-addresses)
|
||||
(fn [{:keys [db]} [{:keys [on-success on-error]}]]
|
||||
(let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled?]))]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_remainingCapacityForSavedAddresses"
|
||||
:params [test-networks-enabled?]
|
||||
:on-success on-success
|
||||
:on-error on-error}]]]})))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:json-rpc/call
|
||||
[{:method "wakuext_getSavedAddresses"
|
||||
:on-success [:wallet/get-saved-addresses-success]
|
||||
:on-success [:infra/convert-saved-addresses]
|
||||
:on-error [:wallet/saved-addresses-rpc-error :get-saved-addresses]}]]]]
|
||||
(is (match? expected-fx result-fx)))))
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
(deftest get-saved-addresses-success-test
|
||||
(let [cofx {:db {}}
|
||||
raw-saved-addresses [saved-address-rpc-1]
|
||||
effects (events/get-saved-addresses-success cofx [raw-saved-addresses])
|
||||
effects (events/convert-saved-addresses cofx [raw-saved-addresses])
|
||||
saved-addresses (data-store/rpc->saved-addresses raw-saved-addresses)
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:dispatch [:wallet/reconcile-saved-addresses saved-addresses]]]]
|
||||
expected-fx [[:dispatch [:domain/reconcile-saved-addresses saved-addresses]]]]
|
||||
(is (match? expected-fx result-fx))))
|
||||
|
||||
(deftest reconcile-saved-addresses-test
|
||||
@@ -220,7 +220,7 @@
|
||||
toast-message "Address saved"
|
||||
effects (events/add-saved-address-success cofx [toast-message])
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:dispatch [:wallet/get-saved-addresses]]
|
||||
expected-fx [[:dispatch [:infra/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.add-address-to-save]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.save-address]]
|
||||
[:dispatch-later
|
||||
@@ -238,7 +238,7 @@
|
||||
toast-message "Address edited"
|
||||
effects (events/edit-saved-address-success cofx)
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:dispatch [:wallet/get-saved-addresses]]
|
||||
expected-fx [[:dispatch [:infra/get-saved-addresses]]
|
||||
[:dispatch [:dismiss-modal :screen/settings.edit-saved-address]]
|
||||
[:dispatch-later
|
||||
{:ms 100
|
||||
|
||||
@@ -32,17 +32,11 @@
|
||||
[address])
|
||||
on-press-save (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch [:wallet/save-address
|
||||
{:on-success
|
||||
(if edit?
|
||||
[:wallet/edit-saved-address-success]
|
||||
[:wallet/add-saved-address-success
|
||||
(i18n/label :t/address-saved)])
|
||||
:on-error
|
||||
[:wallet/add-saved-address-failed]
|
||||
:name address-label
|
||||
:ens (when ens? ens)
|
||||
:address address
|
||||
(rf/dispatch [:app/save-address
|
||||
{:edit? edit?
|
||||
:name address-label
|
||||
:ens (when ens? ens)
|
||||
:address address
|
||||
:customization-color address-color}]))
|
||||
[address address-label
|
||||
address-color])
|
||||
|
||||
@@ -99,12 +99,15 @@
|
||||
|
||||
(defn- navigate-back
|
||||
[]
|
||||
(rf/dispatch [:navigate-back]))
|
||||
(rf/dispatch [:app/finish-use-case :uc-view-saved-addresses])
|
||||
#_(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn- add-address-to-save
|
||||
[]
|
||||
(rf/dispatch [:wallet/check-remaining-capacity-for-saved-addresses
|
||||
{:on-success #(rf/dispatch [:open-modal :screen/settings.add-address-to-save])
|
||||
{:on-success (fn []
|
||||
(rf/dispatch [:app/start-use-case :uc-add-saved-address])
|
||||
#_(rf/dispatch [:open-modal :screen/settings.add-address-to-save]))
|
||||
:on-error #(rf/dispatch [:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
@@ -151,6 +154,10 @@
|
||||
:on-clear on-clear-input
|
||||
:customization-color customization-color}))
|
||||
[has-saved-addresses? customization-color search-text])]
|
||||
#_(rn/use-effect (fn []
|
||||
(when (rf/sub [:app/use-case-active? :uc-view-saved-addresses])
|
||||
(rf/dispatch [:navigate-back])))
|
||||
[(rf/sub [:app/use-case-active? :uc-view-saved-addresses])])
|
||||
[quo/overlay
|
||||
{:type :shell
|
||||
:top-inset? true}
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
(defn open-saved-addresses-settings-modal
|
||||
[]
|
||||
(rf/dispatch [:open-modal :screen/settings.saved-addresses]))
|
||||
(rf/dispatch [:app/start-use-case :uc-view-saved-addresses])
|
||||
#_(rf/dispatch [:open-modal :screen/settings.saved-addresses]))
|
||||
|
||||
(defn open-keypairs-and-accounts-settings-modal
|
||||
[]
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
[clojure.string :as string]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.collectible.utils :as collectible-utils]
|
||||
[status-im.contexts.wallet.send.transaction-settings.core :as transaction-settings]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
[utils.collection :as utils.collection]
|
||||
[utils.money :as money]
|
||||
@@ -163,25 +162,7 @@
|
||||
(->> (map rpc->keypair keypairs)
|
||||
(sort-by #(if (= (:type %) :profile) 0 1))))
|
||||
|
||||
(defn- add-keys-to-saved-address
|
||||
[saved-address]
|
||||
(assoc saved-address :ens? (not (string/blank? (:ens saved-address)))))
|
||||
|
||||
(defn rpc->saved-address
|
||||
[saved-address]
|
||||
(-> saved-address
|
||||
(set/rename-keys {:chainShortNames :chain-short-names
|
||||
:isTest :test?
|
||||
:createdAt :created-at
|
||||
:colorId :customization-color
|
||||
:mixedcaseAddress :mixedcase-address
|
||||
:removed :removed?})
|
||||
(update :customization-color (comp keyword string/lower-case))
|
||||
add-keys-to-saved-address))
|
||||
|
||||
(defn rpc->saved-addresses
|
||||
[saved-addresses]
|
||||
(map rpc->saved-address saved-addresses))
|
||||
|
||||
(defn reconcile-keypairs
|
||||
[keypairs]
|
||||
@@ -230,8 +211,7 @@
|
||||
|
||||
(defn new->old-route-path
|
||||
[new-path]
|
||||
(let [to-bignumber (fn [k] (-> new-path k money/bignumber))
|
||||
suggested-levels-for-max-fees-per-gas (:suggested-levels-for-max-fees-per-gas new-path)]
|
||||
(let [to-bignumber (fn [k] (-> new-path k money/bignumber))]
|
||||
{:approval-fee (to-bignumber :approval-fee)
|
||||
:approval-l-1-fee (to-bignumber :approval-l-1-fee)
|
||||
:bonder-fees (to-bignumber :tx-bonder-fees)
|
||||
@@ -240,34 +220,35 @@
|
||||
:amount-in-locked (:amount-in-locked new-path)
|
||||
:amount-in (:amount-in new-path)
|
||||
:max-amount-in (:max-amount-in new-path)
|
||||
:gas-fees {:gas-price "0"
|
||||
:base-fee (send-utils/convert-to-gwei (:tx-base-fee
|
||||
new-path)
|
||||
precision)
|
||||
:gas-fees {:gas-price "0"
|
||||
:base-fee (send-utils/convert-to-gwei (:tx-base-fee
|
||||
new-path)
|
||||
precision)
|
||||
:max-priority-fee-per-gas (send-utils/convert-to-gwei (:tx-priority-fee
|
||||
new-path)
|
||||
precision)
|
||||
:l-1-gas-fee (send-utils/convert-to-gwei (:tx-l-1-fee
|
||||
new-path)
|
||||
precision)
|
||||
:eip-1559-enabled true
|
||||
:tx-max-fees-per-gas (send-utils/convert-to-gwei
|
||||
(:tx-max-fees-per-gas
|
||||
new-path)
|
||||
precision)
|
||||
:suggested-gas-fees-for-setting
|
||||
{:tx-fee-mode/normal (send-utils/convert-to-gwei
|
||||
(:low
|
||||
suggested-levels-for-max-fees-per-gas)
|
||||
precision)
|
||||
:tx-fee-mode/fast (send-utils/convert-to-gwei
|
||||
(:medium
|
||||
suggested-levels-for-max-fees-per-gas)
|
||||
precision)
|
||||
:tx-fee-mode/urgent (send-utils/convert-to-gwei
|
||||
(:high
|
||||
suggested-levels-for-max-fees-per-gas)
|
||||
precision)}}
|
||||
:max-fee-per-gas-low (send-utils/convert-to-gwei
|
||||
(get-in
|
||||
new-path
|
||||
[:suggested-levels-for-max-fees-per-gas
|
||||
:low])
|
||||
precision)
|
||||
:max-fee-per-gas-medium (send-utils/convert-to-gwei
|
||||
(get-in
|
||||
new-path
|
||||
[:suggested-levels-for-max-fees-per-gas
|
||||
:medium])
|
||||
precision)
|
||||
:max-fee-per-gas-high (send-utils/convert-to-gwei
|
||||
(get-in
|
||||
new-path
|
||||
[:suggested-levels-for-max-fees-per-gas
|
||||
:high])
|
||||
precision)
|
||||
:l-1-gas-fee (send-utils/convert-to-gwei (:tx-l-1-fee
|
||||
new-path)
|
||||
precision)
|
||||
:eip-1559-enabled true}
|
||||
:bridge-name (:processor-name new-path)
|
||||
:amount-out (:amount-out new-path)
|
||||
:approval-contract-address (:approval-contract-address new-path)
|
||||
@@ -276,10 +257,7 @@
|
||||
:to (:to-chain new-path)
|
||||
:approval-amount-required (:approval-amount-required new-path)
|
||||
;; :cost () ;; tbd not used on desktop
|
||||
:gas-amount (:tx-gas-amount new-path)
|
||||
:router-input-params-uuid (:router-input-params-uuid new-path)
|
||||
:tx-fee-mode (transaction-settings/gas-rate->tx-fee-mode (:tx-gas-fee-mode
|
||||
new-path))}))
|
||||
:gas-amount (:tx-gas-amount new-path)}))
|
||||
|
||||
(defn tokens-never-loaded?
|
||||
[db]
|
||||
|
||||
@@ -435,16 +435,14 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/start-bridge
|
||||
(fn [{:keys [db]}]
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-type] :tx/bridge)
|
||||
:fx [[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:start-flow? true
|
||||
:flow-id :wallet-bridge-flow}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-send-tx-type
|
||||
(fn [{:keys [db]} [type]]
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-type] type)}))
|
||||
(let [view-id (:view-id db)]
|
||||
(cond-> {:db (assoc-in db [:wallet :ui :send :tx-type] :tx/bridge)}
|
||||
(= view-id :screen/wallet.accounts)
|
||||
(assoc :fx
|
||||
[[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:start-flow? true
|
||||
:flow-id :wallet-bridge-flow}]]])))))
|
||||
|
||||
(rf/reg-event-fx :wallet/select-bridge-network
|
||||
(fn [{:keys [db]} [{:keys [network-chain-id stack-id]}]]
|
||||
@@ -579,7 +577,7 @@
|
||||
[:dispatch [:wallet/get-ethereum-chains]]
|
||||
[:dispatch [:wallet/get-accounts]]
|
||||
[:dispatch [:wallet/get-keypairs]]
|
||||
[:dispatch [:wallet/get-saved-addresses]]
|
||||
[:dispatch [:infra/get-saved-addresses]]
|
||||
(when (ff/enabled? ::ff/wallet.wallet-connect)
|
||||
[:dispatch-later [{:ms 500 :dispatch [:wallet-connect/init]}]])]}))
|
||||
|
||||
|
||||
@@ -91,16 +91,12 @@
|
||||
{:content buy-token/view}]))
|
||||
on-bridge-press (rn/use-callback
|
||||
(fn []
|
||||
;; For a single account, it starts the bridge flow immediately. For
|
||||
;; multiple accounts, it sets the transaction type and starts the
|
||||
;; bridge flow after account selection.
|
||||
(rf/dispatch [:wallet/clean-send-data])
|
||||
(when-not multiple-accounts?
|
||||
(rf/dispatch [:wallet/switch-current-viewing-account
|
||||
first-account-address])
|
||||
(rf/dispatch [:wallet/start-bridge]))
|
||||
first-account-address]))
|
||||
(rf/dispatch [:wallet/start-bridge])
|
||||
(when multiple-accounts?
|
||||
(rf/dispatch [:wallet/set-send-tx-type :tx/bridge])
|
||||
(rf/dispatch [:open-modal :screen/wallet.select-from])))
|
||||
[multiple-accounts? first-account-address])
|
||||
on-swap-press (rn/use-callback
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||
[status-im.contexts.wallet.data-store :as data-store]
|
||||
[status-im.contexts.wallet.send.transaction-settings.core :as transaction-settings]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
[status-im.contexts.wallet.sheets.network-selection.view :as network-selection]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.address]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.money :as utils.money]
|
||||
[utils.number]
|
||||
[utils.re-frame :as rf]
|
||||
@@ -386,100 +384,16 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-token-amount-to-send
|
||||
(fn [{:keys [db]} [{:keys [amount stack-id start-flow?]}]]
|
||||
{:db (assoc-in db [:wallet :ui :send :amount] amount)
|
||||
:fx [[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-send-flow}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet.send/auth-slider-completed
|
||||
(fn [{:keys [db]}]
|
||||
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])]
|
||||
{:db (update-in db [:wallet :ui :send] dissoc :transaction-for-signing)
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :amount] amount)
|
||||
(update-in [:wallet :ui :send] dissoc :transaction-for-signing))
|
||||
:fx [[:dispatch [:wallet/build-transactions-from-route {:request-uuid last-request-uuid}]]
|
||||
[:dispatch
|
||||
[:wallet.send/set-sign-transactions-callback-fx
|
||||
[:dispatch
|
||||
[:wallet/prepare-signatures-for-transactions :send]]]]]})))
|
||||
|
||||
(defn log-transaction-signature-error
|
||||
[error]
|
||||
(log/error
|
||||
"failed to prepare signatures for transactions"
|
||||
{:event :wallet/prepare-signatures-for-transactions
|
||||
:error error})
|
||||
(rf/dispatch
|
||||
[:toasts/upsert
|
||||
{:id :prepare-signatures-for-transactions-error
|
||||
:type :negative
|
||||
:text (:message error)}]))
|
||||
|
||||
(defn- send-transactions-with-signatures
|
||||
[tx-type signatures]
|
||||
(rf/dispatch
|
||||
[:wallet/send-router-transactions-with-signatures tx-type
|
||||
signatures]))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/send-router-transactions-with-signatures
|
||||
(fn [{:keys [db]} [tx-type signatures]]
|
||||
(let [transaction-for-signing (get-in db [:wallet :ui tx-type :transaction-for-signing])
|
||||
signatures-map (reduce (fn [acc {:keys [message signature]}]
|
||||
(assoc acc
|
||||
message
|
||||
(send-utils/signature-rsv signature)))
|
||||
{}
|
||||
signatures)]
|
||||
{:json-rpc/call [{:method "wallet_sendRouterTransactionsWithSignatures"
|
||||
:params [{:uuid (get-in transaction-for-signing [:sendDetails :uuid])
|
||||
:signatures signatures-map}]
|
||||
:on-success (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet]))
|
||||
:on-error (fn [error]
|
||||
(log/error "failed to send router transactions with signatures"
|
||||
{:event :wallet/send-router-transactions-with-signatures
|
||||
:error error})
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:id :send-router-transactions-with-signatures-error
|
||||
:type :negative
|
||||
:text (:message error)}]))}]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/prepare-signatures-for-transactions
|
||||
(fn [{:keys [db]} [tx-type]]
|
||||
(let [transaction-for-signing (get-in db
|
||||
[:wallet :ui tx-type :transaction-for-signing])
|
||||
signing-details (:signingDetails transaction-for-signing)
|
||||
{:keys [hashes address signOnKeycard]} signing-details
|
||||
send-tx-fn (partial send-transactions-with-signatures tx-type)]
|
||||
(if signOnKeycard
|
||||
{:fx [[:dispatch
|
||||
[:standard-auth/authorize-with-keycard
|
||||
{:on-complete (fn [pin]
|
||||
(rf/dispatch [:keycard/connect-and-sign-hashes
|
||||
{:keycard-pin pin
|
||||
:address address
|
||||
:hashes hashes
|
||||
:on-success send-tx-fn
|
||||
:on-failure log-transaction-signature-error}]))}]]]}
|
||||
{:fx [[:dispatch
|
||||
[:standard-auth/authorize
|
||||
{:on-auth-success (fn [sha3-pwd]
|
||||
(rf/dispatch [:wallet/standard-auth-autorization-success hashes
|
||||
address sha3-pwd send-tx-fn]))
|
||||
:auth-button-label (i18n/label :t/confirm)}]]]}))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/standard-auth-autorization-success
|
||||
(fn [_ [hashes address sha3-pwd send-tx-fn]]
|
||||
{:fx [[:effects.wallet/sign-transaction-hashes
|
||||
{:hashes hashes
|
||||
:address address
|
||||
:password (security/safe-unmask-data sha3-pwd)
|
||||
:on-success send-tx-fn
|
||||
:on-error log-transaction-signature-error}]]}))
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-send-flow}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/build-transaction-for-collectible-route
|
||||
@@ -495,14 +409,16 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-token-amount-to-bridge
|
||||
(fn [{:keys [db]} [{:keys [amount stack-id start-flow?]}]]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :amount] amount)
|
||||
(update-in [:wallet :ui :send] dissoc :transaction-for-signing))
|
||||
:fx [[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-bridge-flow}]]]}))
|
||||
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :amount] amount)
|
||||
(update-in [:wallet :ui :send] dissoc :transaction-for-signing))
|
||||
:fx [[:dispatch [:wallet/build-transactions-from-route {:request-uuid last-request-uuid}]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-bridge-flow}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/clean-bridge-to-selection
|
||||
@@ -664,10 +580,7 @@
|
||||
:wallet/handle-suggested-routes
|
||||
(fn [{:keys [db]} [data]]
|
||||
(let [{send :send swap? :swap} (-> db :wallet :ui)
|
||||
skip-processing-routes? (:skip-processing-suggested-routes? send)
|
||||
clean-user-tx-settings? (get-in db
|
||||
[:wallet :ui :send :custom-tx-settings
|
||||
:delete-on-routes-update?])]
|
||||
skip-processing-routes? (:skip-processing-suggested-routes? send)]
|
||||
(when (or swap? (not skip-processing-routes?))
|
||||
(let [{error-code :code
|
||||
:as error} (:ErrorResponse data)
|
||||
@@ -678,16 +591,13 @@
|
||||
(log/error "failed to get suggested routes (async)"
|
||||
{:event :wallet/handle-suggested-routes
|
||||
:error error-message}))
|
||||
(merge
|
||||
(when clean-user-tx-settings?
|
||||
{:db (update-in db [:wallet :ui :send] dissoc :custom-tx-settings)})
|
||||
{:fx [[:dispatch
|
||||
(cond
|
||||
(and failure? swap?) [:wallet/swap-proposal-error error]
|
||||
failure? [:wallet/suggested-routes-error error-message]
|
||||
swap? [:wallet/swap-proposal-success (fix-routes data)]
|
||||
:else [:wallet/suggested-routes-success (fix-routes data)
|
||||
enough-assets?])]]}))))))
|
||||
{:fx [[:dispatch
|
||||
(cond
|
||||
(and failure? swap?) [:wallet/swap-proposal-error error]
|
||||
failure? [:wallet/suggested-routes-error error-message]
|
||||
swap? [:wallet/swap-proposal-success (fix-routes data)]
|
||||
:else [:wallet/suggested-routes-success (fix-routes data)
|
||||
enough-assets?])]]})))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/transaction-success
|
||||
@@ -759,6 +669,66 @@
|
||||
:type :negative
|
||||
:text (:message error)}]))}]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/prepare-signatures-for-transactions
|
||||
(fn [{:keys [db]} [type sha3-pwd]]
|
||||
(let [{:keys [hashes address signOnKeycard]} (get-in db
|
||||
[:wallet :ui type :transaction-for-signing
|
||||
:signingDetails])
|
||||
on-success (fn [signatures]
|
||||
(rf/dispatch
|
||||
[:wallet/send-router-transactions-with-signatures type
|
||||
signatures]))
|
||||
on-error (fn [error]
|
||||
(log/error
|
||||
"failed to prepare signatures for transactions"
|
||||
{:event :wallet/prepare-signatures-for-transactions
|
||||
:error error})
|
||||
(rf/dispatch
|
||||
[:toasts/upsert
|
||||
{:id :prepare-signatures-for-transactions-error
|
||||
:type :negative
|
||||
:text (:message error)}]))]
|
||||
(if signOnKeycard
|
||||
{:fx [[:dispatch
|
||||
[:standard-auth/authorize-with-keycard
|
||||
{:on-complete #(rf/dispatch [:keycard/connect-and-sign-hashes
|
||||
{:keycard-pin %
|
||||
:address address
|
||||
:hashes hashes
|
||||
:on-success on-success
|
||||
:on-failure on-error}])}]]]}
|
||||
{:fx [[:effects.wallet/sign-transaction-hashes
|
||||
{:hashes hashes
|
||||
:address address
|
||||
:password (security/safe-unmask-data sha3-pwd)
|
||||
:on-success on-success
|
||||
:on-error on-error}]]}))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/send-router-transactions-with-signatures
|
||||
(fn [{:keys [db]} [type signatures]]
|
||||
(let [transaction-for-signing (get-in db [:wallet :ui type :transaction-for-signing])
|
||||
signatures-map (reduce (fn [acc {:keys [message signature]}]
|
||||
(assoc acc
|
||||
message
|
||||
(send-utils/signature-rsv signature)))
|
||||
{}
|
||||
signatures)]
|
||||
{:json-rpc/call [{:method "wallet_sendRouterTransactionsWithSignatures"
|
||||
:params [{:uuid (get-in transaction-for-signing [:sendDetails :uuid])
|
||||
:signatures signatures-map}]
|
||||
:on-success (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet]))
|
||||
:on-error (fn [error]
|
||||
(log/error "failed to send router transactions with signatures"
|
||||
{:event :wallet/send-router-transactions-with-signatures
|
||||
:error error})
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:id :send-router-transactions-with-signatures-error
|
||||
:type :negative
|
||||
:text (:message error)}]))}]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/select-from-account
|
||||
(fn [{db :db} [{:keys [address stack-id network-details network start-flow?] :as params}]]
|
||||
@@ -847,69 +817,35 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/init-tx-settings
|
||||
(fn [{db :db}]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :custom-tx-settings]
|
||||
{:max-base-fee {:low 5
|
||||
:current 8.2
|
||||
:high 9}
|
||||
:priority-fee {:low 0.6
|
||||
:high 5.1
|
||||
:current 1.1}
|
||||
:max-gas-amount {:low 30000
|
||||
:current 31000}
|
||||
:nonce {:last-transaction 21
|
||||
:current 22}}))}))
|
||||
{:db (assoc-in db
|
||||
[:wallet :ui :send :tx-settings]
|
||||
{:max-base-fee {:low 5
|
||||
:current 8.2
|
||||
:high 9}
|
||||
:priority-fee {:low 0.6
|
||||
:high 5.1
|
||||
:current 1.1}
|
||||
:max-gas-amount {:low 30000
|
||||
:current 31000}
|
||||
:nonce {:last-transaction 21
|
||||
:current 22}})}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-max-base-fee
|
||||
(fn [{db :db} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :send :custom-tx-settings :max-base-fee :current] value)}))
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-settings :max-base-fee :current] value)}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-priority-fee
|
||||
(fn [{db :db} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :send :custom-tx-settings :priority-fee :current] value)}))
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-settings :priority-fee :current] value)}))
|
||||
(rf/reg-event-fx
|
||||
|
||||
:wallet/set-max-gas-amount
|
||||
(fn [{db :db} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :send :custom-tx-settings :max-gas-amount :current] value)}))
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-settings :max-gas-amount :current] value)}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-nonce
|
||||
(fn [{db :db} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-settings :nonce :current] value)}))
|
||||
|
||||
(rf/reg-event-fx :wallet/quick-fee-mode-confirmed
|
||||
(fn [{db :db} [fee-mode]]
|
||||
(let [gas-rate (transaction-settings/tx-fee-mode->gas-rate fee-mode)
|
||||
route (first (get-in db [:wallet :ui :send :route]))
|
||||
path-tx-identity (send-utils/path-identity route)
|
||||
params [path-tx-identity gas-rate]]
|
||||
{:db (assoc-in db [:wallet :ui :send :custom-tx-settings :tx-fee-mode] fee-mode)
|
||||
:fx [[:json-rpc/call
|
||||
[{:method "wallet_setFeeMode"
|
||||
:params params
|
||||
:on-error (fn [error]
|
||||
(log/error "failed to set quick transaction settings"
|
||||
{:event :wallet/quick-fee-mode-confirmed
|
||||
:error (:message error)
|
||||
:params params}))}]]
|
||||
[:dispatch [:wallet/mark-user-tx-settings-for-deletion]]]})))
|
||||
|
||||
|
||||
;; There is a delay between the moment when user selected
|
||||
;; custom settings and the moment when new route arrived
|
||||
;; with those settings applied. During this delay
|
||||
;; we should keep user settings for ui. After new route
|
||||
;; arrived we should clean the settings.
|
||||
(rf/reg-event-fx :wallet/mark-user-tx-settings-for-deletion
|
||||
(fn [{db :db}]
|
||||
{:db (assoc-in db [:wallet :ui :send :custom-tx-settings :delete-on-routes-update?] true)}))
|
||||
|
||||
|
||||
(rf/reg-event-fx :wallet.send/set-sign-transactions-callback-fx
|
||||
(fn [{:keys [db]} [callback-fx]]
|
||||
{:db (assoc-in db
|
||||
[:wallet :ui :send :sign-transactions-callback-fx]
|
||||
callback-fx)}))
|
||||
|
||||