fix: reg in webview

This commit is contained in:
BLoC
2025-02-12 17:21:19 +03:00
parent f333e98221
commit 8282d49064

View File

@@ -76,18 +76,22 @@ class _AuthScreenState extends State<AuthScreen> {
..setNavigationDelegate(
NavigationDelegate(
onPageFinished: (String url) async {
final bool tokenInStorage = await TokenStorage.haveTokenInStorage();
final bool credentialsInStorage = await CredentialsStorage.haveCredentialsInStorage();
if (needLogout) {
await logoutFromWeb();
needLogout = false;
} else if (!url.contains('profile') && !url.contains('registration')) {
await _controller.runJavaScript(jsChannelAuthScript);
} else if (url.contains('profile')) {
await CredentialsStorage.saveCredentials(email, password);
await loginInApplication();
if (credentialsInStorage) {
await CredentialsStorage.saveCredentials(email, password);
await loginInApplication();
} else {
await logoutFromWeb();
}
} else {
final bool tokenInStorage = await TokenStorage.haveTokenInStorage();
final bool credentialsInStorage = await CredentialsStorage.haveCredentialsInStorage();
if (tokenInStorage && credentialsInStorage) {
GoRouter.of(context).go('/my-profile-screen');
} else if (!tokenInStorage && credentialsInStorage) {