Skip to content

Commit

Permalink
Merge branch v1.50.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rhrusha committed Dec 20, 2021
2 parents cfa5480 + d7ce0a9 commit 5147aff
Show file tree
Hide file tree
Showing 199 changed files with 11,691 additions and 4,736 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.50.2"
versionName "1.50.3"

missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
Expand Down
Binary file modified android/app/src/main/assets/fonts/icomoon.ttf
Binary file not shown.
45 changes: 29 additions & 16 deletions app/appstores/Actions/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,34 @@ import { Text } from 'react-native'

import Orientation from 'react-native-orientation'

import walletDS from '../../DataSource/Wallet/Wallet'
import walletDS from '@app/appstores/DataSource/Wallet/Wallet'

import NavStore from '../../../components/navigation/NavStore'
import NavStore from '@app/components/navigation/NavStore'

import { setSelectedWallet } from '../../Stores/Main/MainStoreActions'
import { setInitState, setInitError } from '../../Stores/Init/InitStoreActions'
import walletActions from '../../Stores/Wallet/WalletActions'
import currencyActions from '../../Stores/Currency/CurrencyActions'
import settingsActions from '../../Stores/Settings/SettingsActions'
import { setFilter, setSelectedWallet, setSortValue, setStakingCoins } from '@app/appstores/Stores/Main/MainStoreActions'
import { setInitState, setInitError } from '@app/appstores/Stores/Init/InitStoreActions'
import walletActions from '@app/appstores/Stores/Wallet/WalletActions'
import currencyActions from '@app/appstores/Stores/Currency/CurrencyActions'
import settingsActions from '@app/appstores/Stores/Settings/SettingsActions'
import customCurrencyActions from '../CustomCurrencyActions'

import Database, { cleanupNotNeeded } from '@app/appstores/DataSource/Database'

import Log from '../../../services/Log/Log'
import AppLockScreenIdleTime from '../../../services/AppLockScreenIdleTime/AppLockScreenIdleTime'
import AppNotification from '../../../services/AppNotification/AppNotificationListener'
import Log from '@app/services/Log/Log'
import AppLockScreenIdleTime from '@app/services/AppLockScreenIdleTime/AppLockScreenIdleTime'
import AppNotification from '@app/services/AppNotification/AppNotificationListener'

import Daemon from '../../../daemons/Daemon'
import CashBackUtils from '../../Stores/CashBack/CashBackUtils'
import Daemon from '@app/daemons/Daemon'
import CashBackUtils from '@app/appstores/Stores/CashBack/CashBackUtils'

import FilePermissions from '../../../services/FileSystem/FilePermissions'
import UpdateAppNewsDaemon from '../../../daemons/back/UpdateAppNewsDaemon'
import UpdateAccountListDaemon from '../../../daemons/view/UpdateAccountListDaemon'
import FilePermissions from '@app/services/FileSystem/FilePermissions'
import UpdateAppNewsDaemon from '@app/daemons/back/UpdateAppNewsDaemon'
import UpdateAccountListDaemon from '@app/daemons/view/UpdateAccountListDaemon'


import config from '../../../config/config'
import config from '@app/config/config'
import currencyBasicActions from '@app/appstores/Stores/CurrencyBasic/CurrencyBasicActions'
import trusteeAsyncStorage from '@appV2/services/trusteeAsyncStorage/trusteeAsyncStorage'

if (Text.defaultProps == null) Text.defaultProps = {}
Text.defaultProps.allowFontScaling = false
Expand Down Expand Up @@ -168,9 +169,15 @@ class App {

await currencyBasicActions.init()

await setSortValue(trusteeAsyncStorage.getSortValue() || null)

await this.setAccountFilterData()

// first step of init
await Daemon.forceAll({ ...params, noCashbackApi: true })

await setStakingCoins()

} else if (firstTimeCall === 'second') {
// second step of init
await cleanupNotNeeded()
Expand All @@ -188,6 +195,12 @@ class App {
await Log.log('ACT/App appRefreshWalletsStates called from ' + source + ' firstTimeCall ' + JSON.stringify(firstTimeCall) + ' finished')
}

setAccountFilterData = async () => {
let filter = await trusteeAsyncStorage.getAccountFilterData()
filter = typeof filter !== 'undefined' && filter && Object.keys(filter) ? filter : {}
await setFilter(filter)
}


}

