Package 

Class LoadAfterJoin


  • 
    public final class LoadAfterJoin
    
                        

    Many fragments need to load data out of the MeetingViewModel or the ChatViewModel when the view is created. However, if they do this just in onViewCreated, then if the app is destroyed by going in the background, they won't wait until the app has joined the room to load this data. Which means they will crash at some point. Everything covered in this class has been tested by

    • Turning on kill background activities

    • Leave the app, so it's in the background and open it again.

    Fragments particularly must have empty constructors only. This can be resolved by:

    • For methods, make them lateinit and apply them after the fragment is created.

    • For data, pass it in an argument.