convert mih web app from JS to WASm
This commit is contained in:
parent
eb213b01b6
commit
f9c71b656e
17 changed files with 78 additions and 127 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:pwa_install/pwa_install.dart';
|
||||
// import 'package:universal_html/js.dart' as js;
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_helpers/mih_install_stub.dart'
|
||||
if (dart.library.js_interop) 'package:mzansi_innovation_hub/mih_helpers/mih_install_web.dart';
|
||||
|
||||
class MihInstallServices {
|
||||
String? errorMessage;
|
||||
|
|
@ -45,20 +45,11 @@ class MihInstallServices {
|
|||
"https://apps.apple.com/za/app/mzansi-innovation-hub/id6743310890",
|
||||
),
|
||||
);
|
||||
} else if (MzansiInnovationHub.of(context)!.theme.getPlatform() ==
|
||||
"Linux") {
|
||||
} else {
|
||||
//Web
|
||||
if (PWAInstall().installPromptEnabled) {
|
||||
try {
|
||||
PWAInstall().promptInstall_();
|
||||
} catch (e) {
|
||||
errorMessage = e.toString();
|
||||
debugPrint('Error prompting install: $e');
|
||||
}
|
||||
} else {
|
||||
// Fallback for unsupported platforms
|
||||
debugPrint('Install prompt not available for this platform.');
|
||||
}
|
||||
// js.context.callMethod("presentAddToHome");
|
||||
triggerWebInstall();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue