diff --git a/android/app/build.gradle b/android/app/build.gradle index 64a3dd4..284bb60 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -23,8 +23,8 @@ if (flutterVersionName == null) { } android { - namespace "com.ftc.app.ftc_mobile_app" - compileSdkVersion flutter.compileSdkVersion + namespace "com.app.ftc_patient" + compileSdkVersion 32 ndkVersion "25.1.8937393" compileOptions { @@ -42,11 +42,11 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.ftc.app.ftc_mobile_app" + applicationId "com.app.ftc_patient" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 21 - targetSdkVersion flutter.targetSdkVersion + targetSdkVersion 32 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/android/app/google-services.json b/android/app/google-services.json deleted file mode 100644 index 33a8bfb..0000000 --- a/android/app/google-services.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "project_info": { - "project_number": "583559514958", - "project_id": "ftc-services-ea8d6", - "storage_bucket": "ftc-services-ea8d6.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:583559514958:android:89af243ca4a3888a32ec1f", - "android_client_info": { - "package_name": "com.ftc.app.ftc_mobile_app" - } - }, - "oauth_client": [], - "api_key": [ - { - "current_key": "AIzaSyDF2vZbiWQROGvyvLeeCmAjPLnPLYjE6Os" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/ftc/app/ftc_mobile_app/MainActivity.kt b/android/app/src/main/kotlin/com/app/ftc_patient/MainActivity.kt similarity index 73% rename from android/app/src/main/kotlin/com/ftc/app/ftc_mobile_app/MainActivity.kt rename to android/app/src/main/kotlin/com/app/ftc_patient/MainActivity.kt index e341968..5e22c91 100644 --- a/android/app/src/main/kotlin/com/ftc/app/ftc_mobile_app/MainActivity.kt +++ b/android/app/src/main/kotlin/com/app/ftc_patient/MainActivity.kt @@ -1,4 +1,4 @@ -package com.ftc.app.ftc_mobile_app +package com.app.ftc_patient import io.flutter.embedding.android.FlutterActivity diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 4d15d25..26e131b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -507,7 +507,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.ftcs.app; + PRODUCT_BUNDLE_IDENTIFIER = com.app.ftc_patient; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = FTCS_Dev; @@ -700,7 +700,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.ftcs.app; + PRODUCT_BUNDLE_IDENTIFIER = com.app.ftc_patient; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = FTCS_Dev; @@ -737,7 +737,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.ftcs.app; + PRODUCT_BUNDLE_IDENTIFIER = com.app.ftc_patient; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = FTCS_Dev; diff --git a/lib/controllers/home/dashboard_screen_controller.dart b/lib/controllers/home/dashboard_screen_controller.dart index b3d4dc1..cd37268 100644 --- a/lib/controllers/home/dashboard_screen_controller.dart +++ b/lib/controllers/home/dashboard_screen_controller.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:ftc_mobile_app/models/profile_screen_model.dart'; +import 'package:ftc_mobile_app/models/profileData/user_data.dart'; import 'package:ftc_mobile_app/models/rota/LiveRoasterResponseData.dart'; import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart'; import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart'; import 'package:get/get.dart'; -import 'package:intl/intl.dart'; import '../../ftc_mobile_app.dart'; class DashboardScreenController extends GetxController { @@ -16,7 +15,7 @@ class DashboardScreenController extends GetxController { final selectedIndex = 1.obs; final myShiftsList = RxList(); final ongoingShift = Rx(null); - final myProfileData = Rx(null); + final myProfileData = Rx(null); @override void onInit() { @@ -49,10 +48,14 @@ class DashboardScreenController extends GetxController { } getProfileDetail() async { - final resp = await ClientService().getUserDetails(); + final resp = await ClientService().getUserDetails().showLoader(); - if (resp is ProfileDataModel) { - myProfileData.value = resp.data?.staffMembers?.firstOrNull; + if (resp.success == true) { + myProfileData.value = resp.data?.users?.firstOrNull; + } else { + if (resp.message.isNotNullOrEmpty()) { + FrequentFunctions.showToast(message: resp.message!); + } } } diff --git a/lib/controllers/profile/view_profile_screen_controller.dart b/lib/controllers/profile/view_profile_screen_controller.dart index e4b6b46..fee41fc 100644 --- a/lib/controllers/profile/view_profile_screen_controller.dart +++ b/lib/controllers/profile/view_profile_screen_controller.dart @@ -36,7 +36,7 @@ class ViewProfileScreenController extends GetxController { addressTEC.text = d?.user?.modelId?.homeAddress ?? ""; }); - detail.value = dashboardController.myProfileData(); + // detail.value = dashboardController.myProfileData(); super.onInit(); } diff --git a/lib/main.dart b/lib/main.dart index 1a17414..05e4028 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,12 +14,12 @@ void main() async { GetTimeAgo.setCustomLocaleMessages('en', CustomTimeAgoMessages()); //Notification initialize - NotificationUtils.init(); - try { - await FcmNotification.getInstance().init(); - } catch (e) { - debugPrint("FcmNotification init error: $e"); - } + // NotificationUtils.init(); + // try { + // await FcmNotification.getInstance().init(); + // } catch (e) { + // debugPrint("FcmNotification init error: $e"); + // } await LocalStorageManager.init(); Get.lazyPut(() => AppSessionManager(), fenix: true); diff --git a/lib/view/custom_widgets/custom_navigation_drawer.dart b/lib/view/custom_widgets/custom_navigation_drawer.dart index 038d7be..98f6afa 100644 --- a/lib/view/custom_widgets/custom_navigation_drawer.dart +++ b/lib/view/custom_widgets/custom_navigation_drawer.dart @@ -45,7 +45,7 @@ class _CustomDrawerState extends State { return MyCircleImage( imageSize: 80.r, url: - "${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.user?.profilePictureUrl ?? ""}", + "${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.profilePictureUrl ?? ""}", errorWidget: CustomImageWidget( imagePath: AssetsManager.kPersonMainIcon, imageColor: CustomAppColors.kDarkBlueTextColor, @@ -61,7 +61,7 @@ class _CustomDrawerState extends State { () => CustomTextWidget( text: DashboardScreenController.instance .myProfileData() - ?.staffMemberName ?? + ?.displayName ?? "", textAlign: TextAlign.center, fontColor: CustomAppColors.kBlackColor, @@ -69,16 +69,6 @@ class _CustomDrawerState extends State { fontSize: 14.sp, ), ), - Obx( - () => CustomTextWidget( - text: DashboardScreenController.instance - .myProfileData() - ?.staffDesignation ?? - "", - fontColor: CustomAppColors.kLightGreyColor, - fontSize: 10.sp, - fontWeight: FontWeight.w500), - ), ], ), ), @@ -99,55 +89,6 @@ class _CustomDrawerState extends State { Navigator.pop(context); dashboardController.selectedIndex.value = 1; drawerController.selectedIndex.value = 1; - // Navigator.pushNamed( - // context, - // CustomRouteNames.kDashboardScreenRoute, - // ); - }), - 6.verticalSpace, - _getDrawerNavItem( - title: "Rota", - iconPath: AssetsManager.kPersonMainIcon, - color: CustomAppColors.kLightGreyColor, - selected: drawerController.selectedIndex.value == 0, - onTap: () { - Navigator.pop(context); - // dashboardController.selectedIndex.value = 0; - // drawerController.selectedIndex.value = 0; - Navigator.pushNamed( - context, - CustomRouteNames.kRotaDashboardScreenRoute, - ); - }), - 6.verticalSpace, - _getDrawerNavItem( - title: "Clients", - iconPath: AssetsManager.kPeopleIcon, - color: CustomAppColors.kLightGreyColor, - selected: drawerController.selectedIndex.value == 3, - onTap: () { - Navigator.pop(context); - dashboardController.selectedIndex.value = 3; - drawerController.selectedIndex.value = 3; - // Navigator.pushNamed( - // context, - // CustomRouteNames.kClientsListScreenRoute, - // ); - }), - 6.verticalSpace, - _getDrawerNavItem( - title: "Inbox", - iconPath: AssetsManager.kMessageIcon, - color: CustomAppColors.kLightGreyColor, - selected: drawerController.selectedIndex.value == 2, - onTap: () { - Navigator.pop(context); - dashboardController.selectedIndex.value = 2; - drawerController.selectedIndex.value = 2; - // Navigator.pushNamed( - // context, - // CustomRouteNames.kInboxScreenRoute, - // ); }), 6.verticalSpace, _getDrawerNavItem( @@ -191,26 +132,7 @@ class _CustomDrawerState extends State { // CustomRouteNames.kNotificationListScreenRoute, // ); }), - const Expanded(child: FrequentFunctions.noWidget), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CustomTextWidget( - text: "Shift end at ", - fontColor: CustomAppColors.kLightGreyColor, - isExpanded: false, - fontSize: 16.sp, - fontWeight: FontWeight.w700, - ), - CustomTextWidget( - text: "07Hrs 50Sec", - fontColor: CustomAppColors.kSecondaryColor, - isExpanded: false, - fontWeight: FontWeight.w700, - fontSize: 16.sp, - ), - ], - ) + ], ), ), diff --git a/lib/view/screens/clients/client_profile_screen.dart b/lib/view/screens/clients/client_profile_screen.dart index 1909cb1..5e919da 100644 --- a/lib/view/screens/clients/client_profile_screen.dart +++ b/lib/view/screens/clients/client_profile_screen.dart @@ -32,7 +32,7 @@ class _ClientProfileScreenState extends State { backgroundColor: CustomAppColors.kPrimaryColor, screenKey: controller.screenKey, onScreenTap: controller.removeFocus, - showAppBar: true, + showAppBar: false, appBar: CustomAppBar( leadingButton: Container(), showBoxShadow: false, diff --git a/lib/view/screens/home/dashboard_screen.dart b/lib/view/screens/home/dashboard_screen.dart index 7acc4aa..591336e 100644 --- a/lib/view/screens/home/dashboard_screen.dart +++ b/lib/view/screens/home/dashboard_screen.dart @@ -15,6 +15,24 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { + return CustomScaffold( + appBar: appBar, + backgroundColor: CustomAppColors.kPrimaryColor, + screenKey: controller.screenKey, + onScreenTap: controller.removeFocus, + showAppBar: true, + sideDrawer: const CustomDrawer(), + body: SafeArea( + child: Obx(() { + if (controller.myProfileData() == null) { + return FrequentFunctions.centerText(text: "No data found"); + } + + return ClientProfileScreen(userData: controller.myProfileData()!); + }), + ), + ); + return CustomScaffold( appBar: appBar, sideDrawer: const CustomDrawer(), diff --git a/lib/view/screens/home/home_screen.dart b/lib/view/screens/home/home_screen.dart index ad22278..f7bff58 100644 --- a/lib/view/screens/home/home_screen.dart +++ b/lib/view/screens/home/home_screen.dart @@ -48,7 +48,7 @@ class HomeScreen extends StatelessWidget { return MyCircleImage( imageSize: 80.r, url: - "${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.user?.profilePictureUrl ?? ""}", + "${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.profilePictureUrl ?? ""}", errorWidget: CircleAvatar( backgroundColor: Colors.white, child: CustomImageWidget( @@ -67,7 +67,7 @@ class HomeScreen extends StatelessWidget { () => CustomTextWidget( text: DashboardScreenController.instance .myProfileData() - ?.staffMemberName ?? + ?.displayName ?? "", fontSize: 14.sp, fontWeight: FontWeight.w600, @@ -76,17 +76,17 @@ class HomeScreen extends StatelessWidget { ), //designation - Obx( - () => CustomTextWidget( - text: DashboardScreenController.instance - .myProfileData() - ?.staffDesignation ?? - "", - fontSize: 14.sp, - fontColor: CustomAppColors.kPrimaryColor, - fontWeight: FontWeight.w600, - ), - ), + // Obx( + // () => CustomTextWidget( + // text: DashboardScreenController.instance + // .myProfileData() + // ?.staffDesignation ?? + // "", + // fontSize: 14.sp, + // fontColor: CustomAppColors.kPrimaryColor, + // fontWeight: FontWeight.w600, + // ), + // ), 16.verticalSpace, Row( mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/lib/web_services/client_services.dart b/lib/web_services/client_services.dart index 9c4d0bd..ee6b7cb 100644 --- a/lib/web_services/client_services.dart +++ b/lib/web_services/client_services.dart @@ -11,6 +11,7 @@ import 'package:ftc_mobile_app/models/clients/recent_incidents_model.dart'; import 'package:ftc_mobile_app/models/clients/add_pbs_plan_model.dart'; import 'package:ftc_mobile_app/models/clients/riskAssessmentResponse/GetRiskAssessmentResponse.dart'; import 'package:ftc_mobile_app/models/clients/riskAssessmentResponse/RiskAssessmentData.dart'; +import 'package:ftc_mobile_app/utilities/enums/api_method.dart'; import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart'; import '../models/appointmentsListResponse/AppointmentsListResponse.dart'; import '../models/clients/HealthIssuesDetailsModel.dart'; @@ -30,49 +31,29 @@ class ClientService { final HttpRequestClient _httpClient = HttpRequestClient(); - Future getUserDetails() async { - // String userJson = LocalStorageManager.getSessionToken( - // tokenKey: LocalStorageKeys.kUserModelKey, - // ); - // UserModel userModel = UserModel.fromJson(json.decode(userJson)); + Future getUserDetails() async { Map requestBody = { - "sortproperty": "createdAt", - "sortorder": -1, "offset": 0, "limit": 1, "query": { "critarion": { "active": true, - "_id": LocalStorageManager.userId, + // "_id": LocalStorageManager.userId, + "_id": "659535b08d2973ab265f1091" }, - "addedby": "_id email name", - "lastModifiedBy": "_id email name" }, }; - ResponseModel responseModel = await _httpClient.customRequest( - "POST", - url: WebUrls.userProfileUrl, - requestBody: requestBody, - requestHeader: {'Content-Type': 'application/json'}, - isBearerHeaderRequired: true, - isBearer: true, + ResponseModel responseModel = await _httpClient.safeApiCall( + method: ApiMethod.post, + url: WebUrls.getServiceUsersListUrl, + body: requestBody, ); - if (responseModel.statusCode >= 200 && - responseModel.statusCode <= 230 && - responseModel.statusDescription.toLowerCase().contains("success")) { - final profileDataModel = ProfileDataModel.fromJson({ - 'status': "${responseModel.statusCode}", - "data": responseModel.data, - 'message': responseModel.statusDescription, - }); - // await LocalStorageManager.saveSession( - // tokenKey: LocalStorageKeys.kProfileModelKey, - // tokenValue: json.encode(profileDataModel.toJson()), - // ); - return profileDataModel; + if ((responseModel.statusCode ~/ 100) == 2) { + final resp = AllClientsResponseData.fromJson(responseModel.data); + return AllClientsResponse(success: true, data: resp); } else { - return responseModel.statusDescription; + return AllClientsResponse(success: false, message: responseModel.statusDescription); } } @@ -223,11 +204,6 @@ class ClientService { responseModel.statusCode <= 230 && responseModel.statusDescription.toLowerCase().contains("success")) { final resp = AllClientsResponseData.fromJson(responseModel.data); - - // List serviceUsers = []; - // for (var singleUser in responseModel.data['serviceUsers']) { - // serviceUsers.add(ServiceUserModel.fromJson(singleUser)); - // } return AllClientsResponse(success: true, data: resp); } else { return AllClientsResponse( @@ -914,10 +890,7 @@ class ClientService { url: WebUrls.getCarePlansListURL, requestBody: { "query": { - "critarion": { - "userId": serviceUserId, - "active": true - } + "critarion": {"userId": serviceUserId, "active": true} }, "sortproperty": "eventDateTime", "sortorder": -1, diff --git a/pubspec.yaml b/pubspec.yaml index 06d6f04..00b2e99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,7 @@ dev_dependencies: flutter_lints: ^2.0.0 flutter_launcher_icons: ^0.13.1 flutter_native_splash: ^2.2.11 + change_app_package_name: ^1.3.0 # For generating Splash Screen flutter_native_splash: