fix supertokens to work with lastest version of flutter

This commit is contained in:
2026-04-24 13:02:12 +02:00
parent d71f337d37
commit 3e3170b103
4 changed files with 252 additions and 301 deletions

View File

@@ -133,10 +133,10 @@ packages:
dependency: transitive
description:
name: build_modules
sha256: b1fc29a603669b25a5d95cc9610ed649e9f00e6075e5b6b721aa1a095cff13de
sha256: "51422a5753a74fda433d4345b11ce6ad40c2033880a26b2c6b7a8fa7e10e8f2f"
url: "https://pub.dev"
source: hosted
version: "5.0.13"
version: "5.1.11"
build_resolvers:
dependency: transitive
description:
@@ -165,10 +165,10 @@ packages:
dependency: "direct dev"
description:
name: build_web_compilers
sha256: f9b8e84dbfa7688221c2376e6f68ffd796597785a0a5b1e8cd2516a92fdc0a3c
sha256: "311e0b9c797f40eecc8450f0836200b0ad9ea5227f86428a7ed5691f35e347c0"
url: "https://pub.dev"
source: hosted
version: "4.1.5"
version: "4.4.18"
built_collection:
dependency: transitive
description:
@@ -253,10 +253,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
charcode:
dependency: transitive
description:
@@ -1084,26 +1084,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://pub.dev"
source: hosted
version: "10.0.9"
version: "11.0.2"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.dev"
source: hosted
version: "3.0.9"
version: "3.0.10"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
linkify:
dependency: transitive
description:
@@ -1180,18 +1180,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
math_expressions:
dependency: "direct main"
description:
@@ -1212,10 +1212,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev"
source: hosted
version: "1.16.0"
version: "1.17.0"
mih_package_toolkit:
dependency: "direct main"
description:
@@ -1604,10 +1604,10 @@ packages:
dependency: transitive
description:
name: scratch_space
sha256: "8510fbff458d733a58fc427057d1ac86303b376d609d6e1bc43f240aad9aa445"
sha256: "3417e014d20b12cebc5bfb1c0b1f63806054177158596cc31cc4d9aaca767a60"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.2.0"
screen_brightness:
dependency: "direct main"
description:
@@ -1977,10 +1977,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev"
source: hosted
version: "0.7.4"
version: "0.7.10"
timing:
dependency: transitive
description:
@@ -2129,10 +2129,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
version:
dependency: transitive
description:
@@ -2294,5 +2294,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=3.8.1 <3.9.0"
dart: ">=3.9.0-0 <3.13.0-z"
flutter: ">=3.29.0"

View File

@@ -67,6 +67,9 @@ dependencies:
cross_file: ^0.3.5+1
quick_actions: ^1.1.0
dependency_overrides:
supertokens_flutter: any
dev_dependencies:
flutter_test:
sdk: flutter
@@ -104,4 +107,3 @@ flutter_native_splash:
color: "#3A4454"
image: lib/mih_package_components/assets/images/splash_screen/mih_image_splash_android.png
branding: lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png

View File

@@ -0,0 +1,5 @@
{{flutter_js}}
{{flutter_build_config}}
// This is the default loader that Flutter 3.24 expects
_flutter.loader.load();

View File

@@ -1,10 +1,14 @@
<!DOCTYPE html><html><head>
<!DOCTYPE html>
<html>
<head>
<base href="/">
<!-- APP Description -->
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="MIH, the first Mzansi super app by Mzansi Innovation Hub. Streamline your life with Mzansi Profile, Wallet, Patient Manager, AI, Directory, Calendar, Calculator, &amp; secure MIH Access. Unify social, business &amp; personal tools.">
<meta name="description"
content="MIH, the first Mzansi super app by Mzansi Innovation Hub. Streamline your life with Mzansi Profile, Wallet, Patient Manager, AI, Directory, Calendar, Calculator, &amp; secure MIH Access. Unify social, business &amp; personal tools.">
<!-- iOS meta tags & icons -->
<meta name="mobile-web-app-capable" content="yes">
@@ -128,18 +132,21 @@
.contain {
display: block;
width:100%; height:100%;
width: 100%;
height: 100%;
object-fit: contain;
}
.stretch {
display: block;
width:100%; height:100%;
width: 100%;
height: 100%;
}
.cover {
display: block;
width:100%; height:100%;
width: 100%;
height: 100%;
object-fit: cover;
}
@@ -174,33 +181,54 @@
<body>
<picture id="splash-branding">
<source srcset="splash/img/branding-1x.gif 1x, splash/img/branding-2x.gif 2x, splash/img/branding-3x.gif 3x, splash/img/branding-4x.gif 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/branding-dark-1x.gif 1x, splash/img/branding-dark-2x.gif 2x, splash/img/branding-dark-3x.gif 3x, splash/img/branding-dark-4x.gif 4x" media="(prefers-color-scheme: dark)">
<source
srcset="splash/img/branding-1x.gif 1x, splash/img/branding-2x.gif 2x, splash/img/branding-3x.gif 3x, splash/img/branding-4x.gif 4x"
media="(prefers-color-scheme: light)">
<source
srcset="splash/img/branding-dark-1x.gif 1x, splash/img/branding-dark-2x.gif 2x, splash/img/branding-dark-3x.gif 3x, splash/img/branding-dark-4x.gif 4x"
media="(prefers-color-scheme: dark)">
<img class="bottom" aria-hidden="true" src="splash/img/branding-1x.gif" alt="">
</picture>
<picture id="splash">
<source srcset="splash/img/light-1x.gif 1x, splash/img/light-2x.gif 2x, splash/img/light-3x.gif 3x, splash/img/light-4x.gif 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.gif 1x, splash/img/dark-2x.gif 2x, splash/img/dark-3x.gif 3x, splash/img/dark-4x.gif 4x" media="(prefers-color-scheme: dark)">
<source
srcset="splash/img/light-1x.gif 1x, splash/img/light-2x.gif 2x, splash/img/light-3x.gif 3x, splash/img/light-4x.gif 4x"
media="(prefers-color-scheme: light)">
<source
srcset="splash/img/dark-1x.gif 1x, splash/img/dark-2x.gif 2x, splash/img/dark-3x.gif 3x, splash/img/dark-4x.gif 4x"
media="(prefers-color-scheme: dark)">
<img class="center" aria-hidden="true" src="splash/img/light-1x.gif" alt="">
</picture>
<div id="seo-content" style="display:none;">
<h1>Mzansi Innovation Hub (MIH) - Your All-in-One Super App for South Africa</h1>
<p>Tired of juggling multiple apps? Mzansi Innovation Hub (MIH) presents the first super app designed specifically for the people and businesses of Mzansi. MIH is your unified online information technology system to streamline both your personal and professional life, bridging the socio-economic divide during the digital revolution.</p>
<p>Tired of juggling multiple apps? Mzansi Innovation Hub (MIH) presents the first super app designed
specifically for the people and businesses of Mzansi. MIH is your unified online information technology
system to streamline both your personal and professional life, bridging the socio-economic divide during the
digital revolution.</p>
<h2>Key Features of the MIH Super App:</h2>
<ul>
<li><strong>Mzansi Profile:</strong> Effortlessly manage your professional profile, personal information, and valuable business team details. Amplify your online presence.</li>
<li><strong>Mzansi Wallet:</strong> Go digital! Securely store all your loyalty cards in one convenient place, reducing clutter.</li>
<li><strong>Patient Manager:</strong> Revolutionize medical practices with seamless patient appointment scheduling and efficient data management.</li>
<li><strong>Mzansi AI:</strong> Get instant support and quick answers with our friendly AI assistant, available 24/7.</li>
<li></li><li><strong>Mzansi Directory:</strong> Discover and connect with people and businesses across Mzansi.</li>
<li><strong>Calendar:</strong> Stay perfectly organized with an integrated calendar for all your personal and business appointments.</li>
<li><strong>Calculator:</strong> Perform quick calculations, including tips and forex, right within the app.</li>
<li><strong>MIH Access:</strong> Take control of your security. Easily manage and view who has access to your profile and data.</li>
<li><strong>Mzansi Profile:</strong> Effortlessly manage your professional profile, personal information,
and valuable business team details. Amplify your online presence.</li>
<li><strong>Mzansi Wallet:</strong> Go digital! Securely store all your loyalty cards in one convenient
place, reducing clutter.</li>
<li><strong>Patient Manager:</strong> Revolutionize medical practices with seamless patient appointment
scheduling and efficient data management.</li>
<li><strong>Mzansi AI:</strong> Get instant support and quick answers with our friendly AI assistant,
available 24/7.</li>
<li></li>
<li><strong>Mzansi Directory:</strong> Discover and connect with people and businesses across Mzansi.</li>
<li><strong>Calendar:</strong> Stay perfectly organized with an integrated calendar for all your personal
and business appointments.</li>
<li><strong>Calculator:</strong> Perform quick calculations, including tips and forex, right within the app.
</li>
<li><strong>MIH Access:</strong> Take control of your security. Easily manage and view who has access to
your profile and data.</li>
</ul>
<p>MIH simplifies daily tasks, reduces costs, and helps you manage your professional profile, team, and appointments all from a single, user-friendly platform. It's the essential mobile app for business owners and individuals looking to streamline their online presence in South Africa.</p>
<p>MIH simplifies daily tasks, reduces costs, and helps you manage your professional profile, team, and
appointments all from a single, user-friendly platform. It's the essential mobile app for business owners
and individuals looking to streamline their online presence in South Africa.</p>
<h3>Download the MIH Super App Today!</h3>
<p>Available for Android and iOS. Search "Mzansi Innovation Hub" or "MIH App" on your app store.</p>
@@ -228,126 +256,42 @@
});
</script>
<script defer="">
    var serviceWorkerVersion = '{{flutter_service_worker_version}}';
