diff --git a/ios/Ecency/Ecency.entitlements b/ios/Ecency/Ecency.entitlements index c05be6550..5a093c0e5 100644 --- a/ios/Ecency/Ecency.entitlements +++ b/ios/Ecency/Ecency.entitlements @@ -4,14 +4,15 @@ aps-environment development + com.apple.developer.associated-domains + + applinks:ecency.com + applinks:ecency.page.link + applinks:alpha.ecency.com + com.apple.security.application-groups group.com.ecency.eshare - com.apple.developer.associated-domains - - applinks:ecency.com - applinks:ecency.page.link - diff --git a/src/components/profile/profileView.js b/src/components/profile/profileView.js index 676bc1ae5..f9e128ca5 100644 --- a/src/components/profile/profileView.js +++ b/src/components/profile/profileView.js @@ -170,6 +170,7 @@ class ProfileView extends PureComponent { const { currencyRate, currencySymbol, selectedUser } = this.props; const { isSummaryOpen, estimatedWalletValue } = this.state; + return ( val === deepLinkFilter); + if (selectedIndex < 0) { + tabs.pop(); + tabs.push(deepLinkFilter); + selectedIndex = 2; + } + } + const filterOptions = tabs.map((key) => getFilterMap(pageType)[key]); //compile content overrides @@ -222,7 +235,7 @@ class ProfileView extends PureComponent { key={username + JSON.stringify(filterOptions)} filterOptions={filterOptions} filterOptionsValue={tabs} - selectedOptionIndex={0} + selectedOptionIndex={selectedIndex} pageType={pageType} getFor="blog" feedUsername={username} diff --git a/src/constants/routeNames.js b/src/constants/routeNames.js index fcaa8efeb..efbbfca3c 100644 --- a/src/constants/routeNames.js +++ b/src/constants/routeNames.js @@ -31,6 +31,7 @@ export default { COMMUNITY: `Community${SCREEN_SUFFIX}`, COMMUNITIES: `Communities${SCREEN_SUFFIX}`, YOUTUBE: `YouTube${SCREEN_SUFFIX}`, + WEB_BROWSER: `WebBrowser${SCREEN_SUFFIX}`, }, DRAWER: { MAIN: `Main${DRAWER_SUFFIX}`, diff --git a/src/containers/profileContainer.js b/src/containers/profileContainer.js index 4d912702f..158769784 100644 --- a/src/containers/profileContainer.js +++ b/src/containers/profileContainer.js @@ -56,6 +56,7 @@ class ProfileContainer extends Component { name: get(props, 'navigation.state.params.username', ''), }, reverseHeader: !!username, + deepLinkFilter: get(props, 'navigation.state.params.deepLinkFilter'), }; } @@ -68,6 +69,7 @@ class ProfileContainer extends Component { currentAccount: { name: currentAccountUsername }, } = this.props; const username = get(navigation, 'state.params.username'); + const { isOwnProfile } = this.state; let targetUsername = currentAccountUsername; @@ -436,6 +438,7 @@ class ProfileContainer extends Component { user, username, reverseHeader, + deepLinkFilter, } = this.state; const { currency, isDarkTheme, isLoggedIn, navigation, children, isHideImage } = this.props; const activePage = get(navigation.state.params, 'state', 0); @@ -486,6 +489,7 @@ class ProfileContainer extends Component { selectedUser: user, username, reverseHeader, + deepLinkFilter, }) ); } diff --git a/src/navigation/routes.js b/src/navigation/routes.js index 51068a1ab..f897d59a9 100644 --- a/src/navigation/routes.js +++ b/src/navigation/routes.js @@ -38,6 +38,7 @@ import { TagResult, Community, Communities, + WebBrowser, } from '../screens'; import YoutubePlayer from '../screens/youtube/youtubePlayer'; @@ -152,6 +153,7 @@ const stackNavigator = createStackNavigator( [ROUTES.SCREENS.COMMUNITY]: { screen: Community }, [ROUTES.SCREENS.COMMUNITIES]: { screen: Communities }, [ROUTES.SCREENS.YOUTUBE]: { screen: YoutubePlayer }, + [ROUTES.SCREENS.WEB_BROWSER]: { screen: WebBrowser }, }, { headerMode: 'none', diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 622b35bce..7b745c082 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -272,29 +272,47 @@ class ApplicationContainer extends Component { try { if (author) { - if (permlink) { + if ( + !permlink || + permlink === 'wallet' || + permlink === 'points' || + permlink === 'comments' || + permlink === 'replies' || + permlink === 'posts' + ) { + let deepLinkFilter; + if (permlink) { + deepLinkFilter = permlink === 'points' ? 'wallet' : permlink; + } + + profile = await getUser(author); + routeName = ROUTES.SCREENS.PROFILE; + params = { + username: get(profile, 'name'), + reputation: get(profile, 'reputation'), + deepLinkFilter, //TODO: process this in profile screen + }; + keey = get(profile, 'name'); + } else if (permlink === 'communities') { + routeName = ROUTES.SCREENS.WEB_BROWSER; + params = { + url: url, + }; + keey = 'WebBrowser'; + } else if (permlink) { content = await getPost(author, permlink, currentAccount.name); routeName = ROUTES.SCREENS.POST; params = { content, }; keey = `${author}/${permlink}`; - } else { - profile = await getUser(author); - routeName = ROUTES.SCREENS.PROFILE; - params = { - username: get(profile, 'name'), - reputation: get(profile, 'reputation'), - }; - keey = get(profile, 'name'); } } + if (feedType) { - routeName = ROUTES.SCREENS.SEARCH_RESULT; - keey = 'search'; - } - if (feedType && tag) { - if (/hive-[1-3]\d{4,6}$/.test(tag)) { + if (!tag) { + routeName = ROUTES.SCREENS.TAG_RESULT; + } else if (/hive-[1-3]\d{4,6}$/.test(tag)) { routeName = ROUTES.SCREENS.COMMUNITY; } else { routeName = ROUTES.SCREENS.TAG_RESULT; @@ -303,7 +321,7 @@ class ApplicationContainer extends Component { tag, filter: feedType, }; - keey = `${feedType}/${tag}`; + keey = `${feedType}/${tag || ''}`; } } catch (error) { this._handleAlert('deep_link.no_existing_user'); diff --git a/src/screens/index.js b/src/screens/index.js index 2d37b40f8..3a45e2482 100755 --- a/src/screens/index.js +++ b/src/screens/index.js @@ -18,6 +18,7 @@ import ProfileEdit from './profileEdit/screen/profileEditScreen'; import Reblogs from './reblogs'; import Redeem from './redeem/screen/redeemScreen'; import HiveSigner from './steem-connect/hiveSigner'; +import { WebBrowser } from './webBrowser'; import Transfer from './transfer'; import Voters from './voters'; import AccountBoost from './accountBoost/screen/accountBoostScreen'; @@ -54,4 +55,5 @@ export { TagResult, Community, Communities, + WebBrowser, }; diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index bcf8d6e8c..5e5467919 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -40,6 +40,7 @@ const ProfileScreen = () => ( username, votingPower, reverseHeader, + deepLinkFilter, }) => ( ( votingPower={votingPower} isHideImage={isHideImage} reverseHeader={reverseHeader} + deepLinkFilter={deepLinkFilter} /> )} diff --git a/src/screens/webBrowser/index.ts b/src/screens/webBrowser/index.ts new file mode 100644 index 000000000..6f4acfaf6 --- /dev/null +++ b/src/screens/webBrowser/index.ts @@ -0,0 +1 @@ +export {default as WebBrowser} from './webBrowser'; \ No newline at end of file diff --git a/src/screens/webBrowser/webBrowser.tsx b/src/screens/webBrowser/webBrowser.tsx new file mode 100644 index 000000000..a1de6958e --- /dev/null +++ b/src/screens/webBrowser/webBrowser.tsx @@ -0,0 +1,47 @@ +import React, { PureComponent } from 'react'; +import { View, StatusBar } from 'react-native'; +import { WebView } from 'react-native-webview'; + +import { injectIntl } from 'react-intl'; +import { withNavigation } from 'react-navigation'; +import { SafeAreaView } from 'react-native-safe-area-context'; +import { BasicHeader } from '../../components'; + +class WebBrowser extends PureComponent { + constructor(props) { + super(props); + + this.state = { + isLoading: false, + }; + } + + _onNavigationStateChange = (event) => { + + }; + + render() { + const url = this.props.navigation.getParam('url'); + return ( + + + + { + this.webview = ref; + }} + /> + + ); + } +} + + + +export default injectIntl(withNavigation(WebBrowser));