Skip to content

Commit

Permalink
Merge pull request #2425 from wmathurin/dev
Browse files Browse the repository at this point in the history
Showing spinner until login webview page is loaded
  • Loading branch information
wmathurin authored Jun 15, 2023
2 parents 5d68ec4 + 2273c8e commit fa666d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions libs/SalesforceSDK/res/layout/sf__login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
android:layout_height="match_parent"
android:windowDrawsSystemBarBackgrounds="true">

<ProgressBar
android:id="@+id/sf__loading_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>

<WebView android:id="@+id/sf__oauth_webview"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Toast;

Expand Down Expand Up @@ -476,9 +477,18 @@ protected class AuthWebViewClient extends WebViewClient {

@Override
public void onPageFinished(WebView view, String url) {
// Hide spinner / show web view
final RelativeLayout parentView = (RelativeLayout) view.getParent();
if (parentView != null) {
final ProgressBar progressBar = parentView.findViewById(R.id.sf__loading_spinner);
if (progressBar != null) {
progressBar.setVisibility(View.INVISIBLE);
}
}
view.setVisibility(View.VISIBLE);

// Remove the native login buttons (biometric, IDP) once on the allow/deny screen
if (url.contains("frontdoor.jsp")) {
final RelativeLayout parentView = (RelativeLayout) view.getParent();
if (parentView != null) {
final Button idpButton = parentView.findViewById(R.id.sf__idp_login_button);
if (idpButton != null) {
Expand All @@ -490,9 +500,8 @@ public void onPageFinished(WebView view, String url) {
}
}
}

EventsObservable.get().notifyEvent(EventType.AuthWebViewPageFinished, url);
super.onPageFinished(view, url);
super.onPageFinished(view, url);
}

@Override
Expand Down

0 comments on commit fa666d5

Please sign in to comment.