Merge pull request #45 from WDI-Ideas/hotfixes

access-token change
This commit is contained in:
Kishan Bhuta
2024-07-12 12:47:20 +05:30
committed by GitHub
7 changed files with 90 additions and 101 deletions

View File

@@ -8,9 +8,6 @@ class ApiUrls {
static const letUsUnderstandApi = "${baseUrl}update-business-profile-step-1";
static const resetpassword = "${baseUrl}reset-password";
static const registeration = "${baseUrl}send_otp";
static const verifyregisteration = "${baseUrl}verify_otp";
@@ -29,11 +26,7 @@ class ApiUrls {
static const postcommunities = "${baseUrl}select-communities";
static const googlelogin = "${baseUrl}sign-in-with-google-login";
static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type";
}

View File

@@ -149,9 +149,7 @@ class NetworkApiServices {
//New post api
@override
Future<ResponseData> postApi(data, String url,
{bool optionalpar = false}) async {
if (kDebugMode) {
@@ -175,11 +173,7 @@ class NetworkApiServices {
},
)
: Options(
headers: {
'authorization': basicAuth,
'access-token':
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3JlZ3JvdXAuYmV0YWRlbGl2ZXJ5LmNvbS9hcGkvdjEvdmVyaWZ5X290cCIsImlhdCI6MTcyMDYwNDQzNSwibmJmIjoxNzIwNjA0NDM1LCJqdGkiOiJIbG5qdFVqcnBXRldlMjBsIiwic3ViIjoiMzciLCJwcnYiOiI0MGJjM2ZkZTM0NjI1N2E4NTA5NTAyZmU2NDIzNTU5YTExMTY0YmQzIn0.rsaasWoorwiRMcJPO_oluIbfvw48h-P6tfEs8fCnzpM"
},
headers: {'authorization': basicAuth, 'access-token': token},
),
);
log(response.toString());
@@ -202,7 +196,6 @@ class NetworkApiServices {
);
}
if (e.response!.statusCode == 403) {
if (e.response!.data['message'] is List) {
return ResponseData<dynamic>(
e.response!.data['message'][0]!, ResponseStatus.FAILED,
@@ -212,7 +205,6 @@ class NetworkApiServices {
e.response!.data['message'], ResponseStatus.FAILED,
data: e.response!.data);
}
}
}
return ResponseData<dynamic>(
@@ -247,7 +239,7 @@ class NetworkApiServices {
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
// ignore: unused_local_variable
String? token = prefs.getString('token').toString();
String? token = prefs.getString('access-token').toString();
try {
response = await dio.post(url,
data: data,
@@ -369,7 +361,7 @@ class NetworkApiServices {
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
// String? token = prefs.getString('token');
String? token = prefs.getString('token').toString();
String? token = prefs.getString('access-token').toString();
print("token is $token");
try {
response = await dio.post(url,

View File

@@ -50,7 +50,7 @@ class _LoginScreenState extends State<LoginScreen> {
{"google_access_token": value, "one_signal_player_id": "ABCD"});
if (resp.message == "go-to-signin-via-oauth") {
// Get.to(()=> );
Get.toNamed(RouteName.verifygoogleapplepage);
logger.d("go to sign in");
} else {
Get.snackbar(
@@ -155,7 +155,6 @@ class _LoginScreenState extends State<LoginScreen> {
};
final data = await LoginAPI().loginApi(updata);
if (data.status == ResponseStatus.SUCCESS) {
// await global.setname();
Get.snackbar(
"Success!",
@@ -402,7 +401,8 @@ class _LoginScreenState extends State<LoginScreen> {
GestureDetector(
onTap: () {
_loginWithApple();
Get.toNamed(RouteName.verifygoogleapplepage);
Get.toNamed(
RouteName.verifygoogleapplepage);
},
child: Container(
width: 55,
@@ -412,10 +412,10 @@ class _LoginScreenState extends State<LoginScreen> {
begin: const Alignment(0.71, -0.70),
end: const Alignment(-0.71, 0.7),
colors: [
Colors.white
.withOpacity(0.07999999821186066),
Colors.white
.withOpacity(0.12999999523162842)
Colors.white.withOpacity(
0.07999999821186066),
Colors.white.withOpacity(
0.12999999523162842)
],
),
shape: const OvalBorder(
@@ -432,7 +432,6 @@ class _LoginScreenState extends State<LoginScreen> {
GestureDetector(
onTap: () {
_loginWithGoogle();
Get.toNamed(RouteName.verifygoogleapplepage);
},
child: Container(
width: 55,
@@ -442,10 +441,10 @@ class _LoginScreenState extends State<LoginScreen> {
begin: const Alignment(0.71, -0.70),
end: const Alignment(-0.71, 0.7),
colors: [
Colors.white
.withOpacity(0.07999999821186066),
Colors.white
.withOpacity(0.12999999523162842)
Colors.white.withOpacity(
0.07999999821186066),
Colors.white.withOpacity(
0.12999999523162842)
],
),
shape: const OvalBorder(

View File

@@ -35,20 +35,22 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
});
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: Scaffold(
appBar: CommonAppbar(
appBar: const CommonAppbar(
titleTxt: '',
),
backgroundColor: Color.fromARGB(255, 18, 32, 47),
backgroundColor: const Color.fromARGB(255, 18, 32, 47),
body: Stack(
children: [
Positioned(top: 310, right: -30, child: CommonBlurRightSecond()),
Positioned(top: 510, left: -30, child: CommonBlurLeftBlue()),
const Positioned(
top: 310, right: -30, child: CommonBlurRightSecond()),
const Positioned(top: 510, left: -30, child: CommonBlurLeftBlue()),
GlassmorphicContainer(
width: MediaQuery.of(context).size.width,
height:
@@ -62,10 +64,10 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0XFF222935).withOpacity(0.60),
Color(0XFF222935).withOpacity(0.60),
Color(0XFF222935).withOpacity(0.60),
Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
@@ -79,9 +81,9 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
colors: [
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
Color(0XFF222935).withOpacity(0.60),
const Color(0XFF222935).withOpacity(0.60),
],
),
child: Padding(
@@ -94,7 +96,7 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
sizedBoxHeight(10.h),
Container(
width: 154,
decoration: ShapeDecoration(
decoration: const ShapeDecoration(
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1,
@@ -152,7 +154,7 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
CustomDropDownRadio(
header: '',
title: '',
listData: [
listData: const [
'Individual',
'Business',
],
@@ -161,7 +163,7 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
'assets/images/png/user.png',
),
),
Spacer(
const Spacer(
flex: 3,
),
CustomButton(
@@ -176,10 +178,7 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
// Uploadata();
}
}),
Spacer(
)
const Spacer()
],
),
),

View File

@@ -7,22 +7,15 @@ import 'package:shared_preferences/shared_preferences.dart';
class LoginAPI {
Future<ResponseData> loginApi(var data) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final response = await NetworkApiServices().postApi(data,
ApiUrls.getlogin,
// 'https://regroup.betadelivery.com/api/v1/login',
optionalpar: true
// "auth/login/",
);
final response = await NetworkApiServices()
.postApi(data, ApiUrls.getlogin, optionalpar: true);
if (response.status == ResponseStatus.SUCCESS) {
//Map<String, dynamic> responseData = jsonDecode(response.data);
if (response.data['status'] == 'success') {
LoginModel loginObj = LoginModel.fromJson(response.data);
await prefs.setString('access-token', loginObj.data!.accessToken!);
// await prefs.setString('refreshToken', loginObj.data!.refresh!);
print("token is ${loginObj.data!.accessToken!}");
// print("refresh-token is ${loginObj.data!.refresh!}");
} else {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.FAILED);
@@ -48,4 +41,14 @@ class LoginAPI {
return response;
}
Future<ResponseData> storeUserDetailsWhenComingFromGoogleAppleSignin(
var data) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final response = await NetworkApiServices()
.postApi(data, ApiUrls.storeDetailsOfOAuth, optionalpar: true);
if (response.status == ResponseStatus.SUCCESS) {}
return response;
}
}

View File

@@ -48,7 +48,7 @@ class _CustomDropDownWidgetSignupState
padding: EdgeInsets.only(
top: 14.0, bottom: 14.0, right: 22.w, left: 12.w),
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: onDropTap.value
? BorderRadius.vertical(
top: Radius.circular(30.r),
@@ -98,7 +98,7 @@ class _CustomDropDownWidgetSignupState
Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30.r),
),
@@ -139,7 +139,7 @@ class _CustomDropDownWidgetSignupState
),
// sizedBoxHeight(5.h),
if (index != widget.listData.length - 1)
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
],
),
);
@@ -216,7 +216,7 @@ class _CustomDropDownTag1State extends State<CustomDropDownTag1> {
left: 12.w,
),
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
@@ -278,7 +278,7 @@ class _CustomDropDownTag1State extends State<CustomDropDownTag1> {
Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30.r),
),
@@ -320,14 +320,14 @@ class _CustomDropDownTag1State extends State<CustomDropDownTag1> {
fontWeight: FontWeight.w400,
fontFamily: 'Helvetica'),
),
Spacer(),
const Spacer(),
text14400whiteblur(widget.rowData[widget.listData
.indexOf(filteredListData[index])]),
],
),
),
if (index != filteredListData.length - 1)
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
],
),
);
@@ -383,7 +383,7 @@ class _CustomDropDownTagState extends State<CustomDropDownTag> {
padding: EdgeInsets.only(
top: 14.0, bottom: 14.0, right: 22.w, left: 12.w),
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: onDropTap.value
? BorderRadius.vertical(
top: Radius.circular(30.r),
@@ -433,7 +433,7 @@ class _CustomDropDownTagState extends State<CustomDropDownTag> {
Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30.r),
),
@@ -473,14 +473,14 @@ class _CustomDropDownTagState extends State<CustomDropDownTag> {
fontWeight: FontWeight.w400,
fontFamily: 'Helvetica'),
),
Spacer(),
const Spacer(),
text14400whiteblur(widget.rowData[index]),
],
),
),
// sizedBoxHeight(5.h),
if (index != widget.listData.length - 1)
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
],
),
);
@@ -551,10 +551,10 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
},
);
}),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
item,
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Helvetica',
@@ -566,7 +566,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
),
// SizedBox(height: 5.h),
if (index != widget.listData.length - 1)
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
],
),
),
@@ -579,7 +579,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
value: _textController.text,
child: Column(
children: [
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
Row(
children: [
Obx(() {
@@ -594,8 +594,8 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
},
);
}),
SizedBox(width: 8),
Text(
const SizedBox(width: 8),
const Text(
"Other: ",
style: TextStyle(
color: Colors.white,
@@ -608,13 +608,13 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
Expanded(
child: TextField(
controller: _textController,
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: '',
hintStyle: TextStyle(color: Colors.white70),
border: UnderlineInputBorder(),
@@ -628,7 +628,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
widget.onItemSelected(_textController.text);
}
},
child: Text(
child: const Text(
'OK',
style: TextStyle(
color: Colors.white,
@@ -666,7 +666,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
padding: EdgeInsets.only(
top: 14.0, bottom: 14.0, right: 22.w, left: 12.w),
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: onDropTap.value
? BorderRadius.vertical(
top: Radius.circular(30.r),
@@ -715,7 +715,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
width: double.infinity,
//height: widget.listData.length > 4 ? 250.h : null,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30.r),
),
@@ -784,7 +784,7 @@ class _CustomDropDownCheckBoxState extends State<CustomDropDownCheckBox> {
padding: EdgeInsets.only(
top: 14.0, bottom: 14.0, right: 22.w, left: 12.w),
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius: onDropTap.value
? BorderRadius.vertical(top: Radius.circular(30.r))
: BorderRadius.circular(30.r),
@@ -834,7 +834,7 @@ class _CustomDropDownCheckBoxState extends State<CustomDropDownCheckBox> {
Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF).withOpacity(0.10),
color: const Color(0xFFFFFFFF).withOpacity(0.10),
borderRadius:
BorderRadius.vertical(bottom: Radius.circular(30.r)),
border: Border.all(color: const Color(0xFF434A53)),
@@ -895,9 +895,10 @@ class _CustomDropDownCheckBoxState extends State<CustomDropDownCheckBox> {
),
),
Checkbox(
side: BorderSide(color: Color(0xFF434A53)),
side:
const BorderSide(color: Color(0xFF434A53)),
value: selectedValues.contains(item),
activeColor: Color(0xFF434A53),
activeColor: const Color(0xFF434A53),
checkColor: Colors.white,
onChanged: (bool? value) {
if (value == true) {
@@ -913,7 +914,7 @@ class _CustomDropDownCheckBoxState extends State<CustomDropDownCheckBox> {
),
),
if (index != widget.listData.length - 1)
Divider(thickness: 1, color: const Color(0xFF434A53)),
const Divider(thickness: 1, color: Color(0xFF434A53)),
],
),
);

View File

@@ -6,8 +6,6 @@ import 'package:regroup/Common/controller/data/network/network_api.dart';
import 'package:regroup/Global.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Onboard {
Onboard();
@@ -29,7 +27,7 @@ class Onboard {
final SharedPreferences prefs = await SharedPreferences.getInstance();
Map<String, dynamic> res = response.data;
print("res is $res");
await prefs.setString('token', res['data']['token']);
await prefs.setString('access-token', res['data']['token']);
await prefs.setString('email', res['data']['email']);
await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']);
@@ -54,32 +52,36 @@ class Onboard {
return response;
}
Future<ResponseData<dynamic>> PostIndividualActivity(updata) async {
Future<ResponseData<dynamic>> PostIndividualActivity(updata) async {
print("updata is $updata");
final response = await NetworkApiServices()
.postApi(updata, ApiUrls.postindividualactivity,);
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postindividualactivity,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postGroups(updata) async {
Future<ResponseData<dynamic>> postGroups(updata) async {
print("updata is $updata");
final response = await NetworkApiServices()
.postApi(updata, ApiUrls.postgroups,);
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postgroups,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postCommunities(updata) async {
Future<ResponseData<dynamic>> postCommunities(updata) async {
print("updata is $updata");
final response = await NetworkApiServices()
.postApi(updata, ApiUrls.postcommunities,);
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postcommunities,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
}