fluttercommunity / fluttercommunity/flutter_webview_plugin

onUrlChanged.listen never called on iOS

Abierto
#661 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
1.5k
Forks
938
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## System info

Issue occurs on: iOS
Plugin version: xxx

#Problem

I am using onUrlChanged.listen in order to get the code of OAuth2 authentication. I get this code by listening to url changes, and it works fine on Android. When I launch it in iOS, I get a blank white screen. When I try to debug, I see that onUrlChanged.listen callback is never being called.

Here is my code:
void main() {
WidgetsFlutterBinding.ensureInitialized();
LoginController _loginController = new LoginController();
_loginController.getCodeWebView().then((FlutterWebviewPlugin flutterWebView) {
//deal here with webview and token request
flutterWebView.onUrlChanged.listen((String url) async {
if (url.length > 25) {
int endIndex = url.indexOf("&state");
if (url.contains("code=")) {
String code = url.substring(
url.indexOf('code') + 5, endIndex); //with "http://localhost:4200/
flutterWebView.close();
String accessToken = await _loginController.getAccessToken(code);
_loginController.decodeJwtAndPopulateUser(accessToken);
//Now that we have the token, we can instantiate layout with async calls that depends on token
runApp(
AppContainer(accessToken)
);
}
}
});
});
}

Can anyone help me please? I am struggling with it. I don't know if its a bug. I am testing it in iOS 13.3 and I already added the info.plist things to support webview_plugin:

`
NSAllowsArbitraryLoads

NSAllowsArbitraryLoadsInWebContent

`

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza reproduciendo el flujo OAuth2 en iOS 13.3 con el uso reportado de onUrlChanged.listen y compáralo con el comportamiento en Android. Rastrea el manejo de cambios de URL del plugin en iOS y determina si se espera que se ejecute el callback; se considera terminado cuando el comportamiento está corregido o la limitación está documentada con una explicación verificada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
dart, flutter, ios
Área
mobile-dev
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.