Open joaoluis-pdm opened 2 years ago
Meeting with Rafael (in the scope of CSC). Using the new trust-loader. SW are disabled. swBoot.js is still used, but for the application, the serviceWorkers are disabled.
https://github.com/PharmaLedger-IMI/ctr-workspace/blob/f2ca50d970b8261d1b7d64aeacd714ea73b62df5/ctr-patient/pdm-trust-loader/src/assets/pwa/pwa.js seems up-to-date with https://github.com/PrivateSky/trust-loader/blob/a4531f65f7b1f36392ca85305b258b8680007b8c/assets/pwa/pwa.js
(Only whitespace differences on pwa.js)
Compared with https://github.com/PrivateSky/trust-loader/blob/a4531f65f7b1f36392ca85305b258b8680007b8c/swLoader.js
No functional differences.
Differs a lot from current https://github.com/PrivateSky/trust-loader/tree/a4531f65f7b1f36392ca85305b258b8680007b8c/controllers and services.
Let's start with the services:
Ño functional differences. Updated anyway on CTR commit 201627b
Never existed on CTR, but seems to be an old version of https://github.com/PharmaLedger-IMI/ctr-workspace/blob/55801b1be158ba60e618fda35653cb645b851c79/ctr-patient/pdm-trust-loader/src/scripts/services/LoaderService.js
this.restoreFromSeedSSI = function (seedSSI, callback)
only exists on WalletService.js - ignored for now.this.load = function (keyGenArgs, spinner, callback)
PSK: this.load = function (domain, secret, callback)
- candidate for multiple changes on CTR...
CTR called by: https://github.com/PharmaLedger-IMI/ctr-workspace/blob/v0.10.6/ctr-patient/pdm-trust-loader/src/scripts/controllers/HomeController.js#L122
PSK called by:this.getConstDSU = function (domain, secret, callback)
only exists on WalletService.js - ignored for now.this.updateWallet = function ()
only exists on WalletService.js but it is empty - ignored for now.this.create = function (keyGenArgs, callback)
PSK: this.create = function (domain, arrayWithSecrets, callback)
- on PSK side uses a new https://github.com/PrivateSky/trust-loader/blob/master/controllers/services/WalletBuilderService.js instead of AppBuilderService. ... may be relevant (TO SEE...)
CTR called by: https://github.com/PharmaLedger-IMI/ctr-workspace/blob/v0.10.6/ctr-patient/pdm-trust-loader/src/scripts/controllers/HomeController.js#L91
PSK called by:this.createWithKeySSI = function (domain, options, callback)
only exists on WalletService.js - ignored for now.this.rebuild = function (domain, key, callback)
only exists on WalletService.js - ignored for now.
function getIFrameBase()
PSK: function getIFrameBase()
needs update from PSK 2 CTR.function WalletRunner(options)
PSK: function WalletRunner(options)
seems to need update from PSK 2 CTR:
CTR const buildContainerIframe = (useSeedForIframeSource)
PSK: const createContainerIframe = (useSeedForIframeSource)
seems +/- identical.
CTR - PSK: const createTimerElement = ()
TO SEE
CTR const setupLoadEventsListener = (iframe)
PSK const setupLoadEventsListener = (iframeElement)
- different. Hard to understand if it is only about the spinner and timeout button or more, but PSK sets iframeElement.hidden = true;
which does not happen in CTR.
CTR - PSK: const sendCompletedEvent = (iframeElement)
only in PSK TO SEE: Does not send completed event to psk-app-root (but we use webc-app-root not psk-app-root).
CTR const setupSeedRequestListener = ()
PSK const setupSeedRequestListener = ()
seem to have identical functionality.
CTR const setupLoadingProgressEventListener = ()
PSK const setupLoadingProgressEventListener = ()
seems to have a bug missing {}
on CTR side. TO SEE
CTR this.run = function ()
PSK this.run = function ()
** areServiceWorkersEnabled differences ? areServiceWorkersEnables seems to ignore ctr-patient/trust-loader-config/patient-ssapp/loader/environment.js - THIS SEEMS A BUG!
does not update spinner progress when sw are disabled ?
*** when sw disabled removes spinner even if it does not exist - THIS SEEMS A BUGSeems functionally identical to https://github.com/PharmaLedger-IMI/ctr-workspace/blob/55801b1be158ba60e618fda35653cb645b851c79/ctr-patient/pdm-trust-loader/src/scripts/services/NavigatorUtils.js (CTR uses a different singleton access function getNavigatorUtils(env), while PSK uses LOADER_GLOBALS).
Basically, the commit dd8e3b7 has all the updates apparently needed. More tests will come along v0.10.7
Site loading Benchmarks for TST v0.10.3 (sw=true, pwa=true) DEV v0.10.7 (sw=false, pwa=false) DEV v0.10.8 (sw=false, pwa=true)
Time from clickcking on the "Patient Wallet" purple box, until the dashboard is shown. (Discount +/- 1.0 seconds to click on the LOGIN button). (Also note that in the CTR Dashboard, the previous match requests are shown as "? ? ?" while the DB is not initialized. That takes longer, and A blank browser profile is created before the test. The test was run on WiFi over a vodefone.pt home network. (National routing to ARTelecom should have good performance).
DEV v0.10.8 - 8.2 seconds (until dashboard available), ... a lot more (+/- 30 seconds) until it fetches all files from server DEV v0.10.7 - 8.6 seconds (first attempt seemed a bit more. Some sort of transparent cache somewhere ?) TST v0.10.3 - 17.0 seconds
DEV v0.10.8 - 11.x seconds (until dashboard available), 24.8 seconds (until question to install) DEV v0.10.7 - 8.2 seconds TST v0.10.3 - 14.6 seconds (please discount +/- 1.0 seconds to answer "Cancel" for the extra question of choosing to install the app)
DEV v0.10.8 - 18.0 seconds until dashboard is available, 1m38 seconds until the question to install the PWA, 12.1 seconds to open the installed PWA. DEV v0.10.7 - 12.0 seconds (first attempt without cache clear never finished - never transition from PWA to non-PWA ?) TST v0.10.3 - 28.5 seconds (please discount +/- 1.0 seconds to answer "Cancel" for the extra question of choosing to install the app)
PS: On chrome mobile 96.0 - Android 10 ; Fairphone3 using a throttled proxy ngrok.io (at 40 req per minute) it took +/- 45 seconds to open the dashboard (without DB initialization), but it took + than 5 min to finish doing HTTPS GET requests. This was on a v0.10.8 candidate with sw=false+pwa=true.
This is not quite closed, as in firefox we are getting these errors:
e993dbe v0.10.12 has an experimental version on queryParam patient-ssapp/loader/?v=0.10.12 Let's see how it affects installation on mobile application.
Current situation requires the patient-ssapp to be loaded in "Chrome Incognito" mode (or firefox with debug and disable-cache=on), otherwise, it is very likely that some files are loaded from a previous release of the patient-ssapp.
This is not acceptable for a pilot.
Experiment with workarounds, such as removing all service-worker caches:
This workaround has been tested with some success (no mobile tests where performed) at commit a61bda8af752723dbce617cae76e31dbd5b5ea23 and reverted at commit 691bf2c9f2eeac3c27598debb32459c8992811ec
PS: (Later inspection shown that) There is a method in https://github.com/PharmaLedger-IMI/ctr-workspace/blob/df3c5cd75960b684cef856bb07b5932ee23f8803/ctr-patient/pdm-trust-loader/src/scripts/services/NavigatorUtils.js#L200 that could be called for that purpose.
Could the cache be cleared every time that a version change is detected ? (Ex: From site, version v1.12.1 is provided, but localstorage says that last used version is v1.11.9 - if site and localstorage differ, cache could be cleared). ( Had no success yet with experiments using tricks such as https://stackoverflow.com/questions/49739438/when-and-how-does-a-pwa-update-itself )
First, let's try the changes to https://github.com/PharmaLedger-IMI/ctr-workspace/blob/231645e712d9949d153899be84d151fb54ee874f/ctr-patient/trust-loader-config/patient-ssapp/loader/environment.js