diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/RegisterActivity.java b/VideoLocker/src/main/java/org/edx/mobile/view/RegisterActivity.java index f48434e217..c3a858b4d2 100644 --- a/VideoLocker/src/main/java/org/edx/mobile/view/RegisterActivity.java +++ b/VideoLocker/src/main/java/org/edx/mobile/view/RegisterActivity.java @@ -81,7 +81,9 @@ protected void onCreate(Bundle savedInstanceState) { boolean isSocialEnabled = SocialFactory.isSocialFeatureEnabled(getApplicationContext(), SocialFactory.SOCIAL_SOURCE_TYPE.TYPE_UNKNOWN); if ( !isSocialEnabled ){ - findViewById(R.id.panel_login_social).setVisibility(View.GONE); + findViewById(R.id.panel_social_layout).setVisibility(View.GONE); + findViewById(R.id.or_signup_with_email_title).setVisibility(View.GONE); + findViewById(R.id.signup_with_row).setVisibility(View.GONE); } else { ImageView imgFacebook=(ImageView)findViewById(R.id.img_facebook); diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/custom/URLInterceptorWebViewClient.java b/VideoLocker/src/main/java/org/edx/mobile/view/custom/URLInterceptorWebViewClient.java index 8f0a6c5b3b..d994396f70 100644 --- a/VideoLocker/src/main/java/org/edx/mobile/view/custom/URLInterceptorWebViewClient.java +++ b/VideoLocker/src/main/java/org/edx/mobile/view/custom/URLInterceptorWebViewClient.java @@ -1,6 +1,7 @@ package org.edx.mobile.view.custom; import android.annotation.TargetApi; +import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; @@ -12,6 +13,7 @@ import org.apache.http.protocol.HTTP; import org.edx.mobile.logger.Logger; +import org.edx.mobile.util.NetworkUtil; import java.util.HashMap; import java.util.Map; @@ -151,8 +153,17 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { - if (isExternalLink(url)) { - return new WebResourceResponse("text/html", HTTP.UTF_8, null); + try { + Context context = view.getContext().getApplicationContext(); + + // suppress external links on ZeroRated network + if (isExternalLink(url) + && NetworkUtil.isOnZeroRatedNetwork(context) + && NetworkUtil.isConnectedMobile(context)) { + return new WebResourceResponse("text/html", HTTP.UTF_8, null); + } + } catch(Exception ex) { + logger.error(ex); } return super.shouldInterceptRequest(view, url); } @@ -160,8 +171,17 @@ public WebResourceResponse shouldInterceptRequest(WebView view, String url) { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { - if (isExternalLink(request.getUrl().toString())) { - return new WebResourceResponse("text/html", HTTP.UTF_8, null); + try { + Context context = view.getContext().getApplicationContext(); + + // suppress external links on ZeroRated network + if (isExternalLink(request.getUrl().toString()) + && NetworkUtil.isOnZeroRatedNetwork(context) + && NetworkUtil.isConnectedMobile(context)) { + return new WebResourceResponse("text/html", HTTP.UTF_8, null); + } + } catch(Exception ex) { + logger.error(ex); } return super.shouldInterceptRequest(view, request); }