session expiry resolved,adding auth ,logout

This commit is contained in:
snehalathad@aissel.com 2024-12-19 11:03:08 +05:30
parent 7ddfe47058
commit 5185b13694
8 changed files with 276 additions and 256 deletions

View File

@ -3,68 +3,68 @@
"api": "loadFutureEvents", "api": "loadFutureEvents",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "saveUserInterestedEvent", "api": "saveUserInterestedEvent",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "saveUserAttendingEvent", "api": "saveUserAttendingEvent",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "eventOverview", "api": "eventOverview",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "getSpecialitiesDonutChart", "api": "getSpecialitiesDonutChart",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "getTopicCloudChart", "api": "getTopicCloudChart",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "getTopAffiliationBarChart", "api": "getTopAffiliationBarChart",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "eventSpeakers", "api": "eventSpeakers",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "saveEventsTopicNote", "api": "saveEventsTopicNote",
"interval": 5, "interval": 5,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "eventUserAnalytics", "api": "eventUserAnalytics",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "saveEventOffline", "api": "saveEventOffline",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "apis/v1/events"
}, },
{ {
"api": "contactslistapi", "api": "contactslistapi",

View File

@ -202,19 +202,7 @@ Future main() async {
print("checkhere before:$isloggedIn"); print("checkhere before:$isloggedIn");
String secretkey = instance.getString('secretkey') ?? ""; String secretkey = instance.getString('secretkey') ?? "";
OverlaySupportEntry entry;
Connectivity().onConnectivityChanged.listen((event) {
print("CHECK INTERNET");
print(event);
if (event.toString().contains("ConnectivityResult.none")) {
entry = showOverlayNotification((context) {
return Text("this is a message from simple notification");
}, duration: Duration(hours: 1));
}
});
OverlaySupport overlaySupport = OverlaySupport.global(
child: Text("ONLINE"),
);
runApp( runApp(
MultiProvider( MultiProvider(
providers: [ providers: [
@ -260,41 +248,39 @@ Future main() async {
create: (_) => HiveDataRepository( create: (_) => HiveDataRepository(
Hive.box<InteractionConfigData>('InteractionConfigDataBox'))), Hive.box<InteractionConfigData>('InteractionConfigDataBox'))),
], ],
child: child: SafeArea(
// SafeArea( top: true,
// top: true, child: MaterialApp(
// child: theme: ThemeData(
MaterialApp( //fontFamily: "SourceSerif",
theme: ThemeData( ),
//fontFamily: "SourceSerif", debugShowCheckedModeBanner: false,
), title: 'Dynamic Links Example',
debugShowCheckedModeBanner: false, initialRoute: '/',
title: 'Dynamic Links Example', routes: <String, WidgetBuilder>{
initialRoute: '/', '/': (BuildContext context) => FutureBuilder<bool>(
routes: <String, WidgetBuilder>{ future: SessionManager().isLoggedIn(),
'/': (BuildContext context) => FutureBuilder<bool>( builder: (context, snapshot) {
future: SessionManager().isLoggedIn(), print("Data_is : $snapshot");
builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) {
print("Data_is : $snapshot"); return const CircularProgressIndicator();
if (snapshot.connectionState == ConnectionState.waiting) { } else if (snapshot.hasError) {
return const CircularProgressIndicator(); return Text('Error: ${snapshot.error}');
} else if (snapshot.hasError) { } else {
return Text('Error: ${snapshot.error}'); final isLoggedIn = snapshot.data ?? false;
} else { print("isLoggedIn_is : $isLoggedIn");
final isLoggedIn = snapshot.data ?? false; print("secret : $secretkey");
print("isLoggedIn_is : $isLoggedIn"); return isLoggedIn
print("secret : $secretkey"); ? NavigationHomeScreen()
return isLoggedIn : IntroductionAnimationScreen();
? NavigationHomeScreen() }
: IntroductionAnimationScreen(); },
} ), //userInfo != null ? const Home() : OpenidScreen(credential: credential,),
}, // '/details': (BuildContext context) => const HomeScreen(),
), //userInfo != null ? const Home() : OpenidScreen(credential: credential,), },
// '/details': (BuildContext context) => const HomeScreen(), ),
},
), ),
), ),
// ),
); );
}); });
} }

View File

@ -33,9 +33,18 @@ class ApiCall {
final dio = Dio(); final dio = Dio();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance(); final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
late Future<String> _token; String token = "";
String newtoken = ApiCall() {
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZWNyZXRlVG9rZW4iOiJiYjNmOTZmYmI5Y2U3ZjA2ZTliOTlkMzRiMGM3YjZkZTBlNjBmYWYzYmM1NDFhZjY0MGQ5ZjAzMGRlNzMxOWM4ZTAwZWNkMCIsImlhdCI6MTczNDM0OTUwNywiZXhwIjoxNzM0MzUxMzA3fQ.nN5XtgmWHVGGdyLEdICY6jTmlg1070rGFwsdyOd4CYY"; init();
print("constructor");
}
init() async {
token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
}
//K1 API CALLS //K1 API CALLS
Future<dynamic> parseInfo() async { Future<dynamic> parseInfo() async {
Dio dio = Dio(); Dio dio = Dio();
@ -118,41 +127,42 @@ class ApiCall {
Future<List<EventsList>> getEventsFromK1({int? type}) async { Future<List<EventsList>> getEventsFromK1({int? type}) async {
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = // (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) { // (HttpClient client) {
client.badCertificateCallback = // client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true; // (X509Certificate cert, String host, int port) => true;
return client; // return client;
}; // };
Response response; Response response;
String date = "2024-12-17"; String date = "2024-12-12";
var formData = var formData = FormData.fromMap({
FormData.fromMap({"start": date, "order_by": 7, 'type': type ?? 1}); "start": "2024-12-16",
// "end": DateTime(2024, 12, 14).toIso8601String(), "order_by": 7,
_token = _prefs.then((SharedPreferences prefs) { 'type': type ?? 1,
return prefs.getString('token') ?? "";
}); });
print("SAVED TOKEN :${await _token}"); // "end": DateTime(2024, 12, 14).toIso8601String(),
print("SAVED TOKEN :${token}");
//http://192.168.2.130/konectar-staging/apiauths/logout/
try { try {
// dio.options.contentType = Headers.multipartFormDataContentType;
// dio.options.baseUrl = "https://cardio-staging.konectar.io/";
// dio.options.headers["Authorization"] = "Bearer ${newtoken}";
response = await dio.post( response = await dio.post(
'https://cardio-staging.konectar.io/apis/v1/events/loadFutureEvents/', '${EventsConstants.url}${EventsConstants.eventslistapi}',
options: Options( options: Options(
contentType: "multipart/form-data", followRedirects: true,
followRedirects: false,
// will not throw errors
validateStatus: (status) => true, validateStatus: (status) => true,
preserveHeaderCase: true,
headers: { headers: {
'Authorization': 'Bearer ${newtoken}', 'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}), }),
data: formData); data: formData);
print("RESPONSE"); print("RESPONSE ${dio.options.headers}");
print(response.data.toString()); print(response);
Map<String, dynamic> jsondata = json.decode(response.data); Map<String, dynamic> jsondata = json.decode(response.data);
EventsData eventresponse = EventsData.fromJson(jsondata); EventsData eventresponse = EventsData.fromJson(jsondata);
@ -174,13 +184,24 @@ class ApiCall {
return client; return client;
}; };
Response response; Response response;
var formData = FormData.fromMap( String token = await _prefs.then((SharedPreferences prefs) {
{"user_email": "vinodh@aissel.com", "eid": eventid, "flag": flag}); return prefs.getString('token') ?? "";
});
var formData = FormData.fromMap({"eid": eventid, "flag": flag});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.followUnfollowEvent}', '${EventsConstants.url}${EventsConstants.followUnfollowEvent}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
queryParameters: { queryParameters: {
"user_email": "vinodh@aissel.com",
"eid": eventid, "eid": eventid,
"flag": flag, "flag": flag,
}, },
@ -199,14 +220,25 @@ class ApiCall {
(X509Certificate cert, String host, int port) => true; (X509Certificate cert, String host, int port) => true;
return client; return client;
}; };
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
Response response; Response response;
var formData = FormData.fromMap( var formData = FormData.fromMap({"eid": eventid, "flag": flag});
{"user_email": "vinodh@aissel.com", "eid": eventid, "flag": flag});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.attendNotAttendEvent}', '${EventsConstants.url}${EventsConstants.attendNotAttendEvent}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
queryParameters: { queryParameters: {
"user_email": "vinodh@aissel.com",
"eid": eventid, "eid": eventid,
"flag": flag, "flag": flag,
}, },
@ -223,6 +255,9 @@ class ApiCall {
required String endDate, required String endDate,
required bool client, required bool client,
}) async { }) async {
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
print( print(
"FORMAT_CHECK_DATE $startDate $endDate $eventid ${DateTime(2024, 12, 03).toIso8601String()}"); "FORMAT_CHECK_DATE $startDate $endDate $eventid ${DateTime(2024, 12, 03).toIso8601String()}");
Dio dio = Dio(); Dio dio = Dio();
@ -237,7 +272,6 @@ class ApiCall {
var formData; var formData;
if (client) { if (client) {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -246,7 +280,6 @@ class ApiCall {
}); });
} else { } else {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -256,7 +289,17 @@ class ApiCall {
print("FORMDATA:${formData.toString()},$startDate,$endDate"); print("FORMDATA:${formData.toString()},$startDate,$endDate");
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.specialtyOfSpeakers}', '${EventsConstants.url}${EventsConstants.specialtyOfSpeakers}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData); data: formData);
print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! ");
@ -276,6 +319,9 @@ class ApiCall {
required String startDate, required String startDate,
required String endDate, required String endDate,
required bool client}) async { required bool client}) async {
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) { (HttpClient client) {
@ -287,7 +333,6 @@ class ApiCall {
var formData; var formData;
if (client) { if (client) {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -296,7 +341,6 @@ class ApiCall {
}); });
} else { } else {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -306,7 +350,17 @@ class ApiCall {
print("FORMDATA:${formData.toString()},$startDate,$endDate"); print("FORMDATA:${formData.toString()},$startDate,$endDate");
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.insightsTopicsCloud}', '${EventsConstants.url}${EventsConstants.insightsTopicsCloud}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData); data: formData);
print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! ");
@ -328,6 +382,9 @@ class ApiCall {
required String startDate, required String startDate,
required String endDate, required String endDate,
required bool client}) async { required bool client}) async {
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) { (HttpClient client) {
@ -339,7 +396,6 @@ class ApiCall {
var formData; var formData;
if (client) { if (client) {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -348,7 +404,6 @@ class ApiCall {
}); });
} else { } else {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"eventId": eventid, "eventId": eventid,
"sd": startDate, "sd": startDate,
"ed": endDate, "ed": endDate,
@ -358,7 +413,17 @@ class ApiCall {
print("FORMDATA:${formData.toString()},$startDate,$endDate"); print("FORMDATA:${formData.toString()},$startDate,$endDate");
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.insightsBarChart}', '${EventsConstants.url}${EventsConstants.insightsBarChart}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData); data: formData);
print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! ");
@ -385,14 +450,25 @@ class ApiCall {
}; };
Response response; Response response;
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
}); });
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.eventdetailsapi}', '${EventsConstants.url}${EventsConstants.eventdetailsapi}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
queryParameters: { queryParameters: {
"user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
}, },
data: formData); data: formData);
@ -416,17 +492,28 @@ class ApiCall {
}; };
Response response; Response response;
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
"project_id": 1, "project_id": 1,
}); });
// "sd": "2024-07-30", // "sd": "2024-07-30",
// "ed": "2024-08-03", // "ed": "2024-08-03",
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.speakerslistapi}', '${EventsConstants.url}${EventsConstants.speakerslistapi}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
queryParameters: { queryParameters: {
"user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
}, },
data: formData); data: formData);
@ -451,15 +538,27 @@ class ApiCall {
Response response; Response response;
print("formdata : eventid:$eventid kolid:$kolid kid:$kid"); print("formdata : eventid:$eventid kolid:$kolid kid:$kid");
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
"kol_id": kolid, "kol_id": kolid,
"k_id": kid, "k_id": kid,
}); });
// "proj_kol_id": 0, // "proj_kol_id": 0,
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.showEventsTopicsAndSession}', '${EventsConstants.url}${EventsConstants.showEventsTopicsAndSession}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
queryParameters: { queryParameters: {
"user_email": "vinodh@aissel.com", "user_email": "vinodh@aissel.com",
"event_id": eventid, "event_id": eventid,
@ -493,10 +592,12 @@ class ApiCall {
return client; return client;
}; };
var formData; var formData;
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
Response response; Response response;
if (filename != "") { if (filename != "") {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"kol_events_id": eventid, "kol_events_id": eventid,
"kol_id": kolid, "kol_id": kolid,
"event_attendees_id": event_attendees_id, "event_attendees_id": event_attendees_id,
@ -506,7 +607,6 @@ class ApiCall {
}); });
} else { } else {
formData = FormData.fromMap({ formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"kol_events_id": eventid, "kol_events_id": eventid,
"kol_id": kolid, "kol_id": kolid,
"event_attendees_id": event_attendees_id, "event_attendees_id": event_attendees_id,
@ -518,7 +618,17 @@ class ApiCall {
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.saveEventsTopicNote}', '${EventsConstants.url}${EventsConstants.saveEventsTopicNote}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData); data: formData);
print("response user ADDSESSION here!!!!!!!!!!!!!!!!!!!!! "); print("response user ADDSESSION here!!!!!!!!!!!!!!!!!!!!! ");
print(response.data.toString()); print(response.data.toString());
@ -540,15 +650,26 @@ class ApiCall {
return client; return client;
}; };
Response response; Response response;
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"kol_events_id": eventid, "kol_events_id": eventid,
}); });
// "proj_kol_id": 0, // "proj_kol_id": 0,
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.eventUserAnalytics}', '${EventsConstants.url}${EventsConstants.eventUserAnalytics}',
options: Options(), options: Options(
followRedirects: true,
validateStatus: (status) => true,
preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData); data: formData);
print("response user ALLSESSIONNOTES here!!!!!!!!!!!!!!!!!!!!! "); print("response user ALLSESSIONNOTES here!!!!!!!!!!!!!!!!!!!!! ");
List<AllSessionNotesResponse> data = []; List<AllSessionNotesResponse> data = [];
@ -568,7 +689,9 @@ class ApiCall {
dynamic jsonResult = dynamic jsonResult =
jsonDecode(await rootBundle.loadString("assets/api_constants.json")); jsonDecode(await rootBundle.loadString("assets/api_constants.json"));
//dynamic jsonResult = await MockApiCall().getConfigDataMedical(); //dynamic jsonResult = await MockApiCall().getConfigDataMedical();
String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
List<ApiConstantsResponse> responseData = List<ApiConstantsResponse> responseData =
apiConstantsResponseFromJson(jsonResult); apiConstantsResponseFromJson(jsonResult);
print('Response_data_is: $responseData'); print('Response_data_is: $responseData');
@ -611,7 +734,9 @@ class ApiCall {
}); });
try { try {
response = await dio.post( response = await dio.post(
'${url}${EventsConstants.loginmodule}/${EventsConstants.getVerificationCode}', 'http://192.168.2.130/konectar-staging/apiauths/getVerificationCode/',
//'https://cardio-staging.konectar.io/apiauths/getVerificationCode/',
//'${url}${EventsConstants.loginmodule}/${EventsConstants.getVerificationCode}',
options: Options(), options: Options(),
data: formData); data: formData);
if (response.statusCode == 200) { if (response.statusCode == 200) {
@ -645,8 +770,11 @@ class ApiCall {
"verification_code": code, "verification_code": code,
"email_id": email, "email_id": email,
}); });
print("LOGIN : API http://192.168.2.130/konectar-staging/apiauths/login");
response = await dio.post( response = await dio.post(
'${EventsConstants.loginUrl}${EventsConstants.login}', //'http://192.168.2.130/konectar-staging/apiauths/login',
'http://192.168.2.130/konectar-staging/apiauths/login/',
// '${EventsConstants.loginUrl}${EventsConstants.login}',
options: Options(), options: Options(),
data: formData); data: formData);
if (response.statusCode == 200) { if (response.statusCode == 200) {
@ -671,7 +799,7 @@ class ApiCall {
return client; return client;
}; };
print("email : $email,device : $deviceid"); print("email : $email,device : $deviceid");
_token = _prefs.then((SharedPreferences prefs) { String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; return prefs.getString('token') ?? "";
}); });
Response response; Response response;
@ -681,13 +809,19 @@ class ApiCall {
"device_id": deviceid, "device_id": deviceid,
}); });
response = await dio.post( response = await dio.post(
'${EventsConstants.loginUrl}${EventsConstants.logout}', 'http://192.168.2.130/konectar-staging/apiauths/logout/',
// '${EventsConstants.loginUrl}${EventsConstants.logout}',
options: Options( options: Options(
contentType: "application/x-www-form-urlencoded", followRedirects: true,
followRedirects: false,
// will not throw errors
validateStatus: (status) => true, validateStatus: (status) => true,
headers: {"Authorization": "Bearer $_token"}), preserveHeaderCase: true,
headers: {
'Authorization': 'Bearer $token',
"Content-Type":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*',
"Accept":
'application/json, application/x-www-form-urlencoded, multipart/form-data, */*'
}),
data: formData, data: formData,
// queryParameters: { // queryParameters: {
// "token": token, // "token": token,

View File

@ -26,10 +26,10 @@ class EventsConstants {
static const String stagingUrl = static const String stagingUrl =
"https://cardio-staging.konectar.io/$moduleName/"; "https://cardio-staging.konectar.io/$moduleName/";
static const String url = stagingUrl; static const String url = devUrl;
static const String devUrl = static const String devUrl =
"http://192.168.2.130/konectar-sandbox/$moduleName/"; "http://192.168.2.130/konectar-staging/$moduleName/";
static const String loginUrl = static const String loginUrl =
"https://cardio-staging.konectar.io/$loginmodule/"; "https://cardio-staging.konectar.io/$loginmodule/";

View File

@ -183,6 +183,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
} }
init() async { init() async {
await ApiCall().fetchApiConstants();
await Provider.of<EventsProvider>(context, listen: false) await Provider.of<EventsProvider>(context, listen: false)
.initConfigModules(); .initConfigModules();
// await Provider.of<EventsProvider>(context, listen: false).initFiltersData(); // await Provider.of<EventsProvider>(context, listen: false).initFiltersData();

View File

@ -94,7 +94,7 @@ class _LoginScreenState extends State<LoginScreen> {
if (!mounted) return; if (!mounted) return;
deviceId = _deviceId; deviceId = "device123456789hhuuww";
print("DEVICE ID########################## :$deviceId"); print("DEVICE ID########################## :$deviceId");
} }
@ -140,50 +140,8 @@ class _LoginScreenState extends State<LoginScreen> {
List<Widget> _buildBody(Orientation orientation, LoginProvider provider) { List<Widget> _buildBody(Orientation orientation, LoginProvider provider) {
return [ return [
// Expanded(
// flex: 1,
// child: Container(
// width: orientation == Orientation.portrait
// ? double.infinity
// : MediaQuery.of(context).size.height * 0.45,
// decoration: const BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// colors: [
// Color.fromARGB(255, 8, 39, 92),
// Color.fromARGB(255, 11, 60, 144),
// Color.fromARGB(255, 26, 64, 129),
// ],
// )),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// // SizedBox(
// // width: isTablet ? 160 : 80,
// // height: isTablet ? 160 : 80,
// // child: CircleAvatar(
// // backgroundColor: const Color.fromARGB(255, 126, 134, 147),
// // child: Icon(
// // Icons.person,
// // size: isTablet ? 120 : 60,
// // ),
// // ),
// // ),
// // const SizedBox(
// // height: 20,
// // ),
// Text(
// 'Welcome, you are almost there!',
// style: TextStyle(
// fontSize: isTablet ? 22 : 18, color: Colors.white),
// )
// ],
// ),
// ),
// ),
SizedBox( SizedBox(
height: 10, height: 40,
), ),
SvgPicture.asset( SvgPicture.asset(
"assets/images/konectar_logo.svg", "assets/images/konectar_logo.svg",
@ -193,29 +151,9 @@ class _LoginScreenState extends State<LoginScreen> {
flex: 2, flex: 2,
child: Center( child: Center(
child: Container( child: Container(
// decoration: const BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// colors: [
// Color.fromARGB(255, 126, 134, 147),
// Color.fromARGB(255, 193, 198, 209),
// Color.fromARGB(255, 214, 217, 223),
// ],
// )),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 30, horizontal: 30,
vertical: orientation == Orientation.portrait ? 20 : 0), vertical: orientation == Orientation.portrait ? 20 : 0),
// decoration: const BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// colors: [
// Color.fromARGB(255, 126, 134, 147),
// Color.fromARGB(255, 193, 198, 209),
// Color.fromARGB(255, 214, 217, 223),
// ],
// )),
child: _buildform(provider), child: _buildform(provider),
), ),
), ),
@ -287,8 +225,8 @@ class _LoginScreenState extends State<LoginScreen> {
labelStyle: TextStyle(fontSize: isTablet ? 18.0 : 16), labelStyle: TextStyle(fontSize: isTablet ? 18.0 : 16),
labelText: "Domain", labelText: "Domain",
hintStyle: TextStyle(fontSize: isTablet ? 18.0 : 16), hintStyle: TextStyle(fontSize: isTablet ? 18.0 : 16),
prefix: Text("https://"), prefix: Text("https:// "),
suffix: Text(".io/"), suffix: Text(" .konectar.io/"),
hintText: "Enter your Domain"), hintText: "Enter your Domain"),
), ),
), ),
@ -331,35 +269,13 @@ class _LoginScreenState extends State<LoginScreen> {
provider.loading = true; provider.loading = true;
}); });
print("email:${emailTextController.text}"); print("email:${emailTextController.text}");
// if (await _logout) {
// print("LOGOUT");
// provider.code = secretKeyTextConrtroller.text;
// Map<String, dynamic> resp = await provider.verifyCode(
// emailTextController.text, secretKeyTextConrtroller.text);
// if (resp["code"] == "1200") {
// provider.loading = false;
// provider.showCodeField = false;
// provider.showMessage = true;
// _displaySnackBar("You have logged in successfully");
// _saveprefs(resp["token"], emailTextController.text,
// secretKeyTextConrtroller.text, true)
// .then((value) {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (context) => NavigationHomeScreen()),
// );
// });
// } else {
// provider.message = resp["message"];
// }
// } else {
print("FIRST LOGIN"); print("FIRST LOGIN");
if (!provider.showCodeField) { if (!provider.showCodeField) {
provider.email = emailTextController.text; provider.email = emailTextController.text;
// String encoded = // String encoded =
// base64.encode(utf8.encode(deviceId)); // base64.encode(utf8.encode(deviceId));
String domain = String domain =
"https://${domainTextConrtroller.text}.io/"; "https://${domainTextConrtroller.text}.konectar.io/";
var resp = await provider.verifyEmail(domain, var resp = await provider.verifyEmail(domain,
emailTextController.text, deviceId!, platform); emailTextController.text, deviceId!, platform);
if (resp != null) { if (resp != null) {
@ -439,50 +355,24 @@ class _LoginScreenState extends State<LoginScreen> {
secretKeyTextConrtroller.text = provider.code!; secretKeyTextConrtroller.text = provider.code!;
}); });
} }
// }
//_joinMeeting(roomText.text, "demo meet2");
// _saveprefs(
// emailTextController.text,
// true)
// .then((value) {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (context) => FirebaseExample(
// title: secretKeyTextConrtroller.text,
// )),
// );
// }
// );
} else { } else {
_displaySnackBar(textFieldsValidation(provider)); _displaySnackBar(textFieldsValidation(provider));
} }
}, },
// onPressed: () async {
// await ApiCall().fetchApiConstants().then(
// (value) {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (context) => NavigationHomeScreen()),
// );
// },
// );
// },
textColor: Colors.white, textColor: Colors.white,
fontsize: isTablet ? 22 : 18, fontsize: isTablet ? 22 : 18,
title: provider.showCodeField ? "Verify" : "Sign In"), title: provider.showCodeField ? "Verify Code" : "Sign In"),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
provider.showMessage Center(
? Text(provider.message!) child: provider.showMessage
: provider.loading ? Text(provider.message!)
? Center(child: CircularProgressIndicator()) : provider.loading
: SizedBox.shrink(), ? Center(child: CircularProgressIndicator())
: SizedBox.shrink(),
),
]), ]),
); );
} }
@ -520,16 +410,11 @@ class _LoginScreenState extends State<LoginScreen> {
return isloggedout; return isloggedout;
}); });
}); });
// await SessionManager().setLoggedIn(isloggedin);
// UserData userData =
// UserData(email: email, name: token, domainUrl: domain, secretkey: key);
// await provider.saveUserData(userData);
} }
_displaySnackBar(String msg) { _displaySnackBar(String msg) {
final snackBar = SnackBar(content: Text(msg)); final snackBar = SnackBar(content: Text(msg));
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
//scaffoldKeyLogin.currentState!.showSnackBar(snackBar);
} }
String textFieldsValidation(LoginProvider provider) { String textFieldsValidation(LoginProvider provider) {

View File

@ -82,6 +82,20 @@ class CareView extends StatelessWidget {
// // width: MediaQuery.of(context).size.width, // // width: MediaQuery.of(context).size.width,
// // height: MediaQuery.of(context).size.height, // // height: MediaQuery.of(context).size.height,
// ), // ),
Align(
alignment: Alignment.centerRight,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(100),
topLeft: Radius.circular(100)),
color: const Color.fromARGB(255, 167, 203, 234),
shape: BoxShape.rectangle,
),
height: MediaQuery.of(context).size.height / 2,
width: MediaQuery.of(context).size.width / 4,
),
),
Container( Container(
padding: const EdgeInsets.only(bottom: 100), padding: const EdgeInsets.only(bottom: 100),
child: Column( child: Column(

View File

@ -204,7 +204,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
child: ListView.builder( child: ListView.builder(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
itemCount: drawerList?.length, itemCount: drawerList?.length ?? 0,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return inkwell(drawerList![index]); return inkwell(drawerList![index]);
}, },