Expand Down
10 changes: 0 additions & 10 deletions app/appstores/Actions/CustomCurrencyActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ const customCurrencyActions = {
if (typeof (currencyToAdd.tokenType) === 'undefined') {
throw new Error('set tokenType')
}
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'BNB_SMART_20'
&& currencyToAdd.tokenType !== 'MATIC_ERC_20' && currencyToAdd.tokenType !== 'FTM_ERC_20'
&& currencyToAdd.tokenType !== 'TRX' && currencyToAdd.tokenType !== 'SOL') {
throw new Error('only ETH_ERC_20 / BNB_SMART_20 / MATIC_ERC_20 / SOL or TRX tokenType is supported')
}
if (typeof (currencyToAdd.tokenAddress) === 'undefined') {
throw new Error('set tokenAddress')
}
Expand Down Expand Up @@ -61,11 +56,6 @@ const customCurrencyActions = {
if (typeof (currencyToAdd.tokenType) === 'undefined') {
throw new Error('set tokenType')
}
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'TRX'
&& currencyToAdd.tokenType !== 'MATIC_ERC_20' && currencyToAdd.tokenType !== 'FTM_ERC_20'
&& currencyToAdd.tokenType !== 'BNB_SMART_20' && currencyToAdd.tokenType !== 'SOL') {
throw new Error('only ETH_ERC_20 or TRX tokenType is supported')
}
if (typeof (currencyToAdd.currencyCode) === 'undefined') {
throw new Error('set currencyCode')
}
Expand Down
16 changes: 16 additions & 0 deletions app/appstores/Actions/TransactionActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import EthTmpDS from '@crypto/blockchains/eth/stores/EthTmpDS'
import store from '@app/store'
import { setSelectedAccount, setSelectedAccountTransactions, setSelectedCryptoCurrency } from '@app/appstores/Stores/Main/MainStoreActions'
import NavStore from '@app/components/navigation/NavStore'
import TransactionFilterTypeDict from '@appV2/dicts/transactionFilterTypeDict'


