bug fix
This commit is contained in:
parent
59955d3bdd
commit
dfd569a068
@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
|
|||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = "39"
|
flutterVersionCode = "40"
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = "1.0.38"
|
flutterVersionName = "1.0.39"
|
||||||
}
|
}
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
|||||||
@ -33,8 +33,10 @@
|
|||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="http" android:host="fcsc-da580.web.app"/>
|
<data
|
||||||
<data android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:host="fcsc-a161c.web.app"
|
||||||
|
android:pathPrefix="/chartScreen"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<!-- <intent-filter >-->
|
<!-- <intent-filter >-->
|
||||||
<!-- <action android:name="android.intent.action.VIEW" />-->
|
<!-- <action android:name="android.intent.action.VIEW" />-->
|
||||||
|
|||||||
@ -63,6 +63,10 @@
|
|||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>FirebaseDynamicLinksCustomDomains</key>
|
||||||
|
<array>
|
||||||
|
<string>https://fcsc-a161c.web.app</string>
|
||||||
|
</array>
|
||||||
<key>UIStatusBarHidden</key>
|
<key>UIStatusBarHidden</key>
|
||||||
<false/>
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@ -1,34 +1,84 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/domain/entities/session_entity.dart';
|
import 'package:uae_stat/domain/entities/session_entity.dart';
|
||||||
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class SessionCheckScreen extends StatefulWidget {
|
class SessionCheckScreen extends ConsumerStatefulWidget {
|
||||||
@override
|
@override
|
||||||
_SessionCheckScreenState createState() => _SessionCheckScreenState();
|
_SessionCheckScreenState createState() => _SessionCheckScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SessionCheckScreenState extends State<SessionCheckScreen> {
|
class _SessionCheckScreenState extends ConsumerState<SessionCheckScreen> {
|
||||||
|
final pb = PocketBase(apiUrl);
|
||||||
final PAuthRepo _authRepo = PAuthRepo();
|
final PAuthRepo _authRepo = PAuthRepo();
|
||||||
|
dynamic preferredLanguage;
|
||||||
|
bool _isLoading = true;
|
||||||
|
|
||||||
String get playStoreUrl => "https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend";
|
String get playStoreUrl =>
|
||||||
|
"https://play.google.com/store/apps/details?id=ae.gov.fcsc.frontend";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
await userDetails();
|
||||||
_checkSession();
|
_checkSession();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> userDetails() async {
|
||||||
|
try {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final userId = prefs.getString('userId');
|
||||||
|
|
||||||
|
// Authenticate admin d
|
||||||
|
final adminAuth = await pb.admins.authWithPassword(
|
||||||
|
'pb@venbainfotech.com',
|
||||||
|
'pb@venbainfotech.com',
|
||||||
|
);
|
||||||
|
final String adminToken = adminAuth.token;
|
||||||
|
print('adminToken: $adminToken');
|
||||||
|
|
||||||
|
// Fetch user details
|
||||||
|
final userDetailsResponse = await pb.collection('users').getOne(
|
||||||
|
userId!,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $adminToken',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
print('userDetailsLogin: $userDetailsResponse');
|
||||||
|
|
||||||
|
preferredLanguage = userDetailsResponse.data['language'] ?? '';
|
||||||
|
|
||||||
|
print('preferredLanguage login $preferredLanguage');
|
||||||
|
|
||||||
|
// **Set Default Locale in Provider**
|
||||||
|
if (preferredLanguage == 'ar') {
|
||||||
|
ref.read(localeProvider.notifier).setLocale(const Locale('ar'));
|
||||||
|
} else {
|
||||||
|
ref.read(localeProvider.notifier).setLocale(const Locale('en'));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error fetching user details: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _checkSession() async {
|
Future<void> _checkSession() async {
|
||||||
await Future.delayed(Duration(seconds: 2)); // Optional splash delay
|
await Future.delayed(Duration(seconds: 2)); // Optional splash delay
|
||||||
final SessionEntity? session = await _authRepo.fetchLocallyStored();
|
final SessionEntity? session = await _authRepo.fetchLocallyStored();
|
||||||
final GoRouterState state = GoRouterState.of(context);
|
final GoRouterState state = GoRouterState.of(context);
|
||||||
final String? intendedPath = state.uri.toString().isNotEmpty && state.uri.path != '/'
|
final String? intendedPath =
|
||||||
? state.uri.path
|
state.uri.toString().isNotEmpty && state.uri.path != '/'
|
||||||
: null;
|
? state.uri.path
|
||||||
|
: null;
|
||||||
|
|
||||||
print('fetchLocallyStored $session');
|
print('fetchLocallyStored $session');
|
||||||
print('navigating to intended path: $intendedPath');
|
print('navigating to intended path: $intendedPath');
|
||||||
@ -53,7 +103,9 @@ class _SessionCheckScreenState extends State<SessionCheckScreen> {
|
|||||||
// User is not logged in, redirect to login with intended path if present
|
// User is not logged in, redirect to login with intended path if present
|
||||||
print('session expired, redirecting to login');
|
print('session expired, redirecting to login');
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
context.go('/login', extra: intendedPath != null ? {'intendedPath': intendedPath} : null);
|
context.go('/login',
|
||||||
|
extra:
|
||||||
|
intendedPath != null ? {'intendedPath': intendedPath} : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -63,6 +115,9 @@ class _SessionCheckScreenState extends State<SessionCheckScreen> {
|
|||||||
_redirectToPlayStore();
|
_redirectToPlayStore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false; // Stop showing splash
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _redirectToPlayStore() async {
|
Future<void> _redirectToPlayStore() async {
|
||||||
@ -75,10 +130,30 @@ class _SessionCheckScreenState extends State<SessionCheckScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox.shrink();
|
return _isLoading
|
||||||
|
? SplashScreen() // Show splash while loading
|
||||||
|
: SizedBox.shrink();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SplashScreen extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/images/logo.png', width: 150), // App Logo
|
||||||
|
// SizedBox(height: 20),
|
||||||
|
// CircularProgressIndicator(), // Loading indicator
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// import 'dart:math';
|
// import 'dart:math';
|
||||||
//
|
//
|
||||||
|
|||||||
@ -262,7 +262,7 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
// ),
|
// ),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding:
|
contentPadding:
|
||||||
EdgeInsets.symmetric(vertical: 0.5, horizontal: 18.0),
|
EdgeInsets.symmetric(vertical: 9, horizontal: 18.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -47,6 +47,29 @@ class ChartWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
final Map<String, List<Color>> colorMapForFour = {
|
||||||
|
"ECONOMY": [
|
||||||
|
Color(0xFF648CBA),
|
||||||
|
Color(0xFF90B0D5),
|
||||||
|
Color(0xFF98BCE5),
|
||||||
|
Color(0xFFA7B5C5),
|
||||||
|
Color(0xFFBED3EC),
|
||||||
|
],
|
||||||
|
"SOCIAL": [
|
||||||
|
Color(0xFFD9BB99),
|
||||||
|
Color(0xFF87766E),
|
||||||
|
Color(0xFFC6A885),
|
||||||
|
Color(0xFFA28565),
|
||||||
|
Color(0xFFBFB29B),
|
||||||
|
],
|
||||||
|
"ENVIRONMENT": [
|
||||||
|
Color(0xFF376C79),
|
||||||
|
Color(0xFF578D9C),
|
||||||
|
Color(0xFF7DAFBC),
|
||||||
|
Color(0xFF86C7D9),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
final Map<String, List<Color>> colorMapForThree = {
|
final Map<String, List<Color>> colorMapForThree = {
|
||||||
"ECONOMY": [
|
"ECONOMY": [
|
||||||
Color(0xFF648CBA),
|
Color(0xFF648CBA),
|
||||||
@ -116,6 +139,17 @@ class ChartWidget extends StatelessWidget {
|
|||||||
return colorMapForThree[key] ?? [Colors.grey];
|
return colorMapForThree[key] ?? [Colors.grey];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Color> get uniqueColorsForFour {
|
||||||
|
final Map<String, String> translations = {
|
||||||
|
'اقتصاد': 'ECONOMY',
|
||||||
|
'اجتماعي': 'SOCIAL',
|
||||||
|
'بيئة': 'ENVIRONMENT',
|
||||||
|
};
|
||||||
|
|
||||||
|
String key = translations[chartHeader] ?? chartHeader;
|
||||||
|
return colorMapForFour[key] ?? [Colors.grey];
|
||||||
|
}
|
||||||
|
|
||||||
String capitalizeAndSplit(String input) {
|
String capitalizeAndSplit(String input) {
|
||||||
return input
|
return input
|
||||||
.split('_')
|
.split('_')
|
||||||
@ -1009,6 +1043,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
titlesData: titlesData1(uniqueXValuesProcessed),
|
titlesData: titlesData1(uniqueXValuesProcessed),
|
||||||
borderData: borderData(),
|
borderData: borderData(),
|
||||||
lineBarsData: lineBars,
|
lineBarsData: lineBars,
|
||||||
|
// minY: 10000,
|
||||||
// minX: uniqueXValues.reduce((a, b) => a < b ? a : b),
|
// minX: uniqueXValues.reduce((a, b) => a < b ? a : b),
|
||||||
// maxX: uniqueXValues.reduce((a, b) => a > b ? a : b),
|
// maxX: uniqueXValues.reduce((a, b) => a > b ? a : b),
|
||||||
// minX: uniqueXValuesProcessed.reduce((a, b) => a < b ? a : b),
|
// minX: uniqueXValuesProcessed.reduce((a, b) => a < b ? a : b),
|
||||||
@ -2391,7 +2426,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
width: 120,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.right,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
@ -2979,7 +3014,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
// print("Bottomtiles");
|
// print("Bottomtiles");
|
||||||
// print(value);
|
// print(value);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 4, left: 20.0),
|
padding: const EdgeInsets.only(top: 10, left: 20.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 40,
|
width: 40,
|
||||||
child: Transform.rotate(
|
child: Transform.rotate(
|
||||||
@ -3320,6 +3355,10 @@ class ChartWidget extends StatelessWidget {
|
|||||||
barColor =
|
barColor =
|
||||||
uniqueColorsForThree[colorIndex % uniqueColorsForThree.length];
|
uniqueColorsForThree[colorIndex % uniqueColorsForThree.length];
|
||||||
colorIndex++;
|
colorIndex++;
|
||||||
|
} else if (chartData['dataset'] == 'oil_and_gas') {
|
||||||
|
barColor =
|
||||||
|
uniqueColorsForFour[colorIndex % uniqueColorsForFour.length];
|
||||||
|
colorIndex++;
|
||||||
} else {
|
} else {
|
||||||
barColor = uniqueColors[colorIndex % uniqueColors.length];
|
barColor = uniqueColors[colorIndex % uniqueColors.length];
|
||||||
colorIndex++;
|
colorIndex++;
|
||||||
|
|||||||
@ -491,6 +491,11 @@ class _EditProfileState extends ConsumerState<EditProfile> {
|
|||||||
ref.listen<Locale?>(localeProvider, (previous, next) async {
|
ref.listen<Locale?>(localeProvider, (previous, next) async {
|
||||||
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
||||||
await _userService.updateLanguage(localeCode);
|
await _userService.updateLanguage(localeCode);
|
||||||
|
setState(() {
|
||||||
|
isLoader = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
await _fetchUserData();
|
||||||
});
|
});
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
|
|||||||
@ -416,7 +416,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
|
|||||||
// ),
|
// ),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
vertical: 0.5, horizontal: 18.0),
|
vertical: 9, horizontal: 18.0),
|
||||||
),
|
),
|
||||||
onChanged: filterUsers,
|
onChanged: filterUsers,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -109,11 +109,10 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
jsonDecode(response.body); // Decode JSON
|
jsonDecode(response.body); // Decode JSON
|
||||||
|
|
||||||
if (jsonResponse['message'] == 'Success') {
|
if (jsonResponse['message'] == 'Success') {
|
||||||
setState(() async {
|
setState(() {
|
||||||
notifications = List<Map<String, dynamic>>.from(
|
notifications = List<Map<String, dynamic>>.from(
|
||||||
jsonResponse['data']); // Assign decoded data
|
jsonResponse['data']); // Assign decoded data
|
||||||
print('notifications $notifications');
|
print('notifications $notifications');
|
||||||
await Future.delayed(Duration(seconds: 5));
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"namespace": "android_app",
|
"namespace": "android_app",
|
||||||
"package_name": "ae.gov.fcsc.frontend",
|
"package_name": "ae.gov.fcsc.frontend",
|
||||||
"sha256_cert_fingerprints": [
|
"sha256_cert_fingerprints": [
|
||||||
"3D:BB:9E:B6:3E:80:50:6F:52:EB:73:B8:AD:F9:5F:5A:0A:05:BE:E4:CA:D1:AF:F7:26:2C:56:3F:35:1D:4E:81"
|
"E0:B4:6F:B9:8B:96:66:5B:EC:14:98:53:07:01:D4:DF:39:24:E8:1F:CD:A2:9E:E4:77:66:E0:B4:5B:C2:E0:94"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
name: uae_stat
|
name: uae_stat
|
||||||
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
|
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 1.0.38+39
|
version: 1.0.39+40
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.3 <4.0.0"
|
sdk: ">=3.2.3 <4.0.0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user