Skip to content

Commit a300a04

Browse files
authored
Merge pull request #116 from syscoin/dev
Dev
2 parents a13a71f + 475e979 commit a300a04

File tree

40 files changed

+1133
-754
lines changed

40 files changed

+1133
-754
lines changed

app/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ android {
5151
applicationId "io.paliwallet"
5252
minSdkVersion rootProject.ext.minSdkVersion
5353
targetSdkVersion rootProject.ext.targetSdkVersion
54-
versionCode 16
55-
versionName "1.0.5"
54+
versionCode 18
55+
versionName "1.0.7"
5656
multiDexEnabled true
5757
missingDimensionStrategy "minReactNative", "minReactNative46"
5858
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/app/components/Main/MainNavigator.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import TransactionsView from '../UI/TransactionsView';
3434
import GlobeIcon from '../UI/GlobeIcon';
3535
import WalletIcon from '../UI/WalletIcon';
3636
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
37+
import LanguageSelector from '../Views/LanguageSelector';
3738

3839
const options = {
3940
enableVibrateFallback: true,
@@ -407,6 +408,16 @@ export default createStackNavigator(
407408
}
408409
}
409410
})
411+
},
412+
LanguageSelectorView: {
413+
screen: createStackNavigator({
414+
LanguageSelector: {
415+
screen: LanguageSelector,
416+
navigationOptions: {
417+
header: null
418+
}
419+
}
420+
})
410421
}
411422
},
412423
{

app/app/components/Main/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ const Main = props => {
289289
const [allSession, setAllSession] = useState({});
290290
const [isAddChainModalVisible, setIsAddChainModalVisible] = useState(false);
291291
const [addChainInfo, setAddChainInfo] = useState('');
292+
const [reloadCounter, setReloadCounter] = useState(0);
292293

293294
const backgroundMode = useRef(false);
294295
const removeConnectionStatusListener = useRef();
@@ -902,6 +903,17 @@ const Main = props => {
902903
loadSessions();
903904
}, [loadSessions]);
904905

906+
const reloadChild = () => {
907+
setReloadCounter(reloadCounter + 1);
908+
};
909+
910+
useEffect(() => {
911+
DeviceEventEmitter.addListener('languageUpdated', reloadChild);
912+
return () => {
913+
DeviceEventEmitter.removeAllListeners('languageUpdated');
914+
};
915+
}, [reloadChild]);
916+
905917
useEffect(() => {
906918
WC2Manager.hub.on('walletconnectSessionRequest', handleSessionRequest);
907919
WC2Manager.hub.on('walletconnectAddChain', handleAddChain);
@@ -1252,7 +1264,7 @@ const Main = props => {
12521264
</Modal>
12531265
);
12541266
return (
1255-
<React.Fragment>
1267+
<React.Fragment key={reloadCounter + 'main-screen'}>
12561268
<View style={styles.flex}>
12571269
<View style={styles.navigatorView}>
12581270
<SafeAreaProvider>

app/app/components/UI/AssetActionView/index.js

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React, { PureComponent } from 'react';
22
import { toggleShowHint } from '../../../actions/hint';
33
import { connect } from 'react-redux';
44
import PropTypes from 'prop-types';
5-
import { ActivityIndicator, Image, ScrollView, StyleSheet, TouchableOpacity } from 'react-native';
6-
import { colors } from '../../../styles/common';
5+
import { ActivityIndicator, View, Text, Image, ScrollView, StyleSheet, TouchableOpacity } from 'react-native';
6+
import { colors, fontStyles } from '../../../styles/common';
77
import { calcAssetPrices } from '../../../util/number';
88
import Modal from 'react-native-modal';
99
import SendTab from '../../Views/SendFlow/SendTab';
@@ -19,16 +19,7 @@ import Engine from '../../../core/Engine';
1919
import { strings } from '../../../../locales/i18n';
2020
import Device from '../../../util/Device';
2121
import { shouldHideSthForAppStoreReviewer } from '../../../util/ApiClient';
22-
import ImageCapInset from '../ImageCapInset';
2322

24-
import img_send_cn from '../../../images/img_send_cn.png';
25-
import img_send_en from '../../../images/img_send_en.png';
26-
import img_swap_cn from '../../../images/img_swap_cn.png';
27-
import img_swap_en from '../../../images/img_swap_en.png';
28-
import img_crosschain_cn from '../../../images/img_crosschain_cn.png';
29-
import img_crosschain_en from '../../../images/img_crosschain_en.png';
30-
import img_receive_cn from '../../../images/img_receive_cn.png';
31-
import img_receive_en from '../../../images/img_receive_en.png';
3223
import { supportMigration } from '../../Views/SendFlow/MoveTab/Bridge';
3324
import { EngineContracts, EngineNetworks } from '../../../util/ControllerUtils';
3425

@@ -46,6 +37,12 @@ const styles = StyleSheet.create({
4637
flexDirection: 'row',
4738
paddingHorizontal: 15
4839
},
40+
buttonContainer: {
41+
color: '#4D76B8',
42+
fontSize: 16,
43+
lineHeight: 24,
44+
...fontStyles.semibold
45+
},
4946
actionView: {
5047
marginHorizontal: -7,
5148
justifyContent: 'center',
@@ -54,6 +51,19 @@ const styles = StyleSheet.create({
5451
bottomModal: {
5552
justifyContent: 'flex-end',
5653
margin: 0
54+
},
55+
buttonView: {
56+
minWidth: 70,
57+
height: 40,
58+
backgroundColor: 'white',
59+
borderWidth: 1,
60+
borderColor: '#4D76B8',
61+
borderRadius: 5,
62+
justifyContent: 'center',
63+
alignItems: 'center',
64+
marginTop: 15,
65+
marginLeft: 10,
66+
paddingHorizontal: 15
5767
}
5868
});
5969

@@ -309,68 +319,33 @@ class AssetActionView extends PureComponent {
309319
horizontal
310320
contentContainerStyle={styles.actionContainer}
311321
>
312-
<ImageCapInset
313-
style={[styles.actionView, { width: buttonWidth }]}
314-
source={isAndroid ? { uri: 'img_btn_bg' } : require('../../../images/img_btn_bg.png')}
315-
capInsets={{ top: 0, left: 20, bottom: 0, right: 20 }}
316-
>
322+
<View style={[styles.buttonView, { marginLeft: 0 }]}>
317323
<TouchableOpacity onPress={this.showSendModal} activeOpacity={activeOpacity}>
318-
<Image
319-
style={imageWidths[1] && { width: imageWidths[1] }}
320-
onLayout={e => this.onImageLayout(1, buttonWidth, e)}
321-
source={isZh ? img_send_cn : img_send_en}
322-
resizeMode={'contain'}
323-
/>
324+
<Text style={styles.buttonContainer}>{strings('other.send')}</Text>
324325
</TouchableOpacity>
325-
</ImageCapInset>
326+
</View>
327+
326328
{!isRpc && showSwapButton && (
327-
<ImageCapInset
328-
style={[styles.actionView, { width: buttonWidth }]}
329-
source={isAndroid ? { uri: 'img_btn_bg' } : require('../../../images/img_btn_bg.png')}
330-
capInsets={{ top: 0, left: 20, bottom: 0, right: 20 }}
331-
>
329+
<View style={styles.buttonView}>
332330
<TouchableOpacity onPress={this.onSwap} activeOpacity={activeOpacity}>
333-
<Image
334-
style={imageWidths[2] && { width: imageWidths[2] }}
335-
onLayout={e => this.onImageLayout(2, buttonWidth, e)}
336-
source={isZh ? img_swap_cn : img_swap_en}
337-
resizeMode={'contain'}
338-
/>
331+
<Text style={styles.buttonContainer}>{strings('other.swap')}</Text>
339332
</TouchableOpacity>
340-
</ImageCapInset>
333+
</View>
341334
)}
342-
<ImageCapInset
343-
style={[styles.actionView, { width: buttonWidth }]}
344-
source={isAndroid ? { uri: 'img_btn_bg' } : require('../../../images/img_btn_bg.png')}
345-
capInsets={{ top: 0, left: 20, bottom: 0, right: 20 }}
346-
>
335+
<View style={[styles.buttonView, { minWidth: 85 }]}>
347336
<TouchableOpacity onPress={this.showMigrateModal} activeOpacity={activeOpacity}>
348337
{migrationLoading ? (
349-
<ActivityIndicator style={styles.buttonIcon} color={colors.brandPink300} />
338+
<ActivityIndicator style={styles.buttonIcon} color={'#4D76B8'} />
350339
) : (
351-
<Image
352-
style={imageWidths[3] && { width: imageWidths[3] }}
353-
onLayout={e => this.onImageLayout(3, buttonWidth, e)}
354-
source={isZh ? img_crosschain_cn : img_crosschain_en}
355-
resizeMode={'contain'}
356-
/>
340+
<Text style={styles.buttonContainer}>{strings('other.bridge')}</Text>
357341
)}
358342
</TouchableOpacity>
359-
</ImageCapInset>
360-
<ImageCapInset
361-
style={[styles.actionView, { width: buttonWidth }]}
362-
source={isAndroid ? { uri: 'img_btn_bg' } : require('../../../images/img_btn_bg.png')}
363-
capInsets={{ top: 0, left: 20, bottom: 0, right: 20 }}
364-
>
343+
</View>
344+
<View style={styles.buttonView}>
365345
<TouchableOpacity onPress={this.showReceiveModal} activeOpacity={activeOpacity}>
366-
<Image
367-
style={imageWidths[4] && { width: imageWidths[4] }}
368-
onLayout={e => this.onImageLayout(4, buttonWidth, e)}
369-
source={isZh ? img_receive_cn : img_receive_en}
370-
resizeMode={'contain'}
371-
/>
346+
<Text style={styles.buttonContainer}>{strings('other.receive')}</Text>
372347
</TouchableOpacity>
373-
</ImageCapInset>
348+
</View>
374349
</ScrollView>
375350

376351
{this.renderReceiveModal()}

app/app/components/UI/AssetView/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ import {
1414
ActivityIndicator
1515
} from 'react-native';
1616
import { baseStyles, colors, fontStyles } from '../../../styles/common';
17-
import { convertUsdValue, getChainIdByType, onlyAddCurrencySymbol, renderCoinValue } from '../../../util/number';
17+
import {
18+
convertUsdValue,
19+
getChainIdByType,
20+
onlyAddCurrencySymbol,
21+
renderCoinValue,
22+
extractTicker
23+
} from '../../../util/number';
1824
import { WebView } from 'react-native-webview';
1925
import Locked from '../Locked';
2026
import { strings } from '../../../../locales/i18n';
@@ -397,12 +403,14 @@ class AssetView extends PureComponent {
397403
const { TokenRatesController } = Engine.context;
398404
const { ticker, load } = await TokenRatesController.getTvSymbol(asset.symbol);
399405
if (ticker) {
400-
this.setState({ ticker });
406+
const newTicker = extractTicker(ticker);
407+
this.setState({ ticker: newTicker });
401408
return true;
402409
} else if (load) {
403410
const nowTicker = await TokenRatesController.loadTvSymbol(asset.symbol);
411+
const extractedTicker = extractTicker(nowTicker);
404412
if (nowTicker) {
405-
this.setState({ ticker: nowTicker });
413+
this.setState({ ticker: extractedTicker });
406414
}
407415
return !!nowTicker;
408416
}

app/app/components/UI/Icon/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Trash from '../../../images/svg/trash.svg';
1111
import Visibility from '../../../images/svg/visibility.svg';
1212
import VisibilityOff from '../../../images/svg/visibilityOff.svg';
1313
import Wallet from '../../../images/svg/wallet.svg';
14+
import CoinGecko from '../../../images/svg/coingecko-logo.svg';
1415

1516
const icons = {
1617
accountSettings: AccountSettings,
@@ -23,7 +24,8 @@ const icons = {
2324
trash: Trash,
2425
visibility: Visibility,
2526
visibilityOff: VisibilityOff,
26-
wallet: Wallet
27+
wallet: Wallet,
28+
coinGecko: CoinGecko
2729
};
2830

2931
const Icon = _props => {

app/app/components/UI/NFTImage/index.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ class NFTImage extends PureComponent {
124124
addAudioUrl(urlValue);
125125
}
126126
}
127-
if (res.info()?.headers['Content-Length'] && res.info().headers['Content-Length'] > 1024 * 1024) {
127+
if (
128+
res.info()?.headers['Content-Length'] &&
129+
res.info().headers['Content-Length'] > 1024 * 1024 * 3
130+
) {
128131
addOutOfMemoryUrl(urlValue);
129132
}
130133
}
@@ -256,20 +259,11 @@ class NFTImage extends PureComponent {
256259
return (
257260
<FastImage
258261
ref={this.refImage}
259-
source={
260-
defaultLoadingError
261-
? defaultImg || require('../../../images/nft_default_placehoder.png')
262-
: { uri: urlValue }
263-
}
262+
source={{ uri: urlValue }}
264263
style={[style, showBorder && styles.borderStyle]}
265-
onLoadEnd={onLoadEnd}
266264
resizeMode={resizeMode}
265+
onLoadEnd={onLoadEnd}
267266
onLoad={onLoad}
268-
onError={() => {
269-
if (!defaultLoadingError) {
270-
this.setState({ defaultLoadingError: true });
271-
}
272-
}}
273267
/>
274268
);
275269
}

app/app/components/UI/NetworkFee/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const styles = StyleSheet.create({
7777
},
7878
tabView: {
7979
width: '100%',
80-
height: 92
80+
minHeight: 92
8181
},
8282
slider: {
8383
flex: 1,

app/app/components/UI/Tokens/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,11 +1442,16 @@ class Tokens extends PureComponent {
14421442
};
14431443

14441444
renderOtcBanner = () => {
1445-
// 1005 x 216
1446-
const imgSource =
1447-
strings('other.accept_language') === 'zh'
1448-
? require('../../../images/img_otc_banner_cn.png')
1449-
: require('../../../images/img_otc_banner_en.png');
1445+
const getImgSource = () => {
1446+
switch (strings('other.accept_language')) {
1447+
case 'zh':
1448+
return require('../../../images/img_otc_banner_cn.png');
1449+
case 'es':
1450+
return require('../../../images/img_otc_banner_es.png');
1451+
default:
1452+
return require('../../../images/img_otc_banner_en.png');
1453+
}
1454+
};
14501455
const imgWidth = width - 40;
14511456
const imgHeight = (216 * imgWidth * 1.0) / 1005;
14521457
return (
@@ -1464,7 +1469,7 @@ class Tokens extends PureComponent {
14641469
height: imgHeight
14651470
}
14661471
]}
1467-
source={imgSource}
1472+
source={getImgSource()}
14681473
/>
14691474
<TouchableOpacity
14701475
activeOpacity={0.8}

app/app/components/UI/TypedSign/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export default class TypedSign extends PureComponent {
100100
</View>
101101
) : (
102102
<Text style={styles.messageText}>
103-
<Text style={styles.msgKey}>{key}:</Text> {`${obj[key]}`}
103+
<Text style={styles.msgKey}>{key}:</Text>
104+
{obj[key].length > 20
105+
? obj[key].substring(0, 5) + '...' + obj[key].substring(obj[key].length - 5)
106+
: obj[key]}
104107
</Text>
105108
)}
106109
</View>

app/app/components/UI/WebsiteIcon/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ export default class WebsiteIcon extends PureComponent {
7373
// host = host.substr(4);
7474
// }
7575

76-
let iconUrl = `https://api.faviconkit.com/${host}/64`;
76+
let iconUrl = `https://api.faviconkit.com/${host}/128`;
7777
if (!util.isEtherscanAvailable()) {
78-
iconUrl = `https://pali.pollum.cloud/faviconkit/${host}/64`;
78+
iconUrl = `https://pali.pollum.cloud/faviconkit/${host}/128`;
7979
}
8080
return iconUrl;
8181
};

app/app/components/Views/AboutView/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getVersion } from 'react-native-device-info';
77
import MStatusBar from '../../UI/MStatusBar';
88
import PropTypes from 'prop-types';
99
import TitleBar from '../../UI/TitleBar';
10+
import Icon from '../../UI/Icon';
1011

1112
import { SafeAreaView } from 'react-native-safe-area-context';
1213

@@ -59,6 +60,14 @@ const styles = {
5960
alignItems: 'center',
6061
height: 59,
6162
width: '100%'
63+
},
64+
footer: {
65+
alignItems: 'center'
66+
},
67+
footerFont: {
68+
color: '#9B989B',
69+
fontFamily: 'Poppins',
70+
...fontStyles.normal
6271
}
6372
};
6473

@@ -155,6 +164,11 @@ export default class AboutView extends PureComponent {
155164
<View style={styles.line} />
156165

157166
<View style={styles.flex3} />
167+
168+
<View style={styles.footer}>
169+
<Text style={styles.footerFont}>Token information and charts powered by:</Text>
170+
<Icon name={'coinGecko'} color={colors.white} width="200" height="100" />
171+
</View>
158172
</SafeAreaView>
159173
);
160174
}

0 commit comments

Comments
 (0)