const transactionActions = {
Expand All @@ -41,6 +42,7 @@ const transactionActions = {
* @param {object} transaction.bseOrderData
* @param {string} transaction.createdAt: new Date().toISOString(),
* @param {string} transaction.updatedAt: new Date().toISOString()
* @param {string} transaction.transactionFilterType: swap | walletConnect | fee | usual
*/
saveTransaction: async (transaction, source = '') => {

Expand Down Expand Up @@ -139,9 +141,19 @@ const transactionActions = {
preformatWithBSEforShowInner(transaction) {
const direction = transaction.transactionDirection
transaction.addressAmountPrettyPrefix = (direction === 'outcome' || direction === 'self' || direction === 'freeze' || direction === 'swap_outcome') ? '-' : '+'
if (direction === 'vote') {
transaction.addressAmountPrettyPrefix = ''
}
if (typeof transaction.wayType === 'undefined' || !transaction.wayType) {
transaction.wayType = transaction.transactionDirection
}
if (transaction?.bseOrderData) {
transaction.wayType = TransactionFilterTypeDict.SWAP
}
if (transaction?.addressAmount === 0 || transaction?.transactionFilterType === TransactionFilterTypeDict.FEE) {
transaction.addressAmountPrettyPrefix = '-'
transaction.wayType = TransactionFilterTypeDict.FEE
}
return transaction
},

Expand Down Expand Up @@ -191,6 +203,10 @@ const transactionActions = {
bseOrderData : exchangeOrder
}

if (typeof exchangeOrder !== 'undefined' && exchangeOrder) {
transaction.transactionFilterType = TransactionFilterTypeDict.SWAP
}

transaction.transactionBlockchainStatus = transaction.transactionStatus
transaction.transactionVisibleStatus = this.prepareStatus(transaction.transactionStatus)

Expand Down
23 changes: 18 additions & 5 deletions app/appstores/DataSource/Account/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import store from '@app/store'
const tableName = 'account'
let SAVED_UNIQUE = {}

import tokenBlockchainBlocksoftDict from '@crypto/assets/tokenBlockchainBlocksoftDict.json'

class Account {

/**
Expand Down Expand Up @@ -145,15 +147,25 @@ class Account {
// do nothing
continue
}

if (typeof settings.addressCurrencyCode !== 'undefined' && typeof settings.tokenBlockchain !== 'undefined' && settings.tokenBlockchain !== 'BITCOIN' ) {
const { accountList } = store.getState().accountStore
if (typeof accountList[params.walletHash] !== 'undefined' && typeof accountList[params.walletHash][settings.addressCurrencyCode] !== 'undefined') {
const tmpAccount = accountList[params.walletHash][settings.addressCurrencyCode]
let tmpAccount = false
if (typeof accountList[params.walletHash] !== 'undefined') {
const tokenCurrencyCode = typeof tokenBlockchainBlocksoftDict[settings.tokenBlockchain] !== 'undefined' ? tokenBlockchainBlocksoftDict[settings.tokenBlockchain].currencyCode : false
if (tokenCurrencyCode && typeof accountList[params.walletHash][tokenCurrencyCode] !== 'undefined') {
tmpAccount = accountList[params.walletHash][tokenCurrencyCode]
} else if (typeof accountList[params.walletHash][settings.addressCurrencyCode] !== 'undefined') {
tmpAccount = accountList[params.walletHash][settings.addressCurrencyCode]
}
}

if (tmpAccount) {
tmpAccounts = [{
address: tmpAccount.address,
index : tmpAccount.derivationIndex,
path : tmpAccount.derivationPath,
type : tmpAccount.derivationType,
index: tmpAccount.derivationIndex,
path: tmpAccount.derivationPath,
type: tmpAccount.derivationType,
alreadyShown: tmpAccount.alreadyShown,
addedData: tmpAccount.accountJson
}]
Expand Down Expand Up @@ -495,6 +507,7 @@ class Account {
account_balance.balance_txt AS balanceTxt,
account_balance.unconfirmed_fix AS unconfirmedFix,
account_balance.unconfirmed_txt AS unconfirmedTxt,
account_balance.balance_staked_txt AS balanceStaked,
account_balance.balance_provider AS balanceProvider,
account_balance.balance_scan_time AS balanceScanTime,
account_balance.balance_scan_error AS balanceScanError,
Expand Down
49 changes: 47 additions & 2 deletions app/appstores/DataSource/Account/AccountScanning.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,38 @@ class AccountScanning {
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 All @@ -91,6 +123,7 @@ class AccountScanning {
account_balance.balance_txt AS balanceTxt,
account_balance.unconfirmed_fix AS unconfirmedFix,
account_balance.unconfirmed_txt AS unconfirmedTxt,
account_balance.balance_staked_txt AS balanceStaked,
account_balance.balance_provider AS balanceProvider,
account_balance.balance_scan_time AS balanceScanTime,
Expand Down Expand Up @@ -141,6 +174,7 @@ class AccountScanning {
continue
}
uniqueAddresses[key] = res[i].id

res[i].balance = BlocksoftFixBalance(res[i], 'balance')
res[i].unconfirmed = BlocksoftFixBalance(res[i], 'unconfirmed')
res[i].balanceScanBlock = typeof res[i].balanceScanBlock !== 'undefined' ? (res[i].balanceScanBlock * 1) : 0
Expand Down Expand Up @@ -170,6 +204,8 @@ class AccountScanning {
}

async getAddresses (params) {
const withBalances = typeof params.withBalances !== 'undefined' && params.withBalances

let where = []
if (params.walletHash) {
where.push(`account.wallet_hash='${params.walletHash}'`)
Expand All @@ -193,8 +229,13 @@ class AccountScanning {
account.currency_code AS currencyCode,
account.wallet_hash AS walletHash,
account.already_shown AS alreadyShown,
account.address
account.address,
account_balance.balance_txt AS balanceTxt,
account_balance.balance_scan_time AS balanceScanTime,
account_balance.balance_scan_error AS balanceScanError,
account_balance.balance_scan_log AS balanceScanLog
FROM account
LEFT JOIN account_balance ON account_balance.account_id = account.id
${where}
`

Expand All @@ -213,7 +254,11 @@ class AccountScanning {
res = res.array
let tmp
for (tmp of res) {
indexedRes[tmp.address] = tmp.alreadyShown
if (withBalances) {
indexedRes[tmp.address] = tmp
} else {
indexedRes[tmp.address] = tmp.alreadyShown
}
}
} catch (e) {
Log.daemon('AccountScanning getAddresses error ' + sql + ' ' + e.message)
Expand Down
2 changes: 1 addition & 1 deletion app/appstores/DataSource/Currency/Currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
const data = []
let row
for (row of res.array) {
if (row.currencyCode === 'NFT') continue
if (row.currencyCode === 'NFT' || row.currencyCode === 'CASHBACK') continue
data.push(row.currencyCode)
}
data.push('BTC_SEGWIT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ export default function getTableQueries() {
balance_scan_error TEXT NULL,
balance_scan_log TEXT NULL,
balance_scan_block VARCHAR(32) NULL,
balance_staked_txt VARCHAR(256) NULL,
status INTEGER NOT NULL,
Expand Down Expand Up @@ -284,6 +286,7 @@ export default function getTableQueries() {
address_amount INTEGER NULL,
transaction_fee INTEGER NULL,
transaction_fee_currency_code VARCHAR(256) NULL,
transaction_filter_type VARCHAR(256) NULL,
vout VARCHAR(256) NULL,
vin VARCHAR(256) NULL,
Expand All @@ -305,7 +308,9 @@ export default function getTableQueries() {
created_at DATETIME NULL,
mined_at DATETIME NULL,
updated_at DATETIME NULL,
hidden_at DATETIME NULL
hidden_at DATETIME NULL,
special_action_needed VARCHAR(256) NULL
)`
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import settingsActions from '@app/appstores/Stores/Settings/SettingsActions'

export default function getTableUpdateQueries() {
return {
maxVersion: 124,
maxVersion: 128,
updateQuery: {
1: {
queryString: `ALTER TABLE account ADD COLUMN transactions_scan_time INTEGER NULL`,
Expand Down Expand Up @@ -894,6 +894,24 @@ export default function getTableUpdateQueries() {
}
}
},

125: {
afterFunction: async (dbInterface) => {
await dbInterface.query(`INSERT INTO currency (currency_code, is_hidden, currency_rate_json, currency_rate_scan_time) VALUES ('CASHBACK', '0', '', '')`)
}
},

126: {
queryString: `ALTER TABLE transactions ADD COLUMN transaction_filter_type VARCHAR(256) NULL DEFAULT 'usual'`
},

127: {
queryString: `ALTER TABLE account_balance ADD COLUMN balance_staked_txt VARCHAR(256) NULL DEFAULT '0'`
},

128: {
queryString: `ALTER TABLE transactions ADD COLUMN special_action_needed VARCHAR(256) NULL`
}
}
}
}
Loading

0 comments on commit 5147aff

Please sign in to comment.