drawRect / Instagram_Stories

Inspired by Instagram Stories functionality. This source is similar to Instagram Stories, which is having both image and video support.
MIT License
415 stars 76 forks source link

Firebase Implementation #95

Closed LoopingLouieX closed 4 years ago

LoopingLouieX commented 4 years ago

Seems like a good project but as it's not compatible with Firebase I am unable to use it. Implemented the same structure in the backend but with Firebase you will get the following data back. After trying more than a day nearly every possibility of converting the DataSnapshot from Firebase to the right structure I give up..

Optional({
    count = 1;
    stories =     {
        id = a1;
        "last_updated" = 15047999962;
        snaps =         {
            id = c1;
            "last_updated" = 12h;
            "mime_type" = video;
            url = "http://mirrors.standaloneinstaller.com/video-sample/small.mp4";
        };
        "snaps_count" = 1;
        user =         {
            id = b1;
            name = Teresa;
            picture = "https://randomuser.me/api/portraits/med/women/1.jpg";
        };
    };
})

If someone has used this with firebase already, please help out. Otherwise please implement a functionality of converting it to the right structure.

Any additional general documentation would be very helpful!

ranmyfriend commented 4 years ago

Hi @LoopingLouieX

Thanks for using this library.

Actually the JSON we are keeping it in the bundle completely supportive on Backend which using Rest calls. But in using Firebase, you have follow the same strategy, like how story and user and to snap we have segregated same like you also can do follow this hierarchy in your firebase Real-Time DB structure. But, you cannot follow the JSON Encoding to load models from Firebase Snapshot. In this case, you have to iterate the firebase reference children and create IGStories, IGStory, IGStory Models respectively by your own and set all those values from respective child value.

Let me know if you face any issues with architecting the Real-time Firebase DB.

boominadhaprakash commented 4 years ago

Closing this issue due to inactivity. Please reopen this, if anyone needs idea or facing issues related to this in future.