Skip to content

Commit cfa5480

Browse files
committed
Merge branch v1.50.2
2 parents f4b1e4c + 747126e commit cfa5480

File tree

168 files changed

+4091
-1964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+4091
-1964
lines changed

App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import React from 'react'
66

77
import { Provider } from 'react-redux'
88
import { AppearanceProvider } from 'react-native-appearance'
9-
import { Linking, Platform, UIManager } from 'react-native'
9+
import { Platform, UIManager } from 'react-native'
1010

1111
import store from '@app/store'
1212

1313
import Router from '@app/router'
1414
import { ThemeProvider } from '@app/theme/ThemeProvider'
1515

1616
import Application from '@app/appstores/Actions/App/App'
17-
import { SendDeepLinking } from '@app/appstores/Stores/Send/SendDeepLinking'
1817

1918
import appsFlyer from 'react-native-appsflyer'
2019

@@ -33,7 +32,6 @@ export default class App extends React.Component {
3332

3433
componentDidMount() {
3534
Application.init({ source: 'App.mount', onMount : true })
36-
Linking.addEventListener('url', (data) => SendDeepLinking.handleInitialURL(data.url))
3735

3836
if (Platform.OS === 'android') {
3937
if (UIManager.setLayoutAnimationEnabledExperimental) {

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ android {
133133
minSdkVersion rootProject.ext.minSdkVersion
134134
targetSdkVersion rootProject.ext.targetSdkVersion
135135
versionCode 1
136-
versionName "1.40.930"
136+
versionName "1.50.2"
137137

138138
missingDimensionStrategy 'react-native-camera', 'general'
139139
multiDexEnabled true

android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
<category android:name="android.intent.category.DEFAULT" />
7777
<category android:name="android.intent.category.BROWSABLE" />
7878
</intent-filter>
79+
<intent-filter>
80+
<action android:name="android.intent.action.VIEW"/>
81+
<category android:name="android.intent.category.DEFAULT"/>
82+
<category android:name="android.intent.category.BROWSABLE"/>
83+
<data android:host="trustee.app.link" android:scheme="https"/>
84+
</intent-filter>
7985
<intent-filter android:autoVerify="true">
8086
<action android:name="android.intent.action.VIEW" />
8187
<category android:name="android.intent.category.DEFAULT" />
11.6 KB
Binary file not shown.

android/app/src/main/java/com/trusteewallet/MainActivity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ protected void onStart() {
6666
RNBranchModule.initSession(getIntent().getData(), this);
6767
}
6868

69+
@Override
70+
protected void onRestart() {
71+
super.onRestart();
72+
Intent intent = getIntent();
73+
setIntent(intent);
74+
intent.putExtras(this.getIntent());
75+
intent.putExtra("branch_force_new_session", true);
76+
}
77+
78+
6979
@Override
7080
public void onNewIntent(Intent intent) {
7181
super.onNewIntent(intent);

app/appstores/Actions/App/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class App {
158158

159159
await Log.log('ACT/App appRefreshWalletsStates called from ' + source + ' firstTimeCall ' + JSON.stringify(firstTimeCall))
160160

161-
await CashBackUtils.init({},'ACT/App appRefreshWalletsStates called from' + source)
161+
await CashBackUtils.init({}, 'ACT/App appRefreshWalletsStates called from' + source)
162162

163163
await walletActions.setAvailableWallets()
164164

@@ -182,7 +182,7 @@ class App {
182182
} else {
183183
await Daemon.forceAll(params)
184184

185-
await CashBackUtils.init({}, 'ACT/App appRefreshWalletsStates init ' + firstTimeCall)
185+
await CashBackUtils.init({}, 'ACT/App appRefreshWalletsStates init ' + firstTimeCall)
186186
}
187187

188188
await Log.log('ACT/App appRefreshWalletsStates called from ' + source + ' firstTimeCall ' + JSON.stringify(firstTimeCall) + ' finished')

app/appstores/Actions/CustomCurrencyActions.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ const customCurrencyActions = {
2525
if (typeof (currencyToAdd.tokenType) === 'undefined') {
2626
throw new Error('set tokenType')
2727
}
28-
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'BNB_SMART_20' && currencyToAdd.tokenType !== 'TRX' && currencyToAdd.tokenType !== 'SOL') {
29-
throw new Error('only ETH_ERC_20 / BNB_SMART_20 / SOL or TRX tokenType is supported')
28+
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'BNB_SMART_20'
29+
&& currencyToAdd.tokenType !== 'MATIC_ERC_20' && currencyToAdd.tokenType !== 'FTM_ERC_20'
30+
&& currencyToAdd.tokenType !== 'TRX' && currencyToAdd.tokenType !== 'SOL') {
31+
throw new Error('only ETH_ERC_20 / BNB_SMART_20 / MATIC_ERC_20 / SOL or TRX tokenType is supported')
3032
}
3133
if (typeof (currencyToAdd.tokenAddress) === 'undefined') {
3234
throw new Error('set tokenAddress')
@@ -59,7 +61,9 @@ const customCurrencyActions = {
5961
if (typeof (currencyToAdd.tokenType) === 'undefined') {
6062
throw new Error('set tokenType')
6163
}
62-
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'TRX' && currencyToAdd.tokenType !== 'BNB_SMART_20' && currencyToAdd.tokenType !== 'SOL') {
64+
if (currencyToAdd.tokenType !== 'ETH_ERC_20' && currencyToAdd.tokenType !== 'TRX'
65+
&& currencyToAdd.tokenType !== 'MATIC_ERC_20' && currencyToAdd.tokenType !== 'FTM_ERC_20'
66+
&& currencyToAdd.tokenType !== 'BNB_SMART_20' && currencyToAdd.tokenType !== 'SOL') {
6367
throw new Error('only ETH_ERC_20 or TRX tokenType is supported')
6468
}
6569
if (typeof (currencyToAdd.currencyCode) === 'undefined') {

app/appstores/DataSource/Account/Account.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Account {
126126

127127
const tmpName = Database.escapeString('CREATED by ' + source + ' at ' + new Date().toISOString())
128128

129+
let settings
129130
for (code of currencyCode) {
130131
if (typeof accounts[code] === 'undefined') {
131132
throw new Error('DS/Account discoverAddresses NO ACCOUNTS FOR ' + code)
@@ -138,7 +139,12 @@ class Account {
138139
code = 'LTC'
139140
}
140141

141-
const settings = BlocksoftDict.getCurrencyAllSettings(code)
142+
try {
143+
settings = BlocksoftDict.getCurrencyAllSettings(code, 'Account')
144+
} catch (e) {
145+
// do nothing
146+
continue
147+
}
142148
if (typeof settings.addressCurrencyCode !== 'undefined' && typeof settings.tokenBlockchain !== 'undefined' && settings.tokenBlockchain !== 'BITCOIN' ) {
143149
const { accountList } = store.getState().accountStore
144150
if (typeof accountList[params.walletHash] !== 'undefined' && typeof accountList[params.walletHash][settings.addressCurrencyCode] !== 'undefined') {
@@ -200,7 +206,7 @@ class Account {
200206
wallet_hash AS walletHash,
201207
wallet_pub_id AS walletPubId
202208
FROM ${tableName}
203-
WHERE currency_code='${code}' AND address='${account.address}'`
209+
WHERE currency_code='${code}' AND address='${account.address}' AND wallet_hash='${params.walletHash}'`
204210

205211
let find = await Database.query(findSql)
206212
if (find.array.length === 0) {

app/appstores/DataSource/Currency/Currency.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ export default {
4848
* @returns {Promise<void>}
4949
*/
5050
insertCurrency: async (data) => {
51-
await Database.setTableName(tableName).setInsertData(data).insert()
51+
try {
52+
await Database.setTableName(tableName).setInsertData(data).insert()
53+
} catch (e) {
54+
// do nothing
55+
}
5256
},
5357

5458
/**

app/appstores/DataSource/Database/core/init/assets/dbTableUpdateQueries.js

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import settingsActions from '@app/appstores/Stores/Settings/SettingsActions'
1616

1717
export default function getTableUpdateQueries() {
1818
return {
19-
maxVersion: 119,
19+
maxVersion: 124,
2020
updateQuery: {
2121
1: {
2222
queryString: `ALTER TABLE account ADD COLUMN transactions_scan_time INTEGER NULL`,
@@ -829,7 +829,71 @@ export default function getTableUpdateQueries() {
829829
afterFunction: async (dbInterface) => {
830830
await dbInterface.query(`INSERT INTO currency (currency_code, is_hidden, currency_rate_json, currency_rate_scan_time) VALUES ('NFT', '0', '', '')`)
831831
}
832-
}
832+
},
833+
834+
120: {
835+
afterFunction: async (dbInterface) => {
836+
const res = await dbInterface.query(`SELECT currency_code FROM custom_currency WHERE token_type='TRX'`)
837+
if (res && res.array) {
838+
console.log('dbUpdate TRX tokens 1 ' + JSON.stringify(res.array))
839+
for (const row of res.array) {
840+
await dbInterface.query(`UPDATE currency SET currency_code='CUSTOM_TRX_${row.currency_code}' WHERE currency_code='CUSTOM_${row.currency_code}'`)
841+
}
842+
}
843+
}
844+
},
845+
846+
121: {
847+
afterFunction: async (dbInterface) => {
848+
const res = await dbInterface.query(`SELECT currency_code FROM custom_currency WHERE token_type='TRX'`)
849+
if (res && res.array) {
850+
console.log('dbUpdate TRX tokens 2 ' + JSON.stringify(res.array))
851+
for (const row of res.array) {
852+
await dbInterface.query(`UPDATE account SET currency_code='CUSTOM_TRX_${row.currency_code}' WHERE currency_code='CUSTOM_${row.currency_code}'`)
853+
}
854+
}
855+
}
856+
},
857+
858+
122: {
859+
afterFunction: async (dbInterface) => {
860+
const res = await dbInterface.query(`SELECT currency_code FROM custom_currency WHERE token_type='TRX'`)
861+
if (res && res.array) {
862+
console.log('dbUpdate TRX tokens 3 ' + JSON.stringify(res.array))
863+
for (const row of res.array) {
864+
await dbInterface.query(`UPDATE account_balance SET currency_code='CUSTOM_TRX_${row.currency_code}' WHERE currency_code='CUSTOM_${row.currency_code}'`)
865+
}
866+
}
867+
}
868+
},
869+
870+
123: {
871+
afterFunction: async (dbInterface) => {
872+
const res = await dbInterface.query(`SELECT currency_code FROM custom_currency WHERE token_type='TRX'`)
873+
if (res && res.array) {
874+
console.log('dbUpdate TRX tokens 4 ' + JSON.stringify(res.array))
875+
for (const row of res.array) {
876+
await dbInterface.query(`UPDATE transactions SET currency_code='CUSTOM_TRX_${row.currency_code}' WHERE currency_code='CUSTOM_${row.currency_code}'`)
877+
}
878+
}
879+
}
880+
},
881+
882+
124: {
883+
afterFunction: async (dbInterface) => {
884+
const res = await dbInterface.query(`SELECT currency_code, token_address FROM custom_currency WHERE token_type='TRX'`)
885+
if (res && res.array) {
886+
console.log('dbUpdate TRX tokens 5 ' + JSON.stringify(res.array))
887+
for (const row of res.array) {
888+
if (row.token_address.indexOf('0x') !== -1) {
889+
await dbInterface.query(`DELETE FROM custom_currency WHERE token_type='TRX' AND token_address='${row.token_address}'`)
890+
} else {
891+
await dbInterface.query(`UPDATE custom_currency SET currency_code='CUSTOM_TRX_${row.currency_code}' WHERE currency_code='CUSTOM_${row.currency_code}'`)
892+
}
893+
}
894+
}
895+
}
896+
},
833897
}
834898
}
835899
}

0 commit comments

Comments
 (0)