diff --git a/android/app/build.gradle b/android/app/build.gradle index d194c55d4..54e5ce29e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -157,7 +157,6 @@ dependencies { compile project(':appcenter-push') compile project(':react-native-view-overflow') compile project(':react-native-vector-icons') - compile project(':react-native-restart') compile project(':react-native-linear-gradient') compile project(':react-native-config') compile project(':appcenter-crashes') diff --git a/android/app/src/main/java/app/esteem/mobile/MainApplication.java b/android/app/src/main/java/app/esteem/mobile/MainApplication.java index 28d99da1d..d81e0f635 100644 --- a/android/app/src/main/java/app/esteem/mobile/MainApplication.java +++ b/android/app/src/main/java/app/esteem/mobile/MainApplication.java @@ -12,7 +12,6 @@ import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.microsoft.appcenter.reactnative.push.AppCenterReactNativePushPackage; import com.entria.views.RNViewOverflowPackage; import com.oblador.vectoricons.VectorIconsPackage; -import com.avishayil.rnrestart.ReactNativeRestartPackage; import com.BV.LinearGradient.LinearGradientPackage; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage; @@ -54,7 +53,6 @@ public class MainApplication extends Application implements ReactApplication { new AppCenterReactNativePushPackage(MainApplication.this), new RNViewOverflowPackage(), new VectorIconsPackage(), - new ReactNativeRestartPackage(), new LinearGradientPackage(), new ReactNativeConfigPackage(), new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)), diff --git a/android/settings.gradle b/android/settings.gradle index af880f353..f924d3f5f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -17,8 +17,6 @@ include ':react-native-view-overflow' project(':react-native-view-overflow').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-view-overflow/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') -include ':react-native-restart' -project(':react-native-restart').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-restart/android') include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-config' diff --git a/package.json b/package.json index 08c9c8c14..45e045281 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,6 @@ }, "dependencies": { "@babel/runtime": "^7.1.2", - "@esteemapp/react-native-scrollable-tab-view": "^0.8.2", - "@esteemapp/react-native-tags": "^1.3.1", "appcenter": "^1.10.0", "appcenter-analytics": "^1.10.0", "appcenter-crashes": "^1.10.0", @@ -41,7 +39,7 @@ "moment": "^2.22.2", "react": "^16.7.0", "react-intl": "^2.7.2", - "react-native": "^0.57.5", + "react-native": "esteemapp/react-native", "react-native-actionsheet": "^2.4.2", "react-native-code-push": "^5.5.2", "react-native-config": "^0.11.5", @@ -55,7 +53,7 @@ "react-native-markdown-renderer": "^3.2.8", "react-native-modal-dropdown": "^0.6.2", "react-native-modal-popover": "0.0.12", - "react-native-restart": "0.0.6", + "react-native-scrollable-tab-view": "^0.10.0", "react-native-sentry": "^0.42.0", "react-native-slider": "^0.11.0", "react-native-vector-icons": "^6.0.2", diff --git a/src/components/leaderboard/view/leaderboardView.js b/src/components/leaderboard/view/leaderboardView.js index fa5c63bf9..8ea8d386e 100644 --- a/src/components/leaderboard/view/leaderboardView.js +++ b/src/components/leaderboard/view/leaderboardView.js @@ -48,7 +48,7 @@ class LeaderboardView extends PureComponent { item.voter} + keyExtractor={item => item._id} removeClippedSubviews={false} onRefresh={() => fetchLeaderBoard()} renderItem={({ item, index }) => this._renderItem(item, index)} diff --git a/src/components/parentPost/view/parentPostView.js b/src/components/parentPost/view/parentPostView.js index 1623fe57c..12d450a14 100644 --- a/src/components/parentPost/view/parentPostView.js +++ b/src/components/parentPost/view/parentPostView.js @@ -1,28 +1,34 @@ import React from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; import { withNavigation } from 'react-navigation'; +import get from 'lodash/get'; import { default as ROUTES } from '../../../constants/routeNames'; + import styles from './parentPostStyles'; -const ParentPost = ({ post, navigation }) => ( - - (navigation && navigation.navigate - ? navigation.navigate({ - routeName: ROUTES.SCREENS.POST, - params: { - content: post, - }, - key: post.permlink, - }) - : null) +const ParentPost = (props) => { + const { navigation, post } = props; + + return ( + + (get(navigation, 'navigate') + ? navigation.navigate({ + routeName: ROUTES.SCREENS.POST, + params: { + content: post, + }, + key: post.permlink, + }) + : null) } - > - {post.title} - {post.summary} - - -); + > + {get(post, 'title')} + {get(post, 'summary')} + + + ); +}; export default withNavigation(ParentPost); diff --git a/src/components/points/container/pointsContainer.js b/src/components/points/container/pointsContainer.js index 7e6781c2e..09dc0579e 100644 --- a/src/components/points/container/pointsContainer.js +++ b/src/components/points/container/pointsContainer.js @@ -31,7 +31,7 @@ class PointsContainer extends Component { componentDidMount() { this._fetchuserPointActivities(); - this.fetchInterval = setInterval(this._fetchuserPointActivities, 360000); + this.fetchInterval = setInterval(this._fetchuserPointActivities, 6 * 60 * 1000); } componentWillUnmount() { diff --git a/src/components/points/view/pointsView.js b/src/components/points/view/pointsView.js index e59649f5d..5eb530d34 100644 --- a/src/components/points/view/pointsView.js +++ b/src/components/points/view/pointsView.js @@ -1,9 +1,15 @@ import React, { Component, Fragment } from 'react'; import { - Text, View, FlatList, ScrollView, RefreshControl, TouchableOpacity, + Text, + View, + FlatList, + ScrollView, + RefreshControl, + TouchableOpacity, } from 'react-native'; import { injectIntl } from 'react-intl'; import { Popover, PopoverController } from 'react-native-modal-popover'; +import { get, size } from 'lodash'; // Components import { LineBreak, WalletLineItem } from '../../basicUIElements'; @@ -22,153 +28,166 @@ import styles from './pointsStyles'; class PointsView extends Component { /* Props - * ------------------------------------------------ - * @prop { type } name - Description.... - */ + * ------------------------------------------------ + * @prop { type } name - Description.... + */ constructor(props) { super(props); this.state = {}; } - // Component Life Cycles - // Component Functions - refreshControl = () => { - const { fetchUserActivity, refreshing, isDarkTheme } = this.props; + refreshControl = () => { + const { fetchUserActivity, refreshing, isDarkTheme } = this.props; - return ( - - ); - } + return ( + + ); + }; - render() { - const { - userActivities, userPoints, intl, isClaiming, claimPoints, - } = this.props; - // TODO: this feature temporarily closed. - const isActiveIcon = false; + render() { + const { + userActivities, + userPoints, + intl, + isClaiming, + claimPoints, + } = this.props; - return ( + return ( + + + + {userPoints.points} + eSteem Points + {get(userPoints, 'unclaimed_points') > 0 && ( + claimPoints()} + > + + + {userPoints.unclaimed_points} + + + + + + + )} - - - - {userPoints.points} - eSteem Points - {userPoints.unclaimed_points > 0 - && ( - claimPoints()} - > - - {userPoints.unclaimed_points} - - - - - - ) - } + + (item.type + index).toString()} + renderItem={({ item }) => ( + + {({ + openPopover, + closePopover, + popoverVisible, + setPopoverAnchor, + popoverAnchorRect, + }) => ( + + + + + + + + {intl.formatMessage({ id: POINTS[item.type].nameKey })} + + { + closePopover(); + }} + fromRect={popoverAnchorRect} + placement="top" + supportedOrientations={['portrait', 'landscape']} + > + + + {intl.formatMessage({ + id: POINTS[item.type].descriptionKey, + })} + + + + + )} + + )} + /> + - - ( - - {({ - openPopover, closePopover, popoverVisible, setPopoverAnchor, popoverAnchorRect, - }) => ( - - - - - - - {intl.formatMessage({ id: POINTS[item.type].nameKey })} - { - closePopover(); - }} - fromRect={popoverAnchorRect} - placement="top" - supportedOrientations={['portrait', 'landscape']} - > - - {intl.formatMessage({ id: POINTS[item.type].descriptionKey })} - - - - )} - - )} - /> - - - - {userActivities && userActivities.length < 1 - ? {intl.formatMessage({ id: 'points.no_activity' })} - : ( - ( - - )} - /> - ) - } - - - - - - - ); - } + + {size(userActivities) < 1 ? ( + + {intl.formatMessage({ id: 'points.no_activity' })} + + ) : ( + item.id.toString()} + renderItem={({ item, index }) => ( + + )} + /> + )} + + + + ); + } } export default injectIntl(PointsView); diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js index 01b6281d9..cff3956ea 100644 --- a/src/components/postElements/body/view/postBodyView.js +++ b/src/components/postElements/body/view/postBodyView.js @@ -7,7 +7,7 @@ import HTML from 'react-native-html-renderer'; import { getParentsTagsRecursively } from 'react-native-html-renderer/src/HTMLUtils'; // Utils -import { validateUsername } from '../../../../utils/user'; +import { validateUsername } from '../../../../utils/user'; // Styles import styles from './postBodyStyles'; @@ -94,14 +94,16 @@ class PostBody extends PureComponent { _handleOnPostPress = (permlink, author) => { const { navigation } = this.props; - navigation.navigate({ - routeName: ROUTES.SCREENS.POST, - params: { - author, - permlink, - }, - key: permlink, - }); + if (permlink) { + navigation.navigate({ + routeName: ROUTES.SCREENS.POST, + params: { + author, + permlink, + }, + key: permlink, + }); + } }; _handleOnUserPress = (username) => { diff --git a/src/components/postView/container/postDisplayContainer.js b/src/components/postView/container/postDisplayContainer.js index d9b42f558..ee7479c2e 100644 --- a/src/components/postView/container/postDisplayContainer.js +++ b/src/components/postView/container/postDisplayContainer.js @@ -53,6 +53,7 @@ class PostDisplayContainer extends Component { _handleOnReplyPress = () => { const { post, navigation } = this.props; + navigation.navigate({ routeName: ROUTES.SCREENS.EDITOR, params: { @@ -65,14 +66,20 @@ class PostDisplayContainer extends Component { _handleOnEditPress = () => { const { post, navigation } = this.props; - navigation.navigate({ - routeName: ROUTES.SCREENS.EDITOR, - params: { - isEdit: true, - post, - fetchPost: this._fetchPost, - }, - }); + + if (post) { + const isReply = post.parent_author; + + navigation.navigate({ + routeName: ROUTES.SCREENS.EDITOR, + params: { + isEdit: true, + isReply, + post, + fetchPost: this._fetchPost, + }, + }); + } }; _handleDeleteComment = (permlink) => { diff --git a/src/components/postView/view/postDisplayStyles.js b/src/components/postView/view/postDisplayStyles.js index 96061d3f9..4eb47c338 100644 --- a/src/components/postView/view/postDisplayStyles.js +++ b/src/components/postView/view/postDisplayStyles.js @@ -2,7 +2,8 @@ import EStyleSheet from 'react-native-extended-stylesheet'; export default EStyleSheet.create({ container: { - flexDirection: 'column', + backgroundColor: '$primaryBackgroundColor', + flex: 1, }, header: { marginHorizontal: 16, @@ -18,7 +19,7 @@ export default EStyleSheet.create({ flexDirection: 'row', }, scroll: { - height: '$deviceHeight / 1.135', + height: '$deviceHeight', backgroundColor: '$primaryBackgroundColor', marginBottom: 50, }, diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 6240f6f37..b4e20109e 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -167,7 +167,7 @@ class PostDisplayView extends PureComponent { } return ( - + this._handleOnScroll(event)}> {parentPost && } @@ -218,7 +218,7 @@ class PostDisplayView extends PureComponent { cancelButtonIndex={1} onPress={index => (index === 0 ? handleOnRemovePress(get(post, 'permlink')) : null)} /> - + ); } } diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 3883dd6f2..8681fd82c 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -8,6 +8,7 @@ import Config from 'react-native-config'; import { NavigationActions } from 'react-navigation'; import { bindActionCreators } from 'redux'; import Push from 'appcenter-push'; +import get from 'lodash/get'; // Languages import en from 'react-intl/locale-data/en'; @@ -21,10 +22,10 @@ import ko from 'react-intl/locale-data/ko'; import lt from 'react-intl/locale-data/lt'; import pt from 'react-intl/locale-data/pt'; import fa from 'react-intl/locale-data/fa'; -import he from 'react-intl/locale-data/he'; // Constants import AUTH_TYPE from '../../../constants/authType'; +import ROUTES from '../../../constants/routeNames'; // Services import { @@ -103,6 +104,7 @@ class ApplicationContainer extends Component { } this.globalInterval = setInterval(this._refreshGlobalProps, 180000); + this._createPushListener(); }; componentWillReceiveProps(nextProps) { @@ -139,6 +141,58 @@ class ApplicationContainer extends Component { this.setState({ isReady: true }); }; + _createPushListener = () => { + const { dispatch } = this.props; + let params = null; + let key = null; + let routeName = null; + + Push.setListener({ + onPushNotificationReceived(pushNotification) { + const push = get(pushNotification, 'customProperties'); + const permlink1 = get(push, 'permlink1'); + const permlink2 = get(push, 'permlink2'); + const permlink3 = get(push, 'permlink3'); + const parentPermlink1 = get(push, 'parent_permlink1'); + const parentPermlink2 = get(push, 'parent_permlink2'); + const parentPermlink3 = get(push, 'parent_permlink3'); + + if (parentPermlink1 || permlink1) { + const fullParentPermlink = `${parentPermlink1}${parentPermlink2}${parentPermlink3}`; + const fullPermlink = `${permlink1}${permlink2}${permlink3}`; + + params = { + author: parentPermlink1 ? get(push, 'parent_author') : get(push, 'target'), + permlink: parentPermlink1 + ? fullParentPermlink + : fullPermlink, + }; + key = parentPermlink1 + ? fullParentPermlink + : fullPermlink; + routeName = ROUTES.SCREENS.POST; + } else { + params = { + username: push.source, + }; + key = push.source; + routeName = ROUTES.SCREENS.PROFILE; + } + + this.pushNavigationTimeout = setTimeout(() => { + clearTimeout(this.pushNavigationTimeout); + const navigateAction = NavigationActions.navigate({ + routeName, + params, + key, + action: NavigationActions.navigate({ routeName }), + }); + dispatch(navigateAction); + }, 4000); + }, + }); + }; + _handleConntectionChange = (status) => { const { dispatch, isConnected } = this.props; diff --git a/src/screens/bookmarks/container/bookmarksContainer.js b/src/screens/bookmarks/container/bookmarksContainer.js index 239ae3531..692dd5832 100644 --- a/src/screens/bookmarks/container/bookmarksContainer.js +++ b/src/screens/bookmarks/container/bookmarksContainer.js @@ -117,13 +117,15 @@ class DraftsContainer extends Component { _handleOnBookarkPress = (permlink, author) => { const { navigation } = this.props; - navigation.navigate({ - routeName: ROUTES.SCREENS.POST, - params: { - permlink, - author, - }, - }); + if (permlink && author) { + navigation.navigate({ + routeName: ROUTES.SCREENS.POST, + params: { + permlink, + author, + }, + }); + } }; _sortData = data => data.sort((a, b) => { diff --git a/src/screens/bookmarks/screen/bookmarksScreen.js b/src/screens/bookmarks/screen/bookmarksScreen.js index 68f664a42..30a2d0c0b 100644 --- a/src/screens/bookmarks/screen/bookmarksScreen.js +++ b/src/screens/bookmarks/screen/bookmarksScreen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { injectIntl } from 'react-intl'; import { View, FlatList, Text } from 'react-native'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import ActionSheet from 'react-native-actionsheet'; // Components diff --git a/src/screens/drafts/screen/draftsScreen.js b/src/screens/drafts/screen/draftsScreen.js index c111ec8ee..6e6b754e8 100644 --- a/src/screens/drafts/screen/draftsScreen.js +++ b/src/screens/drafts/screen/draftsScreen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { injectIntl } from 'react-intl'; import { View, FlatList, Text } from 'react-native'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import ActionSheet from 'react-native-actionsheet'; // Utils diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index aa51bb115..53947bba3 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -274,9 +274,9 @@ class EditorContainer extends Component { }; _saveCurrentDraft = async (fields) => { - const { draftId, isReply } = this.state; + const { draftId, isReply, isEdit } = this.state; - if (!draftId) { + if (!draftId && !isEdit) { const { currentAccount } = this.props; const username = currentAccount && currentAccount.name ? currentAccount.name : ''; @@ -359,7 +359,7 @@ class EditorContainer extends Component { navigation.navigate({ routeName: ROUTES.SCREENS.POST, params: { - author: currentAccount.name, + author: get(currentAccount, 'name'), permlink, isNewPost: true, }, @@ -410,8 +410,8 @@ class EditorContainer extends Component { 0, ) .then(() => { - this._handleSubmitSuccess(); AsyncStorage.setItem('temp-reply', ''); + this._handleSubmitSuccess(); }) .catch((error) => { this._handleSubmitFailure(error); diff --git a/src/screens/home/screen/homeScreen.js b/src/screens/home/screen/homeScreen.js index 0d965414d..f4a3a3841 100644 --- a/src/screens/home/screen/homeScreen.js +++ b/src/screens/home/screen/homeScreen.js @@ -1,6 +1,6 @@ import React, { PureComponent, Fragment } from 'react'; import { View } from 'react-native'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import { injectIntl } from 'react-intl'; // Components diff --git a/src/screens/login/screen/loginScreen.js b/src/screens/login/screen/loginScreen.js index 9ba374111..811821288 100644 --- a/src/screens/login/screen/loginScreen.js +++ b/src/screens/login/screen/loginScreen.js @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { View, StatusBar, Platform } from 'react-native'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import { injectIntl } from 'react-intl'; // Actions diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index ca03a8a3d..026c43e46 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; +import get from 'lodash/get'; // Actions and Services import { getActivities, markActivityAsRead } from '../../../providers/esteem/esteem'; @@ -61,6 +62,9 @@ class NotificationContainer extends Component { _navigateToNotificationRoute = (data) => { const { navigation, username, dispatch } = this.props; + const type = get(data, 'type'); + const permlink = get(data, 'permlink'); + const author = get(data, 'author'); let routeName; let params; let key; @@ -68,30 +72,32 @@ class NotificationContainer extends Component { dispatch(updateUnreadActivityCount(result.unread)); }); - if (data.permlink) { + if (permlink) { routeName = ROUTES.SCREENS.POST; - key = data.permlink; + key = permlink; params = { - author: data.author, - permlink: data.permlink, - isHasParentPost: data.parent_author && data.parent_permlink, + author, + permlink, + isHasParentPost: get(data, 'parent_permlink'), }; - } else if (data.type === 'follow') { + } else if (type === 'follow') { routeName = ROUTES.SCREENS.PROFILE; - key = data.follower; + key = get(data, 'follower'); params = { - username: data.follower, + username: get(data, 'follower'), }; - } else if (data.type === 'transfer') { + } else if (type === 'transfer') { routeName = ROUTES.TABBAR.PROFILE; params = { activePage: 2 }; } - navigation.navigate({ - routeName, - params, - key, - }); + if (routeName) { + navigation.navigate({ + routeName, + params, + key, + }); + } }; _readAllNotification = () => { diff --git a/src/screens/notification/screen/notificationScreen.js b/src/screens/notification/screen/notificationScreen.js index 0bf310971..e0eb057e1 100644 --- a/src/screens/notification/screen/notificationScreen.js +++ b/src/screens/notification/screen/notificationScreen.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { View } from 'react-native'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import { injectIntl } from 'react-intl'; // Components diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index 19b065418..1d2eff353 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -3,7 +3,7 @@ import { View, ScrollView } from 'react-native'; import { injectIntl } from 'react-intl'; // Components -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import { Comments } from '../../../components/comments'; import { CollapsibleCard } from '../../../components/collapsibleCard'; import { Header } from '../../../components/header'; diff --git a/src/screens/profile/screen/profileStyles.js b/src/screens/profile/screen/profileStyles.js index d268553ba..743f4e945 100644 --- a/src/screens/profile/screen/profileStyles.js +++ b/src/screens/profile/screen/profileStyles.js @@ -53,11 +53,11 @@ export default EStyleSheet.create({ }, postTabBar: { backgroundColor: '$primaryBackgroundColor', + flex: 1, }, commentsTabBar: { backgroundColor: '$primaryBackgroundColor', paddingHorizontal: 16, paddingVertical: 5, }, - tabBarTitle: {}, }); diff --git a/src/screens/root/container/rootContainer.js b/src/screens/root/container/rootContainer.js index 2a516e54e..2d4fe4601 100644 --- a/src/screens/root/container/rootContainer.js +++ b/src/screens/root/container/rootContainer.js @@ -5,6 +5,7 @@ import { import { connect } from 'react-redux'; import Push from 'appcenter-push'; import { injectIntl } from 'react-intl'; +import get from 'lodash/get'; // Actions & Services import { openPinCodeModal } from '../../../redux/actions/applicationActions'; @@ -31,7 +32,6 @@ const RootContainer = () => (WrappedComponent) => { componentDidMount() { AppState.addEventListener('change', this._handleAppStateChange); - this._createPushListener(); if (Platform.OS === 'android') { Linking.getInitialURL().then((url) => { @@ -72,13 +72,15 @@ const RootContainer = () => (WrappedComponent) => { const routeParams = url.indexOf('/') > -1 ? url.split('/') : [url]; [, permlink] = routeParams; - author = routeParams[0].indexOf('@') > -1 ? routeParams[0].replace('@', '') : routeParams[0]; + author = routeParams && routeParams.length > 0 + && routeParams[0].indexOf('@') > -1 + ? routeParams[0].replace('@', '') : routeParams[0]; } if (author && permlink) { await getPost(author, permlink, currentAccountUsername) .then((result) => { - if (result && result.title) { + if (get(result, 'title')) { content = result; } else { this._handleAlert( @@ -111,10 +113,10 @@ const RootContainer = () => (WrappedComponent) => { } routeName = ROUTES.SCREENS.PROFILE; - params = { username: profile.name, reputation: profile.reputation }; + params = { username: get(profile, 'name'), reputation: get(profile, 'reputation') }; } - if (profile || content) { + if (routeName && (profile || content)) { this.navigationTimeout = setTimeout(() => { clearTimeout(this.navigationTimeout); navigation.navigate({ @@ -160,42 +162,6 @@ const RootContainer = () => (WrappedComponent) => { this.setState({ wrappedComponentStates: { ...data } }); }; - _createPushListener = () => { - const { navigation } = this.props; - let params = null; - let key = null; - let routeName = null; - - Push.setListener({ - onPushNotificationReceived(pushNotification) { - const push = pushNotification.customProperties; - - if (push.parent_permlink1 || push.permlink1) { - params = { - author: push.parent_permlink1 ? push.parent_author : push.target, - permlink: push.parent_permlink1 - ? `${push.parent_permlink1}${push.parent_permlink2}${push.parent_permlink3}` - : `${push.permlink1}${push.permlink2}${push.permlink3}`, - }; - key = push.parent_permlink1 - ? `${push.parent_permlink1}${push.parent_permlink2}${push.parent_permlink3}` - : `${push.permlink1}${push.permlink2}${push.permlink3}`; - routeName = ROUTES.SCREENS.POST; - } else { - params = { - username: push.source, - }; - key = push.source; - routeName = ROUTES.SCREENS.PROFILE; - } - - setTimeout(() => { - navigation.navigate({ routeName, params, key }); - }, 4000); - }, - }); - }; - render() { const { isPinCodeReqiure, navigation } = this.props; const { wrappedComponentStates } = this.state; diff --git a/src/screens/searchResult/screen/searchResultScreen.js b/src/screens/searchResult/screen/searchResultScreen.js index 53a23abfe..46514c88a 100644 --- a/src/screens/searchResult/screen/searchResultScreen.js +++ b/src/screens/searchResult/screen/searchResultScreen.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { View } from 'react-native'; -import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; import { injectIntl } from 'react-intl'; // Components diff --git a/yarn.lock b/yarn.lock index 8c6a43e97..a8f3d5949 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1090,20 +1090,6 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" -"@esteemapp/react-native-scrollable-tab-view@^0.8.2": - version "0.8.2" - resolved "https://registry.yarnpkg.com/@esteemapp/react-native-scrollable-tab-view/-/react-native-scrollable-tab-view-0.8.2.tgz#44c0b0dbfc5dca7361a0c60f21e5e6e95d486742" - integrity sha512-RjhzM0pSPHTHyMoyGa3NZRBBDB4gvco8TVmDo7MKzUqjF8a8BQYp43o8IMR5tkKN7UzGgKNsStuRch7MEb+0jQ== - dependencies: - create-react-class "^15.6.2" - prop-types "^15.6.0" - react-timer-mixin "^0.13.3" - -"@esteemapp/react-native-tags@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@esteemapp/react-native-tags/-/react-native-tags-1.3.1.tgz#8345384b21f4cfe26cd01bfea738b9b0ec7b04c2" - integrity sha512-r/EHz8h5wYOPNHA9nv6b2hcaX6pFJI36NHII4ADWJ4Ll9ikQIHCQsDmlS7X8FMmnRQZonETEKglMULfU0of9qw== - "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" @@ -7357,11 +7343,6 @@ react-native-modal-popover@0.0.12: lodash.debounce "^4.0.8" prop-types "^15.6.2" -react-native-restart@0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/react-native-restart/-/react-native-restart-0.0.6.tgz#77770d078683947b2c1f2adb876f179269d8443a" - integrity sha512-ysKvNOjCeCS8A4ouQkJ8DZRYH4wgPdPEJqqqSGFuNzK4eAi3VPOeneQ3w0HHYeOui5fc6fV9y9ClOB9LcKbKpQ== - react-native-safe-area-view@0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.11.0.tgz#4f3dda43c2bace37965e7c6aef5fc83d4f19d174" @@ -7374,6 +7355,15 @@ react-native-screens@^1.0.0-alpha.11: resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-1.0.0-alpha.22.tgz#7a120377b52aa9bbb94d0b8541a014026be9289b" integrity sha512-kSyAt0AeVU6N7ZonfV6dP6iZF8B7Bce+tk3eujXhzBGsLg0VSLnU7uE9VqJF0xdQrHR91ZjGgVMieo/8df9KTA== +react-native-scrollable-tab-view@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/react-native-scrollable-tab-view/-/react-native-scrollable-tab-view-0.10.0.tgz#8ce7908254685ee37d35df7d849676eaa1e81132" + integrity sha512-7FWw9X2hLozWqpGJTAU/p7ONdTTO635bbAZ5AUPDrB4JwaLbhNV6ePjsNUjsCaopgCwz/EdmH0hTCPeja9dh4w== + dependencies: + create-react-class "^15.6.2" + prop-types "^15.6.0" + react-timer-mixin "^0.13.3" + react-native-sentry@^0.42.0: version "0.42.0" resolved "https://registry.yarnpkg.com/react-native-sentry/-/react-native-sentry-0.42.0.tgz#9cd59659d9b6cd36d6fc4c48f50613cd82cde25f" @@ -7422,10 +7412,9 @@ react-native-view-overflow@0.0.3: resolved "https://registry.yarnpkg.com/react-native-view-overflow/-/react-native-view-overflow-0.0.3.tgz#d7b08e8c1e5047a2cf07f3ece82025899f930674" integrity sha512-CcX61kqFyO41WAmqARr/1A7YgTkd1GoQGJl0LYrzl+4CL5uw2CAu68T+1DPapt7RdgvSMLZIPlNvj4TzdJY/hw== -react-native@^0.57.5: +react-native@esteemapp/react-native: version "0.57.8" - resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.57.8.tgz#1a840fbe144cd3902cc14313a783ce28efc48cb9" - integrity sha512-K6DAMTPTq+lxVYC73y4Kh/bgLajddBaIKzwsVeV4JOoS1Fdq48/ISXD3vApV+x+/IBVTXnrT9qlA+9U6MMZCqA== + resolved "https://codeload.github.com/esteemapp/react-native/tar.gz/862999968c8a912c63c048c7b428ea2365a0b58f" dependencies: "@babel/runtime" "^7.0.0" absolute-path "^0.0.0" @@ -9378,9 +9367,9 @@ xcode@^2.0.0: simple-plist "^1.0.0" uuid "^3.3.2" -"xcode@git+https://github.com/apache/cordova-node-xcode.git#e7646f0680d509b590b839e567c217590451505b": +"xcode@https://github.com/apache/cordova-node-xcode#e7646f0680d509b590b839e567c217590451505b": version "1.0.1-dev" - resolved "git+https://github.com/apache/cordova-node-xcode.git#e7646f0680d509b590b839e567c217590451505b" + resolved "https://github.com/apache/cordova-node-xcode#e7646f0680d509b590b839e567c217590451505b" dependencies: simple-plist "^0.2.1" uuid "3.0.1"