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')}
/>
<View style={styles.headerButton}>
<TextButton onPress={onPress} text={rightButtonText} />
<TextButton
onPress={onPress}
text={rightButtonText}
textStyle={{ color: '#357ce6' }}
/>
</View>
</View>
{!isKeyboardOpen && (

View File

@ -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.

View File

@ -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 ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (
<IconButton
backgroundColor="transparent"
color="#c1c5c7"
iconType="MaterialCommunityIcons"
name={followButtonIcon}
onPress={() => handleFollowUnfollowUser(!isFollowing)}
size={20}
/>
)}
<IconButton
backgroundColor="transparent"
color="#c1c5c7"
iconType="MaterialCommunityIcons"
name={followButtonIcon}
onPress={() => handleFollowUnfollowUser(!isFollowing)}
size={20}
/>
{isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (

View File

@ -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?",

View File

@ -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 */

View File

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

View File

@ -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),
);
};

View File

@ -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"