diff --git a/Frontend/android/app/src/main/AndroidManifest.xml b/Frontend/android/app/src/main/AndroidManifest.xml index 407a6481..044c329c 100644 --- a/Frontend/android/app/src/main/AndroidManifest.xml +++ b/Frontend/android/app/src/main/AndroidManifest.xml @@ -39,4 +39,22 @@ android:name="flutterEmbedding" android:value="2" /> + + + + + + + + + + + + + + + + + + diff --git a/Frontend/ios/Runner/Info.plist b/Frontend/ios/Runner/Info.plist index 72247411..11e8e2c6 100644 --- a/Frontend/ios/Runner/Info.plist +++ b/Frontend/ios/Runner/Info.plist @@ -2,6 +2,11 @@ + LSApplicationQueriesSchemes + + sms + tel + NSCameraUsageDescription Camera permission is required for barcode scanning. NSLocationWhenInUseUsageDescription diff --git a/Frontend/lib/mih_components/mih_layout/mih_notification_drawer.dart b/Frontend/lib/mih_components/mih_layout/mih_notification_drawer.dart index a3dbb6ec..16ecfe09 100644 --- a/Frontend/lib/mih_components/mih_layout/mih_notification_drawer.dart +++ b/Frontend/lib/mih_components/mih_layout/mih_notification_drawer.dart @@ -194,52 +194,55 @@ class _MIHNotificationDrawerState extends State { @override Widget build(BuildContext context) { - return Drawer( - //backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(5.0), - child: Text( - "Notifications", - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - fontSize: 20, + return SafeArea( + child: Drawer( + //backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(5.0), + child: Text( + "Notifications", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontWeight: FontWeight.bold, + fontSize: 20, + ), ), ), - ), - ], + ], + ), ), - ), - displayNotification(), - // ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // separatorBuilder: (BuildContext context, index) { - // return Divider( - // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // ); - // }, - // itemCount: widget.notifications.length, - // itemBuilder: (context, index) { - // //final patient = widget.patients[index].id_no.contains(widget.searchString); - // //print(index); - // return displayNotifications(index); - // }, - // ), - ], - ), - )); + displayNotification(), + // ListView.separated( + // shrinkWrap: true, + // physics: const NeverScrollableScrollPhysics(), + // separatorBuilder: (BuildContext context, index) { + // return Divider( + // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // ); + // }, + // itemCount: widget.notifications.length, + // itemBuilder: (context, index) { + // //final patient = widget.patients[index].id_no.contains(widget.searchString); + // //print(index); + // return displayNotifications(index); + // }, + // ), + ], + ), + )), + ); } } diff --git a/Frontend/lib/mih_packages/about_mih/mih_about.dart b/Frontend/lib/mih_packages/about_mih/mih_about.dart index 5b3836a9..75d83674 100644 --- a/Frontend/lib/mih_packages/about_mih/mih_about.dart +++ b/Frontend/lib/mih_packages/about_mih/mih_about.dart @@ -8,6 +8,7 @@ import '../../mih_components/mih_layout/mih_tile.dart'; import '../../main.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import "package:universal_html/js.dart" as js; +import 'package:url_launcher/url_launcher.dart'; // import 'dart:html' as html; class MIHAbout extends StatefulWidget { @@ -20,6 +21,20 @@ class MIHAbout extends StatefulWidget { } class _MIHAboutState extends State { + final Uri _tiktokUrl = + Uri.parse('https://www.tiktok.com/@mzansi.innovation.hub'); + final Uri _instagramUrl = + Uri.parse('https://www.instagram.com/mzansi.innovation.hub'); + final Uri _whatsappUrl = + Uri.parse('https://whatsapp.com/channel/0029Vax3INCIyPtMn8KgeM2F'); + final Uri _youtubeUrl = + Uri.parse('https://www.youtube.com/@mzansiinnovationhub'); + final Uri _xUrl = Uri.parse('https://x.com/mzansi_inno_hub'); + final Uri _linkedinUrl = + Uri.parse('https://www.linkedin.com/company/mzansi-innovation-hub/'); + final Uri _facebookUrl = + Uri.parse('https://www.facebook.com/profile.php?id=61565345762136'); + MIHAction getActionButton() { return MIHAction( icon: const Icon(Icons.arrow_back), @@ -317,7 +332,7 @@ class _MIHAboutState extends State { // //bottom: height / 5, // top: 20, ), - // physics: , + physics: const NeverScrollableScrollPhysics(), // shrinkWrap: true, itemCount: getSocialsList().length, gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( @@ -335,8 +350,7 @@ class _MIHAboutState extends State { List socials = []; socials.add(MIHTile( onTap: () { - // html.window - // .open('https://www.tiktok.com/@mzansi.innovation.hub', 'new tab'); + launchSocialUrl(_tiktokUrl); }, tileName: "TikTok", tileIcon: Center( @@ -352,8 +366,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window - // .open('https://www.instagram.com/mzansi.innovation.hub', 'new tab'); + launchSocialUrl(_instagramUrl); }, tileName: "Instagram", tileIcon: Center( @@ -369,8 +382,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window.open( - // 'https://whatsapp.com/channel/0029Vax3INCIyPtMn8KgeM2F', 'new tab'); + launchSocialUrl(_whatsappUrl); }, tileName: "Whatsapp", tileIcon: Center( @@ -386,8 +398,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window - // .open('https://www.youtube.com/@mzansiinnovationhub', 'new tab'); + launchSocialUrl(_youtubeUrl); }, tileName: "YouTube", tileIcon: Center( @@ -403,7 +414,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window.open('https://x.com/mzansi_inno_hub', 'new tab'); + launchSocialUrl(_xUrl); }, tileName: "X", tileIcon: Center( @@ -419,9 +430,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window.open( - // 'https://www.linkedin.com/company/mzansi-innovation-hub/', - // 'new tab'); + launchSocialUrl(_linkedinUrl); }, tileName: "LinkedIn", tileIcon: Center( @@ -437,9 +446,7 @@ class _MIHAboutState extends State { //================================================================== socials.add(MIHTile( onTap: () { - // html.window.open( - // 'https://www.facebook.com/profile.php?id=61565345762136', - // 'new tab'); + launchSocialUrl(_facebookUrl); }, tileName: "FaceBook", tileIcon: Center( @@ -456,6 +463,12 @@ class _MIHAboutState extends State { return socials; } + Future launchSocialUrl(Uri linkUrl) async { + if (!await launchUrl(linkUrl)) { + throw Exception('Could not launch $linkUrl'); + } + } + @override void dispose() { super.dispose(); diff --git a/Frontend/lib/mih_packages/patient_profile/builder/build_file_view.dart b/Frontend/lib/mih_packages/patient_profile/builder/build_file_view.dart index a523c0c4..9e7ae0a4 100644 --- a/Frontend/lib/mih_packages/patient_profile/builder/build_file_view.dart +++ b/Frontend/lib/mih_packages/patient_profile/builder/build_file_view.dart @@ -103,10 +103,13 @@ class _BuildFileViewState extends State { iconSize: 35, padding: const EdgeInsets.all(0), onPressed: () { - html.window.open( - widget.link, - // '${AppEnviroment.baseFileUrl}/mih/$filePath', - 'download'); + if (MzanziInnovationHub.of(context)!.theme.getPlatform() == + "Web") { + html.window.open( + widget.link, + // '${AppEnviroment.baseFileUrl}/mih/$filePath', + 'download'); + } else {} }, icon: Icon( Icons.download, @@ -164,10 +167,17 @@ class _BuildFileViewState extends State { iconSize: 35, padding: const EdgeInsets.all(0), onPressed: () { - html.window.open( - widget.link, - // '${AppEnviroment.baseFileUrl}/mih/$filePath', - 'download'); + if (MzanziInnovationHub.of(context)!.theme.getPlatform() == + "Web") { + html.window.open( + widget.link, + // '${AppEnviroment.baseFileUrl}/mih/$filePath', + 'download'); + } else {} + // html.window.open( + // widget.link, + // // '${AppEnviroment.baseFileUrl}/mih/$filePath', + // 'download'); }, icon: Icon( Icons.download, diff --git a/Frontend/lib/mih_packages/patient_profile/full_screen_file.dart b/Frontend/lib/mih_packages/patient_profile/full_screen_file.dart index e0077ffd..c6961a64 100644 --- a/Frontend/lib/mih_packages/patient_profile/full_screen_file.dart +++ b/Frontend/lib/mih_packages/patient_profile/full_screen_file.dart @@ -210,10 +210,12 @@ class _FullScreenFileViewerState extends State { iconSize: 30, padding: const EdgeInsets.all(0), onPressed: () { - html.window.open( - widget.arguments.link, - // '${AppEnviroment.baseFileUrl}/mih/$filePath', - 'download'); + if (MzanziInnovationHub.of(context)!.theme.getPlatform() == "Web") { + html.window.open( + widget.arguments.link, + // '${AppEnviroment.baseFileUrl}/mih/$filePath', + 'download'); + } else {} }, icon: Icon( Icons.download, diff --git a/Frontend/pubspec.lock b/Frontend/pubspec.lock index 2bfd1e96..7f2b4e35 100644 --- a/Frontend/pubspec.lock +++ b/Frontend/pubspec.lock @@ -1203,7 +1203,7 @@ packages: source: hosted version: "2.2.2" url_launcher: - dependency: transitive + dependency: "direct main" description: name: url_launcher sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index 021a7ebd..aee465af 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0+2 environment: sdk: '>=3.2.4 <4.0.0' @@ -65,6 +65,7 @@ dependencies: flutter_launcher_icons: ^0.13.1 # flutter_barcode_scanner: ^2.0.0 barcode_widget: ^2.0.4 + url_launcher: ^6.3.1 dev_dependencies: flutter_test: