diff --git a/.run/main.dart.run.xml b/.run/main.dart.run.xml index 4767aff8..0f48346d 100644 --- a/.run/main.dart.run.xml +++ b/.run/main.dart.run.xml @@ -1,5 +1,9 @@ + diff --git a/android/app/.cxx/Debug/4y161to1/arm64-v8a/CMakeCache.txt b/android/app/.cxx/Debug/4y161to1/arm64-v8a/CMakeCache.txt index f440f639..4d0d567f 100644 --- a/android/app/.cxx/Debug/4y161to1/arm64-v8a/CMakeCache.txt +++ b/android/app/.cxx/Debug/4y161to1/arm64-v8a/CMakeCache.txt @@ -121,7 +121,7 @@ CMAKE_EXPORT_COMPILE_COMMANDS:UNINITIALIZED=ON CMAKE_INSTALL_PREFIX:PATH=/usr/local //No help, variable specified on the command line. -CMAKE_LIBRARY_OUTPUT_DIRECTORY:UNINITIALIZED=/Users/venbateam/Documents/UAE_Stats/FCSC/frontend/build/app/intermediates/cxx/Debug/4y161to1/obj/arm64-v8a +CMAKE_LIBRARY_OUTPUT_DIRECTORY:UNINITIALIZED=/Users/venbateam/Documents/UAE_Stats/FCSC/stats/build/app/intermediates/cxx/Debug/4y161to1/obj/arm64-v8a //Path to a program. CMAKE_LINKER:FILEPATH=/Users/venbateam/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/bin/ld.lld diff --git a/android/app/build.gradle b/android/app/build.gradle index 5ef4c760..4602c6b5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) { def flutterVersionCode = localProperties.getProperty("flutter.versionCode") if (flutterVersionCode == null) { - flutterVersionCode = "5" + flutterVersionCode = "69" } def flutterVersionName = localProperties.getProperty("flutter.versionName") if (flutterVersionName == null) { - flutterVersionName = "1.0.5" + flutterVersionName = "1.0.68" } def keystorePropertiesFile = rootProject.file("key.properties") diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a26708e9..7af982c5 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -37,6 +37,7 @@ + diff --git a/android/build.gradle b/android/build.gradle index f721bd9c..81f8ba72 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' // Update this if needed + classpath 'com.android.tools.build:gradle:8.6.0' // Update this if needed classpath 'com.google.gms:google-services:4.3.10' // ✅ Required for Firebase } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 5e6b5427..45181329 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b92e9ca2..104f91b2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -61,6 +61,8 @@ PODS: - flutter_secure_storage_darwin (10.0.0): - Flutter - FlutterMacOS + - flutter_web_auth_2 (3.0.0): + - Flutter - fluttertoast (0.0.2): - Flutter - google_sign_in_ios (0.0.1): @@ -146,6 +148,7 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`) + - flutter_web_auth_2 (from `.symlinks/plugins/flutter_web_auth_2/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) @@ -196,6 +199,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_native_splash/ios" flutter_secure_storage_darwin: :path: ".symlinks/plugins/flutter_secure_storage_darwin/darwin" + flutter_web_auth_2: + :path: ".symlinks/plugins/flutter_web_auth_2/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" google_sign_in_ios: @@ -236,6 +241,7 @@ SPEC CHECKSUMS: Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_native_splash: 6cad9122ea0fad137d23137dd14b937f3e90b145 flutter_secure_storage_darwin: ce237a8775b39723566dc72571190a3769d70468 + flutter_web_auth_2: 5c8d9dcd7848b5a9efb086d24e7a9adcae979c80 fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 google_sign_in_ios: 205742c688aea0e64db9da03c33121694a365109 GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 47057df0..a2218b00 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -337,10 +337,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; @@ -376,10 +380,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; @@ -498,7 +506,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets; DEVELOPMENT_TEAM = 9N5SRFUGK2; ENABLE_BITCODE = NO; @@ -509,7 +517,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.12; + MARKETING_VERSION = 1.0.13; PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -533,7 +541,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.stats.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -551,7 +559,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.stats.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -567,7 +575,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.stats.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -697,7 +705,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets; DEVELOPMENT_TEAM = 9N5SRFUGK2; ENABLE_BITCODE = NO; @@ -708,7 +716,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.12; + MARKETING_VERSION = 1.0.13; PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -734,7 +742,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets; DEVELOPMENT_TEAM = 9N5SRFUGK2; ENABLE_BITCODE = NO; @@ -745,7 +753,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.12; + MARKETING_VERSION = 1.0.13; PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index a9e81ae3..b09a4e62 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -24,14 +24,22 @@ ???? CFBundleURLTypes + + CFBundleURLName + ae.gov.fcsc.stats + CFBundleURLSchemes + + ae.gov.fcsc.stats + + - CFBundleURLName - fcsc-da580.web.app - CFBundleURLSchemes - - https - - + CFBundleURLName + fcsc-da580.web.app + CFBundleURLSchemes + + https + + CFBundleVersion $(FLUTTER_BUILD_NUMBER) diff --git a/lib/config/api_config.dart b/lib/config/api_config.dart index c32efc27..997fb132 100644 --- a/lib/config/api_config.dart +++ b/lib/config/api_config.dart @@ -1,5 +1,5 @@ // api_config.dart // const String apiUrl = 'http://127.0.0.1:8090'; // const String apiUrl = 'https://pbdev.venbait.in/'; -const String apiUrl = 'https://pb.venbait.in/'; -// const String apiUrl = 'https://pocket.fcsc.gov.ae/'; +// const String apiUrl = 'https://pb.venbait.in/'; +const String apiUrl = 'https://pocket.fcsc.gov.ae/'; diff --git a/lib/config/sessionCheckScreen.dart b/lib/config/sessionCheckScreen.dart index 12afd8c3..6b770619 100644 --- a/lib/config/sessionCheckScreen.dart +++ b/lib/config/sessionCheckScreen.dart @@ -235,7 +235,7 @@ class SplashScreen extends StatelessWidget { // class _SessionCheckScreenState extends State { // final PAuthRepo _pAuthRepo = PAuthRepo(); // final AuthRepository _authRepo = AuthRepository(); -// final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend"; +// final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.stats"; // // @override // void initState() { @@ -344,7 +344,7 @@ class SplashScreen extends StatelessWidget { // // class _SessionCheckScreenState extends State { // // final PAuthRepo _pAuthRepo = PAuthRepo(); // // final AuthRepository _authRepo = AuthRepository(); -// // final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend"; +// // final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.stats"; // // // // @override // // void initState() { diff --git a/lib/main.dart b/lib/main.dart index c8bdd643..377c8819 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -196,6 +196,8 @@ class _MainAppState extends ConsumerState { appsflyerSdk.initSdk( registerOnDeepLinkingCallback: true, + registerConversionDataCallback: true, + registerOnAppOpenAttributionCallback: true, ); appsflyerSdk.onDeepLinking((DeepLinkResult result){ diff --git a/lib/presentation/Screens/charts/screens/chart_screen.dart b/lib/presentation/Screens/charts/screens/chart_screen.dart index 12204ac2..de9a85a1 100644 --- a/lib/presentation/Screens/charts/screens/chart_screen.dart +++ b/lib/presentation/Screens/charts/screens/chart_screen.dart @@ -3061,35 +3061,34 @@ class _ChartScreen1State extends ConsumerState { children: [ // ConstrainedBox Container( - height: (chartsData[index][ - 'chart_height'] == - null || - chartsData[index][ - 'chart_height'] == - 0) - ? 350 - : double.tryParse( - chartsData[index] - ['chart_height'] - .toString()), - // height: (chartsData[index] - // ['chart_type'] == - // 'pie_chart') - // ? 500 - // : (chartsData[index][ - // 'chart_type'] == - // 'bar_chart_horizontal') - // ? 370 - // : (chartsData[index][ - // 'chart_type'] == - // 'horizontal_rotate') - // ? 385 - // : (chartsData[index] - // [ - // 'chart_type'] == - // 'fl_stacked_bar') - // ? 390 - // : 350, + height: () { + final chartHeight = chartsData[index]['chart_height']; + final chartType = chartsData[index]['chart_type_json']?['chart_type']; + final responseLength = (chartsData[index]['response'] as List?)?.length ?? 0; + + if (chartType == 'horizontal_rotate') { + // Base 350 + add 30 for each response item + return chartHeight + (responseLength * 20.0); + } + + if (chartHeight == null || chartHeight == 0) { + return 350.0; // default + } + + return double.tryParse(chartHeight.toString()) ?? 350.0; + }(), + // height: (chartsData[index][ + // 'chart_height'] == + // null || + // chartsData[index][ + // 'chart_height'] == + // 0) + // ? 350 + // : double.tryParse( + // chartsData[index] + // ['chart_height'] + // .toString()), + // child: buildChart(chartsData[index]), child: ChartWidget( @@ -3302,6 +3301,26 @@ class CardWidget extends StatelessWidget { (chartScreenData['body_color'] ?? '#898C81') .replaceFirst('#', '0xff'))); + // Determine if icon should be hidden + final hideIcon = chartScreenData['data_set'] == 'population_growth' || + chartScreenData['data_set'] == 'labour_force' || + chartScreenData['data_set'] == 'labour_force1'; + + // Determine the color + final displayColor = hideIcon || (response[0]['font_color'] ?? '').isEmpty + ? bodyColor + : _getColorFromHex(response[0]['font_color']); + +// Determine the icon and color + Icon? valueIcon; + if (!hideIcon && (response[0]['font_color'] ?? '').isNotEmpty) { + if (response[0]['font_color'] == '#D83731') { + valueIcon = const Icon(Icons.arrow_downward, color: Colors.red, size: 20); + } else if (response[0]['font_color'] == '#11AF22') { + valueIcon = const Icon(Icons.arrow_upward, color: Colors.green, size: 20); + } + } + if (response.isEmpty) { return SizedBox.shrink(); } else if (response.length == 1) { @@ -3589,20 +3608,22 @@ class CardWidget extends StatelessWidget { ), fontSize: 23, fontWeight: FontWeight.w900, - color: (response[0]['font_color'] ?? '').isEmpty - ? bodyColor - : _getColorFromHex(response[0]['font_color']), + color: displayColor, + // color: (response[0]['font_color'] ?? '').isEmpty + // ? bodyColor + // : _getColorFromHex(response[0]['font_color']), ), ), const SizedBox(width: 1), // Space between text and icon - if (response[0]['font_color'] != '') ...[ - if (response[0]['font_color'] == '#D83731') - const Icon(Icons.arrow_downward, - color: Colors.red, size: 20) - else if (response[0]['font_color'] == '#11AF22') - const Icon(Icons.arrow_upward, - color: Colors.green, size: 20), - ], + if (valueIcon != null) valueIcon, + // if (!hideIcon && response[0]['font_color'] != '') ...[ + // if (response[0]['font_color'] == '#D83731') + // const Icon(Icons.arrow_downward, + // color: Colors.red, size: 20) + // else if (response[0]['font_color'] == '#11AF22') + // const Icon(Icons.arrow_upward, + // color: Colors.green, size: 20), + // ], ], ), @@ -3628,23 +3649,25 @@ class CardWidget extends StatelessWidget { ), fontSize: 16, fontWeight: FontWeight.w600, - color: (response[1]['font_color'] ?? '').isEmpty - ? const Color(0xFFD83731) - : _getColorFromHex(response[1]['font_color']), + color: displayColor, + // color: (response[1]['font_color'] ?? '').isEmpty + // ? bodyColor + // : _getColorFromHex(response[1]['font_color']), ), textAlign: TextAlign.center, // Ensure proper alignment overflow: TextOverflow.ellipsis, // Truncate if text overflows ), const SizedBox(width: 1), // Space between text and icon - if (response[1]['font_color'] != '') ...[ - if (response[1]['font_color'] == '#D83731') - const Icon(Icons.arrow_downward, - color: Colors.red, size: 20) - else if (response[1]['font_color'] == '#11AF22') - const Icon(Icons.arrow_upward, - color: Colors.green, size: 20), - ], + if (valueIcon != null) valueIcon, + // if (response[1]['font_color'] != '') ...[ + // if (response[1]['font_color'] == '#D83731') + // const Icon(Icons.arrow_downward, + // color: Colors.red, size: 20) + // else if (response[1]['font_color'] == '#11AF22') + // const Icon(Icons.arrow_upward, + // color: Colors.green, size: 20), + // ], ], ), diff --git a/lib/presentation/Screens/charts/widgets/chart_widget.dart b/lib/presentation/Screens/charts/widgets/chart_widget.dart index b51db701..ca37d33f 100644 --- a/lib/presentation/Screens/charts/widgets/chart_widget.dart +++ b/lib/presentation/Screens/charts/widgets/chart_widget.dart @@ -36,7 +36,7 @@ class ChartWidget extends StatelessWidget { ], "SOCIAL": [ Color(0xFF675863), // base - Color(0xFF7A6B76), + Color(0xFFA89AA5), Color(0xFF8C7E8A), Color(0xFFA0909D), Color(0xFFB4A3B0), @@ -83,7 +83,7 @@ class ChartWidget extends StatelessWidget { ], "SOCIAL": [ Color(0xFF675863), // base - Color(0xFF7A6B76), + Color(0xFFA89AA5), Color(0xFF8C7E8A), Color(0xFFA0909D), Color(0xFFB4A3B0), @@ -99,14 +99,14 @@ class ChartWidget extends StatelessWidget { final Map> colorMapForThree = { "ECONOMY": [Color(0xFF89AFD8), Color(0xFF6D99CC), Color(0xFF4F82BA)], - "SOCIAL": [Color(0xFF675863), Color(0xFF7A6B76), Color(0xFF8C7E8A)], + "SOCIAL": [Color(0xFF675863), Color(0xFFA89AA5), Color(0xFF8C7E8A)], "ENVIRONMENT": [Color(0xFFB3CF99), Color(0xFF9DC280), Color(0xFF86B568)], }; // Define color lists final Map> colorMapForTwo = { "ECONOMY": [Color(0xFF89AFD8), Color(0xFF6D99CC)], - "SOCIAL": [Color(0xFF675863), Color(0xFF7A6B76)], + "SOCIAL": [Color(0xFF675863), Color(0xFFA89AA5)], "ENVIRONMENT": [Color(0xFFB3CF99), Color(0xFF9DC280)], }; @@ -3716,9 +3716,9 @@ class ChartWidget extends StatelessWidget { }); return Scaffold( - backgroundColor: isDarkTheme ? Colors.transparent : Colors.white, + backgroundColor: isDarkTheme ? Colors.transparent : Colors.transparent, body: Padding( - padding: const EdgeInsets.all(10), + padding: const EdgeInsets.all(5), child: LayoutBuilder( builder: (context, constraints) { final chartWidth = constraints.maxWidth; @@ -3781,10 +3781,9 @@ class ChartWidget extends StatelessWidget { : Colors.black, fontSize: 10, ); - // Show only for full years - if (value.toInt() >= 2013 && - value.toInt() <= 2022) { + // if (value.toInt() >= 2013 && + // value.toInt() <= 2023) { return Column( mainAxisSize: MainAxisSize.min, children: [ @@ -3802,7 +3801,7 @@ class ChartWidget extends StatelessWidget { style: style), ], ); - } + // } return const SizedBox.shrink(); }, reservedSize: 30, @@ -5126,6 +5125,52 @@ class ChartWidget extends StatelessWidget { } } +// Widget _buildChartLegend( +// Map> groupedCrops, +// Map parsedChartBarColors, +// List uniqueColors, +// BuildContext context, +// ) { +// // Extract unique crop types +// Set uniqueCropTypes = +// groupedCrops.values.expand((list) => list).toSet(); +// +// print('HorizontalLegends2 - $uniqueCropTypes'); +// +// return Wrap( +// alignment: WrapAlignment.center, +// spacing: 12, +// runSpacing: 6, +// children: uniqueCropTypes.map((cropType) { +// // Get index for cycling colors from uniqueColors +// int index = uniqueCropTypes.toList().indexOf(cropType); +// Color cropColor = uniqueColors[index % uniqueColors.length]; +// +// return Row( +// mainAxisSize: MainAxisSize.min, +// children: [ +// CircleAvatar( +// radius: 6, +// backgroundColor: cropColor, // ✅ always from uniqueColors +// ), +// const SizedBox(width: 4), +// Text( +// cropType, +// style: TextStyle( +// fontSize: 12, +// fontFamily: context.translate( +// 'Roboto', +// 'NotoKufi', +// ), +// ), +// ), +// ], +// ); +// }).toList(), +// ); +// } + + Widget _buildChartLegend( Map> groupedCrops, Map parsedChartBarColors, diff --git a/lib/presentation/routes/auth_routes/login_route.dart b/lib/presentation/routes/auth_routes/login_route.dart index 5b465f4e..61a0da8a 100644 --- a/lib/presentation/routes/auth_routes/login_route.dart +++ b/lib/presentation/routes/auth_routes/login_route.dart @@ -46,6 +46,7 @@ import '../../components/my_toggle.dart'; class LoginRoute extends HookConsumerWidget { // final pb = PocketBase('https://pb.venbait.in'); final pb = PocketBase(apiUrl); + static const deepLinkRedirect = 'ae.gov.fcsc.stats://auth-callback'; final FlutterSecureStorage _secureStorage = const FlutterSecureStorage(); // final _pb = PocketBase('http://127.0.0.1:8090'); // final bool isLoginScreen; // Pass `true` if this is the login screen @@ -365,8 +366,25 @@ class LoginRoute extends HookConsumerWidget { try { final authData = await pb.collection('users').authWithOAuth2(platform, (url) async { - await launchUrl(url); + await launchUrl(url); }); + // final authData = await pb.collection('users').authWithOAuth2( + // platform, // 'google' or 'apple' + // (providerUrl) async { + // final Uri uri = Uri.parse(providerUrl.toString()); + // + // // Inject redirect_url so PocketBase will redirect to the app when done + // final newUri = uri.replace(queryParameters: { + // ...uri.queryParameters, + // 'redirect_url': deepLinkRedirect, + // }); + // + // // Open in external browser (ensures OS handles returning to app) + // if (!await launchUrl(newUri, mode: LaunchMode.externalApplication)) { + // throw 'Could not launch OAuth URL'; + // } + // }, + // ); print(authData); // ✅ Check if authData is valid if (authData.token.isNotEmpty && authData.record != null) { @@ -375,6 +393,7 @@ class LoginRoute extends HookConsumerWidget { final metaDetails = authData.meta; final userDetails = authData.record; + final token = authData.token; final userId = userDetails?.id; final email = userDetails?.data['email'] ?? ''; final isProfileComplete = @@ -386,11 +405,6 @@ class LoginRoute extends HookConsumerWidget { print("Email: ${isProfileComplete}"); print("Email: ${loginCount}"); - await loginCountApi(userId!); - await updateOAuthUserDetails(userId!, metaDetails, ref); - // await saveUserId(userId!, loginCount); - // await getDeviceToken(context, userId); - await initializeTheme(context, ref, userId); final session = await context.loaderWithErrorDialog( () => ref @@ -420,6 +434,13 @@ class LoginRoute extends HookConsumerWidget { print("sessionTST - $session"); + + await loginCountApi(userId!); + await updateOAuthUserDetails(userId!, metaDetails, ref,token); + // await saveUserId(userId!, loginCount); + // await getDeviceToken(context, userId); + await initializeTheme(context, ref, userId); + // final se = _sessionEntityFromPocketbaseRecord(authData); // await _LocalAuthRepo.storeLocally(se); @@ -448,9 +469,9 @@ class LoginRoute extends HookConsumerWidget { } } catch (e) { print("❌ Error during Google login: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Login failed. Please try again.")), - ); + // ScaffoldMessenger.of(context).showSnackBar( + // SnackBar(content: Text("Login failed. Please try again.")), + // ); } } @@ -480,7 +501,8 @@ class LoginRoute extends HookConsumerWidget { } Future updateOAuthUserDetails( - String userId, metaDetails, WidgetRef ref) async { + String userId, metaDetails, WidgetRef ref,token) async { + print('Update token : ${token}'); // final url = "${pb.baseUrl}api/collections/users/records/$userId"; try { @@ -509,7 +531,7 @@ class LoginRoute extends HookConsumerWidget { userId, headers: { 'Content-Type': 'application/json', // Add this - 'Authorization': PocketBaseService.authStore.token, // Correct way to send auth token + 'Authorization': 'Bearer $token', // Correct way to send auth token }, body: { "user_mail_verify": true, diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 586789f0..340864b0 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,11 +8,13 @@ import Foundation import app_links import app_settings import connectivity_plus +import desktop_webview_window import device_info_plus import file_selector_macos import firebase_core import firebase_messaging import flutter_secure_storage_darwin +import flutter_web_auth_2 import google_sign_in_ios import package_info_plus import path_provider_foundation @@ -21,16 +23,19 @@ import shared_preferences_foundation import url_launcher_macos import video_player_avfoundation import webview_flutter_wkwebview +import window_to_front func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin")) ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) + DesktopWebviewWindowPlugin.register(with: registry.registrar(forPlugin: "DesktopWebviewWindowPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin")) FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin")) + FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) @@ -39,4 +44,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) + WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin")) } diff --git a/public/.well-known/5-3share complete.txt b/public/.well-known/5-3share complete.txt index 989e25ee..dcb44adb 100644 --- a/public/.well-known/5-3share complete.txt +++ b/public/.well-known/5-3share complete.txt @@ -107,7 +107,7 @@ class _SessionCheckScreenState extends State { // class _SessionCheckScreenState extends State { // final PAuthRepo _pAuthRepo = PAuthRepo(); // final AuthRepository _authRepo = AuthRepository(); -// final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend"; +// final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.stats"; // // @override // void initState() { @@ -216,7 +216,7 @@ class _SessionCheckScreenState extends State { // // class _SessionCheckScreenState extends State { // // final PAuthRepo _pAuthRepo = PAuthRepo(); // // final AuthRepository _authRepo = AuthRepository(); -// // final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend"; +// // final String playStoreUrl = "https://play.google.com/store/apps/details?id=ae.gov.fcsc.stats"; // // // // @override // // void initState() { diff --git a/pubspec.lock b/pubspec.lock index d2081637..9216ddcd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -401,6 +401,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.11" + desktop_webview_window: + dependency: transitive + description: + name: desktop_webview_window + sha256: "57cf20d81689d5cbb1adfd0017e96b669398a669d927906073b0e42fc64111c0" + url: "https://pub.dev" + source: hosted + version: "0.2.3" device_info_plus: dependency: "direct main" description: @@ -743,6 +751,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_auth_2: + dependency: "direct main" + description: + name: flutter_web_auth_2 + sha256: "3c14babeaa066c371f3a743f204dd0d348b7d42ffa6fae7a9847a521aff33696" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + flutter_web_auth_2_platform_interface: + dependency: transitive + description: + name: flutter_web_auth_2_platform_interface + sha256: c63a472c8070998e4e422f6b34a17070e60782ac442107c70000dd1bed645f4d + url: "https://pub.dev" + source: hosted + version: "4.1.0" flutter_web_plugins: dependency: transitive description: flutter @@ -1879,6 +1903,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + window_to_front: + dependency: transitive + description: + name: window_to_front + sha256: "7aef379752b7190c10479e12b5fd7c0b9d92adc96817d9e96c59937929512aee" + url: "https://pub.dev" + source: hosted + version: "0.0.3" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 704f9ed8..bf1ef611 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,8 @@ name: uae_stat description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness." publish_to: "none" -#version: 1.0.65+66 -version: 1.0.12+13 +version: 1.0.68+69 +#version: 1.0.13+14 #version: 1.0.5+5 environment: @@ -79,6 +79,7 @@ dependencies: appsflyer_sdk: ^6.16.2 dotted_border: ^2.1.0 google_sign_in: ^7.1.1 + flutter_web_auth_2: ^4.1.0 dependency_overrides: fading_edge_scrollview: ^4.1.1