| 
				
			 | 
			
			
				@@ -117,6 +117,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> { 
			 | 
		
	
		
			
			| 
				117
			 | 
			
				117
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				118
			 | 
			
				118
			 | 
			
			
				   protected RNCWebChromeClient mWebChromeClient = null; 
			 | 
		
	
		
			
			| 
				119
			 | 
			
				119
			 | 
			
			
				   protected boolean mAllowsFullscreenVideo = false; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				120
			 | 
			
			
				+  protected @Nullable String mUserAgent = null; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				121
			 | 
			
			
				+  protected @Nullable String mUserAgentWithApplicationName = null; 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				122
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				121
			 | 
			
				123
			 | 
			
			
				   public RNCWebViewManager() { 
			 | 
		
	
		
			
			| 
				122
			 | 
			
				124
			 | 
			
			
				     mWebViewConfig = new WebViewConfig() { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -298,8 +300,34 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> { 
			 | 
		
	
		
			
			| 
				298
			 | 
			
				300
			 | 
			
			
				   @ReactProp(name = "userAgent") 
			 | 
		
	
		
			
			| 
				299
			 | 
			
				301
			 | 
			
			
				   public void setUserAgent(WebView view, @Nullable String userAgent) { 
			 | 
		
	
		
			
			| 
				300
			 | 
			
				302
			 | 
			
			
				     if (userAgent != null) { 
			 | 
		
	
		
			
			| 
				301
			 | 
			
				
			 | 
			
			
				-      // TODO(8496850): Fix incorrect behavior when property is unset (uA == null) 
			 | 
		
	
		
			
			| 
				302
			 | 
			
				
			 | 
			
			
				-      view.getSettings().setUserAgentString(userAgent); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				303
			 | 
			
			
				+      mUserAgent = userAgent; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				304
			 | 
			
			
				+    } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				305
			 | 
			
			
				+      mUserAgent = null; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				306
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				307
			 | 
			
			
				+    this.setUserAgentString(view); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				308
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				309
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				310
			 | 
			
			
				+  @ReactProp(name = "applicationNameForUserAgent") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				311
			 | 
			
			
				+  public void setApplicationNameForUserAgent(WebView view, @Nullable String applicationName) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				312
			 | 
			
			
				+    if(applicationName != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				313
			 | 
			
			
				+      if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				314
			 | 
			
			
				+        String defaultUserAgent = WebSettings.getDefaultUserAgent(view.getContext()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				315
			 | 
			
			
				+        mUserAgentWithApplicationName = defaultUserAgent + " " + applicationName; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				316
			 | 
			
			
				+      } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				317
			 | 
			
			
				+    } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				318
			 | 
			
			
				+      mUserAgentWithApplicationName = null; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				319
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				320
			 | 
			
			
				+    this.setUserAgentString(view); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				321
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				322
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				323
			 | 
			
			
				+  protected void setUserAgentString(WebView view) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				324
			 | 
			
			
				+    if(mUserAgent != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				325
			 | 
			
			
				+      view.getSettings().setUserAgentString(mUserAgent); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				326
			 | 
			
			
				+    } else if(mUserAgentWithApplicationName != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				327
			 | 
			
			
				+      view.getSettings().setUserAgentString(mUserAgentWithApplicationName); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				328
			 | 
			
			
				+    } else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				329
			 | 
			
			
				+      // handle unsets of `userAgent` prop as long as device is >= API 17 
			 | 
		
	
		
			
			| 
				
			 | 
			
				330
			 | 
			
			
				+      view.getSettings().setUserAgentString(WebSettings.getDefaultUserAgent(view.getContext())); 
			 | 
		
	
		
			
			| 
				303
			 | 
			
				331
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				304
			 | 
			
				332
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				305
			 | 
			
				333
			 | 
			
			
				  
			 |