From f6ee6b767ef4db51dd7301c3323fe11796b47dd5 Mon Sep 17 00:00:00 2001 From: Amit Uttam Date: Wed, 15 Jan 2020 13:54:18 -0300 Subject: [PATCH] MM-14470 Deep links launch when app is not currently open (#3802) Previously, deep links would only work when the app was already open/previously launched. Now, invoking a deep link launches the app if not already open, and opens the deep link destination. --- app/components/post_list/post_list.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index cc396ba68..aa9b73318 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -98,7 +98,15 @@ export default class PostList extends PureComponent { } componentDidMount() { + const {actions, deepLinkURL} = this.props; + EventEmitter.on('scroll-to-bottom', this.handleSetScrollToBottom); + + // Invoked when hitting a deep link and app is not already running. + if (deepLinkURL) { + this.handleDeepLink(deepLinkURL); + actions.setDeepLinkURL(''); + } } componentDidUpdate(prevProps) { @@ -108,6 +116,7 @@ export default class PostList extends PureComponent { this.resetPostList(); } + // Invoked when hitting a deep link and app is already running. if (deepLinkURL && deepLinkURL !== prevProps.deepLinkURL) { this.handleDeepLink(deepLinkURL); actions.setDeepLinkURL('');