fluttercommunity / fluttercommunity/flutter_webview_plugin

onUrlChanged.listen never called on iOS

Ouverte
#661 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
1.5k
Forks
938
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 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

`

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par reproduire le flux OAuth2 sur iOS 13.3 avec l’utilisation signalée de onUrlChanged.listen et comparez-le au comportement sur Android. Suivez la gestion des changements d’URL du plugin sur iOS et déterminez si le callback est censé être déclenché ; le travail est considéré comme terminé lorsque le comportement est corrigé ou que la limitation est documentée avec une explication vérifiée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
dart, flutter, ios
Domaine
mobile-dev
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.