Code Monkey home page Code Monkey logo

Comments (5)

David-Development avatar David-Development commented on August 14, 2024

First of all, thank you for showing interest in the library! :)

Honestly, I haven't heard of LiveData yet. It looks like it's a new concept (kind of similar to observable I guess). In the docs there is a little paragraph about using rxjava / rxjava2 and LiveData. I think it would be awesome to see some integration here! Since I have limited time right now and I'm still fixing some core-issues of this library, feel free to create a PR if you're able to create an example using LiveData. Would love to add support for LiveData to this library as well! :)

If you have any more questions, feel free to send me an email or text me on matrix (@David-Dev:matrix.org)

from android-singlesignon.

David-Dev avatar David-Dev commented on August 14, 2024

image

from android-singlesignon.

desperateCoder avatar desperateCoder commented on August 14, 2024

We use LiveData in the Deck-app a lot. I have some methods written, that could come handy, when you are going to implement the support: https://github.com/stefan-niedermann/nextcloud-deck/blob/master/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/util/LiveDataHelper.java

e.g. you can turn anything into a LiveData and stuff. Maybe this helps. If you have questions about it, you know how to contact me 😉

from android-singlesignon.

stefan-niedermann avatar stefan-niedermann commented on August 14, 2024

AFAIK it is not possible to make network requests directly via LiveData. One would need to perform the actual Calls and map them into a new MutableLiveData instance - or transform an Observable into LiveData.

My understanding of a good Android app architecture is, that the Repository layer is responsible of delivering results from a local store (aka database) and synchronizing the contents of the database with unreliable remote resources in the background.
LiveData is therefore understandable needed to watch the data of a database via repository, but since the synchronization with remote sources should be handled in the background, there is no dependency to the current state of the Activity / Fragment here in my opinion.

@schaarsc are you aware of any app which is using LiveData in the Remote Data Source layer? Maybe i am missing something here, but i have never seen something like this in the wild yet.

However, i think a valid point is to make the current SingleSignOnAccount available as a LiveData which then can be used in combination with Transformations#map or Transformations#switchMap. I therefore created a PR which adds this feature and deprecates the usage of (un)registerSharedPreferenceChangeListener.

from android-singlesignon.

schaarsc avatar schaarsc commented on August 14, 2024

I have not been active for quite some time, so I'm not sure how this would fit into the current state of implementations ...

The idea behind the original request was to handle all data with LiveData (local and remote).
The UI would be connected to MediatorLiveData and does not need to know where the data comes from.

References:

from android-singlesignon.

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.