forked from Expensify/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 Expensify#23831 from Expensify/tgolen-auto-enableM…
…emoryOnlyKeys Automatically enable memory only keys when payload size of reconnectapp/openapp is too large
- Loading branch information
Showing
7 changed files
with
73 additions
and
22 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,19 @@ | ||
import Onyx from 'react-native-onyx'; | ||
import ONYXKEYS from '../../../ONYXKEYS'; | ||
import Log from '../../Log'; | ||
|
||
const memoryOnlyKeys = [ONYXKEYS.COLLECTION.REPORT, ONYXKEYS.COLLECTION.POLICY, ONYXKEYS.PERSONAL_DETAILS_LIST]; | ||
|
||
const enable = () => { | ||
Log.info('[MemoryOnlyKeys] enabled'); | ||
Onyx.set(ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS, true); | ||
Onyx.setMemoryOnlyKeys(memoryOnlyKeys); | ||
}; | ||
|
||
const disable = () => { | ||
Log.info('[MemoryOnlyKeys] disabled'); | ||
Onyx.set(ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS, false); | ||
Onyx.setMemoryOnlyKeys([]); | ||
}; | ||
|
||
export {disable, enable}; |
12 changes: 12 additions & 0 deletions
12
src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.js
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,12 @@ | ||
import * as MemoryOnlyKeys from '../MemoryOnlyKeys'; | ||
|
||
const exposeGlobalMemoryOnlyKeysMethods = () => { | ||
window.enableMemoryOnlyKeys = () => { | ||
MemoryOnlyKeys.enable(); | ||
}; | ||
window.disableMemoryOnlyKeys = () => { | ||
MemoryOnlyKeys.disable(); | ||
}; | ||
}; | ||
|
||
export default exposeGlobalMemoryOnlyKeysMethods; |
6 changes: 6 additions & 0 deletions
6
src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.native.js
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,6 @@ | ||
/** | ||
* This is a no-op because the global methods will only work for web and desktop | ||
*/ | ||
const exposeGlobalMemoryOnlyKeysMethods = () => {}; | ||
|
||
export default exposeGlobalMemoryOnlyKeysMethods; |
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