forked from binary-com/deriv-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.
Merge pull request #46 from mahdiyeh-fs/mahdiyeh/83434/remove_is_pre_…
…appstore_from_localstorage bugfix: remove localstorage for is_pre_appstore
- Loading branch information
Showing
3 changed files
with
28 additions
and
32 deletions.
There are no files selected for viewing
18 changes: 6 additions & 12 deletions
18
packages/core/src/App/Containers/PlatformContainer/PlatformContainer.jsx
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 |
---|---|---|
@@ -1,32 +1,26 @@ | ||
import React from 'react'; | ||
import { PlatformContext } from '@deriv/shared'; | ||
import { connect } from 'Stores/connect'; | ||
|
||
const DERIV_APPSTORE_KEY = 'is_appstore'; | ||
const DERIV_PRE_APPSTORE_KEY = 'is_pre_appstore'; | ||
|
||
const PlatformContainer = ({ ...props }) => { | ||
const PlatformContainer = ({ is_pre_appstore, setIsPreAppStore, ...props }) => { | ||
// TODO: set is_appstore based on a flag from BE. | ||
const is_appstore_storage = window.localStorage.getItem(DERIV_APPSTORE_KEY) === 'true'; | ||
const [is_appstore, setIsAppStore] = React.useState(is_appstore_storage); | ||
|
||
// TODO: set is_pre_appstore based on a flag from BE. | ||
const is_pre_appstore_storage = window.localStorage.getItem(DERIV_PRE_APPSTORE_KEY) === 'true'; | ||
const [is_pre_appstore, setIsPreAppStore] = React.useState(is_pre_appstore_storage); | ||
|
||
React.useEffect(() => { | ||
window.localStorage.setItem(DERIV_PRE_APPSTORE_KEY, is_pre_appstore); | ||
}, [is_pre_appstore]); | ||
|
||
const platform_store = { | ||
is_appstore, | ||
setIsAppStore, | ||
DERIV_APPSTORE_KEY, | ||
is_pre_appstore, | ||
setIsPreAppStore, | ||
DERIV_PRE_APPSTORE_KEY, | ||
}; | ||
|
||
return <PlatformContext.Provider value={platform_store} {...props} />; | ||
}; | ||
|
||
export default PlatformContainer; | ||
export default connect(({ client }) => ({ | ||
is_pre_appstore: client.is_pre_appstore, | ||
setIsPreAppStore: client.setIsPreAppStore, | ||
}))(PlatformContainer); |
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