Giter Club home page Giter Club logo

Comments (12)

msasikanth avatar msasikanth commented on June 1, 2024 2

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

image

I have also updated the code to be a bit more concise and readable.

image

from simple-android.

msasikanth avatar msasikanth commented on June 1, 2024 2

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.

msasikanth avatar msasikanth commented on June 1, 2024

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.

vinaysshenoy avatar vinaysshenoy commented on June 1, 2024

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.

msasikanth avatar msasikanth commented on June 1, 2024

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.

image

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.

@vinaysshenoy

from simple-android.

vinaysshenoy avatar vinaysshenoy commented on June 1, 2024

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.

msasikanth avatar msasikanth commented on June 1, 2024

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.

Honey14 avatar Honey14 commented on June 1, 2024

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.

msasikanth avatar msasikanth commented on June 1, 2024

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.

msasikanth avatar msasikanth commented on June 1, 2024

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.

msasikanth avatar msasikanth commented on June 1, 2024

One small change is, I have updated the extensions to support multiple request keys.

image

from simple-android.

msasikanth avatar msasikanth commented on June 1, 2024

Closing this, since the change is merged in by #2948

from simple-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.