Comments (12)
The listeners are lifecycle aware, so internally it will observe lifecycle and do necessary operations. So we will only get results when the state is started
I have also updated the code to be a bit more concise and readable.
from simple-android.
Q: With
dispatchScreenResult
, we'd still have to implement the onScreenResult ToDo the body, right?
Yep, it will pass the request type and result and we can continue using the existing approach. So, only the internal implementation is changed.
from simple-android.
Since we only have handful of screens that require screen results, we can finish the migration process in a single PR. #2896
from simple-android.
This approach looks good to me. Ideally, I'd like to abstract even the receiving of results via the Router
in some way (similar to how we are abstracting the sending of results), but I think we can take a look at that after removing the existing mechanism for sending screen results since that will simplify a good bit of the Router
code.
from simple-android.
Okay, updated the Router
to support that. The dispatchScreenResult
function does get a bit complicated, but this would make use not to use the standard result pattern.
Also, one of the consequences I have mentioned (multiple listeners), it's no longer a concern. We can change our extension to support multiple request keys and just iterate over them when setting listeners.
What do you think? I personally prefer the listener approach compared to this. But I am open to either approach.
from simple-android.
This actually looks good. Correct me if I am wrong though, but wouldn't the listening for results have to be done when the fragment is created though? How would this work with the lifecycle?
from simple-android.
As long as the fragment itself is initialised, we can get the lifecycles. Since we found the fragment from the fragment manager, it should be in the initialised state.
from simple-android.
Found easier to understand the extraction after the listeners implemented in OnViewCreated
.
Q: With dispatchScreenResult
, we'd still have to implement the onScreenResult ToDo the body, right?
from simple-android.
The abstraction is causing a memory leak, I will see if we can resolve that leak, or else we will go with the listeners approach.
from simple-android.
Was not able to resolve the memory leak, have to take a look at it at some other time. There seems to be some issue with the fragment lifecycle that we are observing for results in the Router
. Going with the listener approach in the individual fragments.
cc: @vinaysshenoy @Honey14 @janhavisinghh
from simple-android.
One small change is, I have updated the extensions to support multiple request keys.
from simple-android.
Closing this, since the change is merged in by #2948
from simple-android.
Related Issues (20)
- A better way to add feature flags HOT 6
- `ProgressMaterialButton` HOT 16
- Migrating to Java Optional
- Use Dagger `Qualifier` instead of `Named` HOT 5
- Instruction to setup up JDK 1.8 installation on Windows Machines (Readme) HOT 2
- Suggestion[Update Git clone command) Readme HOT 4
- Improve the navigation framework HOT 4
- Proposal for automatic performance reporting of SQL queries HOT 5
- Setting up a regression test suite for meeting performance goals HOT 4
- Dependency Dashboard
- Reset PIN HOT 1
- Action Required: Fix Renovate Configuration
- Reporting a vulnerability HOT 2
- Hide "Record every patient…" text on home when a snackbar is visible HOT 1
- Switch to using App Bundle format for APK to reduce install file size HOT 3
- Gzip request bodies of network calls in the app HOT 4
- If the process restarts while a registration is happening, the app crashes HOT 1
- "Every patient" span of the message on the patients tab is missing on Lollipop devices HOT 1
- Build a custom view to enable fast entry of blood pressures HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-android.