feat: auto login after registration

This commit is contained in:
BLoC
2025-03-10 13:01:21 +03:00
parent 8ef59a0adf
commit 91c907bc57
5 changed files with 101 additions and 50 deletions

View File

@@ -2,27 +2,27 @@ C/C++ Structured Loga
_
]/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  էȃ×2  ‹°™²Ö2^
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  Úðèû×2  ‹°™²Ö2^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build.json  էȃ×2¥ ‘°™²Ö2c
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build.json  Úðèû×2¥ ‘°™²Ö2c
a
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build_mini.json  էȃ×2² –°™²Ö2P
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build_mini.json  Úðèû×2² –°™²Ö2P
N
L/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja  էȃ×2ŠÃ 쯙²Ö2T
L/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja  Úðèû×2ŠÃ 쯙²Ö2T
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja.txt  ֧ȃ×2Y
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja.txt  Úðèû×2Y
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build_file_index.txt  ֧ȃ×2
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build_file_index.txt  Úðèû×2
P —°™²Ö2Z
X
X
V/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/compile_commands.json  Úðèû×2^
\
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/compile_commands.json.bin  Úðèû×2 d
b
b
`/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/metadata_generation_command.txt  Úðèû×2
ÿ —°™²Ö2W
U
U
S/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/prefab_config.json  Úðèû×2
 ( —°™²Ö2\
 ( —°™²Ö2\
Z
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/symbol_folder_index.txt  ֧ȃ×2
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/symbol_folder_index.txt  Úðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Logc
a
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  —©Èƒ×2  àòš²Ö2`
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  íðèû×2  àòš²Ö2`
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build.json  —©Èƒ×2© âòš²Ö2e
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build.json  íðèû×2© âòš²Ö2e
c
a/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build_mini.json  —©Èƒ×2 ãòš²Ö2R
a/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build_mini.json  íðèû×2 ãòš²Ö2R
P
N/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja  —©Èƒ×2–à Âòš²Ö2V
N/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja  íðèû×2–Ã Âòš²Ö2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja.txt  —©Èƒ×2[
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja.txt  íðèû×2[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build_file_index.txt  —©Èƒ×2
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build_file_index.txt  íðèû×2
P ãòš²Ö2\
Z
Z
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/compile_commands.json  íðèû×2`
^
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/compile_commands.json.bin  íðèû×2 f
d
d
b/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/metadata_generation_command.txt  íðèû×2
‰ ãòš²Ö2Y
W
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/prefab_config.json  íðèû×2
 ( ãòš²Ö2^
 ( ãòš²Ö2^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/symbol_folder_index.txt  —©Èƒ×2
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/symbol_folder_index.txt  íðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Log[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ¥©Èƒ×2  <20>÷š²Ö2X
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ôðèû×2  <20>÷š²Ö2X
V
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build.json  ¥©Èƒ×2™ <20>÷š²Ö2]
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build.json  ôðèû×2™ <20>÷š²Ö2]
[
Y/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build_mini.json  ¥©Èƒ×2¦ ‘÷š²Ö2J
Y/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build_mini.json  ôðèû×2¦ ‘÷š²Ö2J
H
F/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja  ¥©Èƒ×2æÂ †÷š²Ö2N
F/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja  ôðèû×2æÂ †÷š²Ö2N
L
J/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja.txt  ¥©Èƒ×2S
J/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja.txt  ôðèû×2S
Q
O/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build_file_index.txt  ¥©Èƒ×2
O/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build_file_index.txt  ôðèû×2
P ‘÷š²Ö2T
R
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/compile_commands.json  ôðèû×2X
V
V
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/compile_commands.json.bin  ôðèû×2 ^
\
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/metadata_generation_command.txt  ôðèû×2
á ‘÷š²Ö2Q
O
O
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/prefab_config.json  ôðèû×2
 ( ‘÷š²Ö2V
 ( ‘÷š²Ö2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/symbol_folder_index.txt  ¥©Èƒ×2
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/symbol_folder_index.txt  ôðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Log^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  á©Èƒ×2  Üúš²Ö2[
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  úðèû×2  Üúš²Ö2[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build.json  á©Èƒ×2Ÿ Þúš²Ö2`
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build.json  úðèû×2Ÿ Þúš²Ö2`
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build_mini.json  á©Èƒ×2¬ Þúš²Ö2M
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build_mini.json  úðèû×2¬ Þúš²Ö2M
K
I/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja  á©Èƒ×2øÂ Ðúš²Ö2Q
I/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja  úðèû×2øÂ Ðúš²Ö2Q
O
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja.txt  á©Èƒ×2V
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja.txt  úðèû×2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build_file_index.txt  á©Èƒ×2
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build_file_index.txt  úðèû×2
P ßúš²Ö2W
U
U
S/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/compile_commands.json  úðèû×2[
Y
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/compile_commands.json.bin  úðèû×2 a
_
_
]/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/metadata_generation_command.txt  úðèû×2
ð ßúš²Ö2T
R
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/prefab_config.json  úðèû×2
 ( ßúš²Ö2Y
 ( ßúš²Ö2Y
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/symbol_folder_index.txt  á©Èƒ×2
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/symbol_folder_index.txt  úðèû×2

View File

@@ -1,6 +1,9 @@
import 'dart:convert';
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_cubit.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewRegistrationScreen extends StatefulWidget {
@@ -12,23 +15,71 @@ class WebViewRegistrationScreen extends StatefulWidget {
class _WebViewRegistrationScreenState extends State<WebViewRegistrationScreen> {
late final WebViewController _controller;
late final AuthCubit authCubit;
String? email;
String? password;
@override
void initState() {
super.initState();
authCubit = sl<AuthCubit>();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..addJavaScriptChannel(
'flutter_inject',
onMessageReceived: (JavaScriptMessage message) {
final data = jsonDecode(message.message);
if (data['type'] == 'email') {
email = data['value'];
print("Email: $email");
} else if (data['type'] == 'password') {
password = data['value'];
print("Password: $password");
}
},
)
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (NavigationRequest request) {
if (request.url.contains('profile')) {
GoRouter.of(context).go('authScreen');
authCubit.getTokenByCredentials(
email!,
password!,
);
}
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse(baseUrl + '/registration/step1'));
_injectJavaScript();
}
void _injectJavaScript() async {
await Future.delayed(Duration(seconds: 2));
_controller.runJavaScript('''
function sendMessageToFlutter(data) {
window.flutter_inject.postMessage(JSON.stringify(data));
}
function trackInputChanges() {
let emailField = document.getElementById('inputEmail');
let passwordField = document.getElementById('inputPassword');
if (emailField && passwordField) {
emailField.addEventListener('input', function() {
sendMessageToFlutter({ type: 'email', value: emailField.value });
});
passwordField.addEventListener('input', function() {
sendMessageToFlutter({ type: 'password', value: passwordField.value });
});
}
}
trackInputChanges();
''');
}
@override