Skip to content

Commit

Permalink
Bugfix: ExceptionsManagerModule android crashes (#968)
Browse files Browse the repository at this point in the history
* issue 1

* more like issue 1

* fix website icon

* animations

* rm code

* comment

* rm state
  • Loading branch information
estebanmino authored Jul 30, 2019
1 parent 25ceeed commit 42c3fc8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 35 deletions.
9 changes: 5 additions & 4 deletions app/components/UI/AccountApproval/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,12 @@ class AccountApproval extends PureComponent {

render = () => {
const {
currentPageInformation: { title, url },
currentPageInformation: { url },
currentPageInformation,
selectedAddress,
identities
} = this.props;
const host = getHost(url);
const title = typeof currentPageInformation.title === 'string' ? currentPageInformation.title : getHost(url);
return (
<View style={styles.root}>
<View style={styles.titleWrapper}>
Expand All @@ -259,9 +260,9 @@ class AccountApproval extends PureComponent {
<View style={styles.wrapper}>
<View style={styles.header}>
<View style={styles.dapp}>
<WebsiteIcon style={styles.icon} title={title || host} url={url} />
<WebsiteIcon style={styles.icon} title={title} url={url} />
<Text style={styles.headerTitle} numberOfLines={1}>
{title || host}
{title}
</Text>
<Text style={styles.headerUrl} numberOfLines={1}>
{url}
Expand Down
8 changes: 6 additions & 2 deletions app/components/UI/SignatureRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import WebsiteIcon from '../WebsiteIcon';
import { renderAccountName } from '../../../util/address';
import Analytics from '../../../core/Analytics';
import ANALYTICS_EVENT_OPTS from '../../../util/analytics';
import { getHost } from '../../../util/browser';

const styles = StyleSheet.create({
wrapper: {
Expand Down Expand Up @@ -148,14 +149,17 @@ class SignatureRequest extends PureComponent {
renderPageInformation = () => {
const {
domain,
currentPageInformation: { title, url }
currentPageInformation: { url },
currentPageInformation
} = this.props;
const title = typeof currentPageInformation.title === 'string' ? currentPageInformation.title : getHost(url);
const name = domain && typeof domain.name === 'string';
return (
<View style={styles.domainWrapper}>
<WebsiteIcon style={styles.domainLogo} viewStyle={styles.assetLogo} title={title} url={url} />
<Text style={styles.domainTitle}>{title}</Text>
<Text style={styles.domainText}>{url}</Text>
{domain && <Text style={styles.domainText}>{domain.name}</Text>}
{name && <Text style={styles.domainText}>{name}</Text>}
</View>
);
};
Expand Down
36 changes: 22 additions & 14 deletions app/components/UI/UrlAutocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,29 @@ class UrlAutocomplete extends PureComponent {

onSubmitInput = () => this.props.onSubmit(this.props.input);

renderUrlOption = (url, name, onPress) => (
<TouchableOpacity containerStyle={styles.item} onPress={onPress} key={url}>
<View style={styles.itemWrapper}>
<WebsiteIcon style={styles.bookmarkIco} url={url} title={name} textStyle={styles.fallbackTextStyle} />
<View style={styles.textContent}>
<Text style={styles.name} numberOfLines={1}>
{name || getHost(url)}
</Text>
<Text style={styles.url} numberOfLines={1}>
{url}
</Text>
renderUrlOption = (url, name, onPress) => {
name = typeof name === 'string' ? name : getHost(url);
return (
<TouchableOpacity containerStyle={styles.item} onPress={onPress} key={url}>
<View style={styles.itemWrapper}>
<WebsiteIcon
style={styles.bookmarkIco}
url={url}
title={name}
textStyle={styles.fallbackTextStyle}
/>
<View style={styles.textContent}>
<Text style={styles.name} numberOfLines={1}>
{name}
</Text>
<Text style={styles.url} numberOfLines={1}>
{url}
</Text>
</View>
</View>
</View>
</TouchableOpacity>
);
</TouchableOpacity>
);
};

render() {
if (this.props.input.length < 2) return <View style={styles.wrapper} />;
Expand Down
8 changes: 5 additions & 3 deletions app/components/UI/WebsiteIcon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const styles = StyleSheet.create({
...fontStyles.normal,
color: colors.white,
fontSize: 24,
textAlign: 'center'
textAlign: 'center',
textTransform: 'uppercase'
}
});

Expand Down Expand Up @@ -75,14 +76,15 @@ export default class WebsiteIcon extends PureComponent {

render = () => {
const { renderIconUrlError } = this.state;
const { url, viewStyle, style, title, textStyle, transparent } = this.props;
const { viewStyle, style, textStyle, transparent, url } = this.props;
const apiLogoUrl = { uri: this.getIconUrl(url) };
const title = typeof this.props.title === 'string' ? this.props.title.substr(0, 1) : getHost(url).substr(0, 1);

if (renderIconUrlError && title) {
return (
<View style={viewStyle}>
<View style={[styles.fallback, style]}>
<Text style={[styles.fallbackText, textStyle]}>{title.substring(0, 1).toUpperCase()}</Text>
<Text style={[styles.fallbackText, textStyle]}>{title}</Text>
</View>
</View>
);
Expand Down
13 changes: 3 additions & 10 deletions app/components/Views/Entry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class Entry extends PureComponent {
this.setState({ viewToGo: view }, () => {
if (Platform.OS === 'android') {
setTimeout(() => {
this.animation.play(0, 25);
this.animation ? this.animation.play(0, 25) : this.onAnimationFinished();
setTimeout(() => {
this.animationName.play();
this.animationName && this.animationName.play();
}, 1);
}, 50);
} else {
Expand Down Expand Up @@ -179,14 +179,7 @@ class Entry extends PureComponent {

renderAnimations() {
if (!this.state.viewToGo) {
return (
<LottieView
// eslint-disable-next-line react/jsx-no-bind
style={styles.animation}
autoPlay
source={require('../../../animations/bounce.json')}
/>
);
return <LottieView style={styles.animation} autoPlay source={require('../../../animations/bounce.json')} />;
}

return (
Expand Down
4 changes: 2 additions & 2 deletions app/components/Views/LockScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export default class LockScreen extends PureComponent {
Logger.log('Lockscreen::unlockKeychain - state: ready');
if (Platform.OS === 'android') {
setTimeout(() => {
this.secondAnimation.play(0, 25);
this.secondAnimation ? this.secondAnimation.play(0, 25) : this.onAnimationFinished();
setTimeout(() => {
this.animationName.play();
this.animationName && this.animationName.play();
}, 1);
}, 50);
} else {
Expand Down

0 comments on commit 42c3fc8

Please sign in to comment.