Security settings improvements
This commit is contained in:
@@ -2,10 +2,9 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:kmobile/data/repositories/auth_repository.dart';
|
||||
import 'package:kmobile/features/profile/change_password/change_password_screen.dart';
|
||||
import 'package:kmobile/features/profile/daily_transaction_limit.dart';
|
||||
import 'package:kmobile/features/profile/logout_dialog.dart';
|
||||
import 'package:kmobile/features/profile/tpin/change_tpin_screen.dart';
|
||||
import 'package:kmobile/features/profile/security_settings_screen.dart';
|
||||
import 'package:kmobile/security/secure_storage.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
@@ -13,8 +12,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../di/injection.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'package:kmobile/features/profile/preferences/preference_screen.dart';
|
||||
import 'package:kmobile/api/services/auth_service.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
final String mobileNumber;
|
||||
@@ -201,77 +198,20 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
secondary: const Icon(Icons.fingerprint),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text(loc.changeLoginPassword),
|
||||
leading: const Icon(Icons.security),
|
||||
title: Text(loc.securitySettings),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangePasswordScreen(
|
||||
mobileNumber: widget.mobileNumber,
|
||||
)),
|
||||
builder: (context) => SecuritySettingsScreen(
|
||||
mobileNumber: widget.mobileNumber,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text('Change TPIN'),
|
||||
onTap: () async {
|
||||
// 1. Get the AuthService instance
|
||||
final authService = getIt<AuthService>();
|
||||
|
||||
// 2. Call checkTpin() to see if TPIN is set
|
||||
final isTpinSet = await authService.checkTpin();
|
||||
|
||||
// 3. If TPIN is not set, show the dialog
|
||||
if (!isTpinSet) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('TPIN Not Set'),
|
||||
content: Text(
|
||||
'You have not set a TPIN yet. Please set a TPIN to proceed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Back'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Proceed'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Dismiss the dialog
|
||||
// Navigate to the TPIN set screen
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => TpinSetScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// Case 2: TPIN is set
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
ChangeTpinScreen(mobileNumber: widget.mobileNumber),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.password),
|
||||
// title: const Text("Change Login MPIN"),
|
||||
// onTap: () async {
|
||||
// },
|
||||
// ),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.smartphone),
|
||||
title: const Text("App Version"),
|
||||
|
||||
Reference in New Issue
Block a user