feat: SMS OTP phone auth + mandatory phone verification gate
- MyUser: add isPhoneVerified field (from is_phone_verified in API) - ApiUserRepository: signInWithPhoneNumber calls POST /auth/send-otp, verifyOTP calls POST /auth/phone, linkWithOTP calls POST /auth/verify-phone Added updateFcmToken and changePassword methods - AuthBloc: remove Firebase PhoneVerificationService, use repository OTP flow - app_view.dart: gate authenticated users without verified phone to PhoneVerifyRequiredScreen before showing HomeScreen - welcome_screen.dart: full redesign with gradient header, logo, integrated OTP flow (phone → code in same screen), 60s resend timer - PhoneVerifyRequiredScreen: new screen for users who need to verify phone Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
38beca4b4f
commit
2c5b237890
+8
-3
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:prosappco/blocs/notification_bloc/notification_bloc.dart';
|
||||
import 'package:prosappco/screens/authentication/welcome_screen.dart';
|
||||
import 'package:prosappco/screens/authentication/phone_verify_required_screen.dart';
|
||||
import 'package:prosappco/screens/home/home_screen.dart';
|
||||
import 'package:prosappco/screens/splash/splash_screen.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
@@ -44,19 +45,23 @@ class MyAppView extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return getScreen(state);
|
||||
return _getScreen(state);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getScreen(AuthenticationState state) {
|
||||
Widget _getScreen(AuthenticationState state) {
|
||||
switch (state.status) {
|
||||
case AuthenticationStatus.authenticated:
|
||||
final phoneVerified = state.user?.isPhoneVerified ?? false;
|
||||
if (!phoneVerified) {
|
||||
return PhoneVerifyRequiredScreen(phone: state.user?.phone);
|
||||
}
|
||||
return HomeScreen();
|
||||
|
||||
case AuthenticationStatus.unauthenticated:
|
||||
return WelcomeScreen();
|
||||
return const WelcomeScreen();
|
||||
|
||||
case AuthenticationStatus.unknown:
|
||||
return const SplashScreen();
|
||||
|
||||
Reference in New Issue
Block a user