diff --git a/src/components/loginHeader/view/loginHeaderView.js b/src/components/loginHeader/view/loginHeaderView.js index 1a16561b7..8ff56da85 100644 --- a/src/components/loginHeader/view/loginHeaderView.js +++ b/src/components/loginHeader/view/loginHeaderView.js @@ -36,7 +36,11 @@ class LoginHeaderView extends PureComponent { source={require('../../../assets/esteem_logo_transparent.png')} /> - + {!isKeyboardOpen && ( diff --git a/src/components/postElements/body/view/config.js b/src/components/postElements/body/view/config.js index 25caddf73..b91c96788 100644 --- a/src/components/postElements/body/view/config.js +++ b/src/components/postElements/body/view/config.js @@ -1,6 +1,6 @@ export default ` var images = document.getElementsByTagName("IMG"); -for (i = 0; i < images.length; i++) { +for (i = 0; i < images.length; i++) { var result = { type: 'image', href: images[i].getAttribute("src") || '' @@ -9,9 +9,10 @@ for (i = 0; i < images.length; i++) { var resultStr = JSON.stringify(JSON.stringify(result)); var message = 'window.ReactNativeWebView.postMessage(' + resultStr + ')'; - images[i].setAttribute("onClick", message); + if (!images[i].classList.contains("video-thumbnail") && !images[i].parentNode.classList.contains("markdown-external-link")) { + images[i].setAttribute("onClick", message); + } } - document.addEventListener('click', function(event) { var el = event.target; // A element can be wrapped with inline element. Look parent elements. diff --git a/src/components/profileSummary/view/profileSummaryView.js b/src/components/profileSummary/view/profileSummaryView.js index 61c3223a0..e929cc3c4 100644 --- a/src/components/profileSummary/view/profileSummaryView.js +++ b/src/components/profileSummary/view/profileSummaryView.js @@ -56,7 +56,7 @@ class ProfileSummaryView extends PureComponent { // This funciton should have switch case but now only has one option therefor // temporarily I created with if statments - if (index === '0' && handleMuteUnmuteUser) { + if (index === 0 && handleMuteUnmuteUser) { handleMuteUnmuteUser(!isMuted); } }; @@ -201,18 +201,14 @@ class ProfileSummaryView extends PureComponent { style={[styles.insetIconStyle]} onPress={() => handleOnFavoritePress(isFavorite)} /> - {isProfileLoading ? ( - - ) : ( - handleFollowUnfollowUser(!isFollowing)} - size={20} - /> - )} + handleFollowUnfollowUser(!isFollowing)} + size={20} + /> {isProfileLoading ? ( ) : ( diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index ade954cb1..8b798e9f5 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -203,7 +203,7 @@ }, "login": { "signin": "Sign in", - "signup": "Sign up", + "signup": "JOIN NOW", "signin_title": "To get all the benefits of using eSteem", "username": "Username", "password": "Password or WIF", @@ -282,6 +282,12 @@ "permission_text": "Please, go to phone Settings and change eSteem app permissions.", "success_rebloged": "Reblogged!", "already_rebloged": "You have already reblogged!", + "success_favorite": "Favorite added!", + "success_unfavorite": "Favorite removed!", + "success_follow": "Follow success!", + "success_mute": "Mute success!", + "success_unmute": "Unmute success!", + "success_unfollow": "Unfollow success!", "warning": "Warning", "invalid_pincode": "Invalid PIN code, please check and try again.", "remove_alert": "Are you sure you want to remove?", diff --git a/src/containers/profileContainer.js b/src/containers/profileContainer.js index b4cd64320..e0fa7a2a8 100644 --- a/src/containers/profileContainer.js +++ b/src/containers/profileContainer.js @@ -4,6 +4,7 @@ import { connect } from 'react-redux'; import { withNavigation } from 'react-navigation'; import { get, has, unionBy } from 'lodash'; import { Alert } from 'react-native'; +import { injectIntl } from 'react-intl'; // Providers import { @@ -23,6 +24,7 @@ import { getIsFavorite, addFavorite, removeFavorite } from '../providers/esteem/ // Utilitites import { getRcPower, getVotingPower } from '../utils/manaBar'; +import { toastNotification } from '../redux/actions/uiAction'; // Constants import { default as ROUTES } from '../constants/routeNames'; @@ -101,7 +103,7 @@ class ProfileContainer extends Component { _handleFollowUnfollowUser = async isFollowAction => { const { isFollowing, username } = this.state; - const { currentAccount, pinCode } = this.props; + const { currentAccount, pinCode, dispatch, intl } = this.props; const follower = get(currentAccount, 'name', ''); const following = username; @@ -122,6 +124,13 @@ class ProfileContainer extends Component { following, }) .then(() => { + dispatch( + toastNotification( + intl.formatMessage({ + id: isFollowing ? 'alert.success_unfollow' : 'alert.success_follow', + }), + ), + ); this._profileActionDone(); }) .catch(err => { @@ -129,11 +138,7 @@ class ProfileContainer extends Component { }); }; - _handleMuteUnmuteUser = isMuteAction => { - this.setState({ - isProfileLoading: true, - }); - + _handleMuteUnmuteUser = async isMuteAction => { if (isMuteAction) { this._muteUser(); } else { @@ -143,15 +148,26 @@ class ProfileContainer extends Component { _muteUser = () => { const { username } = this.state; - const { currentAccount, pinCode } = this.props; + const { currentAccount, pinCode, dispatch, intl } = this.props; const follower = currentAccount.name; const following = username; + this.setState({ + isProfileLoading: true, + }); + ignoreUser(currentAccount, pinCode, { follower, following, }) .then(() => { + dispatch( + toastNotification( + intl.formatMessage({ + id: 'alert.success_mute', + }), + ), + ); this._profileActionDone(); }) .catch(err => { @@ -161,7 +177,9 @@ class ProfileContainer extends Component { _profileActionDone = (error = null) => { const { username } = this.state; - + this.setState({ + isProfileLoading: false, + }); if (error) { this.setState( { @@ -255,10 +273,14 @@ class ProfileContainer extends Component { }; _handleOnFavoritePress = (isFavorite = false) => { - const { currentAccount } = this.props; + const { currentAccount, dispatch, intl } = this.props; const { username } = this.state; let favoriteAction; + this.setState({ + isProfileLoading: true, + }); + if (isFavorite) { favoriteAction = removeFavorite; } else { @@ -266,7 +288,14 @@ class ProfileContainer extends Component { } favoriteAction(currentAccount.name, username).then(() => { - this.setState({ isFavorite: !isFavorite }); + dispatch( + toastNotification( + intl.formatMessage({ + id: isFavorite ? 'alert.success_unfavorite' : 'alert.success_favorite', + }), + ), + ); + this.setState({ isFavorite: !isFavorite, isProfileLoading: false }); }); }; @@ -404,5 +433,5 @@ const mapStateToProps = state => ({ isHideImage: state.ui.hidePostsThumbnails, }); -export default connect(mapStateToProps)(withNavigation(ProfileContainer)); +export default connect(mapStateToProps)(injectIntl(withNavigation(ProfileContainer))); /* eslint-enable */ diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 229fed57d..a20e4276b 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -831,7 +831,7 @@ export const unfollowUser = async (currentAccount, pin, data) => { { follower: `${data.follower}`, following: `${data.following}`, - what: [''], + what: [], }, ]), required_auths: [], diff --git a/src/screens/login/container/loginContainer.js b/src/screens/login/container/loginContainer.js index f37db8fb0..fdf6ee54d 100644 --- a/src/screens/login/container/loginContainer.js +++ b/src/screens/login/container/loginContainer.js @@ -143,7 +143,7 @@ class LoginContainer extends PureComponent { _handleSignUp = () => { const { intl } = this.props; - Linking.openURL('https://signup.steemit.com/?ref=esteem').catch(err => + Linking.openURL('https://esteem.app/signup').catch(err => Alert.alert(intl.formatMessage({ id: 'alert.error' }), err.message), ); }; diff --git a/yarn.lock b/yarn.lock index 2f0a35ad7..4417f1c6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7553,7 +7553,7 @@ react-lifecycles-compat@^3.0.4: react-native-actionsheet@esteemapp/react-native-actionsheet: version "2.4.2" - resolved "https://codeload.github.com/esteemapp/react-native-actionsheet/tar.gz/6cc19973e72bd0e0ba750ce34d42243acff9c109" + resolved "https://codeload.github.com/esteemapp/react-native-actionsheet/tar.gz/c74540db08a4c2049ee9c8a8077b5c476b536e2c" react-native-autoheight-webview@^1.3.4: version "1.3.4"