diff --git a/android/app/build.gradle b/android/app/build.gradle index 4b7282d..8a83f79 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,12 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { namespace "com.Xperience.QueueClient.queue_client" compileSdkVersion flutter.compileSdkVersion @@ -54,11 +60,17 @@ android { versionName flutterVersionName } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 5dd377d..7b6a1e4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ joinedSer = jsonDecode(m_joinedService); if(service['id'] == jsonDecode(m_joinedService)['service_id']){ //Joined this JoinedServices.add(jsonDecode(m_joinedService)); diff --git a/lib/home.dart b/lib/home.dart index 26d59ca..fc190bd 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -103,15 +103,13 @@ class _HomePageState extends State { DataManager.instance().JoinedServices.length, (index) { Map service = (DataManager.instance().JoinedServices[index]); - return ServiceCard( - tokenId: int.parse(service['id']), + return JoinedCard( + appointmentId: int.parse(service['appointment_id']), id: int.parse(service['service_id']), sTime: DateTime.parse( service['start_time'] ?? DateTime.now().toString()), - eTime: DateTime.parse( - service['end_time'] ?? DateTime.now().toString()), name: service['name']!, - memberCount: service['members']!.split(',').length - 1, + queueIndex: int.parse(service['member_pos']), duration: Helpers.ParseDuration(service['duration']) ); }), @@ -137,14 +135,13 @@ class _HomePageState extends State { Map service = DataManager.instance().AvailableServices[index]; return ServiceCard( - tokenId: -1, id: int.parse(service['id']), sTime: DateTime.parse( service['start_time'] ?? DateTime.now().toString()), eTime: DateTime.parse( service['end_time'] ?? DateTime.now().toString()), name: service['name']!, - memberCount: service['members']!.split(',').length - 1, + memberCount: int.parse(service['member_count']), duration: Helpers.ParseDuration(service['duration'])); }), ], @@ -160,23 +157,14 @@ class _HomePageState extends State { required DateTime eTime, required String name, required int memberCount, - required int tokenId, required Duration duration}) { - DateTime eta = sTime.add(duration * (tokenId > 0 ? tokenId : memberCount)); + DateTime eta = sTime.add(duration * memberCount); return InkWell( onTap: () async { - if(tokenId > 0){return;} - - // await Navigator.of(context).push(MaterialPageRoute( - // builder: (context) => ServiceInfoPage( - // id: id, - // tokenId: tokenId, - // ))); - bool confirmed = await Dialogs.AskQuestion(context, "Confirm", "Are you sure to join to this Queue?\n\nQueue Name : ${name}"); if(confirmed){ Dialogs.waiting(context); @@ -207,19 +195,8 @@ class _HomePageState extends State { ]) ], ), - SizedBox(height: tokenId > 0 ? 0 : 10,), - (tokenId > 0) ? Column( - children: [ - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.token,size: 25,), - Text( - " ${tokenId}", - style: TextStyle(fontSize: 40), - ), - ]), - ], - ) - : Row( + SizedBox(height: 10,), + Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded(flex:1,child: Icon(Icons.people)), @@ -229,26 +206,13 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded(flex:1,child: Icon(Icons.access_time)), - Expanded(flex: 4,child: Text("Be there around ${Helpers.DateTimeToRelative(eta)}",maxLines: 3,overflow: TextOverflow.ellipsis,)) + Expanded(flex: 4,child: + eta.isBefore(DateTime.now()) ? Text("Available right now !") : Text("Be there around ${Helpers.DateTimeToRelative(eta)}",maxLines: 3,overflow: TextOverflow.ellipsis,) + ) ]), - // (sTime.isAfter(DateTime.now())) - // ? Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // Expanded(flex:1,child: Icon(Icons.access_time)), - // Expanded(flex: 4,child: Text("Starts ${Helpers.DateTimeToRelative(sTime)}",maxLines: 3,overflow: TextOverflow.ellipsis,style: TextStyle(fontSize: 13),)) - // ]) - // : Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // Expanded(flex:1,child: Icon(Icons.directions_run_outlined)), - // Expanded(flex: 4, - // child: Text( - // "Ongoing until ${Helpers.DateTimeToRelative(eTime)}"), - // ) - // ]), - (tokenId <=0) ? + + Column( children: [ SizedBox(height: 10,), @@ -259,12 +223,68 @@ class _HomePageState extends State { ), ), ], - ) : Container() - + ) ], ), ), ), ); } + + Widget JoinedCard( + {required int id, + required DateTime sTime, + required String name, + required int queueIndex, + required int appointmentId, + required Duration duration}) { + + DateTime eta = sTime.add(duration * appointmentId); + + return Card( + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + name, + style: TextStyle(fontSize: 20), + ), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Icon(Icons.people_alt_rounded,size: 25,), + Text( + " ${queueIndex-1}", + style: TextStyle(fontSize: 25), + ), + ]) + ], + ), + Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Icon(Icons.token,size: 25,), + Text( + " ${appointmentId}", + style: TextStyle(fontSize: 40), + ), + ]), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded(flex:1,child: Icon(Icons.access_time)), + Expanded(flex: 4,child: + eta.isBefore(DateTime.now()) ? Text("You're late !") : Text("Be there around ${Helpers.DateTimeToRelative(eta)}",maxLines: 3,overflow: TextOverflow.ellipsis,) + ) + ]), + ], + ), + ), + ); + } } diff --git a/lib/login.dart b/lib/login.dart index 6827bdf..7f69b1e 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -21,8 +21,8 @@ class _LoginPageState extends State { void initState() { // TODO: implement initState super.initState(); - Reset(); - // AutoLogin(); + // Reset(); + AutoLogin(); } void Reset() async{ diff --git a/pubspec.yaml b/pubspec.yaml index 509aebe..4b26dcd 100644 --- a/pubspec.yaml +++ b/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.3+3 environment: sdk: '>=3.0.6 <4.0.0'