diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index 588046b..c6db056 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -12,9 +12,15 @@ class ApiUrls { //verify otp static String OTPVerify = "${base}OTPVerify"; + //secure access + static String secureAccess = "${base}changeSecureAccessStatus"; + //add details static String AddDetails = "${base}userDetails"; + //delete account + static String deleteAccount = "${base}delete_account"; + //add kyc static String AddKyc = "${base}addUserKYC"; @@ -24,6 +30,9 @@ class ApiUrls { // Privacy Policy API static String privacyPolicyApi = "${base}privacyPolicy"; + // Notification + static String notificationApi = "${base}listNotification"; + //Terms and Condition API static String termsConditionApi = "${base}termsAndCondition"; diff --git a/lib/model/Notification/notification_model.dart b/lib/model/Notification/notification_model.dart new file mode 100644 index 0000000..1ed1182 --- /dev/null +++ b/lib/model/Notification/notification_model.dart @@ -0,0 +1,139 @@ +class GetNotification { + final String? status; + final int? statusCode; + final String? message; + final Data? data; + + GetNotification({ + this.status, + this.statusCode, + this.message, + this.data, + }); + + factory GetNotification.fromJson(Map json) { + return GetNotification( + status: json['status'], + statusCode: json['status_code'], + message: json['message'], + data: json['data'] != null ? Data.fromJson(json['data']) : null, + ); + } + + Map toJson() { + return { + 'status': status, + 'status_code': statusCode, + 'message': message, + if (data != null) 'data': data!.toJson(), + }; + } +} + +class Data { + final List? list; + final int? count; + + Data({ + this.list, + this.count, + }); + + factory Data.fromJson(Map json) { + return Data( + list: json['list'] != null + ? (json['list'] as List) + .map((v) => NotificationItem.fromJson(v)) + .toList() + : null, + count: json['count'], + ); + } + + Map toJson() { + return { + 'list': list?.map((v) => v.toJson()).toList(), + 'count': count, + }; + } +} + +class NotificationItem { + final int? id; + final String? messageName; + final int? userId; + final int? userType; + final String? notificationTitle; + final String? notificationMessage; + final String? notificationImage; + final int? isSchedule; + final String? deliverySchedule; + final int? isRead; + final String? isActive; + final String? createdBy; + final String? modifiedBy; + final String? deletedAt; + final String? createdAt; + final String? updatedAt; + + NotificationItem({ + this.id, + this.messageName, + this.userId, + this.userType, + this.notificationTitle, + this.notificationMessage, + this.notificationImage, + this.isSchedule, + this.deliverySchedule, + this.isRead, + this.isActive, + this.createdBy, + this.modifiedBy, + this.deletedAt, + this.createdAt, + this.updatedAt, + }); + + factory NotificationItem.fromJson(Map json) { + return NotificationItem( + id: json['id'], + messageName: json['message_name'], + userId: json['user_id'], + userType: json['user_type'], + notificationTitle: json['notification_title'], + notificationMessage: json['notification_message'], + notificationImage: json['notification_image'], + isSchedule: json['is_schedule'], + deliverySchedule: json['delivery_schedule'], + isRead: json['is_read'], + isActive: json['is_active'], + createdBy: json['created_by'], + modifiedBy: json['modified_by'], + deletedAt: json['deleted_at'], + createdAt: json['created_at'], + updatedAt: json['updated_at'], + ); + } + + Map toJson() { + return { + 'id': id, + 'message_name': messageName, + 'user_id': userId, + 'user_type': userType, + 'notification_title': notificationTitle, + 'notification_message': notificationMessage, + 'notification_image': notificationImage, + 'is_schedule': isSchedule, + 'delivery_schedule': deliverySchedule, + 'is_read': isRead, + 'is_active': isActive, + 'created_by': createdBy, + 'modified_by': modifiedBy, + 'deleted_at': deletedAt, + 'created_at': createdAt, + 'updated_at': updatedAt, + }; + } +} diff --git a/lib/view/MainScreen/Notification.dart b/lib/view/MainScreen/Notification.dart index d4d348b..a617234 100644 --- a/lib/view/MainScreen/Notification.dart +++ b/lib/view/MainScreen/Notification.dart @@ -1,8 +1,12 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:traderscircuit/Utils/Common/CommonAppbar.dart'; import 'package:traderscircuit/Utils/Common/sized_box.dart'; import 'package:traderscircuit/Utils/text.dart'; +import 'package:traderscircuit/model/Notification/notification_model.dart'; +import 'package:traderscircuit/view_model/Notification/notification_api.dart'; class NotificationScreen extends StatefulWidget { const NotificationScreen({super.key}); @@ -12,116 +16,53 @@ class NotificationScreen extends StatefulWidget { } class _NotificationScreenState extends State { - List> CardList = [ - { - 'profileimg': 'assets/images/png/Ellipse 588.png', - 'title': 'Mokshada Kesarkar', - 'subtitle': 'Lorem ipsum dolor sit amet cons......', - 'time': '1 day ago' - }, - { - 'profileimg': 'assets/images/png/Ellipse 591.png', - 'title': 'Afrid Mulla', - 'subtitle': 'Lorem ipsum dolor sit amet cons......', - 'time': '1 day ago' - }, - { - 'profileimg': 'assets/images/png/Ellipse 588.png', - 'title': 'Mokshada Kesarkar', - 'subtitle': 'Lorem ipsum dolor sit amet cons......', - 'time': '2 days ago' - }, - { - 'profileimg': 'assets/images/png/Ellipse 591.png', - 'title': 'Afrid Mulla', - 'subtitle': 'Lorem ipsum dolor sit amet cons......', - 'time': '3 days ago' - }, - ]; - + StreamController NotificationController = StreamController(); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: CommonAppbar(titleTxt: ''), - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 16.w), - child: text25W600('Notifications'), - ), - sizedBoxHeight(40.h), - Padding( - padding: EdgeInsets.only(left: 16.w), - child: text16W400('Today'), - ), - sizedBoxHeight(25.h), - notificationCard( - profileimg: 'assets/images/png/Ellipse 591.png', - title: 'Mokshada Kesarkar', - subtitle: 'Lorem ipsum dolor sit amet cons......', - time: '30 mins ago'), - Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 20.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color.fromRGBO(176, 176, 176, 0.5), - width: 1, - ), + body: StreamBuilder( + stream: NotificationController.stream, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return Text("data"); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), ), - ), - ), - notificationCard( - profileimg: 'assets/images/png/Ellipse 588.png', - title: 'Mokshada Kesarkar', - subtitle: 'Lorem ipsum dolor sit amet cons......', - time: '1 Hour ago'), - sizedBoxHeight(30.h), - Padding( - padding: EdgeInsets.only(left: 16.w), - child: text16W400('Yesterday'), - ), - sizedBoxHeight(30.h), - ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: CardList.length, - itemBuilder: (context, index) { - return Column( - children: [ - notificationCard( - profileimg: CardList[index]['profileimg']!, - title: CardList[index]['title']!, - subtitle: CardList[index]['subtitle']!, - time: CardList[index]['time']!), - if (index != CardList.length - 1) - Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 20.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color.fromRGBO(176, 176, 176, 0.5), - width: 1, - ), - ), - ), - ), - ], - ); - }, - ), - sizedBoxHeight(40.h), - ], - ), + ); + } + } + return notificationobj!.data!.list!.isEmpty + ? Center(child: _buildNodataBody()) + : _buildBody(context); + }, ), ); } + Widget _buildNodataBody() { + return + // Scaffold( + // body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Lottie.asset('assets/logos/NoDataFoundLottie.json'), + text25W600( + "No Data Available", + // textAlign: TextAlign.center, + ), + ], + ); + } + // 'assets/images/png/Ellipse 1494.png' Widget notificationCard({ required String profileimg, @@ -155,4 +96,109 @@ class _NotificationScreenState extends State { ), ); } + + Widget _buildBody(context) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 16.w), + child: text25W600('Notifications'), + ), + sizedBoxHeight(40.h), + Padding( + padding: EdgeInsets.only(left: 16.w), + child: text16W400('Today'), + ), + sizedBoxHeight(25.h), + notificationCard( + profileimg: 'assets/images/png/Ellipse 591.png', + title: 'Mokshada Kesarkar', + subtitle: 'Lorem ipsum dolor sit amet cons......', + time: '30 mins ago'), + Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 20.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color.fromRGBO(176, 176, 176, 0.5), + width: 1, + ), + ), + ), + ), + notificationCard( + profileimg: 'assets/images/png/Ellipse 588.png', + title: 'Mokshada Kesarkar', + subtitle: 'Lorem ipsum dolor sit amet cons......', + time: '1 Hour ago'), + sizedBoxHeight(30.h), + Padding( + padding: EdgeInsets.only(left: 16.w), + child: text16W400('Yesterday'), + ), + sizedBoxHeight(30.h), + ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: CardList.length, + itemBuilder: (context, index) { + return Column( + children: [ + notificationCard( + profileimg: CardList[index]['profileimg']!, + title: CardList[index]['title']!, + subtitle: CardList[index]['subtitle']!, + time: CardList[index]['time']!), + if (index != CardList.length - 1) + Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 20.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color.fromRGBO(176, 176, 176, 0.5), + width: 1, + ), + ), + ), + ), + ], + ); + }, + ), + sizedBoxHeight(40.h), + ], + ), + ); + } + + List> CardList = [ + { + 'profileimg': 'assets/images/png/Ellipse 588.png', + 'title': 'Mokshada Kesarkar', + 'subtitle': 'Lorem ipsum dolor sit amet cons......', + 'time': '1 day ago' + }, + { + 'profileimg': 'assets/images/png/Ellipse 591.png', + 'title': 'Afrid Mulla', + 'subtitle': 'Lorem ipsum dolor sit amet cons......', + 'time': '1 day ago' + }, + { + 'profileimg': 'assets/images/png/Ellipse 588.png', + 'title': 'Mokshada Kesarkar', + 'subtitle': 'Lorem ipsum dolor sit amet cons......', + 'time': '2 days ago' + }, + { + 'profileimg': 'assets/images/png/Ellipse 591.png', + 'title': 'Afrid Mulla', + 'subtitle': 'Lorem ipsum dolor sit amet cons......', + 'time': '3 days ago' + }, + ]; } diff --git a/lib/view/Sidemenu/Settings.dart b/lib/view/Sidemenu/Settings.dart index 8115f12..d42fa5d 100644 --- a/lib/view/Sidemenu/Settings.dart +++ b/lib/view/Sidemenu/Settings.dart @@ -1,8 +1,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:get/get.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:traderscircuit/Utils/Common/CommonAppbar.dart'; +import 'package:traderscircuit/Utils/Common/commonBotton.dart'; +import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart'; +import 'package:traderscircuit/Utils/Common/sized_box.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; import 'package:traderscircuit/Utils/text.dart'; +import 'package:traderscircuit/Utils/utils.dart'; +import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; +import 'package:traderscircuit/view_model/Login/delete_account_api.dart'; +import 'package:traderscircuit/Utils/Dialogs.dart'; class Settings extends StatefulWidget { const Settings({super.key}); @@ -156,15 +167,151 @@ class _SettingsState extends State { ), Row( children: [ - Image.asset( - "assets/images/png/Delete.png", - width: 20, - height: 22, + InkWell( + child: Image.asset( + "assets/images/png/Delete.png", + width: 20, + height: 22, + ), + onTap: () { + Get.bottomSheet( + commonGlassContainer( + width: double.infinity, + height: 363.h, + borderradius: 4, + customWidget: Center( + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 20.w), + child: Column( + children: [ + sizedBoxHeight(60.h), + // Image.asset( + // 'assets/images/png/Group 1000003722.png', + // height: 100.h, + // ), + // sizedBoxHeight(25.h), + text22W600('Confirm Delete'), + sizedBoxHeight(30.h), + text20W400_center( + 'Are you sure you want to delete your account?'), + sizedBoxHeight(50.h), + CommonYesNoBtn( + yesonTap: () async { + utils.loader(); + + var resp = await DeleteAccountAPI() + .deleteAcountApi(); + print(resp.status); + print('Api msg : ${resp.message}'); + + if (resp.status == + ResponseStatus.SUCCESS) { + Get.back(); + print( + "api response is ${resp.data}"); + Utils.showToast( + "Account deleted successfully"); + + Map res = + resp.data; + print(res); + + Get.offNamed( + RouteName.loginscreen, + ); + } else { + Get.back(); + Utils.showToast(resp.message); + print( + 'Api msg : ${resp.message}'); + } + }, + noonTap: () { + Get.back(); + }, + ), + ], + ), + ), + ), + ), + backgroundColor: Colors.black.withOpacity(0.3), + ); + }, ), SizedBox( width: 15.w, ), - text20W400("Delete Account") + InkWell( + child: text20W400("Delete Account"), + onTap: () { + Get.bottomSheet( + commonGlassContainer( + width: double.infinity, + height: 363.h, + borderradius: 4, + customWidget: Center( + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 20.w), + child: Column( + children: [ + sizedBoxHeight(60.h), + // Image.asset( + // 'assets/images/png/Group 1000003722.png', + // height: 100.h, + // ), + // sizedBoxHeight(25.h), + text22W600('Confirm Delete'), + sizedBoxHeight(30.h), + text20W400_center( + 'Are you sure you want to delete your account?'), + sizedBoxHeight(50.h), + CommonYesNoBtn( + yesonTap: () async { + utils.loader(); + + var resp = await DeleteAccountAPI() + .deleteAcountApi(); + print(resp.status); + print('Api msg : ${resp.message}'); + + if (resp.status == + ResponseStatus.SUCCESS) { + Get.back(); + print( + "api response is ${resp.data}"); + Utils.showToast( + "Account deleted successfully"); + + Map res = + resp.data; + print(res); + + Get.offNamed( + RouteName.loginscreen, + ); + } else { + Get.back(); + Utils.showToast(resp.message); + print( + 'Api msg : ${resp.message}'); + } + }, + noonTap: () { + Get.back(); + }, + ), + ], + ), + ), + ), + ), + backgroundColor: Colors.black.withOpacity(0.3), + ); + }, + ) ], ), ], @@ -177,3 +324,87 @@ class _SettingsState extends State { ); } } + +Deletedialog(context) { + return showDialog( + // barrierDismissible: false, + context: context, + builder: (context) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AlertDialog( + insetPadding: EdgeInsets.symmetric(horizontal: 16.w), + backgroundColor: + Get.isDarkMode ? Colors.black : const Color(0XFF1B243D), + contentPadding: EdgeInsets.fromLTRB(29.w, 44.h, 29.w, 35.h), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(5.r)), + ), + content: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 87.h, + width: 80.w, + decoration: const BoxDecoration( + shape: BoxShape.circle, color: Color(0xFFC18948)), + child: Align( + alignment: Alignment.topLeft, + child: Container( + height: 79.h, + width: 73.w, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color(0xFFE8C69F).withOpacity(0.5), + ), + child: Center( + child: SvgPicture.asset( + 'assets/images/svg/apps 1.svg', + // fit: BoxFit.fill, + ), + ), + ), + ), + ), + sizedBoxHeight(30.h), + Text( + "Are you sure you want to logout ?", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "hiragino", + fontWeight: FontWeight.w400, + fontSize: 20.sp, + color: const Color(0xFFFFFFFF)), + ), + sizedBoxHeight(40.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 140.w, + child: CommonYesNoBtn( + yesonTap: () async { + SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.clear(); + Get.offNamed(RouteName.loginscreen); + }, + )), + SizedBox( + width: 140.w, + child: CommonYesNoBtn( + noonTap: () { + Get.back(); + }, + ), + ), + ], + ) + ], + ), + ), + ], + ), + ); +} diff --git a/lib/view/Sidemenu/Sidemenu.dart b/lib/view/Sidemenu/Sidemenu.dart index f17aef1..c35c860 100644 --- a/lib/view/Sidemenu/Sidemenu.dart +++ b/lib/view/Sidemenu/Sidemenu.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart'; import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart'; import 'package:traderscircuit/Utils/Common/sized_box.dart'; @@ -361,27 +362,27 @@ LogOutdialog(context) { color: const Color(0xFFFFFFFF)), ), sizedBoxHeight(40.h), - const Row( + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - // SizedBox( - // width: 140.w, - // child: CommonBorderNoBtn( - // text: 'Yes', - // onTap: () { - // // prefs.clear(); - // // Get.offNamed(RouteName.loginScreen); - // }, - // )), - // SizedBox( - // width: 140.w, - // child: CommonYesBtn( - // text: 'No', - // onTap: () { - // Get.back(); - // }, - // ), - // ), + SizedBox( + width: 140.w, + child: CommonYesNoBtn( + yesonTap: () async { + SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.clear(); + Get.offNamed(RouteName.loginscreen); + }, + )), + SizedBox( + width: 140.w, + child: CommonYesNoBtn( + noonTap: () { + Get.back(); + }, + ), + ), ], ) ], diff --git a/lib/view/login/VerifyOtp.dart b/lib/view/login/VerifyOtp.dart index 6e4475f..6582545 100644 --- a/lib/view/login/VerifyOtp.dart +++ b/lib/view/login/VerifyOtp.dart @@ -17,6 +17,7 @@ bool? isVendorExist; int? isProfileUpdated; int? isriskProfileUpdated; int? isKycUpdated; +int? isSecuredAccess; class VerifyOTP extends StatefulWidget { const VerifyOTP({super.key}); @@ -56,6 +57,8 @@ class _VerifyOTPState extends State { isriskProfileUpdated = resp.data["data"]["user_data"]["risk_profile_updated"]; isKycUpdated = resp.data["data"]["user_data"]["kyc_updated"]; + isSecuredAccess = resp.data["data"]["user_data"]["secured_access"]; + if (isVendorExist!) { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString( @@ -68,15 +71,15 @@ class _VerifyOTPState extends State { // ProfileApi().GetProfileApi().then( // (value) { - Get.toNamed(RouteName.secureaccess); - - // // isProfileUpdated == 0 - // // ? Get.toNamed(RouteName.adddetails) - // // : isKycUpdated == 0 - // // ? Get.toNamed(RouteName.kyc) - // // : isriskProfileUpdated == 0 - // // ? Get.toNamed(RouteName.updateriskprofile) - // // : Get.toNamed(RouteName.mainscreen); + isSecuredAccess == 0 + ? Get.toNamed(RouteName.secureaccess) + : isProfileUpdated == 0 + ? Get.toNamed(RouteName.adddetails) + : isKycUpdated == 0 + ? Get.toNamed(RouteName.kyc) + : isriskProfileUpdated == 0 + ? Get.toNamed(RouteName.updateriskprofile) + : Get.toNamed(RouteName.mainscreen); // Get.toNamed(RouteName.mainscreen); // }, @@ -96,7 +99,7 @@ class _VerifyOTPState extends State { Utils.showToast("$message"); } else { Get.back(); - String? message = resp.data['message']; + String? message = resp.message; Utils.showToast("$message"); } } diff --git a/lib/view/secureAccess.dart/Faceid.dart b/lib/view/secureAccess.dart/Faceid.dart index 4fecc98..af6972b 100644 --- a/lib/view/secureAccess.dart/Faceid.dart +++ b/lib/view/secureAccess.dart/Faceid.dart @@ -3,11 +3,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:traderscircuit/Utils/Common/CommonAppbar.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; import 'package:traderscircuit/Utils/text.dart'; import 'package:traderscircuit/Utils/utils.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; +import 'package:traderscircuit/view/secureAccess.dart/SecureAccess.dart'; import 'package:traderscircuit/view/secureAccess.dart/faceIdScreen.dart'; +import 'package:traderscircuit/view_model/Login/secure_access_api.dart'; class Faceid extends StatefulWidget { const Faceid({super.key}); @@ -19,6 +22,7 @@ class Faceid extends StatefulWidget { class _FaceidState extends State { Color primaryColor = Colors.transparent.withOpacity(0.2); Color secondaryColor = Colors.grey.shade800; + @override Widget build(BuildContext context) { return Scaffold( @@ -61,10 +65,35 @@ class _FaceidState extends State { bool result = await LocalAuth.authenticate(); // Get.toNamed(RouteName.adddetails); if (result) { - Get.toNamed(RouteName.adddetails); + Utils.loader(); + Map updata = {}; + final resp = + await SecureAccessAPI(updata).secureaccessApi(); + if (resp.status == ResponseStatus.SUCCESS) { + Get.back(); + Get.toNamed(RouteName.adddetails); + } else if (resp.status == ResponseStatus.PRIVATE) { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } else if (resp.status == ResponseStatus.ERROR) { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } else { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } } else { - Utils.showToast("msg"); + Utils.showToast("Setting FaceID Failed!"); } + + // if (result) { + // Get.toNamed(RouteName.adddetails); + // } else { + // Utils.showToast("msg"); + // } }, ) ], diff --git a/lib/view/secureAccess.dart/Fingerprint.dart b/lib/view/secureAccess.dart/Fingerprint.dart index c2bd698..46055df 100644 --- a/lib/view/secureAccess.dart/Fingerprint.dart +++ b/lib/view/secureAccess.dart/Fingerprint.dart @@ -3,10 +3,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:traderscircuit/Utils/Common/CommonAppbar.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; import 'package:traderscircuit/Utils/text.dart'; +import 'package:traderscircuit/Utils/utils.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; import 'package:local_auth/local_auth.dart'; +import 'package:traderscircuit/view_model/Login/secure_access_api.dart'; class Fingerprint extends StatefulWidget { const Fingerprint({super.key}); @@ -45,7 +48,29 @@ class _FingerprintState extends State { ), ); if (isAuth) { - Get.toNamed(RouteName.adddetails); + Utils.loader(); + Map updata = {}; + final resp = await SecureAccessAPI(updata).secureaccessApi(); + if (resp.status == ResponseStatus.SUCCESS) { + Get.back(); + Get.toNamed(RouteName.adddetails); + } else if (resp.status == ResponseStatus.PRIVATE) { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } else if (resp.status == ResponseStatus.ERROR) { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } else { + Get.back(); + String? message = resp.data['message']; + Utils.showToast("$message"); + } + + // Get.toNamed(RouteName.adddetails); + } else { + Utils.showToast("Setting Fingerprint Failed!"); } print(isAuth); // ignore: empty_catches diff --git a/lib/view_model/Login/delete_account_api.dart b/lib/view_model/Login/delete_account_api.dart new file mode 100644 index 0000000..89623ee --- /dev/null +++ b/lib/view_model/Login/delete_account_api.dart @@ -0,0 +1,28 @@ +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:traderscircuit/Utils/api_urls.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; +import 'package:traderscircuit/data/network/network_api_services.dart'; + +class DeleteAccountAPI { + DeleteAccountAPI(); + var data; + Future> deleteAcountApi() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + final response = await NetworkApiServices().postApi( + data, + ApiUrls.deleteAccount, + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("OTP sent successfully"); + } else { + return ResponseData( + responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } +} diff --git a/lib/view_model/Login/secure_access_api.dart b/lib/view_model/Login/secure_access_api.dart new file mode 100644 index 0000000..1717b12 --- /dev/null +++ b/lib/view_model/Login/secure_access_api.dart @@ -0,0 +1,27 @@ +import 'package:traderscircuit/Utils/api_urls.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; +import 'package:traderscircuit/data/network/network_api_services.dart'; + +class SecureAccessAPI { + SecureAccessAPI(this.data); + var data; + Future> secureaccessApi() async { + final response = await NetworkApiServices().postApi( + // optionalpar: true, + data, + ApiUrls.secureAccess, + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("token is $response"); + } else { + return ResponseData( + responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } +} diff --git a/lib/view_model/Notification/notification_api.dart b/lib/view_model/Notification/notification_api.dart new file mode 100644 index 0000000..ce70b7d --- /dev/null +++ b/lib/view_model/Notification/notification_api.dart @@ -0,0 +1,26 @@ +import 'dart:async'; +import 'package:traderscircuit/Utils/api_urls.dart'; +import 'package:traderscircuit/Utils/base_manager.dart'; +import 'package:traderscircuit/data/network/network_api_services.dart'; +import 'package:traderscircuit/model/Notification/notification_model.dart'; + +GetNotification? notificationobj; + +class NotificationsAPI { + Future> notificationList( + {required StreamController streamControl}) async { + final response = await NetworkApiServices().getApi(ApiUrls.notificationApi); + if (response.status == ResponseStatus.SUCCESS) { + notificationobj = GetNotification.fromJson(response.data); + if (!streamControl.isClosed) streamControl.sink.add(notificationobj!); + } + return response; + } + + // Future> PostnotificationAPI(slug) async { + // final response = + // await NetworkApi().postslugApi(ApiUrls.postnotifications + "/${slug}"); + // print("Url is ${ApiUrls.postnotifications + "/${slug}"}"); + // return response; + // } +} diff --git a/pubspec.lock b/pubspec.lock index 0c4175d..0cdab15 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -93,10 +93,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" connectivity_plus: dependency: "direct main" description: @@ -604,10 +604,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" mime: dependency: transitive description: @@ -897,18 +897,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -937,10 +937,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" typed_data: dependency: transitive description: @@ -1114,10 +1114,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" win32: dependency: transitive description: @@ -1143,7 +1143,5 @@ packages: source: hosted version: "6.3.0" sdks: - dart: ">=3.2.3 <4.0.0" flutter: ">=3.16.6" -