nfc plugin improvement.

merge-requests/575/head
Sikander Saleem 4 years ago
parent 2fd0fd3f85
commit 2a92478d01

@ -28,7 +28,7 @@ apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -111,8 +111,7 @@ dependencies {
implementation "com.opentok.android:opentok-android-sdk:2.19.1"
compile 'com.facebook.stetho:stetho:1.5.1'
implementation 'com.facebook.stetho:stetho:1.5.1'
implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1'

@ -5,7 +5,7 @@
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
@ -13,7 +13,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
@ -22,18 +22,24 @@
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/>
<uses-feature
android:name="android.hardware.location.network"
android:required="false" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
<!-- Wifi Permissions-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<!-- Detect Reboot Permission -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
@ -42,10 +48,10 @@
<application
android:name=".Application"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:showOnLockScreen="true"
android:label="Dr. Alhabib"
android:screenOrientation="sensorPortrait"
android:label="Dr. Alhabib">
android:showOnLockScreen="true"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@ -81,31 +87,44 @@
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<!-- Geofencing -->
<service android:name=".geofence.intent_receivers.GeofenceTransitionsJobIntentService" android:exported="true" android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver" android:enabled="true" android:exported="true" />
<receiver android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver" android:enabled="true">
<service
android:name=".geofence.intent_receivers.GeofenceTransitionsJobIntentService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver"
android:enabled="true"
android:exported="true" />
<receiver
android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name=".geofence.intent_receivers.LocationProviderChangeReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED"/>
<action android:name="android.location.PROVIDERS_CHANGED" />
</intent-filter>
</receiver>
<service android:name=".geofence.intent_receivers.ReregisterGeofenceJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name=".geofence.intent_receivers.ReregisterGeofenceJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- Geofencing -->
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8" />
<!-- Don't delete the meta-data below.
@ -115,12 +134,12 @@
android:value="2" />
</application>
z
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
</manifest>

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
@ -11,10 +11,11 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.huawei.agconnect:agcp:1.4.2.301'
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
}
}
@ -26,7 +27,7 @@ allprojects {
maven {
url 'https://developer.huawei.com/repo/'
}
maven{
maven {
url "https://artifactory.ess-dev.com/artifactory/gradle-dev-local"
}
}

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx2048m
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

@ -201,7 +201,7 @@ class _BookConfirmState extends State<BookConfirm> {
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: () async {
if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) {
if (!(await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)??false)) {
insertAppointment(context, widget.doctor);
} else {
insertLiveCareScheduledAppointment(context, widget.doctor);

@ -17,7 +17,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/nfc/nfc_reader_sheet.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:nfc_in_flutter/nfc_in_flutter.dart';
import 'package:flutter_nfc_kit/flutter_nfc_kit.dart';
class QRCode extends StatefulWidget {
PatientShareResponse patientShareResponse;
@ -42,11 +42,11 @@ class _QRCodeState extends State<QRCode> {
_bytes = base64.decode(widget.appoQR.split(',').last);
widget.authUser = new AuthenticatedUser();
NFC.isNDEFSupported.then((supported) {
setState(() {
_supportsNFC = true;
});
FlutterNfcKit.nfcAvailability.then((value) {
_supportsNFC = (value == NFCAvailability.available);
});
super.initState();
}

@ -94,14 +94,13 @@ class _ClickListDialogState extends State<ClickListDialog> {
return InkWell(
onTap: () {
widget.onSelection(tempClinicsList[index]);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: Text(tempClinicsList[index].clinicDescription)),
Expanded(child: Text(tempClinicsList[index].clinicDescription.trim())),
tempClinicsList[index].isLiveCareClinicAndOnline
? SvgPicture.asset(
'assets/images/new-design/video_icon_green_right.svg',

@ -33,7 +33,6 @@ class PrescriptionReminderDialog extends StatefulWidget {
}
class _ReminderDialogState extends State<PrescriptionReminderDialog> {
final CalendarPlugin _myPlugin = CalendarPlugin();
@override
Widget build(BuildContext context) {

@ -6,7 +6,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
class PaymentDialog extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
@ -23,96 +22,90 @@ class PaymentDialog extends StatefulWidget {
class _PaymentDialogState extends State<PaymentDialog> {
@override
Widget build(BuildContext context) {
return Container(
child: Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container(
height: 550.0,
width: 450.0,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0),
child: Text(TranslationBase.of(context).invoiceDetails, style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w600)),
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0),
child: Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600)),
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0),
child: Text(getDate(widget.appo.appointmentDate), style: getTextStyle()),
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0),
child: Text(widget.appo.projectName, style: getTextStyle()),
),
Divider(
color: Colors.grey,
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0),
child: Table(
children: [
TableRow(decoration: BoxDecoration(), children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())),
]),
],
),
),
Divider(
color: Colors.grey,
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0),
child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)),
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container(
//height: 550.0,
width: 450.0,
padding: EdgeInsets.all(21),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(
TranslationBase.of(context).invoiceDetails,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w600,
letterSpacing: -1.14,
color: Color(0xff2B353E),
),
Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()),
Container(
margin: EdgeInsets.fromLTRB(20.0, 30.0, 20.0, 15.0),
child: Text(TranslationBase.of(context).appoPaymentConfirm, style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor, fontWeight: FontWeight.w600)),
),
Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Color(0xff2E303A), fontSize: 16.0, fontWeight: FontWeight.w600,letterSpacing: -0.64)),
Text(getDate(widget.appo.appointmentDate), style: getTextStyle()),
Text(widget.appo.projectName, style: getTextStyle()),
Divider(
color: Colors.grey,
),
Table(
children: [
TableRow(decoration: BoxDecoration(), children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())),
]),
],
),
Divider(color: Colors.grey),
Text(
TranslationBase.of(context).YouCanPayByTheFollowingOptions,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
),
Container(
alignment: Alignment.center,
height: 40.0,
margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0),
child: Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).cancel_nocaps,
() {
Navigator.pop(context, null);
},
color: CustomColors.accentColor,
textColor: Colors.white,
),
),
getPaymentMethods(),
SizedBox(height: 12),
Text(
TranslationBase.of(context).appoPaymentConfirm,
style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.56),
),
SizedBox(height: 12),
Container(
alignment: Alignment.center,
child: Row(
// direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).cancel_nocaps,
() {
Navigator.pop(context, null);
},
color: CustomColors.accentColor,
textColor: Colors.white,
),
mWidth(10.0),
Expanded(
child: DefaultButton(
TranslationBase.of(context).confirm,
() {
Navigator.pop(context, widget.patientShareResponse);
},
color: CustomColors.green,
textColor: Colors.white,
),
),
mWidth(10.0),
Expanded(
child: DefaultButton(
TranslationBase.of(context).confirm,
() {
Navigator.pop(context, widget.patientShareResponse);
},
color: CustomColors.green,
textColor: Colors.white,
),
],
),
),
],
),
]),
),
),
]),
),
);
}
@ -120,21 +113,17 @@ class _PaymentDialogState extends State<PaymentDialog> {
_getNormalText(text) {
return Container(
margin: EdgeInsets.only(top: 10.0, right: 10.0),
child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Colors.black)),
child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Color(0xff2E303A))),
);
}
TextStyle getTextStyle() {
return TextStyle(color: Colors.grey[700], fontSize: 13.0, fontWeight: FontWeight.w600);
return TextStyle(color: Color(0xff575757), fontSize: 13.0, fontWeight: FontWeight.w600);
}
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getDayMonthYearDateFormatted(dateObj) +
" " +
dateObj.hour.toString() +
":" +
getMinute(dateObj);
return DateUtil.getDayMonthYearDateFormatted(dateObj) + " " + dateObj.hour.toString() + ":" + getMinute(dateObj);
}
String getMinute(DateTime dateObj) {

@ -340,11 +340,6 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
Future.delayed(Duration(seconds: 5), () {
isPageNavigated = false;

@ -1,7 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:nfc_in_flutter/nfc_in_flutter.dart';
import 'package:flutter_nfc_kit/flutter_nfc_kit.dart';
void showNfcReader(BuildContext context, {Function onNcfScan}) {
showModalBottomSheet(
@ -9,8 +7,7 @@ void showNfcReader(BuildContext context, {Function onNcfScan}) {
enableDrag: false,
isDismissible: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12), topRight: Radius.circular(12)),
borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
),
backgroundColor: Colors.white,
builder: (context) {
@ -30,7 +27,6 @@ class NfcLayout extends StatefulWidget {
}
class _NfcLayoutState extends State<NfcLayout> {
StreamSubscription<NDEFMessage> _stream;
bool _reading = false;
Widget mainWidget;
String nfcId;
@ -38,47 +34,28 @@ class _NfcLayoutState extends State<NfcLayout> {
@override
void initState() {
super.initState();
readNFC();
}
setState(() {
// _reading = true;
// Start reading using NFC.readNDEF()
_stream = NFC
.readNDEF(
once: false,
throwOnUserCancel: false,
readerMode: NFCDispatchReaderMode())
.listen((NDEFMessage message) {
setState(() {
_reading = true;
mainWidget = doneNfc();
});
Future.delayed(const Duration(milliseconds: 500), () {
_stream?.cancel();
widget.onNcfScan(nfcId);
Navigator.pop(context);
});
print("read NDEF id: ${message.id}");
print("NFC Record "+message.payload);
print("NFC Record Lenght "+message.records.length.toString());
print("NFC Record "+message.records.first.id);
print("NFC Record "+message.records.first.payload);
print("NFC Record "+message.records.first.data);
print("NFC Record "+message.records.first.type);
// widget.onNcfScan(message.id);
nfcId = message.id;
}, onError: (e) {
// Check error handling guide below
void readNFC() async {
FlutterNfcKit.poll(timeout: Duration(seconds: 10), androidPlatformSound: false, iosMultipleTagMessage: "Multiple tags found!").then((value) async {
setState(() {
_reading = true;
mainWidget = doneNfc();
});
Future.delayed(const Duration(milliseconds: 500), () async {
await FlutterNfcKit.finish();
widget.onNcfScan(nfcId);
Navigator.pop(context);
});
nfcId = value.id;
});
}
@override
Widget build(BuildContext context) {
(mainWidget == null && !_reading)
? mainWidget = scanNfc()
: mainWidget = doneNfc();
return AnimatedSwitcher(
duration: Duration(milliseconds: 500), child: mainWidget);
(mainWidget == null && !_reading) ? mainWidget = scanNfc() : mainWidget = doneNfc();
return AnimatedSwitcher(duration: Duration(milliseconds: 500), child: mainWidget);
}
Widget scanNfc() {
@ -125,7 +102,7 @@ class _NfcLayoutState extends State<NfcLayout> {
),
child: RaisedButton(
onPressed: () {
_stream?.cancel();
// _stream?.cancel();
Navigator.pop(context);
},
elevation: 0,
@ -189,7 +166,7 @@ class _NfcLayoutState extends State<NfcLayout> {
// Navigator.pop(context);
// },
onPressed: null,
elevation: 0,
elevation: 0,
child: Text("DONE"),
),
),

@ -128,7 +128,7 @@ dependencies:
flutter_local_notifications: ^9.1.4
#device_calendar
device_calendar: ^3.1.0
device_calendar: ^4.0.1
#Handle Geolocation
geolocator: ^7.7.1
@ -158,7 +158,8 @@ dependencies:
wifi: ^0.1.5
vibration: ^1.7.3
nfc_in_flutter: ^2.0.5
flutter_nfc_kit: ^3.2.0
speech_to_text:
path: speech_to_text
@ -178,8 +179,7 @@ dependencies:
flutter_material_pickers: ^3.1.2
flutter_staggered_grid_view: ^0.4.1
flutter_hms_gms_availability: ^2.0.0
huawei_location:
path: ./hms-plugins/flutter-hms-location
huawei_location: ^6.0.0+302
# Marker Animation
flutter_animarker: ^3.2.0

Loading…
Cancel
Save