From 8c9c309abbc27b72fc117076c5f813e76f25608d Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 5 Apr 2021 11:47:32 +0300 Subject: [PATCH 1/5] bug fixes --- lib/config/localized_values.dart | 4 +++- lib/pages/DrawerPages/family/my-family.dart | 24 ++++++++++++++++----- lib/uitl/translations_delegate_base.dart | 14 +++++++----- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a703d5db..7e5f1b91 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1992,5 +1992,7 @@ const Map localizedValues = { "enter-file": { "en": "Please enter the mobile number and the medical file number", "ar": "الرجاء إدخال رقم الجوال ورقم الملف الطبي" - } + }, + "allow": {"en": "Allow", "ar": "السماح"}, + "reject": {"en": "Reject", "ar": "رفض"} }; diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 07f99b16..32aaaf45 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -395,12 +395,20 @@ class _MyFamily extends State with TickerProviderStateMixin { left: 10, right: 10), child: Row(children: [ Expanded( - flex: 3, child: AppText('Name')), + flex: 3, + child: AppText( + TranslationBase.of(context) + .name)), Expanded( - flex: 1, child: AppText('Allow')), + flex: 1, + child: AppText( + TranslationBase.of(context) + .allow)), Expanded( flex: 1, - child: AppText('Reject')), + child: AppText( + TranslationBase.of(context) + .reject)), ])), Column( children: familyFileProvider @@ -577,9 +585,15 @@ class _MyFamily extends State with TickerProviderStateMixin { EdgeInsets.only(left: 10, right: 10), child: Row(children: [ Expanded( - flex: 3, child: AppText('Name')), + flex: 3, + child: AppText( + TranslationBase.of(context) + .name)), Expanded( - flex: 1, child: AppText('Delete')), + flex: 1, + child: AppText( + TranslationBase.of(context) + .delete)), ])), Column( children: familyFileProvider diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0e0058f9..0beb1c12 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -752,8 +752,10 @@ class TranslationBase { String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; - String get deliveryDriverTrack => localizedValues['DeliveryDriverTrack'][locale.languageCode]; - String get deliveryLocation => localizedValues['DeliveryLocation'][locale.languageCode]; + String get deliveryDriverTrack => + localizedValues['DeliveryDriverTrack'][locale.languageCode]; + String get deliveryLocation => + localizedValues['DeliveryLocation'][locale.languageCode]; String get driver => localizedValues['Driver'][locale.languageCode]; String get subtotal => localizedValues['subtotal'][locale.languageCode]; String get shipping => localizedValues['shipping'][locale.languageCode]; @@ -1558,10 +1560,10 @@ class TranslationBase { localizedValues["submitncontinue"][locale.languageCode]; String get areyousure => localizedValues["areyousure"][locale.languageCode]; - // Offer And Packahes - String get subT=> localizedValues['OffersAndPackages'][locale.languageCode]; - String get totalWithColonRight => localizedValues['totalWithColonRight'][locale.languageCode]; + String get subT => localizedValues['OffersAndPackages'][locale.languageCode]; + String get totalWithColonRight => + localizedValues['totalWithColonRight'][locale.languageCode]; String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; @@ -1605,6 +1607,8 @@ class TranslationBase { String get insuranceID => localizedValues["insurance-id"][locale.languageCode]; String get enterFile => localizedValues["enter-file"][locale.languageCode]; + String get allow => localizedValues["allow"][locale.languageCode]; + String get reject => localizedValues["reject"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From bcabd81f889befd784abe1a9fa13fb9099337d77 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 24 May 2021 13:43:44 +0300 Subject: [PATCH 2/5] BUG FIXES --- .../images/new-design/verification_check.svg | 8 ++++++ .../plugins/GeneratedPluginRegistrant.java | 25 +++++++++++++++++++ .../android/local.properties | 2 ++ .../ios/Flutter/Generated.xcconfig | 14 +++++++++++ .../ios/Flutter/flutter_export_environment.sh | 15 +++++++++++ .../ios/Runner/GeneratedPluginRegistrant.h | 17 +++++++++++++ .../ios/Runner/GeneratedPluginRegistrant.m | 12 +++++++++ lib/config/localized_values.dart | 8 +++++- lib/pages/Blood/blood_donation.dart | 12 ++++++++- .../family_files/family_files_provider.dart | 4 +-- lib/uitl/translations_delegate_base.dart | 3 +++ lib/widgets/drawer/app_drawer_widget.dart | 2 +- 12 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 assets/images/new-design/verification_check.svg create mode 100644 hms-plugins/flutter-hms-location/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java create mode 100644 hms-plugins/flutter-hms-location/android/local.properties create mode 100644 hms-plugins/flutter-hms-location/ios/Flutter/Generated.xcconfig create mode 100644 hms-plugins/flutter-hms-location/ios/Flutter/flutter_export_environment.sh create mode 100644 hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.h create mode 100644 hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.m diff --git a/assets/images/new-design/verification_check.svg b/assets/images/new-design/verification_check.svg new file mode 100644 index 00000000..1b3cdcca --- /dev/null +++ b/assets/images/new-design/verification_check.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/hms-plugins/flutter-hms-location/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/hms-plugins/flutter-hms-location/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..975e9019 --- /dev/null +++ b/hms-plugins/flutter-hms-location/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,25 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; +import com.huawei.hms.flutter.location.LocationPlugin; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + if (alreadyRegisteredWith(registry)) { + return; + } + LocationPlugin.registerWith(registry.registrarFor("com.huawei.hms.flutter.location.LocationPlugin")); + } + + private static boolean alreadyRegisteredWith(PluginRegistry registry) { + final String key = GeneratedPluginRegistrant.class.getCanonicalName(); + if (registry.hasPlugin(key)) { + return true; + } + registry.registrarFor(key); + return false; + } +} diff --git a/hms-plugins/flutter-hms-location/android/local.properties b/hms-plugins/flutter-hms-location/android/local.properties new file mode 100644 index 00000000..c6cb6fc0 --- /dev/null +++ b/hms-plugins/flutter-hms-location/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=C:\\Users\\sultan.khan\\AppData\\Local\\Android\\Sdk +flutter.sdk=C:\\Program Files\\flutter \ No newline at end of file diff --git a/hms-plugins/flutter-hms-location/ios/Flutter/Generated.xcconfig b/hms-plugins/flutter-hms-location/ios/Flutter/Generated.xcconfig new file mode 100644 index 00000000..4527e66e --- /dev/null +++ b/hms-plugins/flutter-hms-location/ios/Flutter/Generated.xcconfig @@ -0,0 +1,14 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Program Files\flutter +FLUTTER_APPLICATION_PATH=C:\Projects\DQ\hms-plugins\flutter-hms-location +FLUTTER_TARGET=lib\main.dart +FLUTTER_BUILD_DIR=build +SYMROOT=${SOURCE_ROOT}/../build\ios +OTHER_LDFLAGS=$(inherited) -framework Flutter +FLUTTER_FRAMEWORK_DIR=C:\Program Files\flutter\bin\cache\artifacts\engine\ios +FLUTTER_BUILD_NAME=5.0.0 +FLUTTER_BUILD_NUMBER=301 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.packages diff --git a/hms-plugins/flutter-hms-location/ios/Flutter/flutter_export_environment.sh b/hms-plugins/flutter-hms-location/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 00000000..87c35592 --- /dev/null +++ b/hms-plugins/flutter-hms-location/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Program Files\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Projects\DQ\hms-plugins\flutter-hms-location" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=C:\Program Files\flutter\bin\cache\artifacts\engine\ios" +export "FLUTTER_BUILD_NAME=5.0.0" +export "FLUTTER_BUILD_NUMBER=301" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.h b/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 00000000..ed9a5c61 --- /dev/null +++ b/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,17 @@ +// +// Generated file. Do not edit. +// + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +NS_ASSUME_NONNULL_END +#endif /* GeneratedPluginRegistrant_h */ diff --git a/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.m b/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 00000000..60dfa42b --- /dev/null +++ b/hms-plugins/flutter-hms-location/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +#import "GeneratedPluginRegistrant.h" + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { +} + +@end diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7e5f1b91..45930514 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1141,6 +1141,12 @@ const Map localizedValues = { "YouCanFind": {"en": "You Can Find ", "ar": "باستطاعتك العثور على "}, "ItemInSearch": {"en": " Item In Search", "ar": " عنصر في البحث "}, "blood-donation": {"en": "Blood Donation", "ar": "التبرع بالدم"}, + "blood-donation-info": { + "en": + "Through this service, you can register your name as a blood donor where the blood bank in the Habib Medical Group will communicate you in case of need for blood type.", + "ar": + "عن طريق هذه الخدمة تستطيع تسجيل اسمك كمتبرع بالدم حيث سيتم التواصل معك عن طريق بنك الدم في مجموعة الحبيب الطبية في حال الحاجة الى فصيلة الدم ." + }, "blood-instruction": { "en": "Enter the required information, In order to register for Blood Donation Service", @@ -1994,5 +2000,5 @@ const Map localizedValues = { "ar": "الرجاء إدخال رقم الجوال ورقم الملف الطبي" }, "allow": {"en": "Allow", "ar": "السماح"}, - "reject": {"en": "Reject", "ar": "رفض"} + "reject": {"en": "Reject", "ar": "رفض"} }; diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index adff790c..ce6ab8ee 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; @@ -60,7 +61,7 @@ class _BloodDonationPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; var checkedValue = false; - + List imagesInfo = List(); @override void initState() { super.initState(); @@ -69,6 +70,13 @@ class _BloodDonationPageState extends State { @override Widget build(BuildContext context) { + imagesInfo.add( + ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), + ); ProjectViewModel projectProvider = Provider.of(context); return BaseView( @@ -76,6 +84,8 @@ class _BloodDonationPageState extends State { builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).bloodDonationInfo, appBarTitle: TranslationBase.of(context).bloodD, body: SingleChildScrollView( physics: ScrollPhysics(), diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 7a2dec81..8238a35b 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -259,7 +259,7 @@ class FamilyFilesProvider with ChangeNotifier { var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); //const request = new SwitchUserRequest(); - request['LogInTokenID'] = ''; + // request['LogInTokenID'] = ''; request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; request['PatientMobileNumber'] = currentUser.mobileNumber; //['MobileNumber']; @@ -276,7 +276,7 @@ class FamilyFilesProvider with ChangeNotifier { AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); //const request = new SwitchUserRequest(); - request['LogInTokenID'] = ''; + // request['LogInTokenID'] = ''; request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; request['PatientMobileNumber'] = switchUser.mobileNumber; //['MobileNumber']; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0beb1c12..f7b494fe 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1036,6 +1036,9 @@ class TranslationBase { localizedValues['ItemInSearch'][locale.languageCode]; String get bloodDonation => localizedValues['blood-donation'][locale.languageCode]; + String get bloodDonationInfo => + localizedValues['blood-donation-info'][locale.languageCode]; + String get bloodInstruction => localizedValues['blood-instruction'][locale.languageCode]; String get bloodTermsNcondition => diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 5192e0f0..283c559f 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -309,7 +309,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.only(left: 5, right: 5), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - AppText(TranslationBase.of(context).fileno + ": " + result.patientID.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.responseID.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), ]))), ], ))) From 85e803651c5ccc8594073d3b777fa9a444c50277 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 14 Jul 2021 09:21:08 +0300 Subject: [PATCH 3/5] permission issue fixed --- .../DrawerPages/family/add-family_type.dart | 2 +- lib/pages/login/register-info.dart | 76 ++++++++++--------- lib/pages/login/register.dart | 14 +++- lib/pages/settings/general_setting.dart | 51 ++++++++++--- lib/pages/settings/profile_setting.dart | 16 ++-- .../permission/permission_service.dart | 59 ++++++++------ lib/uitl/translations_delegate_base.dart | 3 + 7 files changed, 139 insertions(+), 82 deletions(-) diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index 96e055b3..e4a82cb4 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -75,7 +75,7 @@ class AddFamilyMemberType extends StatelessWidget { ), AppText( TranslationBase.of(context) - .nationalID, + .idNo, fontSize: SizeConfig .textMultiplier * 2, diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 467068cc..548405f0 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -278,44 +278,46 @@ class _RegisterInfo extends State { registerNow() { dynamic request = getTempUserRequest(); GifLoaderDialogUtils.showMyDialog(context); - this.authService.registerUser(request).then((result) => { - GifLoaderDialogUtils.hideDialog(context), - // userData = result.list; - //AuthenticatedUser.fromJson(result['List'][0]), - if(result is String){ - new ConfirmDialog( - context: context, - confirmMessage: result, - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - ConfirmDialog.closeAlertDialog(context) - }, - cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}) - .showAlertDialog(context) - - }else - { - result.list.isFamily = false, - sharedPref.setObject(USER_PROFILE, result.list), - this.sharedPref.setObject(MAIN_USER, result.list), - sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), - sharedPref.setString(TOKEN, result.authenticationTokenID), - Navigator.of(context).pushNamed(HOME) - } - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); + this + .authService + .registerUser(request) + .then((result) => { + GifLoaderDialogUtils.hideDialog(context), + // userData = result.list; + //AuthenticatedUser.fromJson(result['List'][0]), + if (result is String) + { + new ConfirmDialog( + context: context, + confirmMessage: result, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => + {ConfirmDialog.closeAlertDialog(context)}, + cancelFunction: () => { + ConfirmDialog.closeAlertDialog(context) + }).showAlertDialog(context) + } + else + { + result.list.isFamily = false, + sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString(TOKEN, result.authenticationTokenID), + Navigator.of(context).pushNamed(HOME) + } + }) + .catchError((err) { + GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: err, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - ConfirmDialog.closeAlertDialog(context) - }, + okFunction: () => {ConfirmDialog.closeAlertDialog(context)}, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - }); } @@ -347,12 +349,12 @@ class _RegisterInfo extends State { "PatientIdentificationNo": registerInfo.idNumber, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, - "FirstNameN":registerInfo.firstNameAr =='-' ?"": registerInfo.firstNameAr, - "FirstName": registerInfo.firstNameEn =='-' ?"":registerInfo.firstNameEn, - "MiddleNameN":registerInfo.secondNameAr =='-' ? "" : registerInfo.secondNameAr, - "MiddleName":registerInfo.secondNameEn == '-' ? "": registerInfo.secondNameEn, - "LastNameN": registerInfo.lastNameAr =='-'? "" : registerInfo.lastNameAr, - "LastName": registerInfo.lastNameEn =='-' ? "": registerInfo.lastNameEn, + "FirstNameN": registerInfo.firstNameAr, + "FirstName": registerInfo.firstNameEn, + "MiddleNameN": registerInfo.secondNameAr, + "MiddleName": registerInfo.secondNameEn, + "LastNameN": registerInfo.lastNameAr, + "LastName": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, "DateofBirth": DateUtil.convertISODateToJsonDate( registerInfo.dateOfBirth.replaceAll('/', '-')), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index c6a3b872..1591d1d5 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; class Register extends StatefulWidget { @override @@ -294,12 +295,12 @@ class _Register extends State { // DOB: this.dateOption === '1' ? this.dateOfBirth : moment(this.dateOfBirth).format('DD/MM/YYYY'), // IsHijri: Number(this.dateOption) // } + + final DateFormat dateFormat = DateFormat('dd/MM/yyyy'); GifLoaderDialogUtils.showMyDialog(context); var request = CheckUserStatusRequest(); request.patientIdentificationID = nationalIDorFile.text; - request.dOB = isHijri == 1 - ? dob - : "${selectedDate.toLocal()}".split(' ')[0].replaceAll('-', '/'); + request.dOB = isHijri == 1 ? dob : dateFormat.format(selectedDate); request.isHijri = isHijri; request.patientOutSA = countryCode == '966' ? 0 : 1; this.authService.checkUserStatus(request).then((result) => { @@ -311,7 +312,12 @@ class _Register extends State { Navigator.of(context).push(FadePage(page: ConfirmLogin())), } else - {AppToast.showErrorToast(message: result)} + { + AppToast.showErrorToast( + message: result + ? result + : TranslationBase.of(context).somethingWentWrong) + } }); } diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 0a6b0e73..9a062eac 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; import 'package:screen/screen.dart'; @@ -27,10 +28,14 @@ class _GeneralSettings extends State bool location = false; var sharedPref = new AppSharedPreferences(); var permission = new PermissionService(); + LocationPermission locationPermission; var mediaQueryData; @override void initState() { - getValues(); + setState(() { + getValues(); + }); + super.initState(); } @@ -215,9 +220,12 @@ class _GeneralSettings extends State Switch( value: location, onChanged: (value) { - setState(() { - location = value; - }); + if (value == true) { + Navigator.pop(context); + this.setLocationPermission(); + } else { + Geolocator.openLocationSettings(); + } }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -227,6 +235,23 @@ class _GeneralSettings extends State ])); } + setLocationPermission() async { + locationPermission = await Geolocator.checkPermission(); + if (locationPermission == LocationPermission.denied) { + locationPermission = await Geolocator.requestPermission(); + if (locationPermission != LocationPermission.denied) { + setState(() { + location = true; + }); + } else { + this.location = false; + } + } else { + Geolocator.openLocationSettings(); + this.location = true; + } + } + setTheme(value) async { switch (value) { case 0: @@ -277,20 +302,26 @@ class _GeneralSettings extends State vibration = permission.isVibrationEnabled() == null ? false : permission.isVibrationEnabled(); - accsibility = mediaQueryData.accessibleNavigation; - setTheme(blindValue); + // accsibility = mediaQueryData.accessibleNavigation; + //setTheme(blindValue); } + + this.location = await this.permission.isLocationEnabled(); } getTheme(value) async { if (value == 1) { return invertThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'WorkSans' - ); + fontName: + Provider.of(context, listen: false).isArabic + ? 'Cairo' + : 'WorkSans'); } else if (value == 3) { return bwThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'WorkSans' - ); + fontName: + Provider.of(context, listen: false).isArabic + ? 'Cairo' + : 'WorkSans'); } else { return defaultTheme( fontName: diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 833cdf2b..d877514c 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -44,7 +44,7 @@ class _ProfileSettings extends State child: model.user != null ? ListView(scrollDirection: Axis.vertical, children: [ Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.all(15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -74,7 +74,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -93,7 +93,7 @@ class _ProfileSettings extends State ], )), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -116,7 +116,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -136,7 +136,7 @@ class _ProfileSettings extends State ], )), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -160,7 +160,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( @@ -175,7 +175,7 @@ class _ProfileSettings extends State ], )), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( @@ -190,7 +190,7 @@ class _ProfileSettings extends State ], )), Container( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index ea408ce2..ab82172e 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -10,9 +10,11 @@ import 'package:flutter/services.dart'; import 'package:localstorage/localstorage.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:vibration/vibration.dart'; +import 'package:geolocator/geolocator.dart' as geo; + class PermissionService extends BaseService { final LocalStorage storage = new LocalStorage("permission"); - + geo.LocationPermission locationPermission; AppGlobal appGlobal = new AppGlobal(); setVibrationPermission(flag) async { @@ -20,23 +22,24 @@ class PermissionService extends BaseService { } isVibrationEnabled() { - return (storage.getItem('isVibration') ==null) || (storage.getItem('isVibration')) ==false ? false :true; + return (storage.getItem('isVibration') == null) || + (storage.getItem('isVibration')) == false + ? false + : true; } - vibrate(callback, context) async{ - if (callback == null) - return null; - if(isVibrationEnabled() ==true){ - if (await Vibration.hasVibrator()) { - Vibration.vibrate(duration: 100); - callback(); + vibrate(callback, context) async { + if (callback == null) return null; + if (isVibrationEnabled() == true) { + if (await Vibration.hasVibrator()) { + Vibration.vibrate(duration: 100); + callback(); } - }else{ + } else { callback(); } } - setTheme(flag) async { storage.setItem('isTheme', flag); } @@ -44,23 +47,35 @@ class PermissionService extends BaseService { isThemeEnabled() { return storage.getItem('isTheme'); } - cameraPermission() async{ - Map statuses = await [ - Permission.camera, - ].request(); - } - isCameraEnabled() async{ + + cameraPermission() async { + Map statuses = await [ + Permission.camera, + ].request(); + } + + isCameraEnabled() async { print(await Permission.camera.status); - return await Permission.camera.status == PermissionStatus.granted ? true : false; + return await Permission.camera.status == PermissionStatus.granted + ? true + : false; } - setCameraLocationPermission(context) async{ + + setCameraLocationPermission(context) async { Navigator.pop(context); openAppSettings(); } - isLocationEnabled() async{ - return await Permission.location.status == PermissionStatus.granted ? true : false; + + isLocationEnabled() async { + var permission = await geo.Geolocator.checkPermission(); + if (permission == geo.LocationPermission.denied) { + return false; + } else { + return true; + } } - openSettings() async{ + + openSettings() async { openAppSettings(); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0995a5a1..c86012f2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1575,6 +1575,9 @@ class TranslationBase { String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; String get trySaying => localizedValues["try-saying"][locale.languageCode]; + String get somethingWentWrong => + localizedValues["somethingWentWrong"][locale.languageCode]; + String get enterIdentificationNumber => localizedValues["enterIdentificationNumber"][locale.languageCode]; String get accountActivationDesc => From d5d48703f9dc2e4e0f3a16186a2c0110f2b6b068 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 14 Jul 2021 10:32:07 +0300 Subject: [PATCH 4/5] camera permission fixed --- lib/pages/settings/general_setting.dart | 14 ++++++++------ lib/services/permission/permission_service.dart | 5 +---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 9a062eac..20c42aa6 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -32,10 +32,7 @@ class _GeneralSettings extends State var mediaQueryData; @override void initState() { - setState(() { - getValues(); - }); - + this.getValues(); super.initState(); } @@ -204,6 +201,7 @@ class _GeneralSettings extends State setState(() { camera = value; }); + this.permission.openSettings(); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -305,8 +303,12 @@ class _GeneralSettings extends State // accsibility = mediaQueryData.accessibleNavigation; //setTheme(blindValue); } - - this.location = await this.permission.isLocationEnabled(); + var camera = await this.permission.isCameraEnabled(); + var location = await this.permission.isLocationEnabled(); + setState(() { + this.camera = camera; + this.location = location; + }); } getTheme(value) async { diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index ab82172e..3b31e27e 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -55,10 +55,7 @@ class PermissionService extends BaseService { } isCameraEnabled() async { - print(await Permission.camera.status); - return await Permission.camera.status == PermissionStatus.granted - ? true - : false; + return await Permission.camera.isGranted; } setCameraLocationPermission(context) async { From 33465b04e56c58249aed006cee545d1432b826cd Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 14 Jul 2021 11:34:38 +0300 Subject: [PATCH 5/5] permission --- lib/pages/settings/general_setting.dart | 1 - lib/services/permission/permission_service.dart | 5 +++++ pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 20c42aa6..eff9537a 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -82,7 +82,6 @@ class _GeneralSettings extends State setState(() { accsibility = value; }); - //setAccisibility(value); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index 3b31e27e..237b2fa8 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -11,6 +11,7 @@ import 'package:localstorage/localstorage.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:vibration/vibration.dart'; import 'package:geolocator/geolocator.dart' as geo; +import 'package:open_settings/open_settings.dart'; class PermissionService extends BaseService { final LocalStorage storage = new LocalStorage("permission"); @@ -75,4 +76,8 @@ class PermissionService extends BaseService { openSettings() async { openAppSettings(); } + + openAccessbility() { + OpenSettings.openAppSetting(); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 34ac3656..7451cb6a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -176,7 +176,7 @@ dependencies: path: speech_to_text badges: ^1.1.4 - + open_settings: ^2.0.1 # Dep by Zohaib shimmer: ^1.1.2 carousel_slider: ^2.3.1