-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48007 from software-mansion-labs/share-token-in-h…
…ybridapp [HybridApp] Share auth token in HybridApp (cherry picked from commit 217774b) (CP triggered by AndrewGable)
- Loading branch information
1 parent
cbd6547
commit e815cb9
Showing
27 changed files
with
332 additions
and
415 deletions.
There are no files selected for viewing
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,40 @@ | ||
diff --git a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js | ||
index 68bd389..be9b5bf 100644 | ||
--- a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js | ||
+++ b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js | ||
@@ -232,12 +232,34 @@ const AppRegistry = { | ||
appParameters: Object, | ||
displayMode?: number, | ||
): void { | ||
+ const redactAppParameters = (parameters) => { | ||
+ const initialProps = parameters['initialProps']; | ||
+ const url = initialProps['url']; | ||
+ | ||
+ if(!url) { | ||
+ return parameters; | ||
+ } | ||
+ | ||
+ const sensitiveParams = ['authToken', 'autoGeneratedPassword', 'autoGeneratedLogin']; | ||
+ const [urlBase, queryString] = url.split('?'); | ||
+ | ||
+ if (!queryString) { | ||
+ return parameters; | ||
+ } | ||
+ | ||
+ const redactedSearchParams = queryString.split('&').map((param) => { | ||
+ const [key, value] = param.split('='); | ||
+ return `${key}=${sensitiveParams.includes(key) ? '<REDACTED>' : value}` | ||
+ }); | ||
+ return {...parameters, initialProps: {...initialProps, url: `${urlBase}?${redactedSearchParams.join('&')}`}}; | ||
+ } | ||
+ | ||
if (appKey !== 'LogBox') { | ||
const msg = | ||
'Updating props for Surface "' + | ||
appKey + | ||
'" with ' + | ||
- JSON.stringify(appParameters); | ||
+ JSON.stringify(redactAppParameters(appParameters)); | ||
infoLog(msg); | ||
BugReporting.addSource( | ||
'AppRegistry.setSurfaceProps' + runCount++, |
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,34 @@ | ||
import React, {useContext, useMemo, useState} from 'react'; | ||
import type {ValueOf} from 'type-fest'; | ||
import CONST from './CONST'; | ||
import type ChildrenProps from './types/utils/ChildrenProps'; | ||
|
||
type SplashScreenStateContextType = { | ||
splashScreenState: ValueOf<typeof CONST.BOOT_SPLASH_STATE>; | ||
setSplashScreenState: React.Dispatch<React.SetStateAction<ValueOf<typeof CONST.BOOT_SPLASH_STATE>>>; | ||
}; | ||
|
||
const SplashScreenStateContext = React.createContext<SplashScreenStateContextType>({ | ||
splashScreenState: CONST.BOOT_SPLASH_STATE.VISIBLE, | ||
setSplashScreenState: () => {}, | ||
}); | ||
|
||
function SplashScreenStateContextProvider({children}: ChildrenProps) { | ||
const [splashScreenState, setSplashScreenState] = useState<ValueOf<typeof CONST.BOOT_SPLASH_STATE>>(CONST.BOOT_SPLASH_STATE.VISIBLE); | ||
const splashScreenStateContext = useMemo( | ||
() => ({ | ||
splashScreenState, | ||
setSplashScreenState, | ||
}), | ||
[splashScreenState], | ||
); | ||
|
||
return <SplashScreenStateContext.Provider value={splashScreenStateContext}>{children}</SplashScreenStateContext.Provider>; | ||
} | ||
|
||
function useSplashScreenStateContext() { | ||
return useContext(SplashScreenStateContext); | ||
} | ||
|
||
export default SplashScreenStateContext; | ||
export {SplashScreenStateContextProvider, useSplashScreenStateContext}; |
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
Oops, something went wrong.