ADUG - TMS Web Core Study Group - Fifth Meeting

Hello Folks!

Our next meeting is tonight on PWA and local files.

Monday, 6th December 2021 at 7:30 PM (AEDST) on Zoom.

Here are the meeting details:

CU tonight.

Salut,
Mathias

Great meeting. TMS WEB Core ships with interesting demo located in Demos / Web / Dictaphone folder. It is actually a Progressive Web Application which allows you to record speech and saves it in-memory dataset.

With PWA technology on mobile device the web application is installed like native application which also can be used offline. For PWA to work you have to use secure connection with HTTPS. Fortunately Rohit Gupta had secure webserver available to test. It worked!

Tip: in dictaphone demo TWebLabel.Caption property is used to assign an icon as HTML string: use TWebLabel.HTML property directly.

For next time local files and local databases are still on the menu. With normal web application access to local file system is not possible due to security restrictions.

With TMS Miletus on other hand it is possible to develop native applications which have possibility to access local file system and local database.

1 Like

IndexedDB

I made a project, adapted from one of the demos to show you can work with multiple databases that are stored on the client’s machine with IndexDB. I have uploaded it here
IndexedDB Demo

IndexDB.rar has the full source. And you can run Test1.html in the browser. Once running, in browser menu (not the application), there is a menu option “Install”, if you want to install on your device.

In the test above, the SwapDB button swaps between two databases. You can enter different tasks and see that it does save them and they are persistent.

Here’s a good description of IndexedDB, I cant get the link to work.Working with IndexedDB  |  Web  |  Google Developers. Its supposed to be present in all browsers, its non-sql. And is stored under the domain. This leads to two assumptions

  1. If the same application is run / or installed from different browsers, the data will be separate
  2. Two applications made by the same developer may be able to share the data.

I have had a few issues with a larger PWA application

  1. Locally it fails on my browser much of the time. It runs if I kill all browser windows and rebuild the application. Bruno thinks it may be because I havent allocated a favicon. I have not tested this yet.
  2. Any external libraries (css, js) etc will trigger CORS issues. I have addons installed for Chrome and Firefox to disable CORS. If you don’t do this, then it has to be tested from a secure website.
  3. On the mobile, I cant get it to update reliably, even when I use auto-increment version numbers. If I close the application and access it on the browser and then run the application on the desktop, it will update. On the TMS forums, there are other solutions for this.
  4. To allow the user to Exit/Close the application I provided a close menu. The confirm box does not have a nice title. I havent figured out how to clean it yet.
  5. When the user has closed the app, he is left with a blank screen, this needs a solution as well.
  6. I havent yet found how to monetise it - such as running Google ads.

On the plus side

  1. There are many demos for TMSWebcore, almost all will work in the PWA.
  2. There are support for many services there such as google maps, charts etc. I have tried a few, they work.
  3. It is a lot faster to write than using FMX.
  4. Optional styling using css is a bonus.

If someone wants to have a look at this application, they can run/install from My Graphs, run My_Graphs.html. Its work in progress. Much of the time has gone into grafting the forms, and implementing the menu system. The menu is disabled for some pages (intended so that they have to press ok or cancel). I am using a template form with these two buttons with images loaded at run-time rather than design time. This is inherited - yay this works. And the graph and edit pages are just adapted demos to prove that those components will work in the PWA. All components are now proven, so I can complete it now.

1 Like