Laravel Offline PWA: Data Sync and View Fallback using TALL Stack - progressive-web-apps

Can Laravel with Livewire be used to create a PWA that completely works offline (static HTML views), stores data client-side and syncs when re-connected to the internet?

Related

Rest API data stored in locally - Flutter

I have a requirement to store data locally to use within a Flutter mobile application. This stored data will be used for when the device is offline and will need to be updated, whilst offline.
On initial login of the application, data must be pulled from a REST API and stored locally to be displayed within the app.
Does anyone have any pointers as to what is the best method for this? I've looked at Sqflite but i can't seem to see any tutorials or documentation on setting this up using an API to 'fill' the data initially.
Any advice would be appreciated.
There are many ways to go about this.
One option is simply using dio, which has caching support built in.
Or, you could use something like hive or SharedPreferences along with http to to persist the data yourself (depending on what level of control you want/need).
You could also encapsulate the data in a state management solution like riverpod (specifically a FutureProvider in this case) which will soon have offline persistence support.
If building an application from scratch, I'd recommend the riverpod route (and it will soon have that offline persistence support).

Flutter Offline app with Spring Boot as Backend using MongoDB

Currently, I have a flutter app using Spring Boot Framework with MongoDB. I want to add Offline functionality to the application.
App Functionality:
User fills various forms(personal details, family member details, etc).
Use Case: When the user fills the Personal Details Form fields like 'name', 'dob' are filled manually and location (selected using the dropdown(GET APIs)).
The internet connection might be gone while filling these forms.
How can I make the application offline ready?
One way that I thought of is storing all the data using any local database like SQLite but there can more than 10 Forms so it can be difficult for maintaining a lot of data. Moreover, how the data will sync with Backend?
Questions:
How to store data?
How to sync store data with Backend when the app comes Online?
Is there any other better approach to achieve this task?

Core Data vs mysql

I already have a django application and am trying to develop an iPhone app. I'm using mysql as the database for the django app.
Here are some questions I was having :
Is it necessary to use Core Data for anything?
Can I create a rest api to interact with the mysql database?
If so, would there be any advantage, at any place or reason, to use Core Data in addition to mysql. For example, for an app like Pinterest, Tumblr, Facebook, etc. are they using Core Data at all? If so, why and how?
Core Data is one way to give you a local database on the phone. With only MySQL on the server, the app cannot access any data when offline. Even in an online-only app, a local cache of some of the data can be useful to speed things up.
Similar to Django,where it has and database-abstraction API that lets you create, retrieve, update and delete objects, iOS has an CoreData. What under-lies is still SQL. From the django end, you need to create an api that returns the class of objects or something. On the iOS side, you have to call this api and parse the data and save it locally using CoreData.
Hope this helps..

Dynamic Content using Xcode

I am relatively new to creating apps, I noticed on some apps that there are images or content that will change with our the app having to be updated, how is this achieved? I have been looking everywhere I could think of and have came up empty.
Thanks for any advice.
As Michael mentions you can use a UIWebView and UIImageView to render the contents of a particular URL. However, most dynamic content on the iPhone is achieved using web services rather than directly rendering a web page.
If you are not familiar with web services, you can think of them as a stripped-down form of content; they are the link between the database and the client. In this model, the client requests data from the web service, the web service fetches from the database, and the client renders the web service response as he sees fit.
For example, you can use a JSON-based web service to return content like {"Movie":"Title","Review":"Pretty good"} and create a content view with two UILabels, one bigger and one smaller, to reflect this:
movieLabel.text = [[JSONParser parseString:[WebServiceClient JSONForRequest:&request] movieString];
reviewLabel.text = [JSONParser parseString:[WebServiceClient JSONForRequest:&request] reviewString];
Read more about web services and iOS at http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service
These are typically apps that get their resources via URL references to servers providing content (graphics, images, the latest "sale" page or whatever).
Many iOS classes (such as NSData or NSString) have initializers like initWithContentsOfURL:encoding:error:. Other classes (like UIImage) can be easily instantiated with data downloaded from a URL (imageWithData).
You can also embed web views (UIWebView objects) into your app and simply point that web view at some convienent URL on your server.
Apps can request data from a remote server and download it to the app. You can use classes in URL loading system to interact with remote servers. Here is a [link] http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/URLLoadingSystem/Concepts/URLOverview.html for further reading.

Accessing UIWebView local storage data from native iPhone app

I'm writing a native iPhone app that contains a UIWebView component. This component accesses an internet webapp and the webapp stores data offline using HTML5 local storage.
Is it possible to access this local storage data from the native app ?
I was looking to do something similar to this. In short, the DOM and all elements are not directly accessible. However, you can hack things up to get at the data. What you have to do is inject your own javascript into the downloaded webpage. Then evaluate the results.
This page shows the mechanism for doing it:
http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview
Then you just need to know the name of the database and create some javascript to return the values in a JSON string. Use a cocoa JSON parser to create objects from that string that you can use in your native app.