<script src="flutter_bootstrap.js" async></script>
<script>
var serviceWorkerVersion = '{{flutter_service_worker_version}}';
var scriptLoaded = false;
var swFallbackTimeout;
function loadMainDartJs() {
console.log('Loading app...');
if (scriptLoaded) {
return;
}
scriptLoaded = true;
// Cancel Timeut
if (swFallbackTimeout) {
clearTimeout(swFallbackTimeout);
console.log('Service worker loaded successfully - fallback timeout cancelled.');
}
{{flutter_js}}
{{flutter_build_config}}
_flutter.loader.load({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer) {
engineInitializer.initializeEngine().then(function (appRunner) {
appRunner.runApp();
});
}
});
var finishLoad = new Date();
var loadTime = (finishLoad.getTime() - startLoad.getTime());
console.log("Load Time: " + loadTime);
}
// Helper function to strip quotes from the version placeholder
function getCleanVersion(version) {
return version.replace(/"/g, '');
}
// We keep your logic to monitor the service worker for immediate updates
if ('serviceWorker' in navigator) {
var startLoad = new Date();
// Service workers are supported. Use them.
window.addEventListener('load', function () {
var cleanServiceWorkerVersion = getCleanVersion(serviceWorkerVersion);
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + cleanServiceWorkerVersion;
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion.replace(/"/g, '');
navigator.serviceWorker.register(serviceWorkerUrl)
.then((reg) => {
function waitForActivation(serviceWorker, isFirstTimeInstall) {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state == 'activated') {
console.log('Installed new service worker.');
loadMainDartJs();
// Only prompt if this is NOT the first time installing (i.e., returning user)
if (!isFirstTimeInstall && navigator.serviceWorker.controller) {
console.log('New app version activated. Prompting for reload.');
// You can replace this confirm with a better UI notification.
if (confirm('A new version of the app is available. Refresh now to update?')) {
navigator.serviceWorker.register(serviceWorkerUrl).then((reg) => {
reg.addEventListener('updatefound', () => {
const newWorker = reg.installing;
newWorker.addEventListener('statechange', () => {
if (newWorker.state === 'activated') {
// This fulfills your requirement for immediate update
if (confirm('A new version of MIH is available. Refresh now to update?')) {
window.location.reload();
}
} else if (isFirstTimeInstall) {
console.log('First time install - skipping reload prompt.');
}
}
});
}
const currentSWVersion = reg.active ? reg.active.scriptURL.split("=")[1].replaceAll("%22", "") : null;
console.log('Active Service Worker URL: ' + (reg.active ? reg.active.scriptURL : 'None'));
console.log('Latest Service Worker Version: ' + cleanServiceWorkerVersion);
console.log('Active Service Worker Version: ' + (currentSWVersion || 'None'));
const isMatch = currentSWVersion === cleanServiceWorkerVersion;
console.log('Latest Service Worker Installed: ' + isMatch);
if (!reg.active && (reg.installing || reg.waiting)) {
// First time load: wait for activation but don't prompt.
console.log('No Service Worker Available - Installing New Service Worker.');
waitForActivation(reg.installing || reg.waiting, true); // true = first time install
} else if (!isMatch) {
// New version available: force update (returning user).
console.log('New service worker available. Updating and waiting for activation.');
reg.update();
waitForActivation(reg.installing, false); // false = not first time
} else {
// Existing service worker is still good.
console.log('Service Worker up-to-date, Loading app.');
loadMainDartJs();
}
})
.catch((error) => {
console.error('Service Worker registration failed:', error);
loadMainDartJs(); // Fallback if registration fails completely
});
// If service worker doesn't succeed in a reasonable amount of time,
// fallback to plain <script> tag.
swFallbackTimeout = setTimeout(() => {
if (!scriptLoaded) {
console.warn(
'Failed to load app from a service worker. Falling back to plain <script> tag.',
);
loadMainDartJs();
}
}, 1500);
});
});
}
else {
// Service workers not supported. Just drop the <script> tag.
console.log('Service Workers Not Supported. Loading app directly.');
loadMainDartJs();
}
  </script>
</script>
<script id="pdfjs-lib" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/pdf.min.js" defer=""></script>
<script id="pdfjs-worker" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/pdf.worker.min.js" defer=""></script>
<script id="pdfjs-worker" type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/pdf.worker.min.js" defer=""></script>
<!--------------------->
</body><!-- File Picker & PDF viewer --></html>
</body><!-- File Picker & PDF viewer -->
</html>