Remove Google auth: drop google_sign_in, google-services.json, gradle plugin; keep email+password+fingerprint
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:login_vault_app/auth_service.dart';
|
||||
import 'package:login_vault_app/dashboard_screen.dart';
|
||||
@@ -83,24 +82,6 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _signInGoogle() async {
|
||||
setState(() => _busy = true);
|
||||
try {
|
||||
final gs = GoogleSignIn(scopes: ['email']);
|
||||
final account = await gs.signIn();
|
||||
if (account?.email != null) {
|
||||
await widget.auth.registerWithGoogle(account!.email);
|
||||
_goToDashboard(account.email);
|
||||
} else {
|
||||
setState(() => _error = 'Google sign-in dibatalkan');
|
||||
}
|
||||
} catch (e) {
|
||||
setState(() => _error = 'Google sign-in gagal: ${e.toString()}');
|
||||
} finally {
|
||||
if (mounted) setState(() => _busy = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -145,12 +126,6 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
? 'Belum punya akun? Daftar'
|
||||
: 'Sudah punya akun? Masuk'),
|
||||
),
|
||||
const Divider(),
|
||||
OutlinedButton.icon(
|
||||
onPressed: _signInGoogle,
|
||||
icon: const Icon(Icons.login),
|
||||
label: const Text('Lanjut dengan Google'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -24,20 +24,10 @@ class AuthService {
|
||||
key: AppConstants.secureKeyAppPassword, value: appPassword);
|
||||
}
|
||||
|
||||
Future<void> registerWithGoogle(String email) async {
|
||||
await _storage.write(key: AppConstants.secureKeyEmail, value: email);
|
||||
final existing = await getAppPassword();
|
||||
if (existing == null) {
|
||||
await _storage.write(
|
||||
key: AppConstants.secureKeyAppPassword, value: '__google__');
|
||||
}
|
||||
}
|
||||
|
||||
/// Verify the entered app password against the stored one.
|
||||
Future<bool> verifyPassword(String password) async {
|
||||
final stored = await getAppPassword();
|
||||
if (stored == null) return false;
|
||||
if (stored == '__google__') return true; // google users: any pass ok
|
||||
return stored == password;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user