diff --git a/.buckconfig b/.buckconfig deleted file mode 100644 index 934256cb2..000000000 --- a/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 000000000..848943bb5 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..13d223678 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,26 @@ +module.exports = { + extends: ['standard', 'prettier', 'plugin:react/recommended'], + parser: '@typescript-eslint/parser', + env: { + 'mocha': true, + 'node': true, + 'jest/globals': true + }, + plugins: ['sql', 'jest', 'react'], + rules: { + 'no-unexpected-multiline': ['warn'], + 'max-len': ['error', { code: 650 }], + 'no-set-state': 'off', + 'react/prop-types': 0, + 'no-unused-expressions': 0, + 'no-return-assign': 0, + 'new-cap': 0, + 'dot-notation': 0, + 'no-unused-vars': 2 + }, + settings: { + 'import/resolver': { + 'babel-module': {} + } + } +} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4463f521e..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": ["standard", "prettier", "plugin:react/recommended"], - "parser": "@typescript-eslint/parser", - "env": { - "mocha": true, - "node": true, - "jest/globals": true - }, - "plugins": ["sql", "jest", "react"], - "rules": { - "no-unexpected-multiline": ["warn"], - "max-len": ["error", { "code": 650 }], - "no-set-state": "off", - "react/prop-types": 0, - "no-unused-expressions": 0, - "no-return-assign": 0, - "new-cap": 0, - "dot-notation": 0, - "no-unused-vars": 2 - }, - "settings": { - "import/resolver": { - "babel-module": {} - } - } -} diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index 4afc766a2..000000000 --- a/.flowconfig +++ /dev/null @@ -1,75 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore polyfills -node_modules/react-native/Libraries/polyfills/.* - -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -node_modules/warning/.* - -; Flow doesn't support platforms -.*/Libraries/Utilities/LoadingView.js - -[untyped] -.*/node_modules/@react-native-community/cli/.*/.* - -[include] - -[libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow/ - -[options] -emoji=true - -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable - -module.file_ext=.js -module.file_ext=.json -module.file_ext=.ios.js - -munge_underscores=true - -module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation' -module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FlowFixMeProps -suppress_type=$FlowFixMeState - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError - -[lints] -sketchy-null-number=warn -sketchy-null-mixed=warn -sketchy-number=warn -untyped-type-import=warn -nonstrict-import=warn -deprecated-type=warn -unsafe-getters-setters=warn -inexact-spread=warn -unnecessary-invariant=warn -signature-verification-failure=warn -deprecated-utility=error - -[strict] -deprecated-type -nonstrict-import -sketchy-null -unclear-type -unsafe-getters-setters -untyped-import -untyped-type-import - -[version] -^0.105.0 diff --git a/.gitignore b/.gitignore index 966efabae..e5c8342e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,6 @@ -.idea -.gradle -local.properties -node_modules -npm-debug.log -yarn-error.log -__tests__ -__mocks__/axios/*.json -build/ -*.iml +# OSX +# +.DS_Store # Xcode # @@ -27,25 +20,26 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace -wallettests +ios/.xcode.env.local -# CocoaPods -ios/Podfile.lock -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control +# Android/IntelliJ # -ios/Pods -.DS_Store - -# BUCK -buck-out/ -\.buckd/ +build/ +.idea +.gradle +local.properties +*.iml +*.hprof +.cxx/ *.keystore !debug.keystore +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the @@ -53,10 +47,24 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle +# Ruby / CocoaPods +/ios/Pods/ +/vendor/ + +# Temporary files created by Metro to check the health of the file watcher +.metro-health-check* + +# testing +/coverage + + +#vscode +.vscode/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 350625fd5..308133c3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,6 @@ variables: LC_ALL: "en_US.UTF-8" LANG: "en_US.UTF-8" GIT_STRATEGY: clone - GIT_SUBMODULE_STRATEGY: recursive GIT_CHECKOUT: "true" stages: @@ -12,13 +11,8 @@ stages: - deploy - release - gopublic - - publicrelease include: - project: 'Trustee/walletinternals' ref: refactor2 file: '/gitlabcicd/wallet-gitlab-ci.yml' -# - project: 'Trustee/walletinternals' -# ref: master -# file: '/githubcicd/wallet-github-ci.yml' - diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 2c6c7ced4..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "__tests__"] - path = __tests__ - url = ../../Trustee/wallettests.git diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index bbe96b90a..000000000 --- a/.prettierrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "tabWidth": 4, - "singleQuote": true, - "jsxSingleQuote": true, - "quoteProps": "consistent", - "bracketSpacing": true, - "jsxBracketSameLine": true, - "arrowParens": "always", - "trailingComma": "none", - "semi": false, - "printWidth": 150 -} diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..90641b801 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,12 @@ +module.exports = { + tabWidth: 4, + singleQuote: true, + jsxSingleQuote: true, + quoteProps: "consistent", + bracketSpacing: true, + jsxBracketSameLine: true, + arrowParens: "always", + trailingComma: "none", + semi: false, + printWidth: 150 +} diff --git a/App.js b/App.js index 43a692f3f..d35634fca 100644 --- a/App.js +++ b/App.js @@ -2,41 +2,55 @@ * @version 0.43 * Init App */ -import React from 'react' - +import React, { useEffect } from 'react' +import SplashScreen from 'react-native-splash-screen' +import notifee, { EventType } from '@notifee/react-native' import { Provider } from 'react-redux' -import { AppearanceProvider } from 'react-native-appearance' import { enableScreens } from 'react-native-screens' import store from '@app/store' +import Application from '@app/appstores/Actions/App/App' import Router from '@app/router' import { ThemeProvider } from '@app/theme/ThemeProvider' -import Application from '@app/appstores/Actions/App/App' +import Log from '@app/services/Log/Log' +import AppNotificationPopup from '@app/services/AppNotification/AppNotificationPopup' enableScreens() -export default class App extends React.Component { - - componentDidMount() { - Application.init({ source: 'App.mount', onMount : true }) - } - - componentWillUnmount() { - Application.willUnmount() - } - - render() { - return ( - - - - - - - - ) - } - +const App = () => { + useEffect(() => { + SplashScreen.hide() + Application.init({ source: 'App.mount', onMount: true }) + + const unsubscribePush = notifee.onForegroundEvent(async (message) => { + await Log.log('App.js notifee.useForegroundEvent message ' + JSON.stringify(message)) + switch (message.type) { + case EventType.DISMISSED: + break + case EventType.PRESS: + AppNotificationPopup.onOpened(message?.detail?.notification) + break + } + }) + + return () => { + if (unsubscribePush) { + unsubscribePush() + } + + Application.willUnmount() + } + }, []) + + return ( + + + + + + ) } + +export default App diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..8d72c37a8 --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +source 'https://rubygems.org' + +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version +ruby ">= 2.6.10" + +# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper +# bound in the template on Cocoapods with next React Native release. +gem 'cocoapods', '>= 1.13', '< 1.15' +gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..3ef401526 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,103 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + activesupport (7.0.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + base64 (0.2.0) + claide (1.1.0) + cocoapods (1.14.3) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.14.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.14.3) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.2.3) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.16.3) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.14.4) + concurrent-ruby (~> 1.0) + json (2.7.1) + minitest (5.22.3) + molinillo (0.8.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + nkf (0.2.0) + public_suffix (4.0.7) + rexml (3.2.6) + ruby-macho (2.5.1) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + xcodeproj (1.24.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + +PLATFORMS + ruby + +DEPENDENCIES + activesupport (>= 6.1.7.5, < 7.1.0) + cocoapods (>= 1.13, < 1.15) + +RUBY VERSION + ruby 2.7.7p221 + +BUNDLED WITH + 2.2.27 diff --git a/__docs__ b/__docs__ deleted file mode 100644 index ab1519704..000000000 --- a/__docs__ +++ /dev/null @@ -1 +0,0 @@ -walletinternals/__docs__/ \ No newline at end of file diff --git a/__mocks__ b/__mocks__ deleted file mode 100644 index 9bcb093ac..000000000 --- a/__mocks__ +++ /dev/null @@ -1 +0,0 @@ -__tests__/__mocks__ \ No newline at end of file diff --git a/__tests__ b/__tests__ deleted file mode 160000 index 1eacb268d..000000000 --- a/__tests__ +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1eacb268dffdf06812b4daaccac88491349b0ae4 diff --git a/__tests__/App.test.tsx b/__tests__/App.test.tsx new file mode 100644 index 000000000..9eac6fbc8 --- /dev/null +++ b/__tests__/App.test.tsx @@ -0,0 +1,17 @@ +/** + * @format + */ + +import 'react-native'; +import React from 'react'; +import App from '../App'; + +// Note: import explicitly to use the types shipped with jest. +import {it} from '@jest/globals'; + +// Note: test renderer must be required after react-native. +import renderer from 'react-test-renderer'; + +it('renders correctly', () => { + renderer.create(); +}); diff --git a/android/app/BUCK b/android/app/BUCK deleted file mode 100644 index 0f6e819db..000000000 --- a/android/app/BUCK +++ /dev/null @@ -1,55 +0,0 @@ -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") - -lib_deps = [] - -create_aar_targets(glob(["libs/*.aar"])) - -create_jar_targets(glob(["libs/*.jar"])) - -android_library( - name = "all-libs", - exported_deps = lib_deps, -) - -android_library( - name = "app-code", - srcs = glob([ - "src/main/java/**/*.java", - ]), - deps = [ - ":all-libs", - ":build_config", - ":res", - ], -) - -android_build_config( - name = "build_config", - package = "com.trusteewallet", -) - -android_resource( - name = "res", - package = "com.trusteewallet", - res = "src/main/res", -) - -android_binary( - name = "app", - keystore = "//android/keystores:debug", - manifest = "src/main/AndroidManifest.xml", - package_type = "debug", - deps = [ - ":app-code", - ], -) diff --git a/android/app/build.gradle b/android/app/build.gradle index 813f1d0e3..a0bffe5ce 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,172 +1,92 @@ apply plugin: "com.android.application" -apply plugin: "io.fabric" - -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation - * entryFile: "index.android.js", - * - * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format - * bundleCommand: "ram-bundle", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // whether to disable dev mode in custom build variants (by default only disabled in release) - * // for example: to disable dev mode in the staging build type (if configured) - * devDisabledInStaging: true, - * // The configuration property can be in the following formats - * // 'devDisabledIn${productFlavor}${buildType}' - * // 'devDisabledIn${buildType}' - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"], - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - -project.ext.react = [ - entryFile: "index.js", - enableHermes: true, // clean and rebuild if changing -] - -apply from: "../../node_modules/react-native/react.gradle" +apply plugin: "org.jetbrains.kotlin.android" +apply plugin: "com.facebook.react" +apply plugin: 'com.google.gms.google-services' +apply plugin: 'com.google.firebase.crashlytics' /** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. + * This is the configuration block to customize your React Native Android app. + * By default you don't need to apply any configuration, just uncomment the lines you need. */ -def enableSeparateBuildPerCPUArchitecture = false +react { + /* Folders */ + // The root of your project, i.e. where "package.json" lives. Default is '..' + // root = file("../") + // The folder where the react-native NPM package is. Default is ../node_modules/react-native + // reactNativeDir = file("../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen + // codegenDir = file("../node_modules/@react-native/codegen") + // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js + // cliFile = file("../node_modules/react-native/cli.js") + + /* Variants */ + // The list of variants to that are debuggable. For those we're going to + // skip the bundling of the JS bundle and the assets. By default is just 'debug'. + // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. + // debuggableVariants = ["liteDebug", "prodDebug"] + + /* Bundling */ + // A list containing the node command and its flags. Default is just 'node'. + // nodeExecutableAndArgs = ["node"] + // + // The command to run when bundling. By default is 'bundle' + // bundleCommand = "ram-bundle" + // + // The path to the CLI configuration file. Default is empty. + // bundleConfig = file(../rn-cli.config.js) + // + // The name of the generated asset file containing your JS bundle + // bundleAssetName = "MyApplication.android.bundle" + // + // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' + // entryFile = file("../js/MyApplication.android.js") + // + // A list of extra flags to pass to the 'bundle' commands. + // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle + // extraPackagerArgs = [] + + /* Hermes Commands */ + // The hermes compiler command to run. By default it is 'hermesc' + // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" + // + // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" + // hermesFlags = ["-O", "-output-source-map"] +} /** - * Run Proguard to shrink the Java bytecode in release builds. + * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** - * The preferred build flavor of JavaScriptCore. + * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that - * give correct results when using with locales other than en-US. Note that + * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -// def jscFlavor = 'org.webkit:android-jsc:+' -def jscFlavor = 'org.webkit:android-jsc-intl:+' - -/** - * Whether to enable the Hermes VM. - * - * This should be set on project.ext.react and mirrored here. If it is not set - * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode - * and the benefits of using Hermes will therefore be sharply reduced. - */ -def enableHermes = project.ext.react.get("enableHermes", false); +def jscFlavor = 'org.webkit:android-jsc:+' android { - compileSdkVersion rootProject.ext.compileSdkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + ndkVersion rootProject.ext.ndkVersion + buildToolsVersion rootProject.ext.buildToolsVersion + compileSdk rootProject.ext.compileSdkVersion + namespace "com.trusteewallet" defaultConfig { applicationId "com.trusteewallet" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "1.51.6" - - missingDimensionStrategy 'react-native-camera', 'general' + versionName "1.0" multiDexEnabled true - -// ndk { -// abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips" -// } - - packagingOptions { - pickFirst 'lib/x86/libc++_shared.so' - pickFirst 'lib/x86_64/libc++_shared.so' - pickFirst 'lib/armeabi-v7a/libc++_shared.so' - pickFirst 'lib/arm64-v8a/libc++_shared.so' - } - - packagingOptions { - exclude 'META-INF/*.version' - exclude 'META-INF/*.kotlin_module' - exclude 'META-INF/rxjava.properties' - } - + missingDimensionStrategy 'react-native-camera', 'general' } - - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" - } - } signingConfigs { debug { storeFile file('debug.keystore') @@ -185,8 +105,9 @@ android { storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' - } + } } + } buildTypes { debug { @@ -194,77 +115,38 @@ android { } release { // Caution! In production, you need to generate your own keystore file. - // see https://facebook.github.io/react-native/docs/signed-apk-android. + // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - } - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // https://developer.android.com/studio/build/configure-apk-splits.html - def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode - } + firebaseCrashlytics { + nativeSymbolUploadEnabled true + unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' + } } } } dependencies { - implementation project(':react-native-appearance') - implementation project(':react-native-branch') + // The version of react-native is set by the React Native Gradle Plugin + implementation("com.facebook.react:react-android") + implementation("com.facebook.react:flipper-integration") implementation project(':react-native-vector-icons') - implementation 'androidx.multidex:multidex:2.0.1' - - implementation 'org.conscrypt:conscrypt-android:2.1.0' - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - - implementation 'com.google.android.gms:play-services-base:17.6.0' - - implementation 'com.google.firebase:firebase-core:17.2.1' - implementation 'com.google.firebase:firebase-messaging:20.1.0' - implementation 'com.google.firebase:firebase-dynamic-links:18.0.0' - implementation 'com.google.firebase:firebase-invites:17.0.0' - implementation 'com.google.firebase:firebase-storage:18.0.0' - implementation 'com.google.firebase:firebase-database:18.0.0' - implementation 'com.google.firebase:firebase-perf:19.1.1' - - - compile('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { - transitive = true; - } - - implementation 'me.leolin:ShortcutBadger:1.1.21@aar' - - implementation fileTree(dir: "libs", include: ["*.jar"]) - - implementation "com.facebook.react:react-native:+" // From node_modules + implementation project(':lottie-react-native') + implementation 'com.google.firebase:firebase-messaging:20.2.+' implementation("com.squareup.okhttp3:okhttp-urlconnection:4.4.1") - if (enableHermes) { - def hermesPath = "../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") + implementation project(':react-native-video') + implementation "androidx.appcompat:appcompat:1.0.0" + + if (hermesEnabled.toBoolean()) { + implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} - -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.firebase-perf' apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply plugin: 'com.google.gms.google-services' diff --git a/android/app/build_defs.bzl b/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d..000000000 --- a/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index d7dbfbf69..831b6afce 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -8,5 +8,21 @@ # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: +-keep class com.facebook.hermes.unicode.** { *; } +-keep class com.facebook.jni.** { *; } +-keep class com.swmansion.** {*;} +-keep class com.swmansion.reanimated.** { *; } +-keep class com.facebook.react.turbomodule.** { *; } +-keep class com.rt2zz.reactnativecontacts.** {*;} +-keepclassmembers class com.rt2zz.reactnativecontacts.** {*;} +-keep public class com.horcrux.svg.** {*;} +-keep public class com.dylanvann.fastimage.* {*;} +-keep public class com.dylanvann.fastimage.** {*;} +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep public class * extends com.bumptech.glide.module.AppGlideModule +-keep class androidx.camera.core.** { *; } +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { + **[] $VALUES; + public *; +} --dontwarn io.branch.** \ No newline at end of file diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index fa26aa56e..eb98c01af 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -2,7 +2,8 @@ - - - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 498d9f3b1..b3e12e1d7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,13 +1,15 @@ - + + + + + android:theme="@style/AppTheme"> + android:name="com.google.firebase.messaging.default_notification_icon" + android:resource="@mipmap/ic_notification"/> - + android:name="com.google.mlkit.vision.DEPENDENCIES" + android:value="barcode" /> + @@ -125,7 +123,6 @@ - diff --git a/android/app/src/main/assets/fonts/icomoon.ttf b/android/app/src/main/assets/fonts/icomoon.ttf index d1e657c6f..b2f87394a 100644 Binary files a/android/app/src/main/assets/fonts/icomoon.ttf and b/android/app/src/main/assets/fonts/icomoon.ttf differ diff --git a/android/app/src/main/java/com/trusteewallet/MainActivity.java b/android/app/src/main/java/com/trusteewallet/MainActivity.java deleted file mode 100644 index 40e798a8c..000000000 --- a/android/app/src/main/java/com/trusteewallet/MainActivity.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.trusteewallet; - -import android.os.Bundle; -import android.view.WindowManager; - -import com.facebook.react.ReactActivity; - -import android.content.Intent; -import android.content.res.Configuration; -import com.facebook.react.ReactActivityDelegate; -import com.facebook.react.ReactRootView; -import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; - -import android.graphics.Color; - -import io.branch.rnbranch.*; -import android.content.Intent; - -public class MainActivity extends ReactActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - - switch (currentNightMode) { - case Configuration.UI_MODE_NIGHT_NO: { - this.getWindow().getDecorView().setBackgroundColor(Color.parseColor("#F5F5F5")); - break; - } - case Configuration.UI_MODE_NIGHT_YES:{ - this.getWindow().getDecorView().setBackgroundColor(Color.BLACK); - break; - } - case Configuration.UI_MODE_NIGHT_UNDEFINED: { - this.getWindow().getDecorView().setBackgroundColor(Color.WHITE); - } - } - } - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - Intent intent = new Intent("onConfigurationChanged"); - intent.putExtra("newConfig", newConfig); - this.sendBroadcast(intent); - } - - @Override - protected ReactActivityDelegate createReactActivityDelegate() { - return new ReactActivityDelegate(this, getMainComponentName()) { - @Override - protected ReactRootView createRootView() { - return new RNGestureHandlerEnabledRootView(MainActivity.this); - } - }; - } - - @Override - protected void onStart() { - super.onStart(); - RNBranchModule.initSession(getIntent().getData(), this); - } - - @Override - protected void onRestart() { - super.onRestart(); - Intent intent = getIntent(); - setIntent(intent); - intent.putExtras(this.getIntent()); - intent.putExtra("branch_force_new_session", true); - } - - - @Override - public void onNewIntent(Intent intent) { - super.onNewIntent(intent); - RNBranchModule.onNewIntent(intent); - } - - protected String getMainComponentName() { - return "TrusteeWallet"; - } -} diff --git a/android/app/src/main/java/com/trusteewallet/MainActivity.kt b/android/app/src/main/java/com/trusteewallet/MainActivity.kt new file mode 100644 index 000000000..a8acc9e11 --- /dev/null +++ b/android/app/src/main/java/com/trusteewallet/MainActivity.kt @@ -0,0 +1,58 @@ +package com.trusteewallet + +import android.os.Bundle +import android.view.WindowManager +import com.facebook.react.ReactActivity +import com.facebook.react.ReactActivityDelegate +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled +import com.facebook.react.defaults.DefaultReactActivityDelegate + +import org.devio.rn.splashscreen.SplashScreen +import io.branch.rnbranch.* +import android.content.Intent + +class MainActivity : ReactActivity() { + override protected fun onCreate(savedInstanceState: Bundle?) { + SplashScreen.show(this) + super.onCreate(null) + } + + override protected fun onPause() { + super.onPause() + getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) + } + + override protected fun onResume() { + super.onResume() + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE) + } + + /** + * https://help.branch.io/developers-hub/docs/react-native + */ + override protected fun onStart() { + super.onStart() + RNBranchModule.initSession(getIntent().getData(), this) + } + + /** + * https://help.branch.io/developers-hub/docs/react-native + */ + override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + RNBranchModule.onNewIntent(intent) + } + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + override fun getMainComponentName(): String = "trusteeWallet" + + /** + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] + */ + override fun createReactActivityDelegate(): ReactActivityDelegate = + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) +} diff --git a/android/app/src/main/java/com/trusteewallet/MainApplication.java b/android/app/src/main/java/com/trusteewallet/MainApplication.java deleted file mode 100644 index aa76f1c04..000000000 --- a/android/app/src/main/java/com/trusteewallet/MainApplication.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.trusteewallet; - -import android.app.Application; -import android.content.Context; - -import androidx.multidex.MultiDexApplication; - -import com.facebook.react.PackageList; -import com.facebook.react.ReactApplication; -import io.expo.appearance.RNCAppearancePackage; -import com.oblador.vectoricons.VectorIconsPackage; -import com.cmcewen.blurview.BlurViewPackage; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.soloader.SoLoader; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import androidx.multidex.MultiDexApplication; - -import java.security.Security; -import android.webkit.WebView; - -import io.branch.rnbranch.RNBranchModule; - -public class MainApplication extends MultiDexApplication implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = - new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - @SuppressWarnings("UnnecessaryLocalVariable") - List packages = new PackageList(this).getPackages(); - // Packages that cannot be autolinked yet can be added manually here, for example: - return packages; - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - Security.insertProviderAt(new org.conscrypt.OpenSSLProvider(), 1); - SoLoader.init(this, /* native exopackage */ false); - initializeFlipper(this); // Remove this line if you don't want Flipper enabled - WebView.setWebContentsDebuggingEnabled(true); - RNBranchModule.getAutoInstance(this); - } - - /** - * Loads Flipper in React Native templates. - * - * @param context - */ - private static void initializeFlipper(Context context) { - if (BuildConfig.DEBUG) { - try { - /* - We use reflection here to pick up the class that initializes Flipper, - since Flipper library is not available in release mode - */ - Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); - aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } -} diff --git a/android/app/src/main/java/com/trusteewallet/MainApplication.kt b/android/app/src/main/java/com/trusteewallet/MainApplication.kt new file mode 100644 index 000000000..2560d715d --- /dev/null +++ b/android/app/src/main/java/com/trusteewallet/MainApplication.kt @@ -0,0 +1,53 @@ +package com.trusteewallet + +import android.app.Application +import com.facebook.react.PackageList +import com.facebook.react.ReactApplication +import com.facebook.react.ReactHost +import com.facebook.react.ReactNativeHost +import com.facebook.react.ReactPackage +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost +import com.facebook.react.defaults.DefaultReactNativeHost +import com.facebook.react.flipper.ReactNativeFlipper +import com.facebook.soloader.SoLoader +import com.facebook.react.bridge.JSIModulePackage +import com.facebook.react.bridge.JSIModuleSpec +import com.facebook.react.bridge.JavaScriptContextHolder +import com.facebook.react.bridge.ReactApplicationContext +import java.util.Collections +import java.util.List + +import io.branch.rnbranch.RNBranchModule + +class MainApplication : Application(), ReactApplication { + override val reactNativeHost: ReactNativeHost = + object : DefaultReactNativeHost(this) { + override fun getPackages(): ArrayList = + PackageList(this).packages.apply { + // Packages that cannot be autolinked yet can be added manually here, for example: + // add(MyReactNativePackage()) + } + + override fun getJSMainModuleName(): String = "index" + + override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG + + override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED + override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED + } + + override val reactHost: ReactHost + get() = getDefaultReactHost(this.applicationContext, reactNativeHost) + + override fun onCreate() { + super.onCreate() + SoLoader.init(this, false) + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + load() + } + ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) + RNBranchModule.getAutoInstance(this) + } +} diff --git a/android/app/src/main/res/drawable/ic_logo.png b/android/app/src/main/res/drawable/ic_logo.png new file mode 100644 index 000000000..5ffb01f6f Binary files /dev/null and b/android/app/src/main/res/drawable/ic_logo.png differ diff --git a/android/app/src/main/res/drawable/rn_edit_text_material.xml b/android/app/src/main/res/drawable/rn_edit_text_material.xml new file mode 100644 index 000000000..73b37e4d9 --- /dev/null +++ b/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/launch_screen.xml b/android/app/src/main/res/layout/launch_screen.xml new file mode 100644 index 000000000..c2d54574b --- /dev/null +++ b/android/app/src/main/res/layout/launch_screen.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index 40720b19e..55501f3e0 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,3 +1,6 @@ + #141414 + #F5F5F5 + #262626 #f24b93 diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 4627b0969..7ba83a2ad 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,9 +1,9 @@ - diff --git a/android/build.gradle b/android/build.gradle index 0a818996f..1c9a77b5c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,80 +1,26 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { ext { firebaseMessagingVersion = "21.1.0" - buildToolsVersion = "30.0.3" + buildToolsVersion = "34.0.0" minSdkVersion = 21 - compileSdkVersion = 31 - targetSdkVersion = 31 - kotlinVersion = "1.6.0" + compileSdkVersion = 34 + targetSdkVersion = 34 + ndkVersion = "25.1.8937393" + kotlinVersion = "1.8.0" + androidXCore = "1.12.0" } repositories { google() - maven { - url 'https://maven.fabric.io/public' - } mavenCentral() } dependencies { - classpath('com.android.tools.build:gradle:4.1.2') - classpath 'com.google.gms:google-services:4.2.0' - classpath 'io.fabric.tools:gradle:1.25.4' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - classpath 'com.google.firebase:perf-plugin:1.3.5' + classpath("com.android.tools.build:gradle") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + classpath 'com.google.gms:google-services:4.4.1' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' } + } -allprojects { - repositories { - exclusiveContent { - // https://github.com/facebook/react-native/issues/35210 - // We get React Native's Android binaries exclusively through npm, - // from a local Maven repo inside node_modules/react-native/. - // (The use of exclusiveContent prevents looking elsewhere like Maven Central - // and potentially getting a wrong version.) - filter { - includeGroup "com.facebook.react" - } - forRepository { - maven { - url "$rootDir/../node_modules/react-native/android" - } - } - } - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url("$rootDir/../node_modules/react-native/android") - } - maven { - // Android JSC is installed from npm - url("$rootDir/../node_modules/jsc-android/dist") - } - - google() - jcenter() { - content { - includeModule("com.github.florent37", "singledateandtimepicker") // Required by fioprotocol_fiosdk - includeModule("com.jraska", "console") // Required by fioprotocol_fiosdk - includeModule("com.eightbitlab", "blurview") // Required by react-native-community_blur - includeGroup("com.google.android.exoplayer") - } - } - maven { url 'https://jitpack.io' } - mavenCentral() - } -} - -subprojects { - afterEvaluate {project -> - if (project.hasProperty("android")) { - android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - } - } - } -} +apply plugin: "com.facebook.react.rootproject" \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index 85c989409..383b8ba93 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -9,17 +9,37 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -org.gradle.parallel=true -org.gradle.daemon=true -org.gradle.jvmargs=-Xmx2560m +# org.gradle.parallel=true + +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX android.enableJetifier=true android.builder.sdkDownload=true -#android.useDeprecatedNdk=true +# Use this property to specify which architecture you want to build. +# You can also override it from the CLI using +# ./gradlew -PreactNativeArchitectures=x86_64 +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 + +# Use this property to enable support to the new architecture. +# This will allow you to use TurboModules and the Fabric render in +# your application. You should enable this flag either if you want +# to write custom TurboModules/Fabric components OR use libraries that +# are providing them. +newArchEnabled=false + +# Use this property to enable or disable the Hermes JS engine. +# If set to false, you will be using JSC instead. +hermesEnabled=true + +# QR/Barcode Scanning with VisionCamera +VisionCamera_enableCodeScanner=true diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf01..7f93135c4 100644 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 8cf6eb5ad..d11cdd907 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew index b0d6d0ab5..0adc8e1a5 100755 --- a/android/gradlew +++ b/android/gradlew @@ -1,13 +1,13 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -17,78 +17,111 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat index 15e1ee37a..6689b85be 100644 --- a/android/gradlew.bat +++ b/android/gradlew.bat @@ -5,7 +5,7 @@ @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem -@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +25,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/android/link-assets-manifest.json b/android/link-assets-manifest.json new file mode 100644 index 000000000..0bb78b93b --- /dev/null +++ b/android/link-assets-manifest.json @@ -0,0 +1,61 @@ +{ + "migIndex": 1, + "data": [ + { + "path": "assets/fonts/CREDC___.ttf", + "sha1": "ab61f7ea82aad08c74f87fe9327defd87bfcb27d" + }, + { + "path": "assets/fonts/Montserrat-Bold.ttf", + "sha1": "3a54407a2b26ff4718708a4726b10cb070d16534" + }, + { + "path": "assets/fonts/Montserrat-Light.ttf", + "sha1": "83879cec4c934d446eca63aa5cfedcebfd60d610" + }, + { + "path": "assets/fonts/Montserrat-Medium.ttf", + "sha1": "65a98832079c4d2c67f3acc4f4ce2de630fe6cb0" + }, + { + "path": "assets/fonts/Montserrat-Regular.ttf", + "sha1": "d25b35242deb1c6ff888b8162ca2aacc356d3899" + }, + { + "path": "assets/fonts/Montserrat-SemiBold.ttf", + "sha1": "f829de4c176fb2ccf5e33360920f48de6794434e" + }, + { + "path": "assets/fonts/Montserrat-Thin.ttf", + "sha1": "1d00ff2f5bc9331aa6e75b5a82dd698976615dc4" + }, + { + "path": "assets/fonts/OCR A Std Regular.ttf", + "sha1": "f284a3627799c528bab7ac7125a6ccbf780eebb3" + }, + { + "path": "assets/fonts/OCRA-Regular.ttf", + "sha1": "95311d280f0567135cb462de409059d34c309e67" + }, + { + "path": "assets/fonts/Roboto-Black.ttf", + "sha1": "ee52f7cf8e54f3ee2afbc474a352d5c19514d9c1" + }, + { + "path": "assets/fonts/SFUIDisplay-Bold.ttf", + "sha1": "ba1034abfaf9ecfe713087746f35efa9bc9f4d58" + }, + { + "path": "assets/fonts/SFUIDisplay-Regular.ttf", + "sha1": "18a14cd1bc60ab26bf0bc1865a8e6ca3a9778949" + }, + { + "path": "assets/fonts/SFUIDisplay-Semibold.ttf", + "sha1": "03ed495e2cc79f579f05e2d68ff6b81b897889a6" + }, + { + "path": "assets/fonts/icomoon.ttf", + "sha1": "db141da45efbab264c127a485bb13e811dd82fff" + } + ] +} diff --git a/android/settings.gradle b/android/settings.gradle index d8f8734ff..f0c92bcb6 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,9 +1,6 @@ -rootProject.name = 'TrusteeWallet' -include ':react-native-appearance' -project(':react-native-appearance').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-appearance/android') -include ':react-native-branch' -project(':react-native-branch').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-branch/android') +rootProject.name = 'trusteeWallet' include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' +includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/app.json b/app.json index f673f7ed6..a97ac6cc9 100644 --- a/app.json +++ b/app.json @@ -1,4 +1,4 @@ { - "name": "TrusteeWallet", - "displayName": "TrusteeWallet" + "name": "trusteeWallet", + "displayName": "trusteeWallet" } diff --git a/app/appstores/Actions/App/App.js b/app/appstores/Actions/App/App.js index cd53b6b34..d761962c4 100644 --- a/app/appstores/Actions/App/App.js +++ b/app/appstores/Actions/App/App.js @@ -4,8 +4,6 @@ import '@app/services/GlobalExceptionHandler/GlobalExceptionHandler' import { Text, Platform, UIManager } from 'react-native' -import Orientation from 'react-native-orientation' - import walletDS from '@app/appstores/DataSource/Wallet/Wallet' import NavStore from '@app/components/navigation/NavStore' @@ -62,7 +60,6 @@ class App { this.initStatus = 'FilePermissions.init' - Orientation.lockToPortrait() this.initStatus = 'await Database.start()' @@ -75,6 +72,7 @@ class App { if (config.debug.appErrors) { console.log(new Date().toISOString() + ' ACT/App init application called finished DB') } + if (!(await walletDS.hasWallet())) { @@ -86,32 +84,33 @@ class App { return } - + AppLockScreenIdleTime.init() this.initStatus = 'AppLockScreenIdleTime.init()' - this.addSupportUiMananger() + this.addSupportUiManager() AppDeepLinking.init() this.initStatus = 'AppDeepLinking.init()' } + this.initHasWallets = true - + await AppNotification.init() - + this.initStatus = 'await AppNotification.init()' - + await customCurrencyActions.importCustomCurrenciesToDict() - + this.initStatus = 'await customCurrencyActions.importCustomCurrenciesToDict()' - + await settingsActions.getSettings(true, false) - + this.initStatus = 'await settingsActions.getSettings()' - + await this.refreshWalletsStore({ firstTimeCall: 'first', source: 'ACT/App init', noRatesApi: true, noCashbackApi: true }) this.initStatus = 'await this.refreshWalletsStore(true)' @@ -161,7 +160,6 @@ class App { // called after wallet create finish return false } - if (firstTimeCall === 'first') { await Log.log('ACT/App appRefreshWalletsStates called from ' + source + ' firstTimeCall ' + JSON.stringify(firstTimeCall)) @@ -182,6 +180,7 @@ class App { await this.setAccountFilterData() + // first step of init await Daemon.forceAll({ ...params, noCashbackApi: true }) @@ -210,7 +209,7 @@ class App { await setFilter(filter) } - addSupportUiMananger = () => { + addSupportUiManager = () => { if (Platform.OS === 'android') { if (UIManager.setLayoutAnimationEnabledExperimental) { UIManager.setLayoutAnimationEnabledExperimental(true) diff --git a/app/appstores/DataSource/Database/core/init/assets/dbTableUpdateQueries.js b/app/appstores/DataSource/Database/core/init/assets/dbTableUpdateQueries.js index 9d2d3e709..16d15ad9f 100644 --- a/app/appstores/DataSource/Database/core/init/assets/dbTableUpdateQueries.js +++ b/app/appstores/DataSource/Database/core/init/assets/dbTableUpdateQueries.js @@ -18,7 +18,7 @@ import { FileSystem } from '@app/services/FileSystem/FileSystem' export default function getTableUpdateQueries() { return { - maxVersion: 139, + maxVersion: 140, updateQuery: { 1: { queryString: `ALTER TABLE account ADD COLUMN transactions_scan_time INTEGER NULL`, @@ -1007,7 +1007,7 @@ export default function getTableUpdateQueries() { 138: { afterFunction: async (dbInterface) => { try { - const zp = new FileSystem({ baseDir: 'zip', fileName: 'logsB', fileExtension: 'zip' }) + const zp = new FileSystem({ baseDir: 'zip', fileName: 'logsB', withDate: false, fileExtension: 'zip' }) await zp.cleanDir() await Log.FS.ALL.cleanFile() await Log.FS.TEST.cleanFile() @@ -1030,6 +1030,22 @@ export default function getTableUpdateQueries() { } }, + 140: { + afterFunction: async (dbInterface) => { + try { + const zp = new FileSystem({ baseDir: 'zip', fileName: 'logsB', withDate: false, fileExtension: 'zip' }) + await zp.cleanDir() + await Log.FS.ALL.cleanFile() + await Log.FS.TEST.cleanFile() + await Log.FS.DAEMON.cleanFile() + await BlocksoftCryptoLog.FS.cleanFile() + await Log.FS.ALL.cleanDir() + } catch (e) { + console.log('DB/Update afterFunction - Migration 140 error', e) + } + } + }, + } } } diff --git a/app/appstores/DataSource/Transaction/Transaction.js b/app/appstores/DataSource/Transaction/Transaction.js index dfa17e7ea..3f3604d5b 100644 --- a/app/appstores/DataSource/Transaction/Transaction.js +++ b/app/appstores/DataSource/Transaction/Transaction.js @@ -351,6 +351,12 @@ class Transaction { NOT(currency_code='TRX' AND transaction_direction = 'income' AND address_amount<${spamLimit}) `) } + const spamLimitUSDT = BlocksoftExternalSettings.getStatic('TRX_SPAM_LIMIT_USDT') * 1 + if (spamLimitUSDT > 1) { + where.push(` + NOT(currency_code='TRX_USDT' AND transaction_direction = 'income' AND address_amount<${spamLimitUSDT}) + `) + } } diff --git a/app/appstores/DataSource/Wallet/WalletPub.js b/app/appstores/DataSource/Wallet/WalletPub.js index 1ae779a86..3907ef221 100644 --- a/app/appstores/DataSource/Wallet/WalletPub.js +++ b/app/appstores/DataSource/Wallet/WalletPub.js @@ -51,17 +51,17 @@ class WalletPub { */ getWalletPubs = async (params) => { if (params && typeof params.walletHash !== 'undefined') { - if (typeof CACHE[params.walletHash] !== 'undefined' && CACHE[params.walletHash] !== false) { - return CACHE[params.walletHash] + if (typeof CACHE?.[params.walletHash] !== 'undefined' && CACHE?.[params.walletHash] !== false) { + return CACHE?.[params.walletHash] } } let where = [] if (params) { - if (typeof params.walletHash !== 'undefined') { + if (typeof params?.walletHash !== 'undefined') { where.push(`wallet_pub.wallet_hash='${params.walletHash}'`) } - if (typeof params.currencyCode !== 'undefined') { + if (typeof params?.currencyCode !== 'undefined') { where.push(`wallet_pub.currency_code='${params.currencyCode}'`) } } diff --git a/app/appstores/Stores/CashBack/CashBackUtils.js b/app/appstores/Stores/CashBack/CashBackUtils.js index 2e72cd98f..080c8cd1d 100644 --- a/app/appstores/Stores/CashBack/CashBackUtils.js +++ b/app/appstores/Stores/CashBack/CashBackUtils.js @@ -1,6 +1,8 @@ /** * @version 0.42 */ +import branch from 'react-native-branch' +import { Linking } from 'react-native' import dynamicLinks from '@react-native-firebase/dynamic-links' import Log from '@app/services/Log/Log' @@ -17,10 +19,6 @@ import store from '@app/store' import trusteeAsyncStorage from '@appV2/services/trusteeAsyncStorage/trusteeAsyncStorage' import settingsActions from '@app/appstores/Stores/Settings/SettingsActions' -import branch from 'react-native-branch' - -const NativeLinking = require('../../../../node_modules/react-native/Libraries/Linking/NativeLinking').default - const CACHE_DATA_FROM_API = {} @@ -42,8 +40,8 @@ class CashBackUtils { firebaseUrl = await dynamicLinks().getInitialLink() await Log.log('SRV/CashBack init dynamicLinks().getInitialLink() ' + JSON.stringify(firebaseUrl)) - const tmp2 = await NativeLinking.getInitialURL() - await Log.log('SRV/CashBack init NativeLinking.getInitialURL() ' + JSON.stringify(tmp2)) + const tmp2 = await Linking.getInitialURL() + await Log.log('SRV/CashBack init Linking.getInitialURL() ' + JSON.stringify(tmp2)) // Branch let branchData @@ -192,12 +190,22 @@ class CashBackUtils { try { let tmpAuthHash = _requestAuthHash if (!tmpAuthHash) { - tmpAuthHash = await settingsActions.getSelectedWallet('createWalletSignature') + try { + tmpAuthHash = await settingsActions.getSelectedWallet('createWalletSignature') + } catch (e) { + throw new Error(e.message + ' while settingsActions.getSelectedWallet') + } } if (!tmpAuthHash) { return false } - const { privateKey, address, cashbackToken } = await this.getByHash(tmpAuthHash, 'ACT/CashBackUtils createSignatureWallet') + let tmp2 + try { + tmp2 = await this.getByHash(tmpAuthHash, 'ACT/CashBackUtils createSignatureWallet') + } catch (e) { + throw new Error(e.message + ' while getByHash') + } + const { privateKey, address, cashbackToken } = tmp2 if (!privateKey) { return false } @@ -209,7 +217,11 @@ class CashBackUtils { msg = new Date().getTime() } } - tmp = await BlocksoftKeysForRef.signDataForApi(msg + '', privateKey) + try { + tmp = await BlocksoftKeysForRef.signDataForApi(msg + '', privateKey) + } catch (e) { + throw new Error(e.message + ' while BlocksoftKeysForRef.signDataForApi') + } tmp.signedAddress = address } if (_requestAuthHash) { @@ -235,5 +247,4 @@ class CashBackUtils { } -const singleCashBackUtils = new CashBackUtils() -export default singleCashBackUtils +export default new CashBackUtils() diff --git a/app/appstores/Stores/Modal/ModalActions.js b/app/appstores/Stores/Modal/ModalActions.js index bcebe4924..0e8721219 100644 --- a/app/appstores/Stores/Modal/ModalActions.js +++ b/app/appstores/Stores/Modal/ModalActions.js @@ -1,7 +1,7 @@ /** * @version 0.9 */ -import { closeOverlay, openOverlay } from 'react-native-blur-overlay' +// import { closeOverlay, openOverlay } from 'react-native-blur-overlay' import { Keyboard } from 'react-native' import store from '../../../store' @@ -12,7 +12,7 @@ export function showModal(data, callback = false) { setTimeout(() => { Keyboard.dismiss() - openOverlay() + // openOverlay() Keyboard.dismiss() }, 500) @@ -26,9 +26,9 @@ export function showModal(data, callback = false) { } export function hideModal() { - setTimeout(() => { - closeOverlay() - }, 500) + // setTimeout(() => { + // closeOverlay() + // }, 500) dispatch({ type: 'HIDE_MODAL', diff --git a/app/appstores/Stores/Send/SendActionsBlockchainWrapper.ts b/app/appstores/Stores/Send/SendActionsBlockchainWrapper.ts index 84f2073e7..4a8994d70 100644 --- a/app/appstores/Stores/Send/SendActionsBlockchainWrapper.ts +++ b/app/appstores/Stores/Send/SendActionsBlockchainWrapper.ts @@ -125,6 +125,7 @@ export namespace SendActionsBlockchainWrapper { newCountedFeesData.amount = uiData.cryptoValue newCountedFeesData.memo = uiData.memo newCountedFeesData.isTransferAll = uiData.isTransferAll + newCountedFeesData.uiType = uiData?.uiType if (newCountedFeesData.isTransferAll && !forceExecAmount) { newCountedFeesData.amount = newCountedFeesData.accountBalanceRaw @@ -231,6 +232,7 @@ export namespace SendActionsBlockchainWrapper { newCountedFeesData.amount = newCountedFeesData.accountBalanceRaw newCountedFeesData.memo = uiData.memo newCountedFeesData.isTransferAll = uiData.isTransferAll + newCountedFeesData.uiType = uiData?.uiType if (!newCountedFeesData.addressTo || newCountedFeesData.addressTo === '' || newCountedFeesData.addressTo === '?') { newCountedFeesData.addressTo = BlocksoftTransferUtils.getAddressToForTransferAll({ currencyCode: newCountedFeesData.currencyCode, diff --git a/app/appstores/Stores/Settings/SettingsActions.js b/app/appstores/Stores/Settings/SettingsActions.js index a3c6f8497..b957b2ef7 100644 --- a/app/appstores/Stores/Settings/SettingsActions.js +++ b/app/appstores/Stores/Settings/SettingsActions.js @@ -1,44 +1,43 @@ /** * @version 0.50 */ -import store from '@app/store' +import * as RNLocalize from 'react-native-localize' +import store from '@app/store' import settingsDS from '@app/appstores/DataSource/Settings/Settings' import Log from '@app/services/Log/Log' import { SettingsKeystore } from './SettingsKeystore' import { fioSdkWrapper } from '@crypto/blockchains/fio/FioSdkWrapper' -import * as RNLocalize from 'react-native-localize' import MarketingEvent from '@app/services/Marketing/MarketingEvent' const { dispatch } = store -const locales = RNLocalize.getLocales(); +const locales = RNLocalize.getLocales() const defaultSettings = { - language : locales[0].languageTag, + language: locales[0].languageTag, local_currency: 'USD', btc_legacy_or_segwit: 'segwit', - notifsStatus : '1', - transactionsNotifs : '1', - exchangeRatesNotifs : '1', - newsNotifs : '1', - isBalanceVisible : '1' + notifsStatus: '1', + transactionsNotifs: '1', + exchangeRatesNotifs: '1', + newsNotifs: '1', + isBalanceVisible: '1' } const settingsActions = { - getSetting: async (key) => { try { const tmp = await settingsDS.getSetting(key) - return tmp ? tmp.paramValue : (typeof defaultSettings[key] !== 'undefined' ? defaultSettings[key] : false) + return tmp ? tmp.paramValue : typeof defaultSettings[key] !== 'undefined' ? defaultSettings[key] : false } catch (e) { Log.err('ACT/Settings getSetting ' + key + ' error ' + e.message) } }, - getSelectedWallet : async (source) => { + getSelectedWallet: async (source) => { try { // console.log(await settingsActions.getSettings()) const walletHash = await settingsActions.getSetting('SELECTED_WALLET') @@ -52,7 +51,7 @@ const settingsActions = { } }, - setSelectedWallet : async (walletHash) => { + setSelectedWallet: async (walletHash) => { return settingsActions.setSettings('SELECTED_WALLET', walletHash) }, @@ -73,7 +72,7 @@ const settingsActions = { getSettings: async (updateStore = true, reloadDB = true) => { try { const tmpSettings = await settingsDS.getSettings(reloadDB) - const settings = {...defaultSettings} + const settings = { ...defaultSettings } let key for (key in tmpSettings) { @@ -84,10 +83,10 @@ const settingsActions = { dispatch({ type: 'UPDATE_SETTINGS', settings, - keystore : { - lockScreenStatus : await SettingsKeystore.getLockScreenStatus(), - askPinCodeWhenSending : await SettingsKeystore.getAskPinCodeWhenSending(), - touchIDStatus : await SettingsKeystore.getTouchIDStatus() + keystore: { + lockScreenStatus: await SettingsKeystore.getLockScreenStatus(), + askPinCodeWhenSending: await SettingsKeystore.getAskPinCodeWhenSending(), + touchIDStatus: await SettingsKeystore.getTouchIDStatus() } }) } @@ -111,7 +110,7 @@ const settingsActions = { setSettingKeyArray: async (keyValues) => { try { - for(const key in keyValues) { + for (const key in keyValues) { const value = keyValues[key] await settingsDS.setSettings(key, value) } diff --git a/app/appstores/Stores/Settings/SettingsStore.js b/app/appstores/Stores/Settings/SettingsStore.js index 85a36dd12..b91a7a6de 100644 --- a/app/appstores/Stores/Settings/SettingsStore.js +++ b/app/appstores/Stores/Settings/SettingsStore.js @@ -3,7 +3,7 @@ */ const INITIAL_STATE = { data: { - isBalanceVisible : true + isBalanceVisible: true }, keystore: { lockScreenStatus: '0', @@ -16,8 +16,9 @@ const settingsStoreReducer = (state = INITIAL_STATE, action) => { switch (action.type) { case 'UPDATE_SETTINGS': return { - data: action.settings, - keystore: action.keystore + ...state, + data: action?.settings, + keystore: action?.keystore } default: return state diff --git a/app/appstores/Stores/Settings/selectors.js b/app/appstores/Stores/Settings/selectors.js index 7f561cc1e..203c06f1d 100644 --- a/app/appstores/Stores/Settings/selectors.js +++ b/app/appstores/Stores/Settings/selectors.js @@ -8,6 +8,11 @@ export const getIsBalanceVisible = createSelector( (data => +data.isBalanceVisible === 1) ) +export const getIsBalanceVisibleV2 = createSelector( + [state => state.settingsStore?.data], + (data => +data.isBalanceVisible === 1) +) + export const getIsSegwit = createSelector( [state => state.settingsStore.data.btc_legacy_or_segwit === 'segwit'], (data => data) @@ -27,18 +32,18 @@ export const getSettingsScreenData = createSelector( [state => state.settingsStore], (data => { return { - language: data.data.language, - localCurrency: data.data.local_currency, - lockScreenStatus: data.keystore.lockScreenStatus, - touchIDStatus: data.keystore.touchIDStatus, - askPinCodeWhenSending: data.keystore.askPinCodeWhenSending, - loggingCode: data.data.loggingCode || 'all', - scannerCode: data.data.scannerCode || '1m', - notifsStatus: +data.data.notifsStatus === 1, - transactionsNotifs: +data.data.transactionsNotifs === 1, - exchangeRatesNotifs: +data.data.exchangeRatesNotifs === 1, - newsNotifs: +data.data.newsNotifs === 1, - isBalanceVisible : +data.data.isBalanceVisible === 1 + language: data?.data?.language, + localCurrency: data?.data?.local_currency, + lockScreenStatus: data?.keystore?.lockScreenStatus, + touchIDStatus: data?.keystore?.touchIDStatus, + askPinCodeWhenSending: data?.keystore.askPinCodeWhenSending, + loggingCode: data?.data?.loggingCode || 'all', + scannerCode: data?.data?.scannerCode || '1m', + notifsStatus: +data?.data?.notifsStatus === 1, + transactionsNotifs: +data?.data?.transactionsNotifs === 1, + exchangeRatesNotifs: +data?.data?.exchangeRatesNotifs === 1, + newsNotifs: +data?.data?.newsNotifs === 1, + isBalanceVisible : +data?.data?.isBalanceVisible === 1 } }) ) diff --git a/app/appstores/Stores/WalletConnect/WalletConnectService.js b/app/appstores/Stores/WalletConnect/WalletConnectService.js index 12f6ea996..14c32d915 100644 --- a/app/appstores/Stores/WalletConnect/WalletConnectService.js +++ b/app/appstores/Stores/WalletConnect/WalletConnectService.js @@ -11,7 +11,8 @@ import { handleSendSignModal, handleSendSignTypedModal, handleSendTransactionRedirect, - handleSessionProposalModal, handleSignTransactionModal + handleSessionProposalModal, handleSignTransactionModal, + handleSessionChangeChainModal } from '@app/appstores/Stores/WalletConnect/helpers' import { Web3Injected } from '@crypto/services/Web3Injected' @@ -30,7 +31,7 @@ import store from '@app/store' let core = false let web3wallet = false -const WC_PROJECT_ID = 'daa39ed4fa0978cc19a9c9c0a2a7015c' // https://cloud.walletconnect.com/app/project +const WC_PROJECT_ID = 'acf247418560ed01a616cc66231ff430' // https://cloud.walletconnect.com/app/project const _getPrivateData = async (from) => { const accountList = store.getState().accountStore.accountList @@ -69,7 +70,8 @@ const _getAccounts = (payload) => { return false } const currentETHAddress = accountList[walletHash]['ETH'] - const namespaces = {} + let namespaces = {} + let found = 0 for (const key in requiredNamespaces) { const accounts = [] for (const chain of requiredNamespaces[key].chains) { @@ -85,12 +87,22 @@ const _getAccounts = (payload) => { accounts.push(`${chain}:${currentETHAddress.address}`) } } + found++ namespaces[key] = { accounts, methods: requiredNamespaces[key].methods, events: requiredNamespaces[key].events } } + if (!found) { + namespaces = { + 'eip155': { + 'accounts': [`eip155:1:${currentETHAddress.address}`], + 'methods': ['eth_sendTransaction', 'personal_sign', 'wallet_switchEthereumChain'], + 'events': ['chainChanged', 'accountsChanged'] + } + } + } return { namespaces } @@ -147,7 +159,21 @@ const walletConnectService = { } } - if (method === 'personal_sign') { + if (method === 'wallet_switchEthereumChain') { + if (config.debug.appErrors) { + console.log('WalletConnectService.on v2 session_request wallet_switchEthereumChain', JSON.stringify(payload)) + } + Log.log('WalletConnectService.on v2 session_request wallet_switchEthereumChain', JSON.stringify(payload)) + + if (typeof params[0] !== 'undefined' && typeof params[0].chainId != 'undefined') { + const tmp = params[0].chainId + const WEB3 = Web3Injected(tmp) + handleSessionChangeChainModal(web3wallet, WEB3.MAIN_CURRENCY_CODE, payload) + } else { + walletConnectService.rejectRequest(web3wallet, payload) + } + + } else if (method === 'personal_sign') { handleSendSignModal(web3wallet, chainId, params[1], params[0], payload) } else if (method.indexOf('eth_') === -1) { if (config.debug.appErrors) { @@ -183,6 +209,14 @@ const walletConnectService = { console.log('WalletConnectService.on v2 session_request error ' + e.message) } Log.log('WalletConnectService.on v2 session_request error ' + e.message) + if (e.message.indexOf('PLEASE ADD SUPPORT') === 0) { + showModal({ + type: 'INFO_MODAL', + icon: null, + title: strings('modal.exchange.sorry'), + description: `Network is not supported` + }) + } } }) @@ -254,7 +288,7 @@ const walletConnectService = { for (const key in activeSessions) { const res = { key, - topic : activeSessions[key].topic, + topic: activeSessions[key].topic, peer: activeSessions[key].peer.metadata } connections.push(res) @@ -268,20 +302,20 @@ const walletConnectService = { return connections }, - killConnections: async (walletConnector) => { + killConnections: async (walletConnector) => { const connections = [] try { const activeSessions = await walletConnector.getActiveSessions() for (const key in activeSessions) { const res = { key, - topic : activeSessions[key].topic, + topic: activeSessions[key].topic, peer: activeSessions[key].peer.metadata } try { await walletConnector.disconnectSession({ topic: activeSessions[key].topic, - reason: getSdkError("USER_DISCONNECTED"), + reason: getSdkError('USER_DISCONNECTED') }) } catch (e) { if (config.debug.appErrors) { @@ -407,7 +441,29 @@ const walletConnectService = { if (config.debug.appErrors) { console.log('WalletConnectService.approveSignTyped2 v2 error ' + e.message) } - Log.log.log('WalletConnectService.approveSignTyped2 v2 error ' + e.message) + Log.log('WalletConnectService.approveSignTyped2 v2 error ' + e.message) + } + }, + + sessionChangeChainModal: async (walletConnector, accountCurrencyCode, payload) => { + try { + Log.log('WalletConnectService.sessionChangeChainModal v2 chainId' + accountCurrencyCode, payload) + + // https://github.com/WalletConnect/wallet-mobile-sdk/blob/b6dfb7d6b8447c7c5b238a10443a1ac28223f38f/react-native/src/WalletMobileSDKEVMProvider.ts#L554 + const res = { + topic: payload.topic, + response: { + id: payload.id, + jsonrpc: '2.0', + result: null + } + } + await walletConnector.respondSessionRequest(res) + } catch (e) { + if (config.debug.appErrors) { + console.log('WalletConnectService.sessionChangeChainModal v2 error ' + e.message) + } + Log.log('WalletConnectService.sessionChangeChainModal v2 error ' + e.message) } }, diff --git a/app/appstores/Stores/WalletConnect/helpers.js b/app/appstores/Stores/WalletConnect/helpers.js index c5c07edcd..3793f740b 100644 --- a/app/appstores/Stores/WalletConnect/helpers.js +++ b/app/appstores/Stores/WalletConnect/helpers.js @@ -125,4 +125,24 @@ export function handleSendSignTypedModal(walletConnector, chainId, from, data, p }, async () => { await walletConnectService.approveSignTyped(walletConnector, chainId, from, data, payload) }) +} + +export function handleSessionChangeChainModal(walletConnector, accountCurrencyCode, payload) { + let title = accountCurrencyCode + for (const tmp of NETWORKS_SETTINGS) { + if (tmp.currencyCode === accountCurrencyCode) { + title = tmp.networkTitle + } + } + showModal({ + type: 'YES_NO_MODAL', + icon: 'WARNING', + title: strings('settings.walletConnect.changeNetwork'), + description: strings('settings.walletConnect.changeNetwork') + ' ' + title, + noCallback: async () => { + walletConnectService.rejectRequest(walletConnector, payload) + } + }, async () => { + await walletConnectService.sessionChangeChainModal(walletConnector, accountCurrencyCode, payload) + }) } \ No newline at end of file diff --git a/app/components/elements/CurrencyIcon.js b/app/components/elements/CurrencyIcon.js index 2ffb2c9c7..692abde16 100644 --- a/app/components/elements/CurrencyIcon.js +++ b/app/components/elements/CurrencyIcon.js @@ -572,6 +572,7 @@ export default class CurrencyIcon extends PureComponent { case 'TRX_USDC': case 'SOL_USDC': case 'MATIC_USDC': + case 'MATIC_USDC_NEW': case 'FTM_USDC': case 'WAVES_USDC': return ( @@ -622,6 +623,11 @@ export default class CurrencyIcon extends PureComponent { case 'ETH_GNO': case 'ETH_APE': case 'ETH_VERSE': + case 'ETH_OUSD': + case 'ETH_OGN': + case 'ETH_OGV': + case 'ETH_PYUSD': + case 'ETH_OETH': return ( @@ -633,12 +639,35 @@ export default class CurrencyIcon extends PureComponent { ) - case 'ETH_KNC': - case 'ETH_KNC_NEW': + case 'ETH_WOUSD': return ( - + + + + + + + ) + + case 'ETH_EURT': + return ( + + + + + + + + + ) + + case 'ETH_WOETH': + return ( + + + @@ -959,6 +988,7 @@ export default class CurrencyIcon extends PureComponent { ) case 'ETH_UAHG': + case 'TRX_UAHG': case 'BNB_SMART_UAHG': return ( @@ -970,6 +1000,32 @@ export default class CurrencyIcon extends PureComponent { ) + + case 'ETH_BOB': + case 'MATIC_BOB': + case 'BNB_SMART_BOB': + return ( + + + + + + + + + ) + + case 'ETH_LDO': + return ( + + + + + + + + + ) case 'CUSTOM_ABYSS': case 'CUSTOM_SOLVE': diff --git a/app/components/elements/CustomIcon.js b/app/components/elements/CustomIcon.js index 841e6ee5a..2b2c3744b 100644 --- a/app/components/elements/CustomIcon.js +++ b/app/components/elements/CustomIcon.js @@ -3,6 +3,6 @@ */ import { createIconSetFromIcoMoon } from 'react-native-vector-icons' -import icoMoonConfig from '@assets/jsons/fonts/selection' +import icoMoonConfig from '@assets/jsons/fonts/selection.json' export default createIconSetFromIcoMoon(icoMoonConfig) diff --git a/app/components/elements/Input.js b/app/components/elements/Input.js index 11a5eddd8..38257c6fd 100644 --- a/app/components/elements/Input.js +++ b/app/components/elements/Input.js @@ -3,7 +3,8 @@ */ import React, { Component } from 'react' import { connect } from 'react-redux' -import { Clipboard, Text, TextInput, View } from 'react-native' +import { Text, TextInput, View } from 'react-native' +import Clipboard from '@react-native-clipboard/clipboard' import { TextField } from 'react-native-material-textfield' import QR from 'react-native-vector-icons/FontAwesome' diff --git a/app/components/elements/NewInput.js b/app/components/elements/NewInput.js index 4dd5ce4f7..3cb018a11 100644 --- a/app/components/elements/NewInput.js +++ b/app/components/elements/NewInput.js @@ -4,9 +4,9 @@ */ import React, { Component } from 'react' import { connect } from 'react-redux' -import { Clipboard, Text, View, Platform, Keyboard } from 'react-native' +import { Text, View, Platform, Keyboard, TextInput } from 'react-native' +import Clipboard from '@react-native-clipboard/clipboard' -import { TextField } from 'react-native-material-textfield' import QR from 'react-native-vector-icons/FontAwesome' import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' @@ -24,7 +24,6 @@ import { ThemeContext } from '@app/theme/ThemeProvider' import TouchableDebounce from './new/TouchableDebounce' class Input extends Component { - constructor(props) { super(props) this.state = { @@ -67,15 +66,17 @@ class Input extends Component { if (typeof pasteCallback !== 'undefined') { pasteCallback(clipboardContent) } - } handleInput = async (value, useCallback, focus = this.state.focus) => { - - value === '' && !focus ? value = this.state.value : value + value === '' && !focus ? (value = this.state.value) : value const { id, name, type, subtype, cuttype, additional, decimals, callback, isTextarea = false } = this.props + this.setState({ + value, + }) + if (additional === 'NUMBER') { value = normalizeInputWithDecimals(value, typeof decimals !== 'undefined' ? decimals : 5) this.setState({ @@ -108,12 +109,12 @@ class Input extends Component { let validation if (cuttype) { - let valueNew = value.trim().replace(/\n/g, " ") + let valueNew = value.trim().replace(/\n/g, ' ') const tmpIndex = valueNew.lastIndexOf('[ Photo ]') if (tmpIndex !== -1) { valueNew = valueNew.slice(tmpIndex + 9).trim() } - if (cuttype === 'TRX' && value.length <= 34 || cuttype === 'FIO') { + if ((cuttype === 'TRX' && value.length <= 34) || cuttype === 'FIO') { // do nothing // TRX addresses can start with TRX } else if (valueNew.indexOf(cuttype) === 0) { @@ -129,16 +130,14 @@ class Input extends Component { const tmps = [] let tmp for (tmp of type) { - tmps.push( - { - id, - name, - type: tmp, - subtype, - cuttype, - value - } - ) + tmps.push({ + id, + name, + type: tmp, + subtype, + cuttype, + value + }) } validation = await Validator.arrayValidation(tmps) @@ -176,9 +175,8 @@ class Input extends Component { } render() { - - const { colors } = this.context - const { value, show, focus, errors, autoFocus } = this.state + const { colors, isLight } = this.context + const { value, focus, errors, autoFocus } = this.state const { id, name, @@ -206,139 +204,120 @@ class Input extends Component { text, containerStyle, inputStyle - } = this.props const placeholder = isCapitalize ? capitalize(name) : name - let error = errors.find(item => item.field === id) + let error = errors.find((item) => item.field === id) error = typeof error !== 'undefined' ? error.msg : '' const isDisabled = typeof disabled !== 'undefined' ? disabled : false - const lineStyle = {} - let elementStyle = {} - if (typeof style !== 'undefined') { - elementStyle = style - } - - - if (isTextarea) { - let height = this.state.inputHeight + 30 - if (height < 70) { - height = 70 - } - elementStyle.minHeight = height - elementStyle.maxHeight = height - lineStyle.top = height - 10 - if (error && height === 70) { - lineStyle.top = height - 20 - } - } + const inputWidth = + (paste && qr) || (paste && search) ? '75%' : fio || search || copy || paste || qr || info || tabInfo || text ? '85%' : '95%' - const inputWidth = ( paste && qr || paste && search ) ? '75%' : ( fio || search || copy || paste || qr || info || tabInfo || text ) ? '85%' : '95%' + const inputValue = validPlaceholder ? !this.state.errors.length && value !== '' && focus === false ? BlocksoftPrettyStrings.makeCut(value, 8) : value : value return ( - - { - show ? - - - this.inputRef = ref} - allowFontScaling={false} - keyboardType={typeof keyboardType !== 'undefined' ? keyboardType : 'default'} - tintColor={typeof tintColor !== 'undefined' ? tintColor : styles.tintColor} - labelHeight={styles.labelHeight} - fontSize={19} - lineWidth={0} - activeLineWidth={0} - placeholder={placeholder} - placeholderTextColor='#999999' - placeholderStyle={{ ...styles.fontFamily, ...inputStyle, fontFamily: 'Montserrat-Semibold' }} - value={validPlaceholder ? !this.state.errors.length && value !== '' && focus === false ? BlocksoftPrettyStrings.makeCut(value, 8) : value : value} - returnKeyLabel='Buy' - onSubmitEditing={typeof onSubmitEditing !== 'undefined' ? onSubmitEditing : () => { - }} - autoFocus={typeof autoFocus !== 'undefined' && !isDisabled ? autoFocus : false} - disabled={isDisabled} - disabledLineType='none' - onChangeText={(value) => this.handleInput(value)} - style={noEdit ? { ...styles.fontFamily, ...inputStyle, color: colors.sendScreen.amount } : { ...styles.fontFamily, ...inputStyle, color: addressError && error ? '#864DD9' : colors.sendScreen.amount }} - multiline={isTextarea} - autoCorrect={false} - spellCheck={false} - label={''} - onBlur={() => { - this.setState({ focus: false }) - }} - onContentSizeChange={(e) => { - const h = e.nativeEvent.contentSize.height - if (h > 1) { - this.setState({ inputHeight: h }) - } - }} - onFocus={typeof onFocus === 'undefined' ? () => { + + + this.inputRef = ref} + allowFontScaling={false} + keyboardType={typeof keyboardType !== 'undefined' ? keyboardType : 'default'} + keyboardAppearance={!isLight ? 'dark' : 'light'} + selectionColor={typeof tintColor !== 'undefined' ? tintColor : styles.tintColor} + placeholder={placeholder} + placeholderTextColor='#999999' + value={inputValue} + onChangeText={this.handleInput} + autoCapitalize='none' + autoCorrect={false} + spellCheck={false} + editable={!isDisabled} + multiline={isTextarea} + onSubmitEditing={typeof onSubmitEditing !== 'undefined' ? onSubmitEditing : () => {}} + autoFocus={typeof autoFocus !== 'undefined' && !isDisabled ? autoFocus : false} + style={ + noEdit + ? [styles.fontFamily, inputStyle, { color: colors.sendScreen.amount }] + : [styles.fontFamily, inputStyle, { color: addressError && error ? '#864DD9' : colors.sendScreen.amount }] + } + onBlur={() => { + this.setState({ focus: false }) + }} + onFocus={ + typeof onFocus === 'undefined' + ? () => { this.setState({ focus: true }) - } : () => { + } + : () => { this.setState({ focus: true }) - onFocus() - }} + onFocus() + } + } + /> + + + {typeof fio !== 'undefined' && fio ? ( + NavStore.goNext('FioChooseRecipient')} style={styles.actionBtn}> + - - : null - } - - { - typeof fio !== 'undefined' && fio ? - NavStore.goNext('FioChooseRecipient')} style={styles.actionBtn}> - - : null - } - { - typeof text !== 'undefined' && text ? - - {text} - : null - } - { - typeof copy !== 'undefined' && copy ? - - - : null - } - { - typeof paste !== 'undefined' && paste ? - - - : null - } - { - typeof qr !== 'undefined' && qr ? - checkQRPermission(qrCallback)} style={styles.actionBtn}> - - : null - } - { - typeof info !== 'undefined' && typeof tabInfo !== 'undefined' && info && tabInfo ? - - - : null - } + + ) : null} + {typeof text !== 'undefined' && text ? ( + {text} + ) : null} + {typeof copy !== 'undefined' && copy ? ( + + + + ) : null} + {typeof paste !== 'undefined' && paste ? ( + + + + ) : null} + {typeof qr !== 'undefined' && qr ? ( + checkQRPermission(qrCallback)} style={styles.actionBtn}> + + + ) : null} + {typeof info !== 'undefined' && typeof tabInfo !== 'undefined' && info && tabInfo ? ( + + + + ) : null} - { - typeof action !== 'undefined' && !disabled ? - - - - {action.title} - - - : null - } + {typeof action !== 'undefined' && !disabled ? ( + + + {action.title} + + + ) : null} ) } @@ -365,7 +344,7 @@ const styles = { flex: 1, position: 'relative', - zIndex: 3, + zIndex: 3 }, content: { flexDirection: 'row', @@ -394,9 +373,10 @@ const styles = { }, fontFamily: { fontFamily: 'SFUIDisplay-Semibold', + fontSize: 19, + lineHeight: 22, marginLeft: 16, - marginTop: -3, - letterSpacing: 1, + letterSpacing: 1 }, mark: { right: 0, @@ -426,11 +406,11 @@ const styles = { height: '100%', flexDirection: 'row', alignItems: 'center', - paddingRight: 16, + paddingRight: 16 }, actionBtn: {}, actionBtn__icon: { - marginLeft: 15, + marginLeft: 15 }, actionBtn__icon_qr: { marginTop: 2 @@ -498,7 +478,6 @@ const styles = { backgroundColor: '#f9f9f9' }, inputShadow: { - shadowColor: '#000', shadowOffset: { @@ -559,7 +538,7 @@ const styles = { y: 0, style: { flexDirection: 'row', - position: 'absolute', + position: 'absolute' } }, text: { diff --git a/app/components/elements/QrCodeBox.js b/app/components/elements/QrCodeBox.js index de4357a88..751e8c15c 100644 --- a/app/components/elements/QrCodeBox.js +++ b/app/components/elements/QrCodeBox.js @@ -3,11 +3,8 @@ */ import React, { Component } from 'react' import QRCode from 'react-native-qrcode-svg' -import QRCodeOld from 'react-native-qrcode' -import OldPhone from '../../services/UI/OldPhone/OldPhone' export default class QrCodeBox extends Component { - constructor(props) { super(props) this.state = {} @@ -17,20 +14,6 @@ export default class QrCodeBox extends Component { if (!this.props.value || this.props.value === '') { return null } - if (OldPhone.isOldPhone()) { - return ( - - ) - } - return ( { - this.sheetBottomRef.snapTo(number) + this.sheetBottomRef.snapToIndex(number) } renderCustomBackdrop = (props) => { diff --git a/app/components/elements/new/Message.js b/app/components/elements/new/Message.js index b6293218a..c8281c85f 100644 --- a/app/components/elements/new/Message.js +++ b/app/components/elements/new/Message.js @@ -4,34 +4,38 @@ */ import React from 'react' -import { - StyleSheet, - Text, - View -} from 'react-native' +import { StyleSheet, Text, View } from 'react-native' import CustomIcon from '@app/components/elements/CustomIcon' import { useTheme } from '@app/theme/ThemeProvider' import LottieView from 'lottie-react-native' import ProgressAnimation from '@assets/jsons/animations/pieWithStroke.json' +import Animated from 'react-native-reanimated' -const Message = (props) => { +const AnimatedLottie = Animated.createAnimatedComponent(LottieView) - const { - colors, - } = useTheme() +const Message = (props) => { + const { colors } = useTheme() - const { - containerStyles, - progress, - timer, - name, - text - } = props + const { containerStyles, progress, timer, name, text, newFlow } = props return ( {timer || false ? ( - + newFlow ? ( + + ) : ( + + ) ) : ( @@ -42,7 +46,6 @@ const Message = (props) => { ) } - export default Message const styles = StyleSheet.create({ diff --git a/app/components/elements/new/ScrollingList.js b/app/components/elements/new/ScrollingList.js index e7438df74..c83ead75a 100644 --- a/app/components/elements/new/ScrollingList.js +++ b/app/components/elements/new/ScrollingList.js @@ -84,7 +84,7 @@ class ScrollingList extends React.PureComponent { ref={ref => this.flatlistRef = ref} data={data} horizontal - keyExtractor={({ index }) => index} + keyExtractor={(_, index) => index} renderItem={this.renderListItem} showsHorizontalScrollIndicator={false} initialScrollIndex={this.state.localIndex} diff --git a/app/components/elements/new/Switch.js b/app/components/elements/new/Switch.js new file mode 100644 index 000000000..77eb3f394 --- /dev/null +++ b/app/components/elements/new/Switch.js @@ -0,0 +1,116 @@ +/** + * @version 2.1 + * @author yura + */ + +import React, { useCallback, useEffect, useState } from 'react' +import { Pressable, StyleSheet } from 'react-native' +import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated' + +const Switch = (props) => { + const { + onPress, + circleColor, + activeBackgroundColor, + inactiveBackgroundColor, + value, + disabled = false, + disabledWithOpacity = false, + animated = true, + width = 44 + } = props + + const [localValue, setLocalValue] = useState(false) + + const switchTranslate = useSharedValue(value ? (width - 6) / 2 : 0) + + useEffect(() => { + if (localValue) { + switchTranslate.value = (width - 6) / 2 + } else { + switchTranslate.value = 0 + } + }, [localValue]) + + useEffect(() => { + setLocalValue(value) + }, [value]) + + const interpolateBackgroundColor = useAnimatedStyle(() => { + return { + backgroundColor: withSpring(!switchTranslate.value ? inactiveBackgroundColor : activeBackgroundColor, { + mass: 0.1, + damping: 20, + stiffness: 20, + overshootClamping: false, + restSpeedThreshold: 0.001, + restDisplacementThreshold: 0.001 + }) + } + }, []) + + const transformCircle = useAnimatedStyle(() => { + return { + transform: [ + { + translateX: withSpring(switchTranslate.value, { + mass: 0.1, + damping: 20, + stiffness: 20, + overshootClamping: false, + restSpeedThreshold: 0.001, + restDisplacementThreshold: 0.001 + }) + } + ] + } + }, []) + + const memoizedOnSwitchPressCallback = useCallback(() => { + if (disabled) return + if (!animated) { + onPress(!value) + return + } + setLocalValue(!localValue) + onPress(!value) + }, [onPress, value, disabled, localValue]) + + return ( + + + + + + ) +} + +export default React.memo(Switch) + +const styles = StyleSheet.create({ + circleStyle: { + width: 22, + height: 22, + borderRadius: 22 + }, + containerStyle: { + width: 44, + paddingVertical: 2, + paddingHorizontal: 2, + borderRadius: 21 + } +}) diff --git a/app/components/elements/new/TextInput.js b/app/components/elements/new/TextInput.js index 8fbea6cb6..79894ae7b 100644 --- a/app/components/elements/new/TextInput.js +++ b/app/components/elements/new/TextInput.js @@ -3,7 +3,8 @@ */ import React from 'react' -import { Text, TextInput, View, StyleSheet, Animated, Keyboard, Clipboard } from 'react-native' +import { Text, TextInput, View, StyleSheet, Animated, Keyboard } from 'react-native' +import Clipboard from '@react-native-clipboard/clipboard' import QR from 'react-native-vector-icons/FontAwesome' import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' diff --git a/app/components/elements/new/list/ListItem/Asset.js b/app/components/elements/new/list/ListItem/Asset.js index ee5043979..68f3fd2f3 100644 --- a/app/components/elements/new/list/ListItem/Asset.js +++ b/app/components/elements/new/list/ListItem/Asset.js @@ -1,18 +1,11 @@ - import React from 'react' -import { - Text, - View, - StyleSheet, -} from 'react-native' - -import Switch from 'react-native-switch-pro' +import { Text, View, StyleSheet } from 'react-native' import CurrencyIcon from '../../../CurrencyIcon' import { useTheme } from '@app/theme/ThemeProvider' import TouchableDebounce from '../../TouchableDebounce' - +import Switch from '../../Switch' const getRightContent = (rightContent, params) => { const { onPress, value, disabled } = params @@ -23,17 +16,17 @@ const getRightContent = (rightContent, params) => { case 'switch': return ( ) - default: return null + default: + return null } } @@ -62,8 +55,7 @@ export default function SettingListItem(props) { onLongPress={onLongPress} delayLongPress={delayLongPress} activeOpacity={0.8} - disabled={disabled} - > + disabled={disabled}> - {title} + + {title} + {TitleExtraView && } - {!!subtitle && {subtitle}} + {!!subtitle && ( + + {subtitle} + + )} {!!rightContent && ( @@ -92,24 +90,24 @@ export default function SettingListItem(props) { const styles = StyleSheet.create({ container: { flexDirection: 'row', - alignItems: 'center', + alignItems: 'center' }, icon: { width: 40, height: 40, borderRadius: 20, - marginRight: 8, + marginRight: 8 }, mainContent: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingLeft: 4, - flex: 1, + flex: 1 }, textContent: { flex: 1, - justifyContent: 'center', + justifyContent: 'center' }, rightContent: { justifyContent: 'center', diff --git a/app/components/elements/new/list/ListItem/Setting.js b/app/components/elements/new/list/ListItem/Setting.js index 58a28193d..a9e739a69 100644 --- a/app/components/elements/new/list/ListItem/Setting.js +++ b/app/components/elements/new/list/ListItem/Setting.js @@ -1,18 +1,12 @@ - import React from 'react' -import { - Text, - View, - StyleSheet, -} from 'react-native' +import { Text, View, StyleSheet } from 'react-native' import { TouchableOpacity } from '@gorhom/bottom-sheet' -import Switch from 'react-native-switch-pro' - import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons' import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome' import CustomIcon from '@app/components/elements/CustomIcon' +import Switch from '../../Switch' import { useTheme } from '@app/theme/ThemeProvider' @@ -21,59 +15,59 @@ import CheckBox from '../../CheckBox' const getIcon = (iconType, color) => { switch (iconType) { case 'wallet': - return + return case 'accounts': - return + return case 'pinCode': - return + return case 'biometricLock': - return + return case 'transactionConfirmation': - return + return case 'notifications': - return + return case 'about': - return + return case 'darkMode': - return + return case 'localCurrency': - return + return case 'config': - return + return case 'testerMode': - return + return case 'changePinCode': - return + return case 'language': - return + return case 'scanning': - return + return case 'shareLogs': - return + return case 'contactSupport': - return + return case 'termsOfUse': - return + return case 'transactions': - return + return case 'privacyPolicy': - return + return case 'exchangeRates': - return + return case 'news': - return + return case 'key': - return + return case 'importWallet': - return + return case 'cashMultiple': - return + return case 'accountBoxMultiple': - return + return case 'cogs': - return + return case 'information': - return + return case 'hd': return case 'rbf': @@ -134,7 +128,8 @@ const getIcon = (iconType, color) => { return case 'blockchain': return - default: return null + default: + return null } } @@ -149,15 +144,14 @@ const getRightContent = (rightContent, params, color, isVisibleDone) => { case 'switch': return ( ) case 'arrow_down': @@ -167,7 +161,8 @@ const getRightContent = (rightContent, params, color, isVisibleDone) => { case 'checkbox': return - default: return null + default: + return null } } @@ -198,8 +193,6 @@ export default function SettingListItem(props) { } = props const { colors, GRID_SIZE } = useTheme() - - if (type === 'dropdown') { return ( <> @@ -209,15 +202,20 @@ export default function SettingListItem(props) { onLongPress={onLongPress} delayLongPress={delayLongPress} activeOpacity={0.8} - disabled={disabled} - > + disabled={disabled}> {getIcon(iconType, colors.common.listItem.basic.iconColorLight)} - {title} - {!!subtitle && {subtitle}} + + {title} + + {!!subtitle && ( + + {subtitle} + + )} {!!rightContent && ( @@ -226,9 +224,7 @@ export default function SettingListItem(props) { )} - {(ExtraView && switchParams.value) && ( - - )} + {ExtraView && switchParams.value && } ) } else { @@ -240,29 +236,51 @@ export default function SettingListItem(props) { onLongPress={onLongPress} delayLongPress={delayLongPress} activeOpacity={0.8} - disabled={disabled} - > - {iconType && - + disabled={disabled}> + {iconType && ( + {getIcon(iconType, customIconStyle?.color || colors.common.listItem.basic.iconColorLight)} - {hasInfo && } + {hasInfo && ( + + )} - } + )} - - {title} - {!!subtitle && {subtitle}} + + + {title} + + {!!subtitle && ( + + {subtitle} + + )} {!!rightContent && ( - + {getRightContent(rightContent, { ...switchParams, disabled, onPress, checked }, colors.common.text1, isVisibleDone)} )} - {ExtraView && ( - - )} + {ExtraView && } {!last && } ) @@ -272,7 +290,7 @@ export default function SettingListItem(props) { const styles = StyleSheet.create({ container: { flexDirection: 'row', - alignItems: 'center', + alignItems: 'center' }, icon: { width: 40, @@ -287,11 +305,11 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', - flex: 1, + flex: 1 }, textContent: { flex: 1, - justifyContent: 'center', + justifyContent: 'center' }, rightContent: { justifyContent: 'center', @@ -329,6 +347,6 @@ const styles = StyleSheet.create({ width: 10, height: 10, borderRadius: 5, - borderWidth: 2, + borderWidth: 2 } }) diff --git a/app/components/modal/elements/CustomReceiveAmountModal.js b/app/components/modal/elements/CustomReceiveAmountModal.js index 0ba338563..c1f054497 100644 --- a/app/components/modal/elements/CustomReceiveAmountModal.js +++ b/app/components/modal/elements/CustomReceiveAmountModal.js @@ -85,7 +85,7 @@ class CustomReceiveAmountModal extends Component { // noinspection ES6MissingAwait prettyShare({ message, url: `data:image/png;base64,${data}`, title : 'QR', type: 'image/png' }) } else { - const fs = new FileSystem({fileEncoding: 'base64', fileName : 'QR', fileExtension : 'jpg'}) + const fs = new FileSystem({fileEncoding: 'base64', fileName : 'QR', withDate: false, fileExtension : 'jpg'}) await fs.writeFile(data) // noinspection ES6MissingAwait prettyShare({ message, url: await fs.getPathOrBase64() }) diff --git a/app/daemons/back/UpdateAccountBalanceAndTransactionsHD.js b/app/daemons/back/UpdateAccountBalanceAndTransactionsHD.js index 4a72633f6..a746d2db9 100644 --- a/app/daemons/back/UpdateAccountBalanceAndTransactionsHD.js +++ b/app/daemons/back/UpdateAccountBalanceAndTransactionsHD.js @@ -72,7 +72,7 @@ class UpdateAccountBalanceAndTransactionsHD { for (key in this._logNews) { await appNewsDS.saveAppNews({ onlyOne: true, walletHash: key, currencyCode: 'BTC', newsGroup: 'ONE_BY_ONE_SCANNER', newsName: 'HD_SCANNED_LAST_TIME', - newsJson: { log: this._logNews[key].substr(0, 50) + '...' } + newsJson: { log: this._logNews[key].substr(0, 50) + '...' }, }) } } diff --git a/app/daemons/back/UpdateAppNewsDaemon.js b/app/daemons/back/UpdateAppNewsDaemon.js index bd8483e2e..ce1892af5 100644 --- a/app/daemons/back/UpdateAppNewsDaemon.js +++ b/app/daemons/back/UpdateAppNewsDaemon.js @@ -50,12 +50,7 @@ class UpdateAppNewsDaemon { const walletHash = await settingsActions.getSelectedWallet('UpdateNewsDaemon') let res - let asked = false if (!dataUpdate) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateNewsDaemon loading new') - } - asked = true try { res = await ApiProxy.getAll({...params, source: 'UpdateAppNewsDaemon.updateAppNews' }) } catch (e) { @@ -80,12 +75,6 @@ class UpdateAppNewsDaemon { return false } - if (!asked) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateNewsDaemon loaded proxy') - } - } - CACHE_NEWS_HASH = typeof res.newsHash !== 'undefined' ? res.newsHash : '' const keys = { diff --git a/app/daemons/back/UpdateCardsDaemon.js b/app/daemons/back/UpdateCardsDaemon.js index f56c5d87c..a37f8191b 100644 --- a/app/daemons/back/UpdateCardsDaemon.js +++ b/app/daemons/back/UpdateCardsDaemon.js @@ -34,17 +34,12 @@ class UpdateCardsDaemon { Log.daemon('UpdateCardsDaemon called') - let asked = false if (!dataUpdate) { const authHash = await settingsActions.getSelectedWallet('UpdateCardsDaemon') if (!authHash) { Log.daemon('UpdateCardsDaemon skipped as no auth') return false } - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateCardsDaemon loading new') - } - asked = true try { dataUpdate = await ApiProxy.getAll({ ...params, source: 'UpdateCardsDaemon.updateCards' }) } catch (e) { @@ -60,11 +55,6 @@ class UpdateCardsDaemon { } if (typeof dataUpdate.forCardsAll !== 'undefined' && dataUpdate.forCardsAll) { - if (!asked) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateCardsDaemon loaded proxy forCardsAll') - } - } try { const saved = await cardDS.getCards() const cardsSaved = {} @@ -146,9 +136,6 @@ class UpdateCardsDaemon { return false } } else if (typeof dataUpdate.forCardsOk !== 'undefined' && dataUpdate.forCardsOk) { - if (!asked) { - console.log(new Date().toISOString() + ' UpdateCardsDaemon loaded proxy forCardsOk', JSON.stringify(params)) - } try { for (const number in dataUpdate.forCardsOk) { const dataOne = dataUpdate.forCardsOk[number] diff --git a/app/daemons/back/UpdateCashBackDataDaemon.js b/app/daemons/back/UpdateCashBackDataDaemon.js index 6c9d3301b..116534488 100644 --- a/app/daemons/back/UpdateCashBackDataDaemon.js +++ b/app/daemons/back/UpdateCashBackDataDaemon.js @@ -77,12 +77,6 @@ class UpdateCashBackDataDaemon { return } - if (!asked) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateCashBackDataDaemon loaded proxy') - } - } - try { Log.daemon('UpdateCashBackDataDaemon result ', data) data.time = new Date().getTime() diff --git a/app/daemons/back/UpdateTradeOrdersDaemon.js b/app/daemons/back/UpdateTradeOrdersDaemon.js index 19a677f83..4fb23a340 100644 --- a/app/daemons/back/UpdateTradeOrdersDaemon.js +++ b/app/daemons/back/UpdateTradeOrdersDaemon.js @@ -140,12 +140,7 @@ class UpdateTradeOrdersDaemon { try { let res = false - let asked = false if (!dataUpdate) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateTradeOrdersDaemon loading new') - } - asked = true res = await ApiProxy.getAll({ source: 'UpdateTradeOrdersDaemon.updateTradeOrders' }) if (config.debug.appErrors) { console.log(new Date().toISOString() + ' UpdateTradeOrdersDaemon loaded new finished') @@ -170,12 +165,6 @@ class UpdateTradeOrdersDaemon { return false } - if (!asked) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateTradeOrdersDaemon loaded proxy') - } - } - let item const index = {} diff --git a/app/daemons/back/UpdateWalletsDaemon.js b/app/daemons/back/UpdateWalletsDaemon.js index b08c7ce8c..176c3ba20 100644 --- a/app/daemons/back/UpdateWalletsDaemon.js +++ b/app/daemons/back/UpdateWalletsDaemon.js @@ -34,17 +34,12 @@ class UpdateWalletsDaemon { Log.daemon('UpdateWalletsDaemon called') - let asked = false if (!dataUpdate) { const authHash = await settingsActions.getSelectedWallet('_updateWalletsDaemon') if (!authHash) { Log.daemon('UpdateWalletsDaemon skipped as no auth') return false } - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateWalletsDaemon loading new') - } - asked = true try { dataUpdate = await ApiProxy.getAll({ ...params, source: 'UpdateWalletsDaemon.updateWallets' }) } catch (e) { @@ -60,11 +55,6 @@ class UpdateWalletsDaemon { } if (typeof dataUpdate.forWalletsAll !== 'undefined' && dataUpdate.forWalletsAll) { - if (!asked) { - if (config.debug.appErrors) { - console.log(new Date().toISOString() + ' UpdateWalletsDaemon loaded proxy forWalletsAll') - } - } try { const saved = await walletDS.getWallets() diff --git a/app/daemons/view/UpdateAccountListDaemon.js b/app/daemons/view/UpdateAccountListDaemon.js index 0229555aa..962533f76 100644 --- a/app/daemons/view/UpdateAccountListDaemon.js +++ b/app/daemons/view/UpdateAccountListDaemon.js @@ -327,7 +327,9 @@ class UpdateAccountListDaemon extends Update { for (tmpWalletHash of tmpWalletHashes) { // console.log('updateAccounts ' + tmpWalletHash + ' ' + currencyCode + ' ' + rate, reformatted[tmpWalletHash][currencyCode]) if (typeof reformatted[tmpWalletHash][currencyCode] === 'undefined') { - if (currencyCode === 'BTC' && typeof walletPub[tmpWalletHash] !== 'undefined') { + if (currencyCode === 'FIO') { + // do nothing + } else if (currencyCode === 'BTC' && typeof walletPub[tmpWalletHash] !== 'undefined') { Log.daemon('UpdateAccountListDaemon need to generate ' + tmpWalletHash + ' ' + currencyCode) const res = await walletPubDS.discoverMoreAccounts({ diff --git a/app/modules/Account/AccountFilter/AccountTransactionCategories.js b/app/modules/Account/AccountFilter/AccountTransactionCategories.js index 3067b6046..6c871aad7 100644 --- a/app/modules/Account/AccountFilter/AccountTransactionCategories.js +++ b/app/modules/Account/AccountFilter/AccountTransactionCategories.js @@ -218,7 +218,7 @@ class TransactionCategories extends React.PureComponent { data={this.state.categoriesData} renderItem={this.renderItem} ListHeaderComponent={this.renderHeaderComponent} - keyExtractor={({ index }) => index} + keyExtractor={(_, index) => index} />