Przeglądaj źródła

deep links for messages

Viktoriia 22 godzin temu
rodzic
commit
069ffae696
3 zmienionych plików z 30 dodań i 1 usunięć
  1. 2 1
      App.tsx
  2. 5 0
      app.config.ts
  3. 23 0
      src/contexts/NavigationContext.tsx

+ 2 - 1
App.tsx

@@ -79,7 +79,8 @@ const linking = {
     screens: {
       publicProfileView: '/profile/:userId',
       inAppEvent: '/event/:url',
-      inAppMapTab: '/map/:lon/:lat'
+      inAppMapTab: '/map/:lon/:lat',
+      inAppMessagesTab: '/messages'
     }
   }
 };

+ 5 - 0
app.config.ts

@@ -124,6 +124,11 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
             scheme: 'https',
             host: 'nomadmania.com',
             pathPrefix: '/map/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/messages/'
           }
         ],
         category: ['BROWSABLE', 'DEFAULT']

+ 23 - 0
src/contexts/NavigationContext.tsx

@@ -103,6 +103,29 @@ export const NavigationProvider = ({ children }: { children: React.ReactNode })
             })
           );
         }
+      } else if (path.startsWith('/messages')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_MESSAGES_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.CHATS_LIST },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
       }
     }
     if (!initialUrlProcessed) {