The webDialog header is "CURRENT GOALS", but there is no button to authorize or cancel

I am new to the Facebook SDK. I am adding Facebook login in my Android application using Facebook SDK 3.0.1. Facebook popup window for the website to log in. Today I discovered a strange behavior that is different from yesterday.

After entering the account name and password and pressing the login button in the web dialog box, at the end it displays "CURRENT GOALS" in the header asking you to add friends, enter addresses, etc. The body shows that "(YOUR_APP) would like to access your public profile and friend list." But there is no longer a button for authorization or cancellation. From Eclipse LogCat the current state of the session from Session.StatusCallback () is OPEN. As a result, the user cannot complete the login process.

So, how do I go through the dialogue to successfully complete the login process? If I click the close button of the upper left corner or the back button, the dialog closes. Session state will become CLOSED_LOGIN_FAILED.

Yesterday, when the same login, webDalog finally displays "You are already authorized (YOURAPP)" and there are buttons "Cancel" and "OK". If the user clicks OK, the dialog closes, and Session.StatusCallback () calls the session state, it will be OPEN. Thus, the user will successfully complete the login process.

+2
source share
1 answer

I just found and posted a workaround at current targets hiding the facebook ok button during Facebook authorization in web view

In FaceBookSDK, I changed com / facebook / widget / WebDialog.java so that as soon as the web dialog has been loaded, it will look for the block containing "Current Goals" and hide it (if it exists). Once you do this, the buttons are visible again (at least they were for me).

In com / facebook / widget / WebDialog.java:

private class DialogWebViewClient extends WebViewClient { // ... other methods ... @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (!isDetached) { spinner.dismiss(); } /* * Once web view is fully loaded, set the contentFrameLayout background to be transparent * and make visible the 'x' image. */ contentFrameLayout.setBackgroundColor(Color.TRANSPARENT); webView.setVisibility(View.VISIBLE); crossImageView.setVisibility(View.VISIBLE); // I don't know how to highlight in the code block // So I just add this extra long comment to make it obvious // Add a javascript call to hide that element, if it exists webView.loadUrl("javascript:try{ document.getElementById('nux-missions-bar').style.display='none'; } catch (e) {}"); // End changes } 
+2
source

Source: https://habr.com/ru/post/1481736/


All Articles