Skip to content

Conversation

@stevekuznetsov
Copy link
Collaborator

This commit adds a function to map between any avalanche center's URL and the correct set of (nested) screens on the app. Lots of testing to do.

if (initialUrl) {
// this url contains the whole url, like so: https://nwac.us/observations/#/observations/fb5bb19a-2b89-4c9c-91d2-eb673c5ab877
const url = new URL(initialUrl);
return getStateFromPath(path + '?share=true&share_url=' + url.origin + '/', opts);
Copy link
Collaborator

@yuliadub yuliadub Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the back button navigation depends on these two params - so if you are going to fully take this out, that logic will need to change or it will be broken

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I am hoping we don't go that route ... 🤞

};

// centers use the widgets, and the widgets manage state after some prefix in the URL; not ever center has the same prefix for every widget
const prefixesForCenter = (avalancheCenter: AvalancheCenterID): prefixes => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense for this to live in a separate file vs with all this linking

This commit adds a function to map between any avalanche center's URL
and the correct set of (nested) screens on the app. Lots of testing to
do.

Signed-off-by: Steve Kuznetsov <stekuznetsov@microsoft.com>
@stevekuznetsov stevekuznetsov force-pushed the skuznets/linking-config branch from 99429a4 to 3ac4dac Compare October 31, 2024 20:49
Signed-off-by: Steve Kuznetsov <stekuznetsov@microsoft.com>
@stevekuznetsov
Copy link
Collaborator Author

Fixes #812

import {TabNavigatorParamList} from 'routes';
import {AvalancheCenterID, AvalancheCenterWebsites, reverseLookup} from 'types/nationalAvalancheCenter';

export const getStateFromUrl = (logger: Logger, rawUrl: string): undefined | PartialState<NavigationState<TabNavigatorParamList>> => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: on unknown, fall back to a new webview in the root stack that just shows the website, since there's no way to programatically reject some parts of the domain if we're registered for the whole thing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and/or use the filter config for linking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants