mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-26 14:54:19 +03:00
Merge pull request #133 from esteemapp/bugfix/side-other
Bugfix/side other
This commit is contained in:
commit
8f01c62a69
@ -772,6 +772,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0C09B6DC21A3393A00536C9D /* libReactNativeConfig.a */,
|
||||
94D7D44E21B4402E00476275 /* libReactNativeConfig-tvOS.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -183,7 +183,7 @@ class BasicHeaderView extends Component {
|
||||
})}
|
||||
/>
|
||||
) : (
|
||||
<ActivityIndicator style={styles.textButtonWrapper} />
|
||||
<ActivityIndicator style={[styles.textButtonWrapper]} />
|
||||
)}
|
||||
</Fragment>
|
||||
)}
|
||||
|
@ -14,10 +14,10 @@ import { connect } from 'react-redux';
|
||||
import { HeaderView } from '..';
|
||||
|
||||
/*
|
||||
* Props Name Description Value
|
||||
*@props --> props name here description here Value Type Here
|
||||
*
|
||||
*/
|
||||
* Props Name Description Value
|
||||
*@props --> props name here description here Value Type Here
|
||||
*
|
||||
*/
|
||||
|
||||
class HeaderContainer extends Component {
|
||||
constructor(props) {
|
||||
@ -56,7 +56,7 @@ class HeaderContainer extends Component {
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isLoggedIn: state.application.isLoggedIn || false,
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
currentUser: state.account.currentAccount,
|
||||
});
|
||||
|
||||
|
@ -20,10 +20,10 @@ const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
|
||||
|
||||
class HeaderView extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { boolean } hideStatusBar - Can declare status bar is hide or not.
|
||||
*
|
||||
*/
|
||||
* ------------------------------------------------
|
||||
* @prop { boolean } hideStatusBar - Can declare status bar is hide or not.
|
||||
*
|
||||
*/
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -36,26 +36,6 @@ class HeaderView extends Component {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_getNameOfUser = () => {
|
||||
const { currentAccount } = this.props;
|
||||
if (Object.keys(currentAccount).length === 0) return currentAccount.name;
|
||||
if (Object.keys(currentAccount.about).length === 0) return currentAccount.name;
|
||||
if (Object.keys(currentAccount.about.profile).length !== 0) {
|
||||
return currentAccount.about.profile.name;
|
||||
}
|
||||
return currentAccount.name;
|
||||
};
|
||||
|
||||
_getUserAvatar = () => {
|
||||
const { currentAccount } = this.props;
|
||||
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about.profile).length !== 0) {
|
||||
return { uri: currentAccount.about.profile.profile_image };
|
||||
}
|
||||
return DEFAULT_IMAGE;
|
||||
};
|
||||
|
||||
_handleOnCloseSearch = () => {
|
||||
this.setState({ isSearchModalOpen: false });
|
||||
};
|
||||
@ -70,8 +50,10 @@ class HeaderView extends Component {
|
||||
intl,
|
||||
} = this.props;
|
||||
const { isSearchModalOpen } = this.state;
|
||||
const _name = this._getNameOfUser();
|
||||
const _reputation = getReputation(currentAccount.reputation);
|
||||
const _avatar = currentAccount.profile_image
|
||||
? { uri: currentAccount.profile_image }
|
||||
: DEFAULT_IMAGE;
|
||||
|
||||
return (
|
||||
<SafeAreaView style={[styles.container, isReverse && styles.containerReverse]}>
|
||||
@ -97,17 +79,15 @@ class HeaderView extends Component {
|
||||
]}
|
||||
>
|
||||
<View>
|
||||
<FastImage
|
||||
style={styles.avatar}
|
||||
source={this._getUserAvatar()}
|
||||
defaultSource={DEFAULT_IMAGE}
|
||||
/>
|
||||
<FastImage style={styles.avatar} source={_avatar} defaultSource={DEFAULT_IMAGE} />
|
||||
</View>
|
||||
</LinearGradient>
|
||||
</TouchableOpacity>
|
||||
{currentAccount && currentAccount.name ? (
|
||||
<View style={styles.titleWrapper}>
|
||||
{_name && <Text style={styles.title}>{_name}</Text>}
|
||||
{currentAccount.display_name && (
|
||||
<Text style={styles.title}>{currentAccount.display_name}</Text>
|
||||
)}
|
||||
<Text style={styles.subTitle}>
|
||||
@
|
||||
{currentAccount.name}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { FlatList, View, ActivityIndicator } from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
// STEEM
|
||||
import { getPostsSummary } from '../../../providers/steem/dsteem';
|
||||
@ -7,7 +8,8 @@ import { getPostsSummary } from '../../../providers/steem/dsteem';
|
||||
// COMPONENTS
|
||||
import { PostCard } from '../../postCard';
|
||||
import { FilterBar } from '../../filterBar';
|
||||
import { PostCardPlaceHolder } from '../../basicUIElements';
|
||||
import { PostCardPlaceHolder, NoPost } from '../../basicUIElements';
|
||||
|
||||
import filters from '../../../constants/options/filters.json';
|
||||
// Styles
|
||||
import styles from './postsStyles';
|
||||
@ -141,7 +143,9 @@ class PostsView extends Component {
|
||||
const {
|
||||
refreshing, posts, user, isPostsLoading, isHideImage,
|
||||
} = this.state;
|
||||
const { componentId, filterOptions, isLoggedIn } = this.props;
|
||||
const {
|
||||
componentId, filterOptions, isLoggedIn, intl,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
@ -180,6 +184,20 @@ class PostsView extends Component {
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
{/* TODO: fix here */}
|
||||
{/* {
|
||||
(posts.length <= 0 && (
|
||||
<NoPost
|
||||
name={user.name}
|
||||
text={intl.formatMessage({
|
||||
id: 'profile.havent_posted',
|
||||
})}
|
||||
defaultText={intl.formatMessage({
|
||||
id: 'profile.login_to_see',
|
||||
})}
|
||||
/>
|
||||
))
|
||||
} */}
|
||||
<PostCardPlaceHolder />
|
||||
<PostCardPlaceHolder />
|
||||
</Fragment>
|
||||
@ -189,4 +207,4 @@ class PostsView extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default PostsView;
|
||||
export default injectIntl(PostsView);
|
||||
|
@ -13,13 +13,13 @@ import { default as ROUTES } from '../../../constants/routeNames';
|
||||
// Component
|
||||
import { SideMenuView } from '..';
|
||||
|
||||
const DEFAULT_IMAGE = require('../../../assets/esteem.png');
|
||||
const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
|
||||
|
||||
/*
|
||||
* Props Name Description
|
||||
*@props --> props name navigation coming from react-navigation
|
||||
*
|
||||
*/
|
||||
* Props Name Description
|
||||
*@props --> props name navigation coming from react-navigation
|
||||
*
|
||||
*/
|
||||
|
||||
class SideMenuContainer extends Component {
|
||||
constructor(props) {
|
||||
@ -45,6 +45,7 @@ class SideMenuContainer extends Component {
|
||||
name: 'Add Account',
|
||||
route: ROUTES.SCREENS.LOGIN,
|
||||
icon: 'plus-square-o',
|
||||
id: 'add_account',
|
||||
});
|
||||
this.setState({ accounts });
|
||||
});
|
||||
@ -87,7 +88,7 @@ class SideMenuContainer extends Component {
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isLoggedIn: state.application.isLoggedIn || false,
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
currentAccount: state.account.currentAccount || {},
|
||||
});
|
||||
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
Thumbnail, List, ListItem, Container,
|
||||
} from 'native-base';
|
||||
import LinearGradient from 'react-native-linear-gradient';
|
||||
import FastImage from 'react-native-fast-image';
|
||||
|
||||
// Components
|
||||
import { Icon, IconButton } from '../..';
|
||||
@ -16,66 +17,52 @@ import { default as MENU } from '../../../constants/sideMenuItems';
|
||||
import styles from './sideMenuStyles';
|
||||
|
||||
// Images
|
||||
const DEFAULT_IMAGE = require('../../../assets/esteem.png');
|
||||
const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
|
||||
const SIDE_MENU_BACKGROUND = require('../../../assets/side_menu_background.png');
|
||||
|
||||
class SideMenuView extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
*/
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
*/
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
menuItems: [],
|
||||
menuItems: props.isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
|
||||
isAddAccountIconActive: false,
|
||||
};
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
|
||||
componentWillMount() {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { isLoggedIn } = this.props;
|
||||
|
||||
this.setState({
|
||||
menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
|
||||
});
|
||||
if (isLoggedIn !== nextProps.isLoggedIn) {
|
||||
this._setMenuItems(nextProps.isLoggedIn);
|
||||
}
|
||||
}
|
||||
|
||||
// Component Functions
|
||||
|
||||
_handleOnPressAddAccountIcon = () => {
|
||||
const { isAddAccountIconActive } = this.state;
|
||||
const { isLoggedIn, accounts } = this.props;
|
||||
const { isAddAccountIconActive } = this.state;
|
||||
|
||||
if (!isAddAccountIconActive) {
|
||||
this.setState({ menuItems: accounts, isAddAccountIconActive: !isAddAccountIconActive });
|
||||
this.setState({ menuItems: accounts });
|
||||
} else {
|
||||
this.setState({
|
||||
menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
|
||||
isAddAccountIconActive: !isAddAccountIconActive,
|
||||
});
|
||||
this._setMenuItems(isLoggedIn);
|
||||
}
|
||||
|
||||
this.setState({ isAddAccountIconActive: !isAddAccountIconActive });
|
||||
};
|
||||
|
||||
_getNameOfUser = () => {
|
||||
const { currentAccount } = this.props;
|
||||
if (Object.keys(currentAccount).length === 0) return currentAccount.name;
|
||||
if (Object.keys(currentAccount.about).length === 0) return currentAccount.name;
|
||||
if (Object.keys(currentAccount.about.profile).length !== 0) {
|
||||
return currentAccount.about.profile.name;
|
||||
}
|
||||
return currentAccount.name;
|
||||
};
|
||||
|
||||
_getUserAvatar = () => {
|
||||
const { currentAccount } = this.props;
|
||||
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about.profile).length !== 0) {
|
||||
return { uri: currentAccount.about.profile.profile_image };
|
||||
}
|
||||
return DEFAULT_IMAGE;
|
||||
_setMenuItems = (isLoggedIn) => {
|
||||
this.setState({
|
||||
menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
@ -83,6 +70,9 @@ class SideMenuView extends Component {
|
||||
navigateToRoute, currentAccount, isLoggedIn, switchAccount, intl,
|
||||
} = this.props;
|
||||
const { menuItems, isAddAccountIconActive } = this.state;
|
||||
const _avatar = currentAccount.profile_image
|
||||
? { uri: currentAccount.profile_image }
|
||||
: DEFAULT_IMAGE;
|
||||
|
||||
return (
|
||||
<Container style={styles.container}>
|
||||
@ -98,9 +88,15 @@ class SideMenuView extends Component {
|
||||
>
|
||||
{isLoggedIn && (
|
||||
<View style={styles.headerContentView}>
|
||||
<Thumbnail style={styles.userAvatar} source={this._getUserAvatar()} />
|
||||
<FastImage
|
||||
style={styles.userAvatar}
|
||||
source={_avatar}
|
||||
defaultSource={DEFAULT_IMAGE}
|
||||
/>
|
||||
<View style={styles.userInfoView}>
|
||||
<Text style={styles.username}>{this._getNameOfUser()}</Text>
|
||||
{currentAccount.display_name && (
|
||||
<Text style={styles.username}>{currentAccount.display_name}</Text>
|
||||
)}
|
||||
<Text style={styles.usernick}>{`@${currentAccount.name}`}</Text>
|
||||
</View>
|
||||
<View style={styles.addAccountIconView}>
|
||||
@ -124,7 +120,7 @@ class SideMenuView extends Component {
|
||||
<List
|
||||
itemDivider={false}
|
||||
dataArray={menuItems}
|
||||
renderRow={item => (
|
||||
renderRow={(item, i) => (
|
||||
<ListItem
|
||||
noBorder
|
||||
style={styles.listItem}
|
||||
@ -143,7 +139,13 @@ class SideMenuView extends Component {
|
||||
<Thumbnail small style={styles.otherUserAvatar} source={item.image} />
|
||||
)}
|
||||
<Text style={styles.listItemText}>
|
||||
{intl.formatMessage({ id: `side_menu.${item.id}` })}
|
||||
{isAddAccountIconActive
|
||||
? menuItems[menuItems.length - 1].id === item.id
|
||||
? intl.formatMessage({ id: `side_menu.${item.id}` })
|
||||
: item.name
|
||||
:
|
||||
intl.formatMessage({ id: `side_menu.${item.id}` })
|
||||
}
|
||||
</Text>
|
||||
</ListItem>
|
||||
)}
|
||||
@ -154,4 +156,4 @@ class SideMenuView extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default injectIntl(SideMenuView);
|
||||
export default injectIntl(SideMenuView);
|
@ -44,6 +44,7 @@
|
||||
"voting_power": "Voting power",
|
||||
"login_to_see": "Login to see!",
|
||||
"havent_commented": "haven't commented anything yet",
|
||||
"havent_posted": "haven't posted anything yet",
|
||||
"steem_power": "Steem Power",
|
||||
"next_power_text": "Next power down is in",
|
||||
"days": "days",
|
||||
|
@ -41,6 +41,7 @@
|
||||
"unclaimed_rewards": "Sahipsiz Ödül",
|
||||
"login_to_see": "Giriş yap ve gör!",
|
||||
"havent_commented": "henüz yorum yapmadı",
|
||||
"havent_posted": "henüz post paylasmadi",
|
||||
"full_in": "Full in",
|
||||
"hours": "saat",
|
||||
"voting_power": "Oylama güçü",
|
||||
|
@ -43,6 +43,12 @@ const authMenuItems = [
|
||||
icon: 'gear',
|
||||
id: 'settings',
|
||||
},
|
||||
{
|
||||
name: 'Add Account',
|
||||
route: ROUTES.SCREENS.LOGIN,
|
||||
icon: 'plus-square-o',
|
||||
id: 'add_account',
|
||||
},
|
||||
];
|
||||
|
||||
const noAuthMenuItems = [
|
||||
|
@ -1,8 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
// TestNet
|
||||
// const client = new Client("https://testnet.steem.vc", { chainId: "79276aea5d4877d9a25892eaa01b0adf019d3e5cb12a97478df3298ccdd01673", addressPrefix: "STX" });
|
||||
|
||||
import { Client, PrivateKey } from 'dsteem';
|
||||
import { AsyncStorage } from 'react-native';
|
||||
|
||||
@ -16,6 +11,8 @@ import {
|
||||
parsePosts, parsePost, parseComments, parsePostsSummary,
|
||||
} from '../../utils/postParser';
|
||||
|
||||
import { getName, getAvatar } from '../../utils/user';
|
||||
|
||||
let rewardFund = null;
|
||||
let medianPrice = null;
|
||||
let client = new Client('https://api.steemit.com');
|
||||
@ -29,6 +26,7 @@ getClient = async () => {
|
||||
client = new Client(`${server}`);
|
||||
}
|
||||
};
|
||||
|
||||
getClient();
|
||||
|
||||
/**
|
||||
@ -88,6 +86,9 @@ export const getUser = async (user) => {
|
||||
);
|
||||
|
||||
account[0].about = account[0].json_metadata && JSON.parse(account[0].json_metadata);
|
||||
account[0].profile_image = getAvatar(account[0].about);
|
||||
account[0].display_name = getName(account[0].about);
|
||||
|
||||
return account[0];
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
@ -191,9 +192,8 @@ export const ignoreUser = (data, postingKey) => {
|
||||
let key;
|
||||
try {
|
||||
key = PrivateKey.fromString(postingKey);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
const json = {
|
||||
id: 'follow',
|
||||
json: JSON.stringify([
|
||||
@ -212,11 +212,9 @@ export const ignoreUser = (data, postingKey) => {
|
||||
client.broadcast
|
||||
.json(json, key)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -350,7 +348,7 @@ export const upvoteAmount = async (input) => {
|
||||
medianPrice = res;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
// reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
@ -366,11 +364,9 @@ export const transferToken = (data, activeKey) => {
|
||||
client.broadcast
|
||||
.transfer(data, key)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -381,7 +377,6 @@ export const followUser = (data, postingKey) => {
|
||||
try {
|
||||
key = PrivateKey.fromString(postingKey);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
const json = {
|
||||
id: 'follow',
|
||||
@ -401,11 +396,9 @@ export const followUser = (data, postingKey) => {
|
||||
client.broadcast
|
||||
.json(json, key)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -416,7 +409,6 @@ export const unfollowUser = (data, postingKey) => {
|
||||
try {
|
||||
key = PrivateKey.fromString(postingKey);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
const json = {
|
||||
id: 'follow',
|
||||
@ -436,11 +428,9 @@ export const unfollowUser = (data, postingKey) => {
|
||||
client.broadcast
|
||||
.json(json, key)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -451,7 +441,6 @@ export const delegate = (data, activeKey) => {
|
||||
try {
|
||||
key = PrivateKey.fromString(activeKey);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -461,7 +450,6 @@ export const delegate = (data, activeKey) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@ -472,7 +460,6 @@ export const globalProps = async () => {
|
||||
const globalProperties = await client.database.getDynamicGlobalProperties();
|
||||
return globalProperties;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
};
|
||||
@ -482,7 +469,6 @@ export const getFeedHistory = async () => {
|
||||
const feedHistory = await client.database.call('get_feed_history');
|
||||
return feedHistory;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
};
|
||||
@ -491,9 +477,7 @@ export const transferToVesting = (data, activeKey) => {
|
||||
let key;
|
||||
try {
|
||||
key = PrivateKey.fromString(activeKey);
|
||||
console.log(key);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
const op = [
|
||||
@ -512,7 +496,6 @@ export const transferToVesting = (data, activeKey) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -522,9 +505,7 @@ export const withdrawVesting = (data, activeKey) => {
|
||||
let key;
|
||||
try {
|
||||
key = PrivateKey.fromString(activeKey);
|
||||
console.log(key);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
const op = [
|
||||
@ -542,7 +523,6 @@ export const withdrawVesting = (data, activeKey) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -554,7 +534,6 @@ export const postContent = (data, postingKey) => {
|
||||
try {
|
||||
key = PrivateKey.fromString(postingKey);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
const post = {
|
||||
@ -595,7 +574,6 @@ export const postContent = (data, postingKey) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
@ -63,6 +63,7 @@ class ApplicationContainer extends Component {
|
||||
|
||||
_getUserData = () => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
getAuthStatus().then((res) => {
|
||||
if (res.isLoggedIn) {
|
||||
getUserData().then((response) => {
|
||||
@ -77,9 +78,9 @@ class ApplicationContainer extends Component {
|
||||
const realmObject = response[response.length - 1];
|
||||
accountData.realm_object = realmObject;
|
||||
|
||||
dispatch(login());
|
||||
dispatch(updateCurrentAccount(accountData));
|
||||
dispatch(activeApplication());
|
||||
dispatch(login());
|
||||
if (__DEV__ === false) {
|
||||
dispatch(openPinCodeModal());
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Alert } from 'react-native';
|
||||
import ImagePicker from 'react-native-image-crop-picker';
|
||||
|
||||
// Services and Actions
|
||||
@ -217,11 +218,12 @@ class EditorContainer extends Component {
|
||||
|
||||
postContent(post, postingKey)
|
||||
.then((result) => {
|
||||
alert('Your post succesfully shared');
|
||||
Alert.alert('Success', 'Your reply has been submitted!');
|
||||
navigation.navigate(ROUTES.SCREENS.HOME);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert(`Opps! there is a problem${error}`);
|
||||
Alert.alert('Failed!', 'Your reply failed to submit!');
|
||||
|
||||
this.setState({ isPostSending: false });
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { PureComponent, Fragment } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { View, Alert } from 'react-native';
|
||||
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
|
@ -128,16 +128,6 @@ class PinCodeContainer extends Component {
|
||||
}
|
||||
});
|
||||
|
||||
_getUserAvatar = () => {
|
||||
const { currentAccount } = this.props;
|
||||
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
|
||||
if (Object.keys(currentAccount.about.profile).length !== 0) {
|
||||
return { uri: currentAccount.about.profile.profile_image };
|
||||
}
|
||||
return DEFAULT_IMAGE;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { currentAccount, intl } = this.props;
|
||||
const { informationText, isExistUser } = this.state;
|
||||
@ -147,7 +137,7 @@ class PinCodeContainer extends Component {
|
||||
setPinCode={this._setPinCode}
|
||||
showForgotButton={isExistUser}
|
||||
username={currentAccount ? currentAccount.name : 'unknow'}
|
||||
avatar={this._getUserAvatar()}
|
||||
avatar={currentAccount.profile_image}
|
||||
intl={intl}
|
||||
/>
|
||||
);
|
||||
|
@ -22,3 +22,17 @@ export const getReputation = (input) => {
|
||||
|
||||
return Math.floor(reputationLevel);
|
||||
};
|
||||
/* eslint-disable */
|
||||
export const getName = about => {
|
||||
if (about['profile'] && about['profile']['name']) {
|
||||
return about['profile']['name'];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getAvatar = about => {
|
||||
if (about['profile'] && about['profile']['profile_image']) {
|
||||
return about['profile']['profile_image'];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user