Merge pull request #1493 from esteemapp/mmore

Fix Actionsheet, Profile action loader, Imageviewer disable for external links and video thumbnails, Signup
This commit is contained in:
Feruz M 2020-01-17 11:53:08 +02:00 committed by GitHub
commit 234fc93c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 68 additions and 32 deletions

View File

@ -36,7 +36,11 @@ class LoginHeaderView extends PureComponent {
source={require('../../../assets/esteem_logo_transparent.png')} source={require('../../../assets/esteem_logo_transparent.png')}
/> />
<View style={styles.headerButton}> <View style={styles.headerButton}>
<TextButton onPress={onPress} text={rightButtonText} /> <TextButton
onPress={onPress}
text={rightButtonText}
textStyle={{ color: '#357ce6' }}
/>
</View> </View>
</View> </View>
{!isKeyboardOpen && ( {!isKeyboardOpen && (

View File

@ -1,6 +1,6 @@
export default ` export default `
var images = document.getElementsByTagName("IMG"); var images = document.getElementsByTagName("IMG");
for (i = 0; i < images.length; i++) { for (i = 0; i < images.length; i++) {
var result = { var result = {
type: 'image', type: 'image',
href: images[i].getAttribute("src") || '' href: images[i].getAttribute("src") || ''
@ -9,9 +9,10 @@ for (i = 0; i < images.length; i++) {
var resultStr = JSON.stringify(JSON.stringify(result)); var resultStr = JSON.stringify(JSON.stringify(result));
var message = 'window.ReactNativeWebView.postMessage(' + resultStr + ')'; 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) { document.addEventListener('click', function(event) {
var el = event.target; var el = event.target;
// A element can be wrapped with inline element. Look parent elements. // A element can be wrapped with inline element. Look parent elements.

View File

@ -56,7 +56,7 @@ class ProfileSummaryView extends PureComponent {
// This funciton should have switch case but now only has one option therefor // This funciton should have switch case but now only has one option therefor
// temporarily I created with if statments // temporarily I created with if statments
if (index === '0' && handleMuteUnmuteUser) { if (index === 0 && handleMuteUnmuteUser) {
handleMuteUnmuteUser(!isMuted); handleMuteUnmuteUser(!isMuted);
} }
}; };
@ -201,18 +201,14 @@ class ProfileSummaryView extends PureComponent {
style={[styles.insetIconStyle]} style={[styles.insetIconStyle]}
onPress={() => handleOnFavoritePress(isFavorite)} onPress={() => handleOnFavoritePress(isFavorite)}
/> />
{isProfileLoading ? ( <IconButton
<ActivityIndicator style={styles.activityIndicator} /> backgroundColor="transparent"
) : ( color="#c1c5c7"
<IconButton iconType="MaterialCommunityIcons"
backgroundColor="transparent" name={followButtonIcon}
color="#c1c5c7" onPress={() => handleFollowUnfollowUser(!isFollowing)}
iconType="MaterialCommunityIcons" size={20}
name={followButtonIcon} />
onPress={() => handleFollowUnfollowUser(!isFollowing)}
size={20}
/>
)}
{isProfileLoading ? ( {isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} /> <ActivityIndicator style={styles.activityIndicator} />
) : ( ) : (

View File

@ -203,7 +203,7 @@
}, },
"login": { "login": {
"signin": "Sign in", "signin": "Sign in",
"signup": "Sign up", "signup": "JOIN NOW",
"signin_title": "To get all the benefits of using eSteem", "signin_title": "To get all the benefits of using eSteem",
"username": "Username", "username": "Username",
"password": "Password or WIF", "password": "Password or WIF",
@ -282,6 +282,12 @@
"permission_text": "Please, go to phone Settings and change eSteem app permissions.", "permission_text": "Please, go to phone Settings and change eSteem app permissions.",
"success_rebloged": "Reblogged!", "success_rebloged": "Reblogged!",
"already_rebloged": "You have already 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", "warning": "Warning",
"invalid_pincode": "Invalid PIN code, please check and try again.", "invalid_pincode": "Invalid PIN code, please check and try again.",
"remove_alert": "Are you sure you want to remove?", "remove_alert": "Are you sure you want to remove?",

View File

@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { withNavigation } from 'react-navigation'; import { withNavigation } from 'react-navigation';
import { get, has, unionBy } from 'lodash'; import { get, has, unionBy } from 'lodash';
import { Alert } from 'react-native'; import { Alert } from 'react-native';
import { injectIntl } from 'react-intl';
// Providers // Providers
import { import {
@ -23,6 +24,7 @@ import { getIsFavorite, addFavorite, removeFavorite } from '../providers/esteem/
// Utilitites // Utilitites
import { getRcPower, getVotingPower } from '../utils/manaBar'; import { getRcPower, getVotingPower } from '../utils/manaBar';
import { toastNotification } from '../redux/actions/uiAction';
// Constants // Constants
import { default as ROUTES } from '../constants/routeNames'; import { default as ROUTES } from '../constants/routeNames';
@ -101,7 +103,7 @@ class ProfileContainer extends Component {
_handleFollowUnfollowUser = async isFollowAction => { _handleFollowUnfollowUser = async isFollowAction => {
const { isFollowing, username } = this.state; const { isFollowing, username } = this.state;
const { currentAccount, pinCode } = this.props; const { currentAccount, pinCode, dispatch, intl } = this.props;
const follower = get(currentAccount, 'name', ''); const follower = get(currentAccount, 'name', '');
const following = username; const following = username;
@ -122,6 +124,13 @@ class ProfileContainer extends Component {
following, following,
}) })
.then(() => { .then(() => {
dispatch(
toastNotification(
intl.formatMessage({
id: isFollowing ? 'alert.success_unfollow' : 'alert.success_follow',
}),
),
);
this._profileActionDone(); this._profileActionDone();
}) })
.catch(err => { .catch(err => {
@ -129,11 +138,7 @@ class ProfileContainer extends Component {
}); });
}; };
_handleMuteUnmuteUser = isMuteAction => { _handleMuteUnmuteUser = async isMuteAction => {
this.setState({
isProfileLoading: true,
});
if (isMuteAction) { if (isMuteAction) {
this._muteUser(); this._muteUser();
} else { } else {
@ -143,15 +148,26 @@ class ProfileContainer extends Component {
_muteUser = () => { _muteUser = () => {
const { username } = this.state; const { username } = this.state;
const { currentAccount, pinCode } = this.props; const { currentAccount, pinCode, dispatch, intl } = this.props;
const follower = currentAccount.name; const follower = currentAccount.name;
const following = username; const following = username;
this.setState({
isProfileLoading: true,
});
ignoreUser(currentAccount, pinCode, { ignoreUser(currentAccount, pinCode, {
follower, follower,
following, following,
}) })
.then(() => { .then(() => {
dispatch(
toastNotification(
intl.formatMessage({
id: 'alert.success_mute',
}),
),
);
this._profileActionDone(); this._profileActionDone();
}) })
.catch(err => { .catch(err => {
@ -161,7 +177,9 @@ class ProfileContainer extends Component {
_profileActionDone = (error = null) => { _profileActionDone = (error = null) => {
const { username } = this.state; const { username } = this.state;
this.setState({
isProfileLoading: false,
});
if (error) { if (error) {
this.setState( this.setState(
{ {
@ -255,10 +273,14 @@ class ProfileContainer extends Component {
}; };
_handleOnFavoritePress = (isFavorite = false) => { _handleOnFavoritePress = (isFavorite = false) => {
const { currentAccount } = this.props; const { currentAccount, dispatch, intl } = this.props;
const { username } = this.state; const { username } = this.state;
let favoriteAction; let favoriteAction;
this.setState({
isProfileLoading: true,
});
if (isFavorite) { if (isFavorite) {
favoriteAction = removeFavorite; favoriteAction = removeFavorite;
} else { } else {
@ -266,7 +288,14 @@ class ProfileContainer extends Component {
} }
favoriteAction(currentAccount.name, username).then(() => { 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, isHideImage: state.ui.hidePostsThumbnails,
}); });
export default connect(mapStateToProps)(withNavigation(ProfileContainer)); export default connect(mapStateToProps)(injectIntl(withNavigation(ProfileContainer)));
/* eslint-enable */ /* eslint-enable */

View File

@ -831,7 +831,7 @@ export const unfollowUser = async (currentAccount, pin, data) => {
{ {
follower: `${data.follower}`, follower: `${data.follower}`,
following: `${data.following}`, following: `${data.following}`,
what: [''], what: [],
}, },
]), ]),
required_auths: [], required_auths: [],

View File

@ -143,7 +143,7 @@ class LoginContainer extends PureComponent {
_handleSignUp = () => { _handleSignUp = () => {
const { intl } = this.props; 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), Alert.alert(intl.formatMessage({ id: 'alert.error' }), err.message),
); );
}; };

View File

@ -7553,7 +7553,7 @@ react-lifecycles-compat@^3.0.4:
react-native-actionsheet@esteemapp/react-native-actionsheet: react-native-actionsheet@esteemapp/react-native-actionsheet:
version "2.4.2" 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: react-native-autoheight-webview@^1.3.4:
version "1.3.4" version "1.3.4"