| #
c596d6cd |
| 21-Feb-2020 |
Tomasz Sapeta <[email protected]> |
[android][home] Add DevMenu on Android (#6829)
# Why
Fixes #6521
# How
- Created unversioned `DevMenuManager` class which mostly just delegates calls to versioned `DevMenuModule` module
[android][home] Add DevMenu on Android (#6829)
# Why
Fixes #6521
# How
- Created unversioned `DevMenuManager` class which mostly just delegates calls to versioned `DevMenuModule` modules specific for SDK version. These modules are responsible for providing initial props, dev menu options and actions to run when these options are selected. The manager creates a new `ReactRootView` that bases on kernel's (home's) React instance manager and starts `HomeMenu` app which is registered as a second entry point in `home` and then, manager adds this root view to the currently used activity (it must implement `ExperienceActivity`). As I needed to know which experience activity is the current one, I've added `sCurrentActivity` static member to that class and just track it using activity's lifecycle methods.
- Backported `DevMenuModule` to all SDK versions included in the client. Including some changes between them - for example hot and fast reloading.
- Added support for back button and Android's menu press (which can be simulated by `adb shell input keyevent 82`).
- Removed some unused code related to `Nux` and replaced it with new onboarding screen (see #6793).
- Created new `ShakeDetector` which works more like on iOS. The one provided by React Native is annoying in most cases as it actually requires two shakes.
- Updated `ReactAndroidCodeTransformer` to turn off showing React Native dev menu in non-standalone apps.
- **To do after merging:** Rebuild versioned expoviews.
# Test Plan
- [x] Test on experience in debug mode
- [x] Test on experience in production mode
- [x] Test on snacks
- [x] Test on older SDKs
- [x] Test on simulators
- [x] Test that onboarding shows up once you open the experience for the first time or you didn't accept it yet (clicked `Got it` button).
- [x] Test that using dev menu still works once we kill home's activity.
show more ...
|