Merge pull request 'updated changes' (#11) from snehalatha_dev into dev

Reviewed-on: #11
This commit is contained in:
snehalathad 2024-12-19 10:31:53 +00:00
commit 73e5211dbd
12 changed files with 229 additions and 164 deletions

View File

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

View File

@ -74,6 +74,8 @@ PODS:
- FirebaseRemoteConfigInterop (10.25.0) - FirebaseRemoteConfigInterop (10.25.0)
- FirebaseSharedSwift (10.25.0) - FirebaseSharedSwift (10.25.0)
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_background_service_ios (0.0.3):
- Flutter
- GoogleUtilities/Environment (7.13.3): - GoogleUtilities/Environment (7.13.3):
- GoogleUtilities/Privacy - GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2) - PromisesObjC (< 3.0, >= 1.2)
@ -120,6 +122,7 @@ DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`) - firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_background_service_ios (from `.symlinks/plugins/flutter_background_service_ios/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- mobile_device_identifier (from `.symlinks/plugins/mobile_device_identifier/ios`) - mobile_device_identifier (from `.symlinks/plugins/mobile_device_identifier/ios`)
- open_file (from `.symlinks/plugins/open_file/ios`) - open_file (from `.symlinks/plugins/open_file/ios`)
@ -160,6 +163,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_remote_config/ios" :path: ".symlinks/plugins/firebase_remote_config/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_background_service_ios:
:path: ".symlinks/plugins/flutter_background_service_ios/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
mobile_device_identifier: mobile_device_identifier:
@ -194,6 +199,7 @@ SPEC CHECKSUMS:
FirebaseRemoteConfigInterop: b25018791b204c0d78a90e394d6c62d9b1f22da8 FirebaseRemoteConfigInterop: b25018791b204c0d78a90e394d6c62d9b1f22da8
FirebaseSharedSwift: 0274086954b1b2d5fd7e829eccc587044d72a4ba FirebaseSharedSwift: 0274086954b1b2d5fd7e829eccc587044d72a4ba
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_background_service_ios: e30e0d3ee69e4cee66272d0c78eacd48c2e94aac
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18 image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18
JNKeychain: fb6cc9ec95959ba46cd95d0ee6f7a05e41da9f42 JNKeychain: fb6cc9ec95959ba46cd95d0ee6f7a05e41da9f42

View File

@ -520,10 +520,11 @@ import 'contacts_module/provider_class/award_provider.dart';
import 'firebase_options.dart'; import 'firebase_options.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
late SharedPreferences sp;
Future main() async { Future main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// startPeriodicCalls(); // startPeriodicCalls();
sp = await SharedPreferences.getInstance();
await Hive.initFlutter(); await Hive.initFlutter();
await initializeService(); await initializeService();

View File

@ -21,13 +21,14 @@ class HiveApiConstantsAdapter extends TypeAdapter<HiveApiConstants> {
interval: fields[1] as int?, interval: fields[1] as int?,
method: fields[2] as String?, method: fields[2] as String?,
module: fields[3] as String?, module: fields[3] as String?,
hivename: fields[4] as String?,
); );
} }
@override @override
void write(BinaryWriter writer, HiveApiConstants obj) { void write(BinaryWriter writer, HiveApiConstants obj) {
writer writer
..writeByte(4) ..writeByte(5)
..writeByte(0) ..writeByte(0)
..write(obj.functionName) ..write(obj.functionName)
..writeByte(1) ..writeByte(1)
@ -35,7 +36,9 @@ class HiveApiConstantsAdapter extends TypeAdapter<HiveApiConstants> {
..writeByte(2) ..writeByte(2)
..write(obj.method) ..write(obj.method)
..writeByte(3) ..writeByte(3)
..write(obj.module); ..write(obj.module)
..writeByte(4)
..write(obj.hivename);
} }
@override @override

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:dio/io.dart'; import 'package:dio/io.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:konectar_events/main.dart';
import 'package:konectar_events/model/affiliationsmodel.dart'; import 'package:konectar_events/model/affiliationsmodel.dart';
import 'package:konectar_events/model/allsessionnotesmodel.dart'; import 'package:konectar_events/model/allsessionnotesmodel.dart';
import 'package:konectar_events/model/api_constants_model.dart'; import 'package:konectar_events/model/api_constants_model.dart';
@ -30,19 +31,9 @@ import 'package:http/http.dart' as http;
class ApiCall { class ApiCall {
final dio = Dio(); final dio = Dio();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
String token = ""; String token = sp.getString('token') ?? "";
ApiCall() { String global_url = sp.getString('url') ?? "";
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 {
@ -140,15 +131,16 @@ class ApiCall {
'type': type ?? 1, 'type': type ?? 1,
}); });
// "end": DateTime(2024, 12, 14).toIso8601String(), // "end": DateTime(2024, 12, 14).toIso8601String(),
token = await _prefs.then((SharedPreferences prefs) { // token = sp.getString('token') ?? "";
return prefs.getString('token') ?? ""; // await _prefs.then((SharedPreferences prefs) {
}); // return prefs.getString('token') ?? "";
// });
print("SAVED TOKEN :${token}"); print("SAVED TOKEN :${token}");
//http://192.168.2.130/konectar-staging/apiauths/logout/ //http://192.168.2.130/konectar-staging/apiauths/logout/
try { try {
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.eventslistapi}', '${global_url}${EventsConstants.moduleName}${EventsConstants.eventslistapi}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -185,12 +177,12 @@ class ApiCall {
return client; return client;
}; };
Response response; Response response;
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
var formData = FormData.fromMap({"eid": eventid, "flag": flag}); var formData = FormData.fromMap({"eid": eventid, "flag": flag});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.followUnfollowEvent}', '${global_url}${EventsConstants.moduleName}${EventsConstants.followUnfollowEvent}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -221,13 +213,13 @@ 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) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
Response response; Response response;
var formData = FormData.fromMap({"eid": eventid, "flag": flag}); var formData = FormData.fromMap({"eid": eventid, "flag": flag});
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.attendNotAttendEvent}', '${global_url}${EventsConstants.moduleName}${EventsConstants.attendNotAttendEvent}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -256,9 +248,9 @@ class ApiCall {
required String endDate, required String endDate,
required bool client, required bool client,
}) async { }) async {
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // 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();
@ -289,7 +281,7 @@ 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}', '${global_url}${EventsConstants.moduleName}${EventsConstants.specialtyOfSpeakers}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -320,9 +312,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) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) { (HttpClient client) {
@ -350,7 +342,7 @@ 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}', '${global_url}${EventsConstants.moduleName}${EventsConstants.insightsTopicsCloud}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -383,9 +375,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) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) { (HttpClient client) {
@ -413,7 +405,7 @@ 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}', '${global_url}${EventsConstants.moduleName}${EventsConstants.insightsBarChart}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -453,11 +445,11 @@ class ApiCall {
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"event_id": eventid, "event_id": eventid,
}); });
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.eventdetailsapi}', '${global_url}${EventsConstants.moduleName}${EventsConstants.eventdetailsapi}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -498,11 +490,11 @@ class ApiCall {
}); });
// "sd": "2024-07-30", // "sd": "2024-07-30",
// "ed": "2024-08-03", // "ed": "2024-08-03",
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.speakerslistapi}', '${global_url}${EventsConstants.moduleName}${EventsConstants.speakerslistapi}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -544,11 +536,11 @@ class ApiCall {
"k_id": kid, "k_id": kid,
}); });
// "proj_kol_id": 0, // "proj_kol_id": 0,
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.showEventsTopicsAndSession}', '${global_url}${EventsConstants.moduleName}${EventsConstants.showEventsTopicsAndSession}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -593,9 +585,9 @@ class ApiCall {
return client; return client;
}; };
var formData; var formData;
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
Response response; Response response;
if (filename != "") { if (filename != "") {
formData = FormData.fromMap({ formData = FormData.fromMap({
@ -618,7 +610,7 @@ class ApiCall {
// "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/3CBC1CFF-79AD-49FA-A6E0-13D0AA2959D2/tmp/Flutter Questionaire.pdf", // "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/3CBC1CFF-79AD-49FA-A6E0-13D0AA2959D2/tmp/Flutter Questionaire.pdf",
response = await dio.post( response = await dio.post(
'${EventsConstants.url}${EventsConstants.saveEventsTopicNote}', '${global_url}${EventsConstants.moduleName}${EventsConstants.saveEventsTopicNote}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -651,15 +643,15 @@ class ApiCall {
return client; return client;
}; };
Response response; Response response;
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"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}', '${global_url}${EventsConstants.moduleName}${EventsConstants.eventUserAnalytics}',
options: Options( options: Options(
followRedirects: true, followRedirects: true,
validateStatus: (status) => true, validateStatus: (status) => true,
@ -690,9 +682,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) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
List<ApiConstantsResponse> responseData = List<ApiConstantsResponse> responseData =
apiConstantsResponseFromJson(jsonResult); apiConstantsResponseFromJson(jsonResult);
print('Response_data_is: $responseData'); print('Response_data_is: $responseData');
@ -775,7 +767,7 @@ class ApiCall {
response = await dio.post( response = await dio.post(
//'http://192.168.2.130/konectar-staging/apiauths/login', //'http://192.168.2.130/konectar-staging/apiauths/login',
//'http://192.168.2.130/konectar-staging/apiauths/login/', //'http://192.168.2.130/konectar-staging/apiauths/login/',
'${EventsConstants.loginUrl}${EventsConstants.login}', '${global_url}${EventsConstants.loginmodule}${EventsConstants.login}',
options: Options(), options: Options(),
data: formData); data: formData);
if (response.statusCode == 200) { if (response.statusCode == 200) {
@ -800,9 +792,9 @@ class ApiCall {
return client; return client;
}; };
print("email : $email,device : $deviceid"); print("email : $email,device : $deviceid");
String token = await _prefs.then((SharedPreferences prefs) { // String token = await _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; // return prefs.getString('token') ?? "";
}); // });
Response response; Response response;
print("url :${EventsConstants.loginUrl}${EventsConstants.logout}/"); print("url :${EventsConstants.loginUrl}${EventsConstants.logout}/");
var formData = FormData.fromMap({ var formData = FormData.fromMap({
@ -828,12 +820,17 @@ class ApiCall {
// "token": token, // "token": token,
// }, // },
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
print("response user LoGOUT!!!!!!!!!!!!!!!!!!!!! \n ${response.data} "); print("response user LoGOUT!!!!!!!!!!!!!!!!!!!!! \n ${response.data} ");
VerificationResponse verificationResponse =
verificationResponseFromJson(response.data);
return verificationResponse;
} }
print(response.data.toString()); print(response.data.toString());
return response.data; return "";
} }
//************ K2 API CALLS *********************************************************************************************************************************** //************ K2 API CALLS ***********************************************************************************************************************************

View File

@ -21,7 +21,7 @@ class EventsConstants {
//192.0.0.2:8007 - iphone //192.0.0.2:8007 - iphone
// 192.168.2.109:8007 - office jkqehjkq // 192.168.2.109:8007 - office jkqehjkq
//K1 API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //K1 API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static const String moduleName = "apis/v1/events"; static const String moduleName = "apis/v1/events/";
static const String loginmodule = "apiauths"; static const String loginmodule = "apiauths";
static const String stagingUrl = static const String stagingUrl =

View File

@ -66,6 +66,8 @@ class _EventsListingScreenState extends State<EventsListingScreen>
pagingController.addPageRequestListener((pageKey) { pagingController.addPageRequestListener((pageKey) {
_fetchPages(pageKey, provider); _fetchPages(pageKey, provider);
}); });
pagingController.addStatusListener(_showError);
pagingController.error = "No Speakers";
} }
Future<void> _fetchPage(int pageKey) async { Future<void> _fetchPage(int pageKey) async {
@ -101,7 +103,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
pagingController.appendPage(newItems, nextPageKey); pagingController.appendPage(newItems, nextPageKey);
} }
} catch (error) { } catch (error) {
pagingController.error = error; pagingController.error = "Speakers not Available";
} }
// } // }
} }
@ -110,15 +112,51 @@ class _EventsListingScreenState extends State<EventsListingScreen>
List<EventSpeakersData> list = await provider List<EventSpeakersData> list = await provider
.getInitialSpeakersDetails(widget.event.id!, searchkey: searchSpeaker); .getInitialSpeakersDetails(widget.event.id!, searchkey: searchSpeaker);
print("CHECK LENGTH ${list.length}"); print("CHECK LENGTH ${list.length}");
final isLastPage = pageKey + _pageSize >= list.length; try {
final nextItems = final isLastPage = pageKey + _pageSize >= list.length;
list.skip(pageKey).take(_pageSize).toList(); // Get next batch of items final nextItems = list
.skip(pageKey)
.take(_pageSize)
.toList(); // Get next batch of items
if (isLastPage) { if (isLastPage) {
pagingController.appendLastPage(nextItems); pagingController.appendLastPage(nextItems);
} else { } else {
final nextPageKey = pageKey + nextItems.length; final nextPageKey = pageKey + nextItems.length;
pagingController.appendPage(nextItems, nextPageKey); pagingController.appendPage(nextItems, nextPageKey);
}
} catch (error) {
pagingController.error = "Speakers not Available";
}
}
Future<void> _showError(PagingStatus status) async {
if (status == PagingStatus.subsequentPageError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text(
'Something went wrong while fetching',
),
action: SnackBarAction(
label: 'Retry',
onPressed: () => pagingController.retryLastFailedRequest(),
),
),
);
}
if (status == PagingStatus.noItemsFound) {
pagingController.error = "Speakers not available";
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text(
'Speakers not available',
),
action: SnackBarAction(
label: 'Retry',
onPressed: () => pagingController.retryLastFailedRequest(),
),
),
);
} }
} }
@ -1599,46 +1637,29 @@ class _EventsListingScreenState extends State<EventsListingScreen>
} }
} }
return return (topTopics.isEmpty && topSponsors.isEmpty && topSpeakers.isEmpty)
// isTablet ? Center(child: Text("Details not available!"))
// ? Container( : Container(
// margin: EdgeInsets.symmetric(vertical: 20.0), height: MediaQuery.of(context).size.height,
// height: 200.0, color: AppColors.bgcolor,
// child: Row( padding: EdgeInsets.only(left: 8, right: 8),
// mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: SingleChildScrollView(
// children: <Widget>[ child: Expanded(
// _topicCard("Top 3 topics", child: Column(spacing: 3, children: [
// " 1. Hematologic Neoplasms \n 2. Antibodies, Bispecific \n 3. Multiple Myeloma"), topTopics.isEmpty
// _topicCard("Speakers with most sessions", ? SizedBox.shrink()
// " 1. James A. Davis \n 2. Sandra Cuellar \n 3. Allison Butts"), : listViewTopicCard("Top 3 topics", topTopics, true),
// _topicCard("Sponsors", topSpeakers.isEmpty
// " 1. Amgen Inc \n 2. Bristol-Myers Squibb Company \n 3. Genmab A/S") ? SizedBox.shrink()
// ], : listViewTopicCard(
// )) "Speakers with most sessions", topSpeakers, true),
// : topSponsors.isEmpty
Container( ? SizedBox.shrink()
height: MediaQuery.of(context).size.height, : listViewTopicCard("Sponsors", topSponsors, true)
color: AppColors.bgcolor, ]),
padding: EdgeInsets.only(left: 8, right: 8), ),
child: SingleChildScrollView(
child: Expanded(
child: Column(children: [
SizedBox(
height: 5,
), ),
listViewTopicCard("Top 3 topics", topTopics, true), );
SizedBox(
height: 3,
),
listViewTopicCard("Speakers with most sessions", topSpeakers, true),
SizedBox(
height: 3,
),
listViewTopicCard("Sponsors", topSponsors, true)
]),
),
),
);
} }
Widget _topicCard(String title, String content) { Widget _topicCard(String title, String content) {

View File

@ -96,6 +96,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
pagingController.addPageRequestListener((pageKey) { pagingController.addPageRequestListener((pageKey) {
_fetchPage(pageKey); _fetchPage(pageKey);
}); });
pagingController.addStatusListener(_showError);
super.initState(); super.initState();
} }
@ -184,6 +185,22 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
} }
} }
Future<void> _showError(PagingStatus status) async {
if (status == PagingStatus.subsequentPageError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text(
'Something went wrong while fetching',
),
action: SnackBarAction(
label: 'Retry',
onPressed: () => pagingController.retryLastFailedRequest(),
),
),
);
}
}
init() async { init() async {
await ApiCall().fetchApiConstants(); await ApiCall().fetchApiConstants();
await Provider.of<EventsProvider>(context, listen: false) await Provider.of<EventsProvider>(context, listen: false)

View File

@ -87,6 +87,7 @@ class _EventsInsightsState extends State<EventsInsights> {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
child: Wrap( child: Wrap(
@ -139,7 +140,12 @@ class _EventsInsightsState extends State<EventsInsights> {
color: AppColors.blueColor, color: AppColors.blueColor,
), ),
) )
: _buildCharts(provider, widgets), : (provider.affiliations.affiliationCount.isEmpty &&
provider.specialtyList.isEmpty &&
widgets.isEmpty &&
widget.allSessionNotes.isEmpty)
? Center(child: Text("Insights not available!"))
: _buildCharts(provider, widgets),
widget.allSessionNotes.isNotEmpty widget.allSessionNotes.isNotEmpty
? labelWidget("Session Notes") ? labelWidget("Session Notes")
: SizedBox.shrink(), : SizedBox.shrink(),

View File

@ -46,6 +46,7 @@ class _LoginScreenState extends State<LoginScreen> {
late Future<bool> _login; late Future<bool> _login;
late Future<bool> _logout; late Future<bool> _logout;
late Future<String> _verification_code; late Future<String> _verification_code;
late Future<String> _url;
String platform = "android"; String platform = "android";
String? deviceId; String? deviceId;
final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier(); final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier();
@ -62,20 +63,16 @@ class _LoginScreenState extends State<LoginScreen> {
platform = "ios"; platform = "ios";
} }
}); });
// _username = _prefs.then((SharedPreferences prefs) {
// return prefs.getString('username') ?? "";
// });
_useremail = _prefs.then((SharedPreferences prefs) { _useremail = _prefs.then((SharedPreferences prefs) {
emailTextController.text = prefs.getString('useremail') ?? ""; emailTextController.text = prefs.getString('useremail') ?? "";
return prefs.getString('useremail') ?? ""; return prefs.getString('useremail') ?? "";
}); });
// _domain = _prefs.then((SharedPreferences prefs) { _domain = _prefs.then((SharedPreferences prefs) {
// return prefs.getString('domain') ?? ""; domainTextConrtroller.text = prefs.getString('domain') ?? "";
// }); return prefs.getString('domain') ?? "";
// _key = _prefs.then((SharedPreferences prefs) { });
// secretKeyTextConrtroller.text = prefs.getString('secretkey') ?? "";
// return prefs.getString('secretkey') ?? "";
// });
_login = _prefs.then((SharedPreferences prefs) { _login = _prefs.then((SharedPreferences prefs) {
return prefs.getBool('isloggedin') ?? false; return prefs.getBool('isloggedin') ?? false;
}); });
@ -270,13 +267,14 @@ class _LoginScreenState extends State<LoginScreen> {
provider.loading = true; provider.loading = true;
}); });
print("email:${emailTextController.text}"); print("email:${emailTextController.text}");
String domain =
"https://${domainTextConrtroller.text}.konectar.io/";
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 =
"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) {
@ -303,6 +301,7 @@ class _LoginScreenState extends State<LoginScreen> {
emailTextController.text, emailTextController.text,
secretKeyTextConrtroller.text, secretKeyTextConrtroller.text,
deviceId!, deviceId!,
domain,
true) true)
.then((value) { .then((value) {
Navigator.of(context).pushReplacement( Navigator.of(context).pushReplacement(
@ -318,7 +317,6 @@ class _LoginScreenState extends State<LoginScreen> {
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
resp.message, context, resp.message, context,
error: true); error: true);
();
} }
provider.message = resp.message; provider.message = resp.message;
@ -341,6 +339,7 @@ class _LoginScreenState extends State<LoginScreen> {
emailTextController.text, emailTextController.text,
secretKeyTextConrtroller.text, secretKeyTextConrtroller.text,
deviceId!, deviceId!,
domain,
true) true)
.then((value) { .then((value) {
Navigator.of(context).pushReplacement( Navigator.of(context).pushReplacement(
@ -378,8 +377,8 @@ class _LoginScreenState extends State<LoginScreen> {
); );
} }
Future<void> _saveprefs( Future<void> _saveprefs(String token, String email, String key, String vcode,
String token, String email, String key, String vcode, bool login) async { String url, bool login) async {
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
final String useremail = (prefs.getString('useremail') ?? ''); final String useremail = (prefs.getString('useremail') ?? '');
final String username = (prefs.getString('username') ?? ''); final String username = (prefs.getString('username') ?? '');
@ -387,6 +386,7 @@ class _LoginScreenState extends State<LoginScreen> {
final String secretkey = (prefs.getString('secretkey') ?? ''); final String secretkey = (prefs.getString('secretkey') ?? '');
final String verification_code = final String verification_code =
(prefs.getString('verfication_code') ?? ''); (prefs.getString('verfication_code') ?? '');
final String urlstr = (prefs.getString('url') ?? '');
final bool isloggedin = (prefs.getBool('isloggedin') ?? false); final bool isloggedin = (prefs.getBool('isloggedin') ?? false);
final bool isloggedout = (prefs.getBool('isloggedout') ?? false); final bool isloggedout = (prefs.getBool('isloggedout') ?? false);
setState(() { setState(() {
@ -404,6 +404,9 @@ class _LoginScreenState extends State<LoginScreen> {
prefs.setString('deviceid', vcode).then((bool success) { prefs.setString('deviceid', vcode).then((bool success) {
return verification_code; return verification_code;
}); });
_url = prefs.setString('url', url).then((bool success) {
return urlstr;
});
_login = prefs.setBool('isloggedin', login).then((bool success) { _login = prefs.setBool('isloggedin', login).then((bool success) {
return isloggedin; return isloggedin;
}); });

View File

@ -82,20 +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( // Align(
alignment: Alignment.centerRight, // alignment: Alignment.centerRight,
child: Container( // child: Container(
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.only( // borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(100), // bottomLeft: Radius.circular(100),
topLeft: Radius.circular(100)), // topLeft: Radius.circular(100)),
color: const Color.fromARGB(255, 167, 203, 234), // color: const Color.fromARGB(255, 167, 203, 234),
shape: BoxShape.rectangle, // shape: BoxShape.rectangle,
), // ),
height: MediaQuery.of(context).size.height / 2, // height: MediaQuery.of(context).size.height / 2,
width: MediaQuery.of(context).size.width / 4, // 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

@ -6,6 +6,7 @@ import 'package:konectar_events/utils/sessionmanager.dart';
import 'package:konectar_events/view/login.dart'; import 'package:konectar_events/view/login.dart';
import 'package:konectar_events/viewmodel/hive_repository.dart'; import 'package:konectar_events/viewmodel/hive_repository.dart';
import 'package:konectar_events/viewmodel/loginprovider.dart'; import 'package:konectar_events/viewmodel/loginprovider.dart';
import 'package:konectar_events/widgets/snackbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -335,16 +336,26 @@ class _HomeDrawerState extends State<HomeDrawer> {
void onTapped() async { void onTapped() async {
print("device id : ${await _deviceid}"); print("device id : ${await _deviceid}");
final resp = await ApiCall().logout(await _useremail, await _deviceid); dynamic resp = await ApiCall().logout(await _useremail, await _deviceid);
print("resp:$resp"); print("resp:$resp");
await SessionManager().logoutSession(false).then((value) { if (resp.status == 1200) {
Navigator.of(context).popUntil((route) => route.isFirst); SnackBarWidget.displaySnackBar(
// Navigator.of(context, rootNavigator: true).pushReplacementNamed("/"); resp.message,
Navigator.pushReplacement(
context, context,
MaterialPageRoute(builder: (context) => LoginScreen()),
); );
}); await SessionManager().logoutSession(false).then((value) {
Navigator.of(context).popUntil((route) => route.isFirst);
// Navigator.of(context, rootNavigator: true).pushReplacementNamed("/");
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LoginScreen()),
);
});
} else {
SnackBarWidget.displaySnackBar(
"Something went wrong..Try Again!", context,
error: true);
}
} }
Widget inkwell(DrawerList listData) { Widget inkwell(DrawerList listData) {