forked from bluesky-social/social-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass referrer on native (with an opt out) (bluesky-social#6648)
* Pass referer on native * Add ChainLink3 * Add an opt out for sending utm * Remove noreferrer on links We do have <meta name="referrer" content="origin-when-cross-origin"> in HTML, should be sufficient. * Narrow down the condition slightly --------- Co-authored-by: Eric Bailey <[email protected]>
- Loading branch information
1 parent
fee2f5d
commit ac5b2cf
Showing
9 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {createSinglePathSVG} from './TEMPLATE' | ||
|
||
export const ChainLink3_Stroke2_Corner0_Rounded = createSinglePathSVG({ | ||
path: 'M18.535 5.465a5.003 5.003 0 0 0-7.076 0l-.005.005-.752.742a1 1 0 1 1-1.404-1.424l.749-.74a7.003 7.003 0 0 1 9.904 9.905l-.002.003-.737.746a1 1 0 1 1-1.424-1.404l.747-.757a5.003 5.003 0 0 0 0-7.076ZM6.202 9.288a1 1 0 0 1 .01 1.414l-.747.757a5.003 5.003 0 1 0 7.076 7.076l.005-.005.752-.742a1 1 0 1 1 1.404 1.424l-.746.737-.003.002a7.003 7.003 0 0 1-9.904-9.904l.74-.75a1 1 0 0 1 1.413-.009Zm8.505.005a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0Z', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react' | ||
|
||
import * as persisted from '#/state/persisted' | ||
|
||
type StateContext = boolean | ||
type SetContext = (v: boolean) => void | ||
|
||
const stateContext = React.createContext<StateContext>( | ||
Boolean(persisted.defaults.optOutOfUtm), | ||
) | ||
const setContext = React.createContext<SetContext>((_: boolean) => {}) | ||
|
||
export function Provider({children}: {children: React.ReactNode}) { | ||
const [state, setState] = React.useState( | ||
Boolean(persisted.get('optOutOfUtm')), | ||
) | ||
|
||
const setStateWrapped = React.useCallback( | ||
(optOutOfUtm: persisted.Schema['optOutOfUtm']) => { | ||
setState(Boolean(optOutOfUtm)) | ||
persisted.write('optOutOfUtm', optOutOfUtm) | ||
}, | ||
[setState], | ||
) | ||
|
||
React.useEffect(() => { | ||
return persisted.onUpdate('optOutOfUtm', nextOptOutOfUtm => { | ||
setState(Boolean(nextOptOutOfUtm)) | ||
}) | ||
}, [setStateWrapped]) | ||
|
||
return ( | ||
<stateContext.Provider value={state}> | ||
<setContext.Provider value={setStateWrapped}> | ||
{children} | ||
</setContext.Provider> | ||
</stateContext.Provider> | ||
) | ||
} | ||
|
||
export const useOptOutOfUtm = () => React.useContext(stateContext) | ||
export const useSetOptOutOfUtm = () => React.useContext(setContext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters