Fix and add workaround for cookie banner blocking login (#381)

* Constraint cookie banner description height

* Add workaround instructions for cookie banner blocking
This commit is contained in:
Tommy Chow 2024-08-16 18:53:09 -07:00 • committed by GitHub
parent 5a374f74bc
commit e297e38178
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 57 additions and 4 deletions

View file

@ -84,12 +84,42 @@ abstract class AuthBase with Store {
}
WebViewController createAuthWebViewController({Widget? routeAfter}) {
return WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
final webViewController = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted);
return webViewController
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (request) =>
handleNavigation(request: request, routeAfter: routeAfter),
onPageFinished: (_) => webViewController.runJavaScript(
'''
{
function modifyElement(element) {
element.style.maxHeight = '20vh';
element.style.overflow = 'auto';
}
const observer = new MutationObserver((mutations) => {
for (let mutation of mutations) {
if (mutation.type === 'childList') {
const element = document.querySelector('.fAVISI');
if (element) {
modifyElement(element);
observer.disconnect();
break;
}
}
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
}
''',
),
),
)
..loadRequest(