oldergod / android-architecture

MVI architecture Implementation of the ToDo app.
Apache License 2.0
669 stars 70 forks source link

How to handle realtime data subscriber #63

Closed watsaponk closed 4 years ago

watsaponk commented 4 years ago

Example : Chat Application that message can come anytime I should subscribe to realtime data source on Fragment or ViewModel ? if I subscribe on ViewModel so it ok or not to call intent inside ViewModel?

Thank yoy

oldergod commented 4 years ago

Any new emission should generate a new view model. You could receive a push notification which would update a DB which the presenter could react on.

watsaponk commented 4 years ago

mvi_realtime-data

Am i understand correctly ?

oldergod commented 4 years ago

A processor should be the one hitting the network or the cache or whatever it is. Otherwise, yes.

watsaponk commented 4 years ago

thank you @oldergod :)