Skip to content

Commit

Permalink
[GAL-4226] Deep Link to Post (#1895)
Browse files Browse the repository at this point in the history
* deeplink post

* Avoid username that has post string
  • Loading branch information
jakzaizzat authored Sep 8, 2023
1 parent 7a52ca5 commit 70d2412
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/mobile/src/components/DeepLinkRegistrar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ export function DeepLinkRegistrar() {
const parsedUrl = new URL(url);
const splitBySlash = parsedUrl.pathname.split('/').filter(Boolean);

if (parsedUrl.pathname.includes('post/')) {
const [, maybePostId] = splitBySlash;

if (maybePostId) {
navigation.navigate('MainTabs', {
screen: 'HomeTab',
params: {
screen: 'Post',
params: { postId: maybePostId },
},
});
}

return;
}

if (splitBySlash.length === 1) {
const [maybeUsername] = splitBySlash;

Expand Down

0 comments on commit 70d2412

Please sign in to comment.