Browse Source

deep links for Travellers section

Viktoriia 20 giờ trước cách đây
mục cha
commit
5210c7066d
3 tập tin đã thay đổi với 241 bổ sung1 xóa
  1. 9 1
      App.tsx
  2. 40 0
      app.config.ts
  3. 192 0
      src/contexts/NavigationContext.tsx

+ 9 - 1
App.tsx

@@ -80,7 +80,15 @@ const linking = {
       publicProfileView: '/profile/:userId',
       inAppEvent: '/event/:url',
       inAppMapTab: '/map/:lon/:lat',
-      inAppMessagesTab: '/messages'
+      inAppChatsList: '/messages',
+      inAppMasterRanking: '/master-ranking',
+      inAppLpiRanking: '/lpi',
+      inAppInMemoriam: '/in-memoriam',
+      inAppInHistory: '/travellers-in-history',
+      inAppUNMaster: '/un-masters',
+      inAppStatistics: '/statistics',
+      inAppTriumphs: '/triumphs',
+      inAppSeriesRanking: '/series-ranking'
     }
   }
 };

+ 40 - 0
app.config.ts

@@ -129,6 +129,46 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
             scheme: 'https',
             host: 'nomadmania.com',
             pathPrefix: '/messages/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/lpi/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/master-ranking/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/travellers-in-history/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/triumphs/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/statistics/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/in-memoriam/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/series-ranking/'
+          },
+          {
+            scheme: 'https',
+            host: 'nomadmania.com',
+            pathPrefix: '/un-masters/'
           }
         ],
         category: ['BROWSABLE', 'DEFAULT']

+ 192 - 0
src/contexts/NavigationContext.tsx

@@ -126,6 +126,198 @@ export const NavigationProvider = ({ children }: { children: React.ReactNode })
             ]
           })
         );
+      } else if (path.startsWith('/lpi')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.LPI_RANKING },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/master-ranking')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.MASTER_RANKING },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/travellers-in-history')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.IN_HISTORY },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/triumphs')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.TRIUMPHS },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/statistics')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.STATISTICS },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/in-memoriam')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.IN_MEMORIAM },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/series-ranking')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.SERIES_RANKING },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
+      } else if (path.startsWith('/un-masters')) {
+        navigation.dispatch(
+          CommonActions.reset({
+            index: 1,
+            routes: [
+              {
+                name: 'DrawerApp',
+                state: {
+                  routes: [
+                    {
+                      name: NAVIGATION_PAGES.IN_APP_TRAVELLERS_TAB,
+                      state: {
+                        routes: [
+                          { name: NAVIGATION_PAGES.TRAVELLERS_TAB },
+                          { name: NAVIGATION_PAGES.UN_MASTERS },
+                        ]
+                      }
+                    }
+                  ]
+                }
+              }
+            ]
+          })
+        );
       }
     }
     if (!initialUrlProcessed) {