side bar profile issue
This commit is contained in:
parent
26cf708671
commit
a30d194f9c
@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = "69"
|
||||
flutterVersionCode = "6"
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = "1.0.68"
|
||||
flutterVersionName = "1.0.6"
|
||||
}
|
||||
|
||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||
|
||||
@ -1,68 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "62132243005",
|
||||
"project_id": "fcsc-a161c",
|
||||
"storage_bucket": "fcsc-a161c.firebasestorage.app"
|
||||
"project_number": "534109861443",
|
||||
"project_id": "fcsc-uae-stats-9cb1e",
|
||||
"storage_bucket": "fcsc-uae-stats-9cb1e.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:62132243005:android:18b7ca94608afaeb7c7854",
|
||||
"android_client_info": {
|
||||
"package_name": "ae.gov.fcsc.frontend"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "62132243005-rnqthdakjs2ccs1ri7hnh79eh8t6hojl.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB-QQbnq366f7rrKLVVFJKnSZgR9LcDWFI"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "62132243005-rnqthdakjs2ccs1ri7hnh79eh8t6hojl.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:62132243005:android:a50184ce50e0407d7c7854",
|
||||
"mobilesdk_app_id": "1:534109861443:android:25d267f0c986b2042f46f6",
|
||||
"android_client_info": {
|
||||
"package_name": "ae.gov.fcsc.stats"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "62132243005-rnqthdakjs2ccs1ri7hnh79eh8t6hojl.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB-QQbnq366f7rrKLVVFJKnSZgR9LcDWFI"
|
||||
"current_key": "AIzaSyDj1DrqD5WEiviIz3VtwCUCo-LuyFj32Bs"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "62132243005-rnqthdakjs2ccs1ri7hnh79eh8t6hojl.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,8 +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" />
|
||||
<data android:scheme="https" android:host="fcscstats.onelink.me" />
|
||||
</intent-filter>
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.VIEW" />-->
|
||||
|
||||
@ -0,0 +1 @@
|
||||
{"guid":"dc4b70c03e8043e50e38f2068887b1d4","name":"Pods","path":"/Users/venbateam/Documents/UAE_Stats/FCSC/frontend/ios/Pods/Pods.xcodeproj/project.xcworkspace","projects":["PROJECT@v11_mod=0b74ffacc71bdcf46ebf150515ee10c1_hash=bfdfe7dc352907fc980b868725387e98plugins=1OJSG6M1FOV3XYQCBH7Z29RZ0FPR9XDE1"]}
|
||||
@ -337,14 +337,10 @@
|
||||
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";
|
||||
@ -380,14 +376,10 @@
|
||||
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";
|
||||
@ -506,7 +498,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 14;
|
||||
CURRENT_PROJECT_VERSION = 16;
|
||||
DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets;
|
||||
DEVELOPMENT_TEAM = 9N5SRFUGK2;
|
||||
ENABLE_BITCODE = NO;
|
||||
@ -517,7 +509,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.13;
|
||||
MARKETING_VERSION = 1.0.15;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -705,7 +697,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 14;
|
||||
CURRENT_PROJECT_VERSION = 16;
|
||||
DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets;
|
||||
DEVELOPMENT_TEAM = 9N5SRFUGK2;
|
||||
ENABLE_BITCODE = NO;
|
||||
@ -716,7 +708,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.13;
|
||||
MARKETING_VERSION = 1.0.15;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -742,7 +734,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 14;
|
||||
CURRENT_PROJECT_VERSION = 16;
|
||||
DEVELOPMENT_ASSET_PATHS = Runner/Assets.xcassets;
|
||||
DEVELOPMENT_TEAM = 9N5SRFUGK2;
|
||||
ENABLE_BITCODE = NO;
|
||||
@ -753,7 +745,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.13;
|
||||
MARKETING_VERSION = 1.0.15;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ae.gov.fcsc.frontend.ios;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
||||
@ -3,17 +3,17 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyCuGieAmgg217jhsx7foqpI-sOkAfEq5SU</string>
|
||||
<string>AIzaSyBYWYHFIMuD5gEgbH9sEQk8kqqXX0zemJc</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>62132243005</string>
|
||||
<string>534109861443</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>ae.gov.fcsc.frontend.ios</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>fcsc-a161c</string>
|
||||
<string>fcsc-uae-stats-9cb1e</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>fcsc-a161c.firebasestorage.app</string>
|
||||
<string>fcsc-uae-stats-9cb1e.firebasestorage.app</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
@ -25,6 +25,6 @@
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:62132243005:ios:fcd5a574f5a796a47c7854</string>
|
||||
<string>1:534109861443:ios:83bfecd0cfefa6d52f46f6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -71,9 +71,9 @@ class AuthUseCase extends _$AuthUseCase {
|
||||
}
|
||||
|
||||
Future<SessionEntity> googleAndAppleAuthencation(token) async {
|
||||
// print("loginTEST2");
|
||||
// print("loginTEST2 $token");
|
||||
final session = await _repo.googleAndAppleAuthencation(token);
|
||||
// print("loginTEST4");
|
||||
// print("loginTEST4 $session");
|
||||
final localPrefs = await getIt.call<TLocalPreferencesRepo>().get();
|
||||
if (localPrefs != null) {
|
||||
await getIt.call<TUserRepo>().syncPreferences(
|
||||
|
||||
@ -446,6 +446,12 @@ abstract class AppLocalizations {
|
||||
/// **'Change Password'**
|
||||
String get change_password;
|
||||
|
||||
/// No description provided for @delete_account.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delete Account'**
|
||||
String get delete_account;
|
||||
|
||||
/// No description provided for @sure_save_page.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@ -186,6 +186,9 @@ class AppLocalizationsAr extends AppLocalizations {
|
||||
@override
|
||||
String get change_password => 'تغيير كلمة المرور';
|
||||
|
||||
@override
|
||||
String get delete_account => 'حذف الحساب';
|
||||
|
||||
@override
|
||||
String get sure_save_page => ' هل أنت متأكد أنك ترغب في حفظ هذه الصفحة؟';
|
||||
|
||||
|
||||
@ -186,6 +186,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get change_password => 'Change Password';
|
||||
|
||||
@override
|
||||
String get delete_account => 'Delete Account';
|
||||
|
||||
@override
|
||||
String get sure_save_page => 'Are you sure you want to save this page? ';
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
"cancel": "إلغاء",
|
||||
"confirm": "تأكيد",
|
||||
"change_password": "تغيير كلمة المرور",
|
||||
"delete_account": "حذف الحساب",
|
||||
"sure_save_page": " هل أنت متأكد أنك ترغب في حفظ هذه الصفحة؟",
|
||||
"not_able_to_change": "بمجرد الحفظ، لن تتمكن من تعديل اسمك أو تاريخ ميلادك.",
|
||||
"save": "حفظ",
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"change_password": "Change Password",
|
||||
"delete_account": "Delete Account",
|
||||
"sure_save_page": "Are you sure you want to save this page? ",
|
||||
"not_able_to_change": "Once saved, you will not be able to change your ",
|
||||
"save": "Save",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2294,7 +2294,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
|
||||
try {
|
||||
final String currentRoute = GoRouterState.of(context).uri.toString();
|
||||
final String baseAppLink = 'https://fcscapp.onelink.me';
|
||||
// final String baseAppLink = 'https://fcscapp.onelink.me';
|
||||
final String baseAppLink = 'https://fcscstats.onelink.me';
|
||||
final String shareLink = '$baseAppLink$currentRoute';
|
||||
final String shareText = 'Check this out!\n\n$shareLink';
|
||||
print('Generated Share Link: $shareLink');
|
||||
|
||||
@ -27,6 +27,7 @@ import 'package:uae_stat/presentation/components/indicators/locale_provider.dart
|
||||
import 'package:uae_stat/presentation/components/my_toggle.dart';
|
||||
import 'package:uae_stat/l10n/app_localizations.dart';
|
||||
import 'package:uae_stat/presentation/routes/drawer_routes/Drawer%20Items/notification/notification.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ProfileScreen extends ConsumerStatefulWidget {
|
||||
final String userId; // Add this field to hold the user ID
|
||||
@ -1511,7 +1512,40 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
final Uri url = Uri.parse('https://pocket.fcsc.gov.ae/accountdeletion/index.html');
|
||||
if (await canLaunchUrl(url)) {
|
||||
await launchUrl(
|
||||
url,
|
||||
mode: LaunchMode.externalApplication, // opens in browser
|
||||
);
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete_account,
|
||||
style: TextStyle(
|
||||
// color: Color(0xFF648CBA),
|
||||
color: Color(0xFFB68A34),
|
||||
// color: isDarkTheme
|
||||
// ? Color(0xFF9EB3E4)
|
||||
// : Color(0xFF985400),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: context.translate(
|
||||
'Roboto',
|
||||
'NotoKufi',
|
||||
),
|
||||
// decoration: TextDecoration.underline),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:android_intent_plus/android_intent.dart';
|
||||
import 'package:android_intent_plus/flag.dart';
|
||||
import 'package:external_repos/external_repos.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter_uae_pass/flutter_uae_pass.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:jwt_decoder/jwt_decoder.dart';
|
||||
@ -35,6 +38,7 @@ import 'package:uae_stat/presentation/components/space.dart';
|
||||
import 'package:uae_stat/presentation/components/themed_text_field.dart';
|
||||
import 'package:uae_stat/presentation/routes/bottom_bar_routes/tab_routes/home/home_route.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:uae_stat/presentation/routes/uae_pass/uaepass_signin_page.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../Screens/auth_verification/registration.dart';
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
@ -59,6 +63,10 @@ class LoginRoute extends HookConsumerWidget {
|
||||
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
|
||||
// final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||
static final formKey = GlobalKey<FormState>();
|
||||
String? authCode;
|
||||
String? accessToken;
|
||||
ProfileData? profileData;
|
||||
final _uaePass = UaePass();
|
||||
|
||||
Future<bool> profileStatus(String userId, WidgetRef ref) async {
|
||||
try {
|
||||
@ -138,55 +146,80 @@ class LoginRoute extends HookConsumerWidget {
|
||||
// }
|
||||
|
||||
Future<void> getDeviceToken(
|
||||
BuildContext context, String userId, WidgetRef ref) async {
|
||||
BuildContext context, String userId, WidgetRef ref,authtoken) async {
|
||||
try {
|
||||
// await _firebaseMessaging.requestPermission();
|
||||
print("FCM Token Entry");
|
||||
String? token = await FirebaseMessaging.instance.getToken();
|
||||
print("FCM Token: $token");
|
||||
// print("FCM Token Entry");
|
||||
// String? token = await FirebaseMessaging.instance.getToken();
|
||||
// print("FCM Token: $token");
|
||||
|
||||
if (token != null) {
|
||||
await updateDeviceToken(userId, token, ref);
|
||||
if (Platform.isIOS || Platform.isMacOS) {
|
||||
// Get APNS token
|
||||
String? token = await _firebaseMessaging.getAPNSToken();
|
||||
print('📱 APNS Token (iOS): $token');
|
||||
|
||||
// Automatically copy to clipboard
|
||||
// Clipboard.setData(ClipboardData(text: token));
|
||||
// Retry if null
|
||||
if (token == null) {
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
token = await _firebaseMessaging.getAPNSToken();
|
||||
print('🔁 Retried APNS Token: $token');
|
||||
}
|
||||
|
||||
// Show token in Alert Dialog
|
||||
// if (context.mounted) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return AlertDialog(
|
||||
// title: Text("FCM Token"),
|
||||
// content: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// SelectableText(token), // Allows manual selection
|
||||
// SizedBox(height: 10),
|
||||
// Text(
|
||||
// "Token copied to clipboard ✅",
|
||||
// style: TextStyle(color: Colors.green),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// child: Text("OK"),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
if (token != null) {
|
||||
await updateDeviceToken(userId, token, ref,authtoken);
|
||||
}
|
||||
} else if (Platform.isAndroid) {
|
||||
// Get FCM token
|
||||
String? fcmToken = await _firebaseMessaging.getToken();
|
||||
print('🔥 FCM Token (Android): $fcmToken');
|
||||
|
||||
if (fcmToken != null) {
|
||||
await updateDeviceToken(userId, fcmToken, ref,authtoken);
|
||||
}
|
||||
}
|
||||
|
||||
// if (token != null) {
|
||||
// await updateDeviceToken(userId, token, ref,authtoken);
|
||||
//
|
||||
// // Automatically copy to clipboard
|
||||
// // Clipboard.setData(ClipboardData(text: token));
|
||||
//
|
||||
// // Show token in Alert Dialog
|
||||
// // if (context.mounted) {
|
||||
// // showDialog(
|
||||
// // context: context,
|
||||
// // builder: (context) {
|
||||
// // return AlertDialog(
|
||||
// // title: Text("FCM Token"),
|
||||
// // content: Column(
|
||||
// // mainAxisSize: MainAxisSize.min,
|
||||
// // children: [
|
||||
// // SelectableText(token), // Allows manual selection
|
||||
// // SizedBox(height: 10),
|
||||
// // Text(
|
||||
// // "Token copied to clipboard ✅",
|
||||
// // style: TextStyle(color: Colors.green),
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // actions: [
|
||||
// // TextButton(
|
||||
// // onPressed: () => Navigator.pop(context),
|
||||
// // child: Text("OK"),
|
||||
// // ),
|
||||
// // ],
|
||||
// // );
|
||||
// // },
|
||||
// // );
|
||||
// // }
|
||||
// }
|
||||
} catch (e) {
|
||||
print("Error getting FCM Token: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateDeviceToken(
|
||||
String userId, String token, WidgetRef ref) async {
|
||||
String userId, String token, WidgetRef ref,authtoken) async {
|
||||
final url = "${pb.baseUrl}api/collections/users/records/$userId";
|
||||
|
||||
try {
|
||||
@ -213,7 +246,7 @@ class LoginRoute extends HookConsumerWidget {
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
'Content-Type': 'application/json', // Add this
|
||||
'Authorization': PocketBaseService.authStore.token, // Correct way to send auth token
|
||||
'Authorization': 'Bearer $authtoken', // Correct way to send auth token
|
||||
},
|
||||
body: jsonEncode({
|
||||
"device_token": token,
|
||||
@ -347,6 +380,24 @@ class LoginRoute extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> login() async {
|
||||
authCode = null;
|
||||
accessToken = null;
|
||||
profileData = null;
|
||||
try {
|
||||
authCode = await _uaePass.signIn();
|
||||
print('authCode $authCode');
|
||||
accessToken = await _uaePass.getAccessToken(authCode ?? "");
|
||||
print('accessToken $accessToken');
|
||||
profileData = await _uaePass.getProfile(accessToken ?? "");
|
||||
print('profileData $profileData');
|
||||
} catch (e) {
|
||||
if (kDebugMode) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> initializeTheme(
|
||||
BuildContext context, WidgetRef ref, String userId) async {
|
||||
final themeService = ThemeBaseService();
|
||||
@ -362,8 +413,9 @@ class LoginRoute extends HookConsumerWidget {
|
||||
|
||||
Future<void> oAuthGoogleAndAppleLogin(
|
||||
BuildContext context, WidgetRef ref, platform) async {
|
||||
print(platform);
|
||||
print('platform $platform');
|
||||
try {
|
||||
print('platform $platform');
|
||||
final authData =
|
||||
await pb.collection('users').authWithOAuth2(platform, (url) async {
|
||||
await launchUrl(url);
|
||||
@ -385,7 +437,7 @@ class LoginRoute extends HookConsumerWidget {
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
print(authData);
|
||||
print('authData $authData');
|
||||
// ✅ Check if authData is valid
|
||||
if (authData.token.isNotEmpty && authData.record != null) {
|
||||
print("✅ Login Successful");
|
||||
@ -438,7 +490,7 @@ class LoginRoute extends HookConsumerWidget {
|
||||
await loginCountApi(userId!);
|
||||
await updateOAuthUserDetails(userId!, metaDetails, ref,token);
|
||||
// await saveUserId(userId!, loginCount);
|
||||
// await getDeviceToken(context, userId);
|
||||
await getDeviceToken(context, userId,ref,token);
|
||||
await initializeTheme(context, ref, userId);
|
||||
|
||||
// final se = _sessionEntityFromPocketbaseRecord(authData);
|
||||
@ -649,6 +701,13 @@ print('User response $response');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
||||
|
||||
useEffect(() {
|
||||
_uaePass.setUpSandbox(); // equivalent to initState()
|
||||
return null; // no cleanup needed
|
||||
}, const []);
|
||||
|
||||
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||
if (hasInternet.value == false) {
|
||||
context.push('/internetcheck');
|
||||
@ -1014,7 +1073,7 @@ print('User response $response');
|
||||
}
|
||||
|
||||
await saveUserId(userId, loginCount);
|
||||
await getDeviceToken(context, userId, ref);
|
||||
await getDeviceToken(context, userId, ref, PocketBaseService.authStore.token);
|
||||
await initializeTheme(context, ref, userId);
|
||||
}
|
||||
try {
|
||||
@ -1331,6 +1390,40 @@ print('User response $response');
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
final orText = SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
// Left line
|
||||
Expanded(
|
||||
child: Divider(
|
||||
color: isDarkTheme ? Colors.white : Colors.grey.shade400,
|
||||
thickness: 1,
|
||||
endIndent: 10,
|
||||
),
|
||||
),
|
||||
|
||||
// Center text
|
||||
Text(
|
||||
'OR',
|
||||
style: TextStyle(
|
||||
color: isDarkTheme ? Colors.white : Color(0x33000000),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
|
||||
// Right line
|
||||
Expanded(
|
||||
child: Divider(
|
||||
color: isDarkTheme ? Colors.white : Colors.grey.shade400,
|
||||
thickness: 1,
|
||||
indent: 10,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final signInWithGoogleBtn = SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton(
|
||||
@ -1413,10 +1506,21 @@ print('User response $response');
|
||||
),
|
||||
),
|
||||
);
|
||||
final signInWithUAEPassBtn = SizedBox(
|
||||
final signInWithUAEPassBtn = Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 60,
|
||||
right: 60),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton(
|
||||
onPressed: () async {},
|
||||
onPressed: () async {
|
||||
// oAuthGoogleAndAppleLogin(context, ref, 'uaepass');
|
||||
login();
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => const UAEPassSignInPage()),
|
||||
// );
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: Color(0xFF000000)),
|
||||
shape: RoundedRectangleBorder(
|
||||
@ -1451,7 +1555,7 @@ print('User response $response');
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
final fcscBanner = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
child: Image.asset(
|
||||
@ -1507,13 +1611,18 @@ print('User response $response');
|
||||
25.verticalSpace,
|
||||
dontHaveAnAccountRegisterBtn,
|
||||
// continueAsGuestBtn,
|
||||
25.verticalSpace,
|
||||
signInWithGoogleBtn,
|
||||
15.verticalSpace,
|
||||
signInWithAppleBtn,
|
||||
15.verticalSpace,
|
||||
signInWithUAEPassBtn,
|
||||
25.verticalSpace,
|
||||
// 15.verticalSpace,
|
||||
// orText,
|
||||
// 15.verticalSpace,
|
||||
// signInWithUAEPassBtn,
|
||||
// 15.verticalSpace,
|
||||
// orText,
|
||||
// 15.verticalSpace,
|
||||
// signInWithGoogleBtn,
|
||||
// 15.verticalSpace,
|
||||
// signInWithAppleBtn,
|
||||
// 30.verticalSpace,
|
||||
120.verticalSpace,
|
||||
fcscBanner,
|
||||
],
|
||||
),
|
||||
|
||||
@ -28,6 +28,7 @@ import 'package:uae_stat/presentation/components/indicators/locale_provider.dart
|
||||
import 'package:uae_stat/presentation/routes/drawer_routes/Drawer%20Items/notification/notification.dart';
|
||||
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
|
||||
import 'package:uae_stat/l10n/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class EditProfile extends ConsumerStatefulWidget {
|
||||
const EditProfile({super.key});
|
||||
@ -1514,7 +1515,40 @@ class _EditProfileState extends ConsumerState<EditProfile> {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
final Uri url = Uri.parse('https://pocket.fcsc.gov.ae/accountdeletion/index.html');
|
||||
if (await canLaunchUrl(url)) {
|
||||
await launchUrl(
|
||||
url,
|
||||
mode: LaunchMode.externalApplication, // opens in browser
|
||||
);
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete_account,
|
||||
style: TextStyle(
|
||||
// color: Color(0xFF648CBA),
|
||||
color: Color(0xFFB68A34),
|
||||
// color: isDarkTheme
|
||||
// ? Color(0xFF9EB3E4)
|
||||
// : Color(0xFF985400),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: context.translate(
|
||||
'Roboto',
|
||||
'NotoKufi',
|
||||
),
|
||||
// decoration: TextDecoration.underline),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
14
lib/presentation/routes/uae_pass/uaepass_pkce.dart
Normal file
14
lib/presentation/routes/uae_pass/uaepass_pkce.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// import 'dart:convert';
|
||||
// import 'dart:math';
|
||||
// import 'package:crypto/crypto.dart';
|
||||
//
|
||||
// String randomString(int length) {
|
||||
// final r = Random.secure();
|
||||
// final bytes = List<int>.generate(length, (_) => r.nextInt(256));
|
||||
// return base64UrlEncode(bytes).replaceAll('=', '');
|
||||
// }
|
||||
//
|
||||
// String codeChallengeFromVerifier(String verifier) {
|
||||
// final h = sha256.convert(utf8.encode(verifier));
|
||||
// return base64UrlEncode(h.bytes).replaceAll('=', '');
|
||||
// }
|
||||
74
lib/presentation/routes/uae_pass/uaepass_signin_page.dart
Normal file
74
lib/presentation/routes/uae_pass/uaepass_signin_page.dart
Normal file
@ -0,0 +1,74 @@
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:webview_flutter/webview_flutter.dart';
|
||||
// import 'package:webview_flutter_android/webview_flutter_android.dart';
|
||||
// import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';
|
||||
//
|
||||
// class UAEPassSignInPage extends StatefulWidget {
|
||||
// const UAEPassSignInPage({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// State<UAEPassSignInPage> createState() => _UAEPassSignInPageState();
|
||||
// }
|
||||
//
|
||||
// class _UAEPassSignInPageState extends State<UAEPassSignInPage> {
|
||||
// late final WebViewController _controller;
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
//
|
||||
// late PlatformWebViewControllerCreationParams params;
|
||||
//
|
||||
// if (WebViewPlatform.instance is WebKitWebViewPlatform) {
|
||||
// params = WebKitWebViewControllerCreationParams(
|
||||
// allowsInlineMediaPlayback: true,
|
||||
// mediaTypesRequiringUserAction: const <PlaybackMediaTypes>{},
|
||||
// );
|
||||
// } else {
|
||||
// params = const PlatformWebViewControllerCreationParams();
|
||||
// }
|
||||
//
|
||||
// final controller = WebViewController.fromPlatformCreationParams(params);
|
||||
//
|
||||
// controller
|
||||
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
// ..setNavigationDelegate(
|
||||
// NavigationDelegate(
|
||||
// onPageStarted: (String url) {
|
||||
// debugPrint('Started loading: $url');
|
||||
// },
|
||||
// onPageFinished: (String url) {
|
||||
// debugPrint('Finished loading: $url');
|
||||
// },
|
||||
// onNavigationRequest: (NavigationRequest request) {
|
||||
// // Handle UAE PASS redirect URLs here
|
||||
// if (request.url.contains('your-redirect-uri')) {
|
||||
// debugPrint('Redirect detected: ${request.url}');
|
||||
// // You can now extract the token from the URL
|
||||
// return NavigationDecision.prevent;
|
||||
// }
|
||||
// return NavigationDecision.navigate;
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
// ..loadRequest(Uri.parse('https://stg-id.uaepass.ae/idshub/authorize'));
|
||||
//
|
||||
// if (controller.platform is AndroidWebViewController) {
|
||||
// AndroidWebViewController.enableDebugging(true);
|
||||
// (controller.platform as AndroidWebViewController)
|
||||
// .setMediaPlaybackRequiresUserGesture(false);
|
||||
// }
|
||||
//
|
||||
// _controller = controller;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Sign in with UAE PASS'),
|
||||
// ),
|
||||
// body: WebViewWidget(controller: _controller),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
32
pubspec.lock
32
pubspec.lock
@ -751,6 +751,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_uae_pass:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_uae_pass
|
||||
sha256: c0e5de77e01b8f26cddcad5e00b530c680bff280acf3b4851d18e974bcfdbdf2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter_web_auth_2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1859,34 +1867,34 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: webview_flutter
|
||||
sha256: "889a0a678e7c793c308c68739996227c9661590605e70b1f6cf6b9a6634f7aec"
|
||||
sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.10.0"
|
||||
version: "4.13.0"
|
||||
webview_flutter_android:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: webview_flutter_android
|
||||
sha256: "631093a7fbd93e9690ac61d8c8f3e857efbc189fc33f712b9ad6c01a623517ef"
|
||||
sha256: e5201c620eb2637dca88a756961fae4a7191bb30b4f2271e08b746405ffdf3fd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.3.3"
|
||||
version: "4.10.5"
|
||||
webview_flutter_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webview_flutter_platform_interface
|
||||
sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d
|
||||
sha256: "63d26ee3aca7256a83ccb576a50272edd7cfc80573a4305caa98985feb493ee0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
version: "2.14.0"
|
||||
webview_flutter_wkwebview:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: webview_flutter_wkwebview
|
||||
sha256: c49a98510080378b1525132f407a92c3dcd3b7145bef04fb8137724aadcf1cf0
|
||||
sha256: fea63576b3b7e02b2df8b78ba92b48ed66caec2bb041e9a0b1cbd586d5d80bfd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.18.4"
|
||||
version: "3.23.1"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1936,5 +1944,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.8.0-0 <4.0.0"
|
||||
flutter: ">=3.27.0"
|
||||
dart: ">=3.9.0 <4.0.0"
|
||||
flutter: ">=3.35.0"
|
||||
|
||||
11
pubspec.yaml
11
pubspec.yaml
@ -1,9 +1,9 @@
|
||||
name: uae_stat
|
||||
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
|
||||
publish_to: "none"
|
||||
version: 1.0.68+69
|
||||
#version: 1.0.13+14
|
||||
#version: 1.0.5+5
|
||||
#version: 1.0.68+69
|
||||
#version: 1.0.15+16
|
||||
version: 1.0.6+6
|
||||
|
||||
environment:
|
||||
sdk: ">=3.2.3 <4.0.0"
|
||||
@ -41,7 +41,7 @@ dependencies:
|
||||
flutter_secure_storage: ^10.0.0-beta.4
|
||||
jwt_decoder: ^2.0.1
|
||||
fluttertoast: ^8.2.11
|
||||
webview_flutter: ^4.5.0
|
||||
webview_flutter: ^4.13.0
|
||||
video_player: ^2.8.5
|
||||
flutter_carousel_widget: ^3.1.0
|
||||
share_plus: ^10.1.1
|
||||
@ -80,6 +80,9 @@ dependencies:
|
||||
dotted_border: ^2.1.0
|
||||
google_sign_in: ^7.1.1
|
||||
flutter_web_auth_2: ^4.1.0
|
||||
flutter_uae_pass: ^1.1.0
|
||||
webview_flutter_android: ^4.10.5
|
||||
webview_flutter_wkwebview: ^3.23.1
|
||||
|
||||
dependency_overrides:
|
||||
fading_edge_scrollview: ^4.1.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user