From 0e8512597c63bfed0607f3893003f84ce1d098c3 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Tue, 24 Jun 2025 10:10:08 +0300 Subject: [PATCH] logins apis --- android/app/src/main/AndroidManifest.xml | 30 +++++-------------- .../com/mohem_flutter_app/MainActivity.kt | 3 +- android/settings.gradle | 4 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 ++ lib/api/api_mapper_class.dart | 7 +++-- lib/api/login_api_client.dart | 25 +++++++++++----- .../get_mobile_login_info_list_model.dart | 8 +++++ lib/ui/login/verify_last_login_screen.dart | 1 + pubspec.yaml | 3 +- 9 files changed, 46 insertions(+), 37 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d4b3b70..95b4fd4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,8 +8,7 @@ - - + @@ -19,8 +18,7 @@ - - + @@ -40,33 +38,22 @@ android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileProvider" android:exported="false" - android:grantUriPermissions="true" - tools:replace="android:authorities"> + android:grantUriPermissions="true"> + android:resource="@xml/filepaths" /> - - @@ -80,11 +67,8 @@ - - - + \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/mohem_flutter_app/MainActivity.kt b/android/app/src/main/kotlin/com/mohem_flutter_app/MainActivity.kt index 0023ec9..60cd948 100644 --- a/android/app/src/main/kotlin/com/mohem_flutter_app/MainActivity.kt +++ b/android/app/src/main/kotlin/com/mohem_flutter_app/MainActivity.kt @@ -1,4 +1,5 @@ -package com.mohem_flutter_app +//package com.mohem_flutter_app +package hmg.cloudSolutions.mohem //import io.flutter.embedding.android.FlutterActivity // diff --git a/android/settings.gradle b/android/settings.gradle index 862146f..9b43b24 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -47,10 +47,10 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version '8.10.0' apply false + id "com.android.application" version '8.10.1' apply false id("org.jetbrains.kotlin.android") version "2.1.10" apply false id("com.google.gms.google-services") version "4.4.2" apply false - id("com.google.firebase.crashlytics") version "3.0.3" apply false + id("com.google.firebase.crashlytics") version "3.0.4" apply false id ("com.huawei.agconnect.agcp") version "1.7.3.302" apply false id ("com.huawei.agconnect.apms") version "1.6.1.300" apply false diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c53e2b3..9c12df5 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> 0 ? (responseData.mohemmGetMobileLoginInfoList!.first) : null; + // GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print(jsonDecode(json["Data"].first)); + GetMobileLoginInfoListModel? modelData= GetMobileLoginInfoListModel.fromRawJson(jsonDecode(json["Data"].first)); + print("getMobileLoginInfoNEW: ${modelData.toJson()}"); + // return (responseData.mohemmGetMobileLoginInfoList?.length ?? 0) > 0 ? (responseData.mohemmGetMobileLoginInfoList!.first) : null; + return modelData; }, url, postParams); + + // dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, token: AppState().postParamsObject!.tokenID); + // ApiResponse res = ApiResponse.fromJson(response); + // dynamic ress = await ApiClassMapper().handleApiEndpoint(endpoint: "Mohemm_GetMobileLoginInfo_NEW", jsonData: res.data); + // return ress; } - Future insertMobileLoginInfoNEW( - String email, int sessionId, String employeeName, int loginType, String mobileNumber, String userName, String deviceToken, String deviceType) async { + Future insertMobileLoginInfoNEW(String email, int sessionId, String employeeName, int loginType, String mobileNumber, String userName, String deviceToken, String deviceType) async { String url = "${ApiConsts.authRest}Mohemm_Insert_MobileDeviceInfo"; // String url = "${ApiConsts.authRest}Mohemm_InsertMobileLoginInfo"; Map postParams = { @@ -51,11 +60,10 @@ class LoginApiClient { dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, token: AppState().postParamsObject!.tokenID); ApiResponse res = ApiResponse.fromJson(response); dynamic ress = await ApiClassMapper().handleApiEndpoint(endpoint: "Mohemm_Insert_MobileDeviceInfo", jsonData: res); - if(ress == true){ + if (ress == true) { AppState().setLogged = true; } return ress; - } Future checkMobileAppVersion() async { @@ -110,7 +118,10 @@ class LoginApiClient { String url = "${ApiConsts.authRest}Get_BasicUserInformation"; Map postParams = {"P_APP_VERSION": pAppVersion, "P_USER_NAME": pUsername}; postParams.addAll(AppState().postParamsJson); - return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams); + dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams); + ApiResponse res = ApiResponse.fromJson(response); + return await ApiClassMapper().handleApiEndpoint(endpoint: "Get_BasicUserInformation", jsonData: res.data); + // return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams); } Future sendPublicActivationCode(String? mobileNumber, String? pUsername) async { diff --git a/lib/models/get_mobile_login_info_list_model.dart b/lib/models/get_mobile_login_info_list_model.dart index a2f7799..06292b5 100644 --- a/lib/models/get_mobile_login_info_list_model.dart +++ b/lib/models/get_mobile_login_info_list_model.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + class GetMobileLoginInfoListModel { int? iD; int? employeeID; @@ -61,4 +63,10 @@ class GetMobileLoginInfoListModel { data['BusinessCardPrivilege'] = businessCardPrivilege; return data; } + + + factory GetMobileLoginInfoListModel.fromRawJson(String str) => GetMobileLoginInfoListModel.fromJson(json.decode(str)); + } + + diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index d2b4a10..8c673e4 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -59,6 +59,7 @@ class _VerifyLastLoginScreenState extends State { @override Widget build(BuildContext context) { if (ModalRoute.of(context)!.settings.arguments != null) { + print("Arguments: ${ModalRoute.of(context)!.settings.arguments}"); mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; // String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; String empName = mobileLoginInfoListModel!.employeeName!; diff --git a/pubspec.yaml b/pubspec.yaml index 517aa4a..042fea0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -120,7 +120,8 @@ dependencies: # saf: ^1.0.3+4 -#dependency_overrides: +dependency_overrides: + intl: ^0.19.0 dev_dependencies: