chart bug fix google and apple signin

This commit is contained in:
Surendiran 2025-10-13 12:05:58 +05:30
parent 9bbf370aa7
commit 26cf708671
19 changed files with 259 additions and 101 deletions

View File

@ -1,5 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="additionalArgs" value="--web-browser-flag &quot;--disable-web-security" />
<option name="envs">
<entry key="google-chrome --disable-web-security --user-data-dir" value="~/chromeTemp" />
</option>
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" />
</configuration>

View File

@ -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

View File

@ -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")

View File

@ -37,6 +37,7 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="ae.gov.fcsc.stats" android:host="auth-callback" />
<data android:scheme="https" android:host="fcscapp.onelink.me" />
</intent-filter>
<!-- <intent-filter>-->

View File

@ -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
}
}

View File

@ -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

View File

@ -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

View File

@ -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 = "";

View File

@ -24,14 +24,22 @@
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>ae.gov.fcsc.stats</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ae.gov.fcsc.stats</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>fcsc-da580.web.app</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
</array>
</dict>
<key>CFBundleURLName</key>
<string>fcsc-da580.web.app</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>

View File

@ -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/';

View File

@ -235,7 +235,7 @@ class SplashScreen extends StatelessWidget {
// class _SessionCheckScreenState extends State<SessionCheckScreen> {
// 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<SessionCheckScreen> {
// // 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() {

View File

@ -196,6 +196,8 @@ class _MainAppState extends ConsumerState<MainApp> {
appsflyerSdk.initSdk(
registerOnDeepLinkingCallback: true,
registerConversionDataCallback: true,
registerOnAppOpenAttributionCallback: true,
);
appsflyerSdk.onDeepLinking((DeepLinkResult result){

View File

@ -3061,35 +3061,34 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
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),
// ],
],
),

View File

@ -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<String, List<Color>> 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<String, List<Color>> 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<String, List<String>> groupedCrops,
// Map<String, Color> parsedChartBarColors,
// List<Color> uniqueColors,
// BuildContext context,
// ) {
// // Extract unique crop types
// Set<String> 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<String, List<String>> groupedCrops,
Map<String, Color> parsedChartBarColors,

View File

@ -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<void> 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,

View File

@ -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"))
}

View File

@ -107,7 +107,7 @@ class _SessionCheckScreenState extends State<SessionCheckScreen> {
// class _SessionCheckScreenState extends State<SessionCheckScreen> {
// 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<SessionCheckScreen> {
// // class _SessionCheckScreenState extends State<SessionCheckScreen> {
// // 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() {

View File

@ -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:

View File

@ -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