Skip to content

Commit

Permalink
Merge branch v1.51.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rhrusha committed Mar 24, 2023
2 parents ca36a30 + 79ef792 commit 5fa0120
Show file tree
Hide file tree
Showing 201 changed files with 4,955 additions and 2,929 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include:
- project: 'Trustee/walletinternals'
ref: master
file: '/gitlabcicd/wallet-gitlab-ci.yml'
- project: 'Trustee/walletinternals'
ref: master
file: '/githubcicd/wallet-github-ci.yml'
# - project: 'Trustee/walletinternals'
# ref: master
# file: '/githubcicd/wallet-github-ci.yml'

13 changes: 0 additions & 13 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import React from 'react'
import { Provider } from 'react-redux'
import { AppearanceProvider } from 'react-native-appearance'
import { enableScreens } from 'react-native-screens'
import appsFlyer from 'react-native-appsflyer'

import store from '@app/store'

Expand All @@ -16,18 +15,6 @@ import { ThemeProvider } from '@app/theme/ThemeProvider'

import Application from '@app/appstores/Actions/App/App'


appsFlyer.initSdk(
{
devKey: 'qUa6hSzjW3RDsTgEYQh4oT',
isDebug: false,
appId: '1462924276',
onInstallConversionDataListener: true, // Optional
onDeepLinkListener: true, // Optional
timeToWaitForATTUserAuthorization: 10 // for iOS 14.5
}
);

enableScreens()

export default class App extends React.Component {
Expand Down
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def enableProguardInReleaseBuilds = false
* 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:+'
def jscFlavor = 'org.webkit:android-jsc-intl:+'

/**
* Whether to enable the Hermes VM.
Expand All @@ -133,7 +134,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.50.8"
versionName "1.51.2"

missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Binary file modified android/app/src/main/assets/fonts/icomoon.ttf
Binary file not shown.
20 changes: 18 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ buildscript {
firebaseMessagingVersion = "21.1.0"
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = "1.6.0"
}
repositories {
google()
Expand All @@ -28,6 +29,21 @@ buildscript {

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
Expand Down
41 changes: 1 addition & 40 deletions app/appstores/DataSource/Account/AccountScanning.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class AccountScanning {
let where = []
let limit = 3

//where.push(`account.currency_code='ETH_UAX'`)

if (typeof params.force === 'undefined' || !params.force) {
const now = Math.round(new Date().getTime() / 1000) - 30 // 1 minute before
where.push(`(account_balance.balance_scan_time IS NULL OR account_balance.balance_scan_time < ${now} OR account.transactions_scan_time IS NULL OR account.transactions_scan_time < ${now})`)
Expand Down Expand Up @@ -74,39 +72,6 @@ class AccountScanning {
} else {
where = ''
}

const sqlTotal = `
SELECT
account.id,
account.currency_code AS currencyCode,
account.wallet_hash AS walletHash,
account.address,
account.transactions_scan_time AS transactionsScanTime,
account.transactions_scan_log AS transactionsScanLog,
account_balance.balance_provider AS balanceProvider,
account_balance.balance_scan_time AS balanceScanTime,
account_balance.balance_scan_error AS balanceScanError,
account_balance.balance_scan_log AS balanceScanLog,
account_balance.balance_scan_block AS balanceScanBlock
FROM account
LEFT JOIN account_balance ON account_balance.account_id=account.id
LEFT JOIN currency ON currency.currency_code=account.currency_code
LEFT JOIN wallet ON wallet.wallet_hash=account.wallet_hash
ORDER BY account_balance.balance_scan_time ASC, account.currency_code ASC
`
const resTotal = await Database.query(sqlTotal)
let tmp = ''
for (const account1 of resTotal.array) {
tmp += account1.currencyCode + ' ' + account1.address + ' ' + (account1.balanceScanLog ? account1.balanceScanLog.substr(0, 200) : '') + `
`
}
Log.test(`
============================================================================================
${new Date().toISOString()} accounts total
${tmp}
`)

const sql = `
SELECT
account.id,
Expand Down Expand Up @@ -141,15 +106,13 @@ class AccountScanning {
ORDER BY account_balance.balance_scan_time ASC, account.currency_code ASC
LIMIT ${limit}
`
Log.daemon('AccountScanning getAccountsForScan where ' + where + ' limit ' + limit)

let res = []
const uniqueAddresses = {}
const idsToRemove = []
try {
res = await Database.query(sql)
if (!res || typeof res.array === 'undefined' || !res.array || !res.array.length) {
Log.daemon('AccountScanning getAccountsForScan finished as empty')
return false
}
res = res.array
Expand Down Expand Up @@ -191,7 +154,6 @@ class AccountScanning {
}
}
if (idsToRemove.length > 0) {
Log.daemon('AccountScanning getAccountsForScan unique check finished, found ' + idsToRemove.join(','))
Log.daemon('AccountScanning getAccountsForScan not removed', uniqueAddresses)

await Database.query(`DELETE FROM account WHERE id IN (${idsToRemove.join(',')})`)
Expand Down Expand Up @@ -244,7 +206,6 @@ class AccountScanning {
try {
let res = await Database.query(sql)
if (!res || typeof res.array === 'undefined' || !res.array || !res.array.length) {
Log.daemon('AccountScanning getAddresses finished as empty')
return false
}
if (typeof params.limit !== 'undefined') {
Expand All @@ -254,7 +215,7 @@ class AccountScanning {
}

res = res.array

res = res.map(e => e.addressName.includes("CREATED") ? {...e, addressName: ''} : e)

let tmp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import currencyActions from '@app/appstores/Stores/Currency/CurrencyActions'
import { SettingsKeystore } from '@app/appstores/Stores/Settings/SettingsKeystore'

import Log from '@app/services/Log/Log'
import BlocksoftCryptoLog from '@crypto/common/BlocksoftCryptoLog'

import countries from '@assets/jsons/other/country-codes'

import settingsActions from '@app/appstores/Stores/Settings/SettingsActions'
import { FileSystem } from '@app/services/FileSystem/FileSystem'


export default function getTableUpdateQueries() {
return {
maxVersion: 136,
maxVersion: 138,
updateQuery: {
1: {
queryString: `ALTER TABLE account ADD COLUMN transactions_scan_time INTEGER NULL`,
Expand Down Expand Up @@ -976,7 +979,47 @@ export default function getTableUpdateQueries() {
AND (transaction_hash='${address}')`)
}
}
}
},

137: {
afterFunction: async (dbInterface) => {
try {
const res = await dbInterface.query(`SELECT is_hidden FROM currency WHERE currency_code='ETH_RSR'`)
if (res && res.array) {
for(const row of res.array) {
console.log(`row old`, row)
const res3 = await dbInterface.query(`SELECT is_hidden FROM currency WHERE currency_code='ETH_RSR_NEW'`)
if (!res3 || !res3.array || !res3.array.length) {
Log.log('DB/Update afterFunction insert RSR_NEW')
await dbInterface.query(`INSERT INTO currency ( currency_code , currency_rate_scan_time , is_hidden ) VALUES ( 'ETH_RSR_NEW' , '0' , ${row.is_hidden})`)
} else {
Log.log('DB/Update afterFunction update RSR_NEW')
await dbInterface.query(`UPDATE currency SET is_hidden=${row.is_hidden} WHERE currency_code='ETH_RSR_NEW'`)
}
}
}
} catch (e) {
Log.err('DB/Update afterFunction - Migration 137 error', e)
}
}
},

138: {
afterFunction: async (dbInterface) => {
try {
const zp = new FileSystem({ baseDir: 'zip', fileName: 'logsB', 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 138 error', e)
}
}
},

}
}
}
21 changes: 18 additions & 3 deletions app/appstores/DataSource/Transaction/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Log from '@app/services/Log/Log'
import BlocksoftUtils from '@crypto/common/BlocksoftUtils'
import config from '@app/config/config'
import TransactionFilterTypeDict from '@appV2/dicts/transactionFilterTypeDict'
import BlocksoftExternalSettings from '@crypto/common/BlocksoftExternalSettings'

class Transaction {

Expand Down Expand Up @@ -238,6 +239,7 @@ class Transaction {
* @param {string} params.filterTypeHideSwap
* @param {string} params.filterTypeHideStake
* @param {string} params.filterTypeHideWalletConnect
* @param {string} params.filterTypeShowSpam
* @returns {Promise<[{createdAt, updatedAt, blockTime, blockHash, blockNumber, blockConfirmations, transactionHash, addressFrom, addressAmount, addressTo, transactionFee, transactionStatus, transactionDirection, accountId, walletHash, currencyCode, transactionOfTrusteeWallet, transactionJson}]>}
*/
getTransactions = async (params, source = '?') => {
Expand Down Expand Up @@ -340,6 +342,17 @@ class Transaction {
`)
}

if (typeof params.filterTypeShowSpam !== 'undefined' && params.filterTypeShowSpam) {
// do nothing
} else {
const spamLimit = BlocksoftExternalSettings.getStatic('TRX_SPAM_LIMIT') * 1
if (spamLimit > 1) {
where.push(`
NOT(currency_code='TRX' AND transaction_direction = 'income' AND address_amount<${spamLimit})
`)
}
}


// other categories
if (typeof params.filterTypeHideSwap !== 'undefined' && params.filterTypeHideSwap) {
Expand Down Expand Up @@ -385,7 +398,10 @@ class Transaction {
}

where.push(`transaction_hash !=''`)
where.push(`NOT (transaction_direction IN ('swap_income', 'income') AND (address_amount == '0' OR address_amount IS NULL))`)

// trx fee somehow marked as "swap_income"
where.push(`NOT (currency_code != 'TRX' AND transaction_direction IN ('swap_income', 'income') AND (address_amount == '0' OR address_amount IS NULL))`)
where.push(`NOT (currency_code = 'TRX' AND address_from !='' AND (address_amount == '0' OR address_amount IS NULL))`)

let order = ' ORDER BY created_at DESC, id DESC'
if (params.noOrder) {
Expand All @@ -394,8 +410,7 @@ class Transaction {
where.push(`(hidden_at IS NULL OR hidden_at='null')`)
}

// where.push(`(address_from OR adress_to OR transaction_hash) LIKE ('d2884dd42808150753d')`)
// where.push(`'${source}' = '${source})


if (where.length > 0) {
where = ' WHERE (' + where.join(') AND (') + ')'
Expand Down
11 changes: 6 additions & 5 deletions app/appstores/DataSource/Wallet/Wallet.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @version 0.9
* @version 0.77
*/
import Database from '@app/appstores/DataSource/Database'

import BlocksoftKeysUtils from '@crypto/actions/BlocksoftKeys/BlocksoftKeysUtils'
import Log from '@app/services/Log/Log'
import CashBackUtils from '@app/appstores/Stores/CashBack/CashBackUtils'
import UpdateWalletsDaemon from '@app/daemons/back/UpdateWalletsDaemon'

import store from '@app/store'
import Validator from '@app/services/UI/Validator/Validator'


const CACHE = []
Expand Down Expand Up @@ -66,11 +66,9 @@ class Wallet {
* @returns {Promise<void>}
*/
clearWallet = async (wallet) => {
Log.daemon('DS/Wallet clear wallet called ' + wallet.walletHash)
const sql = `DELETE FROM wallet WHERE wallet_hash='${wallet.walletHash}'`
await Database.query(sql)
CACHE[wallet.walletHash] = false
Log.daemon('DS/Wallet clear wallet finished ' + wallet.walletHash)
}

/**
Expand Down Expand Up @@ -192,7 +190,6 @@ class Wallet {
wallet_is_created_here AS walletIsCreatedHere
FROM wallet ORDER BY wallet_number`)
if (!res || !res.array) {
Log.log('DS/Wallet getWallets no result')
return []
}
for (let i = 0, ic = res.array.length; i < ic; i++) {
Expand All @@ -215,6 +212,10 @@ class Wallet {
_prepWallet(wallet) {
wallet.walletToSendStatus = wallet.walletToSendStatus * 1
wallet.walletName = Database.unEscapeString(wallet.walletName)
const safeName = Validator.safeWords(wallet.walletName, 10)
if (wallet.walletName !== safeName) {
Database.query(`UPDATE wallet SET wallet_name='${Database.escapeString(safeName)}' WHERE wallet_hash='${wallet.walletHash}'`)
}
wallet.walletNumber = wallet.walletNumber * 1 || 1
wallet.walletIsHd = wallet.walletIsHd * 1 || 0
if (typeof wallet.walletIsBackedUp !== 'undefined') {
Expand Down
Loading

0 comments on commit 5fa0120

Please sign in to comment.