From 3cb8169a4f98cf400b0560001b2d5588bd35b0c0 Mon Sep 17 00:00:00 2001
From: Ansh <anshnanda10@gmail.com>
Date: Tue, 30 May 2023 19:16:29 -0700
Subject: Fix deeplink when app is suspended (#812)

* Update Navigation.tsx

Missing If statement within the Deep Linking function that broke the ability to change state to hometab

* Updated the function correctly, I missed a bracket

* format

* add pre-existing home state when unspecified path

* Remove unnecessary log

---------

Co-authored-by: Gai <68623807+that-gai-gai@users.noreply.github.com>
Co-authored-by: that-gai-gai <kgai@protonmail.com>
---
 src/Navigation.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'src/Navigation.tsx')

diff --git a/src/Navigation.tsx b/src/Navigation.tsx
index 87330e3bf..77e7cfa0b 100644
--- a/src/Navigation.tsx
+++ b/src/Navigation.tsx
@@ -410,7 +410,16 @@ const LINKING = {
       if (name === 'Notifications') {
         return buildStateObject('NotificationsTab', 'Notifications', params)
       }
-      return buildStateObject('HomeTab', name, params)
+      if (name === 'Home') {
+        return buildStateObject('HomeTab', 'Home', params)
+      }
+      // if the path is something else, like a post, profile, or even settings, we need to initialize the home tab as pre-existing state otherwise the back button will not work
+      return buildStateObject('HomeTab', name, params, [
+        {
+          name: 'Home',
+          params: {},
+        },
+      ])
     } else {
       return buildStateObject('Flat', name, params)
     }
-- 
cgit 1.4.1

