From 3d9e71cbba1555e42c3f5ac6c0bf3fac38c207f3 Mon Sep 17 00:00:00 2001 From: Rajshinde046 Date: Tue, 4 Jun 2024 15:56:01 +0530 Subject: [PATCH] settings --- android/app/src/main/AndroidManifest.xml | 39 +++ lib/Utils/api_urls.dart | 3 + lib/main.dart | 27 ++ lib/model/ProfileModel/GetProfileModel.dart | 287 +++++++++++++++++++- lib/view/MainScreen/ShortTrade.dart | 203 ++++++++++---- lib/view/Sidemenu/Settings.dart | 90 +++++- lib/view/login/LoginScreen.dart | 7 - lib/view_model/SettingApi/setting_api.dart | 27 ++ pubspec.lock | 50 +++- pubspec.yaml | 1 + 10 files changed, 644 insertions(+), 90 deletions(-) create mode 100644 lib/view_model/SettingApi/setting_api.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 60b4a84..b61b240 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -66,9 +66,48 @@ android:scheme="scgatewayredirect" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index fed98d2..694ff41 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -88,4 +88,7 @@ class ApiUrls { //Stock Details static String subscriptionApi = "${base}my-subscription-page"; + + //setting + static String setting = "${base}update-notification"; } diff --git a/lib/main.dart b/lib/main.dart index 0440b53..59e492c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,6 +7,7 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_branch_sdk/flutter_branch_sdk.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -77,6 +78,8 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State with WidgetsBindingObserver { + StreamSubscription? streamSubscription; + StreamController controllerData = StreamController(); var _connectionStatus = ConnectivityResult.values.toString(); late StreamSubscription subscription; Connectivity connectivity = Connectivity(); @@ -109,6 +112,30 @@ class _MyAppState extends State with WidgetsBindingObserver { // print(_connectionStatus); } + void listenDynamicLinks() async { + streamSubscription = FlutterBranchSdk.initSession().listen((data) { + print('listenDynamicLinks - DeepLink Data: $data'); + controllerData.sink.add((data.toString())); + if (data.containsKey('+clicked_branch_link') && + data['+clicked_branch_link'] == true) { + debugPrint( + '------------------------------------Link clicked----------------------------------------------'); + // debugPrint('Custom string: ${data['custom_string']}'); + debugPrint('Custom number: ${data['custom_number']}'); + debugPrint("var type is ${data['custom_number'].runtimeType}"); + debugPrint( + '------------------------------------------------------------------------------------------------'); + // showSnackBar( + // message: 'Link clicked: Custom string - ${data['custom_string']}', + // duration: 10); + // Get.to(() => + // SvpMain(fromHome: false, index: int.parse(data['custom_number']))); + } + }, onError: (error) { + print('InitSesseion error: ${error.toString()}'); + }); + } + Future checkInternet() async { final connectivityResult = await (Connectivity().checkConnectivity()); diff --git a/lib/model/ProfileModel/GetProfileModel.dart b/lib/model/ProfileModel/GetProfileModel.dart index 79804ff..b198f7d 100644 --- a/lib/model/ProfileModel/GetProfileModel.dart +++ b/lib/model/ProfileModel/GetProfileModel.dart @@ -30,18 +30,18 @@ class Data { int? principalTypeXid; int? principalSourceXid; String? userName; - Null? gender; + String? gender; String? dateOfBirth; String? phoneNumber; - Null? otherPhoneNumber; + String? otherPhoneNumber; String? emailAddress; - Null? addressLine1; - Null? addressLine2; + String? addressLine1; + String? addressLine2; String? city; - Null? postCode; + String? postCode; String? profilePhoto; - Null? referralCode; - Null? description; + String? referralCode; + String? description; int? whatsappUpdate; int? profileUpdated; int? riskProfileUpdated; @@ -50,6 +50,13 @@ class Data { String? playerId; int? notificationAlert; String? isActive; + bool? isSubscriptionTaken; + bool? isSubscriptionCancelled; + SubscriptionData? subscriptionData; + int? alertWhatsAppNotification; + int? alertInAppNotification; + int? alertPushAppNotification; + int? alertSmsAppNotification; Data( {this.id, @@ -75,7 +82,14 @@ class Data { this.securedAccess, this.playerId, this.notificationAlert, - this.isActive}); + this.isActive, + this.isSubscriptionTaken, + this.isSubscriptionCancelled, + this.subscriptionData, + this.alertWhatsAppNotification, + this.alertInAppNotification, + this.alertPushAppNotification, + this.alertSmsAppNotification}); Data.fromJson(Map json) { id = json['id']; @@ -102,6 +116,15 @@ class Data { playerId = json['player_id']; notificationAlert = json['notification_alert']; isActive = json['is_active']; + isSubscriptionTaken = json['is_subscription_taken']; + isSubscriptionCancelled = json['is_subscription_cancelled']; + subscriptionData = json['subscription_data'] != null + ? new SubscriptionData.fromJson(json['subscription_data']) + : null; + alertWhatsAppNotification = json['alert_whats_app_notification']; + alertInAppNotification = json['alert_in_app_notification']; + alertPushAppNotification = json['alert_push_app_notification']; + alertSmsAppNotification = json['alert_sms_app_notification']; } Map toJson() { @@ -130,6 +153,254 @@ class Data { data['player_id'] = this.playerId; data['notification_alert'] = this.notificationAlert; data['is_active'] = this.isActive; + data['is_subscription_taken'] = this.isSubscriptionTaken; + data['is_subscription_cancelled'] = this.isSubscriptionCancelled; + if (this.subscriptionData != null) { + data['subscription_data'] = this.subscriptionData!.toJson(); + } + data['alert_whats_app_notification'] = this.alertWhatsAppNotification; + data['alert_in_app_notification'] = this.alertInAppNotification; + data['alert_push_app_notification'] = this.alertPushAppNotification; + data['alert_sms_app_notification'] = this.alertSmsAppNotification; + return data; + } +} + +class SubscriptionData { + int? id; + int? iamPrincipalXid; + int? manageProductXid; + String? razorpayPlanId; + String? subscriptionId; + String? razorpayCustomerId; + String? status; + String? paymentMethod; + int? quantity; + String? chargeAt; + String? startAt; + String? endAt; + String? totalCount; + int? isCancelledSubscription; + String? cancelledAt; + String? expireBy; + String? shortUrl; + String? hasScheduledChanges; + int? isActive; + String? createdBy; + String? modifiedBy; + String? deletedAt; + String? createdAt; + String? updatedAt; + String? amount; + ProductData? productData; + + SubscriptionData( + {this.id, + this.iamPrincipalXid, + this.manageProductXid, + this.razorpayPlanId, + this.subscriptionId, + this.razorpayCustomerId, + this.status, + this.paymentMethod, + this.quantity, + this.chargeAt, + this.startAt, + this.endAt, + this.totalCount, + this.isCancelledSubscription, + this.cancelledAt, + this.expireBy, + this.shortUrl, + this.hasScheduledChanges, + this.isActive, + this.createdBy, + this.modifiedBy, + this.deletedAt, + this.createdAt, + this.updatedAt, + this.amount, + this.productData}); + + SubscriptionData.fromJson(Map json) { + id = json['id']; + iamPrincipalXid = json['iam_principal_xid']; + manageProductXid = json['manage_product_xid']; + razorpayPlanId = json['razorpay_plan_id']; + subscriptionId = json['subscription_id']; + razorpayCustomerId = json['razorpay_customer_id']; + status = json['status']; + paymentMethod = json['payment_method']; + quantity = json['quantity']; + chargeAt = json['charge_at']; + startAt = json['start_at']; + endAt = json['end_at']; + totalCount = json['total_count']; + isCancelledSubscription = json['isCancelledSubscription']; + cancelledAt = json['cancelled_at']; + expireBy = json['expire_by']; + shortUrl = json['short_url']; + hasScheduledChanges = json['has_scheduled_changes']; + isActive = json['is_active']; + createdBy = json['created_by']; + modifiedBy = json['modified_by']; + deletedAt = json['deleted_at']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + amount = json['amount']; + productData = json['product_data'] != null + ? new ProductData.fromJson(json['product_data']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['iam_principal_xid'] = this.iamPrincipalXid; + data['manage_product_xid'] = this.manageProductXid; + data['razorpay_plan_id'] = this.razorpayPlanId; + data['subscription_id'] = this.subscriptionId; + data['razorpay_customer_id'] = this.razorpayCustomerId; + data['status'] = this.status; + data['payment_method'] = this.paymentMethod; + data['quantity'] = this.quantity; + data['charge_at'] = this.chargeAt; + data['start_at'] = this.startAt; + data['end_at'] = this.endAt; + data['total_count'] = this.totalCount; + data['isCancelledSubscription'] = this.isCancelledSubscription; + data['cancelled_at'] = this.cancelledAt; + data['expire_by'] = this.expireBy; + data['short_url'] = this.shortUrl; + data['has_scheduled_changes'] = this.hasScheduledChanges; + data['is_active'] = this.isActive; + data['created_by'] = this.createdBy; + data['modified_by'] = this.modifiedBy; + data['deleted_at'] = this.deletedAt; + data['created_at'] = this.createdAt; + data['updated_at'] = this.updatedAt; + data['amount'] = this.amount; + if (this.productData != null) { + data['product_data'] = this.productData!.toJson(); + } + return data; + } +} + +class ProductData { + int? id; + String? razorpayPlanId; + int? productTypeXid; + int? productTierXid; + String? productName; + String? productDescription; + String? productPrice; + String? productImage; + String? template; + int? isActive; + String? createdBy; + String? modifiedBy; + String? deletedAt; + String? createdAt; + String? updatedAt; + ProductTier? productTier; + + ProductData( + {this.id, + this.razorpayPlanId, + this.productTypeXid, + this.productTierXid, + this.productName, + this.productDescription, + this.productPrice, + this.productImage, + this.template, + this.isActive, + this.createdBy, + this.modifiedBy, + this.deletedAt, + this.createdAt, + this.updatedAt, + this.productTier}); + + ProductData.fromJson(Map json) { + id = json['id']; + razorpayPlanId = json['razorpay_plan_id']; + productTypeXid = json['product_type_xid']; + productTierXid = json['product_tier_xid']; + productName = json['product_name']; + productDescription = json['product_description']; + productPrice = json['product_price']; + productImage = json['product_image']; + template = json['template']; + isActive = json['is_active']; + createdBy = json['created_by']; + modifiedBy = json['modified_by']; + deletedAt = json['deleted_at']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + productTier = json['product_tier'] != null + ? new ProductTier.fromJson(json['product_tier']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['razorpay_plan_id'] = this.razorpayPlanId; + data['product_type_xid'] = this.productTypeXid; + data['product_tier_xid'] = this.productTierXid; + data['product_name'] = this.productName; + data['product_description'] = this.productDescription; + data['product_price'] = this.productPrice; + data['product_image'] = this.productImage; + data['template'] = this.template; + data['is_active'] = this.isActive; + data['created_by'] = this.createdBy; + data['modified_by'] = this.modifiedBy; + data['deleted_at'] = this.deletedAt; + data['created_at'] = this.createdAt; + data['updated_at'] = this.updatedAt; + if (this.productTier != null) { + data['product_tier'] = this.productTier!.toJson(); + } + return data; + } +} + +class ProductTier { + int? id; + String? name; + int? isActive; + String? createdAt; + String? updatedAt; + String? deletedAt; + + ProductTier( + {this.id, + this.name, + this.isActive, + this.createdAt, + this.updatedAt, + this.deletedAt}); + + ProductTier.fromJson(Map json) { + id = json['id']; + name = json['name']; + isActive = json['is_active']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + deletedAt = json['deleted_at']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['is_active'] = this.isActive; + data['created_at'] = this.createdAt; + data['updated_at'] = this.updatedAt; + data['deleted_at'] = this.deletedAt; return data; } } diff --git a/lib/view/MainScreen/ShortTrade.dart b/lib/view/MainScreen/ShortTrade.dart index 0344a08..3940607 100644 --- a/lib/view/MainScreen/ShortTrade.dart +++ b/lib/view/MainScreen/ShortTrade.dart @@ -6,7 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:gap/gap.dart'; import 'package:get/get.dart'; -import 'package:glassmorphism/glassmorphism.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.dart'; import 'package:traderscircuit/Utils/Common/CommonTabBar.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart'; @@ -20,8 +20,10 @@ import 'package:traderscircuit/model/ProductsModel/call_recommendations_model.da import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; import 'package:traderscircuit/view/MainScreen/stockDetails/stock_details_screen.dart'; import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; +import 'package:traderscircuit/view/Sidemenu/webview_subscription.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; import 'package:traderscircuit/view_model/ProductsApi/products_api.dart'; +import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart'; class ShortTrade extends StatefulWidget { const ShortTrade({super.key}); @@ -259,71 +261,156 @@ class _ShortTradeState extends State { return Padding( padding: EdgeInsets.only(top: 20.h, bottom: 5.h), child: productsController.selectedIndex.value == 0 - ? cardSwingWidget( - instrumentName: callRecommendationsModel - .data!.activeCalls![index].instrumentKey!, - pdfLink: "", - image: callRecommendationsModel - .data!.activeCalls![index].stockImage!, - text: callRecommendationsModel - .data!.activeCalls![index].stockName!, - amount: '₹ 196.50 - ₹ 197', - targetamount: - '₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}', - stoploss: - '₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}', - time: - '${callRecommendationsModel.data!.activeCalls![index].duration}', - action: callRecommendationsModel - .data!.activeCalls![index].actionData!.name!, - ) - : productsController.selectedIndex.value == 1 - ? cardMultibaggerWidget( - instrumentName: callRecommendationsModel - .data!.activeCalls![index].instrumentKey!, - image: callRecommendationsModel - .data!.activeCalls![index].stockImage!, - action: callRecommendationsModel - .data!.activeCalls![index].actionData!.name!, - text: callRecommendationsModel - .data!.activeCalls![index].stockName!, - price: - "₹ ${callRecommendationsModel.data!.activeCalls![index].buyPrice}", - date: callRecommendationsModel - .data!.activeCalls![index].createdAt!, - returns: - "₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}", - stoploss: - "₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}", - duration: callRecommendationsModel - .data!.activeCalls![index].duration!, - pdfname: "Download Pdf", - pdfLink: callRecommendationsModel - .data!.activeCalls![index].docs!, - ) - : cardOptionWidget( + ? ProfileObj!.data!.subscriptionData!.productData! + .productName! == + "Swing Trade" + ? cardSwingWidget( instrumentName: callRecommendationsModel .data!.activeCalls![index].instrumentKey!, pdfLink: "", image: callRecommendationsModel .data!.activeCalls![index].stockImage!, - action: callRecommendationsModel - .data!.activeCalls![index].actionData!.name!, text: callRecommendationsModel .data!.activeCalls![index].stockName!, - optiontype: callRecommendationsModel.data! - .activeCalls![index].optionTypeData!.name!, - price: - "₹ ${callRecommendationsModel.data!.activeCalls![index].buyPrice}", - date: callRecommendationsModel - .data!.activeCalls![index].createdAt!, - premium: - "₹ ${callRecommendationsModel.data!.activeCalls![index].currentPrice}", - price1: - "₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}", + amount: '₹ 196.50 - ₹ 197', + targetamount: + '₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}', stoploss: - "₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}", - ), + '₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}', + time: + '${callRecommendationsModel.data!.activeCalls![index].duration}', + action: callRecommendationsModel + .data!.activeCalls![index].actionData!.name!, + ) + : Text("Please Subscribe to Swing traxde") + : productsController.selectedIndex.value == 1 + ? ProfileObj!.data!.subscriptionData!.productData! + .productName! == + "MultiBagger" + ? cardMultibaggerWidget( + instrumentName: callRecommendationsModel + .data!.activeCalls![index].instrumentKey!, + image: callRecommendationsModel + .data!.activeCalls![index].stockImage!, + action: callRecommendationsModel.data! + .activeCalls![index].actionData!.name!, + text: callRecommendationsModel + .data!.activeCalls![index].stockName!, + price: + "₹ ${callRecommendationsModel.data!.activeCalls![index].buyPrice}", + date: callRecommendationsModel + .data!.activeCalls![index].createdAt!, + returns: + "₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}", + stoploss: + "₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}", + duration: callRecommendationsModel + .data!.activeCalls![index].duration!, + pdfname: "Download Pdf", + pdfLink: callRecommendationsModel + .data!.activeCalls![index].docs!, + ) + : Center( + child: commonGlassContainer( + width: double.infinity, + height: 150, + borderradius: 2, + customWidget: Center( + child: Column( + children: [ + SizedBox( + height: 20, + ), + text18W500( + "Please Subscribe to Multibagger"), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: CommonBtn( + text: "Unlock Now", + onTap: () async { + SharedPreferences prefs = + await SharedPreferences + .getInstance(); + + Get.to(WebViewSubscription( + token: prefs + .getString('accessToken') + .toString())); + }, + ), + ) + ], + ), + ), + ), + ) + // Text("Please Subscribe to Multibagger") + : ProfileObj!.data!.subscriptionData!.productData! + .productName! == + "Options" + ? cardOptionWidget( + instrumentName: callRecommendationsModel + .data!.activeCalls![index].instrumentKey!, + pdfLink: "", + image: callRecommendationsModel + .data!.activeCalls![index].stockImage!, + action: callRecommendationsModel.data! + .activeCalls![index].actionData!.name!, + text: callRecommendationsModel + .data!.activeCalls![index].stockName!, + optiontype: callRecommendationsModel.data! + .activeCalls![index].optionTypeData!.name!, + price: + "₹ ${callRecommendationsModel.data!.activeCalls![index].buyPrice}", + date: callRecommendationsModel + .data!.activeCalls![index].createdAt!, + premium: + "₹ ${callRecommendationsModel.data!.activeCalls![index].currentPrice}", + price1: + "₹ ${callRecommendationsModel.data!.activeCalls![index].targetPrice}", + stoploss: + "₹ ${callRecommendationsModel.data!.activeCalls![index].stopLoss}", + ) + : Center( + child: commonGlassContainer( + width: double.infinity, + height: 150, + borderradius: 2, + customWidget: Center( + child: Column( + children: [ + SizedBox( + height: 20, + ), + text18W500( + "Please Subscribe to Options"), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: CommonBtn( + text: "Unlock Now", + onTap: () async { + SharedPreferences prefs = + await SharedPreferences + .getInstance(); + + Get.to(WebViewSubscription( + token: prefs + .getString('accessToken') + .toString())); + }, + ), + ) + ], + ), + ), + ), + ), ); }); } diff --git a/lib/view/Sidemenu/Settings.dart b/lib/view/Sidemenu/Settings.dart index d42fa5d..a993e8b 100644 --- a/lib/view/Sidemenu/Settings.dart +++ b/lib/view/Sidemenu/Settings.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -14,6 +16,8 @@ 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'; +import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart'; +import 'package:traderscircuit/view_model/SettingApi/setting_api.dart'; class Settings extends StatefulWidget { const Settings({super.key}); @@ -23,33 +27,103 @@ class Settings extends StatefulWidget { } class _SettingsState extends State { - bool isSwitched = false; - bool isSwitched1 = false; - bool isSwitched2 = false; - bool isSwitched3 = false; + late bool isSwitched = false; + late bool isSwitched1 = false; + late bool isSwitched2 = false; + late bool isSwitched3 = false; - void _toggleSwitch(bool value) { + @override + void initState() { + super.initState(); + isSwitched = ProfileObj!.data?.alertWhatsAppNotification == 1; + isSwitched1 = ProfileObj!.data?.alertInAppNotification == 1; + isSwitched2 = ProfileObj!.data?.alertPushAppNotification == 1; + isSwitched3 = ProfileObj!.data?.alertSmsAppNotification == 1; + } + + Future _verifycheck({ + required int alertWhatsAppNotification, + required int alertInAppNotification, + required int alertPushAppNotification, + required int alertSmsAppNotification, + }) async { + Map updata = { + "alert_whats_app_notification": alertWhatsAppNotification.toString(), + "alert_in_app_notification": alertInAppNotification.toString(), + "alert_push_app_notification": alertPushAppNotification.toString(), + "alert_sms_app_notification": alertSmsAppNotification.toString(), + }; + final resp = await SettingAPI(updata).verifysettingApi(); + if (resp.status == ResponseStatus.SUCCESS) { + log(resp.data.toString()); + } else if (resp.status == ResponseStatus.PRIVATE) { + 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.message; + Utils.showToast(message); + } + } + + void _toggleSwitch(bool value) async { setState(() { isSwitched = value; + ProfileObj?.data?.alertWhatsAppNotification = value ? 1 : 0; }); + await _verifycheck( + alertWhatsAppNotification: + ProfileObj?.data?.alertWhatsAppNotification ?? 0, + alertInAppNotification: ProfileObj?.data?.alertInAppNotification ?? 0, + alertPushAppNotification: ProfileObj?.data?.alertPushAppNotification ?? 0, + alertSmsAppNotification: ProfileObj?.data?.alertSmsAppNotification ?? 0, + ); } - void _toggleSwitch1(bool value1) { + void _toggleSwitch1(bool value1) async { setState(() { isSwitched1 = value1; + ProfileObj?.data?.alertInAppNotification = value1 ? 1 : 0; }); + await _verifycheck( + alertWhatsAppNotification: + ProfileObj?.data?.alertWhatsAppNotification ?? 0, + alertInAppNotification: ProfileObj?.data?.alertInAppNotification ?? 0, + alertPushAppNotification: ProfileObj?.data?.alertPushAppNotification ?? 0, + alertSmsAppNotification: ProfileObj?.data?.alertSmsAppNotification ?? 0, + ); } - void _toggleSwitch2(bool value2) { + void _toggleSwitch2(bool value2) async { setState(() { isSwitched2 = value2; + ProfileObj?.data?.alertPushAppNotification = value2 ? 1 : 0; }); + await _verifycheck( + alertWhatsAppNotification: + ProfileObj?.data?.alertWhatsAppNotification ?? 0, + alertInAppNotification: ProfileObj?.data?.alertInAppNotification ?? 0, + alertPushAppNotification: ProfileObj?.data?.alertPushAppNotification ?? 0, + alertSmsAppNotification: ProfileObj?.data?.alertSmsAppNotification ?? 0, + ); } - void _toggleSwitch3(bool value3) { + void _toggleSwitch3(bool value3) async { setState(() { isSwitched3 = value3; + ProfileObj?.data?.alertSmsAppNotification = value3 ? 1 : 0; }); + await _verifycheck( + alertWhatsAppNotification: + ProfileObj?.data?.alertWhatsAppNotification ?? 0, + alertInAppNotification: ProfileObj?.data?.alertInAppNotification ?? 0, + alertPushAppNotification: ProfileObj?.data?.alertPushAppNotification ?? 0, + alertSmsAppNotification: ProfileObj?.data?.alertSmsAppNotification ?? 0, + ); } @override diff --git a/lib/view/login/LoginScreen.dart b/lib/view/login/LoginScreen.dart index 5f7e158..7fbcc9f 100644 --- a/lib/view/login/LoginScreen.dart +++ b/lib/view/login/LoginScreen.dart @@ -8,17 +8,10 @@ import 'package:get/get.dart'; import 'package:glassmorphism/glassmorphism.dart'; import 'package:traderscircuit/Utils/Common/CustomTextFormField.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/login/VerifyOtp.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; -import 'package:traderscircuit/view_model/Login/send_otp_api.dart'; -import 'package:traderscircuit/Utils/Dialogs.dart'; -import 'package:traderscircuit/view_model/LoginPage/Loginbloc.dart'; - -import '../../view_model/LoginPage/Loginobserver.dart'; import '../../view_model/SendOtp/sendOtpObserver.dart'; import '../../view_model/SendOtp/sendOtpbloc.dart'; diff --git a/lib/view_model/SettingApi/setting_api.dart b/lib/view_model/SettingApi/setting_api.dart new file mode 100644 index 0000000..21f567c --- /dev/null +++ b/lib/view_model/SettingApi/setting_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 SettingAPI { + SettingAPI(this.data); + var data; + Future> verifysettingApi() async { + final response = await NetworkApiServices().postApi( + // optionalpar: true, + data, + ApiUrls.setting, + ); + + 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/pubspec.lock b/pubspec.lock index 34b7098..81ecb25 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -399,7 +399,7 @@ packages: source: hosted version: "8.1.5" flutter_branch_sdk: - dependency: transitive + dependency: "direct main" description: name: flutter_branch_sdk sha256: "3850097e5c70d89db235fb160e92eac5928f4206ab167b0d83c7e4e50b1357f8" @@ -728,6 +728,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.9" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: transitive description: @@ -796,26 +820,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: @@ -860,10 +884,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -1422,6 +1446,14 @@ packages: url: "https://github.com/kishan06/videoPlayerKB.git" source: git version: "0.0.2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" wakelock: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5886ad8..ce689b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: syncfusion_flutter_charts: ^21.2.4 flutter_inappwebview: ^6.0.0 + flutter_branch_sdk: ^7.1.0 dev_dependencies: