-
Notifications
You must be signed in to change notification settings - Fork 60
offline storage ? #89
Comments
A nice idea. I will add this in the next release. I'm not sure how to solve switching to "live" mode when there is a connection after a lack of connection. Perhaps one refresh (pull down) will be needed to do so. Stay tuned, I'm a little busy at the moment but I'm trying to reply all the issues and solve them :) |
A note to myself: Floating Action Button - "Go online": https://gist.github.com/Jogan/9def6110edf3247825c9 When an user is offline and wants to go online (there's a network connection again). |
I tried to do it a few times but apparently Facebook doesn't allow to cache the whole page. Although I managed to implement caching mechanism it didn't work. The idea is nice but unfortunately it's not gonna happen. The "problem" is in the website itself. |
that's unfortunate. what do you mean "to cache the whole page" ? My request was actually related to messages more then to the main page. Is it really complicated to store all received messages somewhere and build the message page from there ? You would need to parse the message page, look for individual messages and then store the html fragments . I'm sorry I can't help you with a bit of code, but java is definitely not my language ... Maybe you can publish in a separate branch your attempts, so others can start from there ... thank you for trying anyway :+1 |
Ok. I think there is a way to do it. Do you need images too? Or just text versions for offline mode? If text versions are enough than good and it's not so complicated. All the (selected at preferences) pages would be saved to a plain text file when visited. During offline mode the file would be loaded instead. The file would be obviously private.
On the other hand there is a serialization, but I'm not quite sure how to use it properly for a WebView. |
I think text is more then enough. In the end all fb messages are usually short and not very content-rich. What about using a small sqlite db to store everything ? This should remove clutter on the disk and maybe avoid over complicated lookup routines to retrieve a message ... 👍 |
Ooooh! It's a good point! I learned how to use SQLite recently. But in fact in Android the database is still saved in a file xD |
Ok, it's actually done. A dissappointing thing is: it doesn't work for a dynamically loaded content (e.g. opening the whole message thread). But it works great for a wide variety of cases. Let's assume there was something at the top of your newsfeed or you want to check upcoming events. If you have visited those pages recently there will be the latest version of them in a database. It saves just a plain html, so it doesn't use much data. All the images are loaded from cache. It was not possible to load the whole page from cache so I've invented a quite complicated workaround. Try for yourself. It may be usefull sometimes but it's not a must have :) |
I'll test it sometimes this evening / tomorrow and get back to you 👍 |
Great! Use the latest version please :) |
Hello. Tanks for implementing this. One question: you say that it is not possible to have the offline function for dynamically loaded content. Is this in any case, even for chats? Or do you think that there might be a way to solve this? |
ok, I've tested it now for a couple of days. My first impression is that the network detection is still a bit problematic. Sometimes it gets stuck in offline mode. This is just an impression. I didn't pinpoint the problem. Second , I see you present an overlay of the list of cached pages. This is ok, but it would be even better if you could maintain a cache of the message page (as it was seen the last time) and use that as an index to retrieve messages in offline mode. This way you could get rid of the small circle and just change the color of the bar when in offline mode, so to maintain the look and feel more consistent. Basically the different from offline and online mode would be just the color of the upper bar and the fact that some content would not be available... Other than that, I haven't noticed any regressions with the rest of the functionalities. |
Network detection should be good for the official release. I changed some things yesterday. Changing color of status bar looks like a great idea but remember that app supports also ICS and Jellybean and there is no way to change the color for those versions. To save a chat thread you have to pull to refresh the page because it cannot be done automatically. This way it will be saved to a database. I don't think it's possible to make it different. So in general I achieved more less the thing I was supposed to. To save a dynamically loaded page you have to refresh it unfortunatelly. |
Hi all.
First let me thank you for this very nice app ! I've a small request. I often find myself offline and in need to check a message I received earlier. Would it be possible to add some kind of offline storage or cache to make it possible to use the app even without network connection ? I really miss this feature.
thank you for your work !
The text was updated successfully, but these errors were encountered: