Java 11 networkSecurityConfig
- upgrading gradle to Java 11 - fix CleartextTraffic with networkSecurityConfig - fix port empty
This commit is contained in:
		@ -7,12 +7,13 @@
 | 
			
		||||
    <uses-permission android:name="android.permission.INTERNET" />
 | 
			
		||||
 | 
			
		||||
    <application
 | 
			
		||||
        android:allowBackup="true"
 | 
			
		||||
        android:icon="@mipmap/ic_launcher"
 | 
			
		||||
        android:label="@string/app_name"
 | 
			
		||||
        android:roundIcon="@mipmap/ic_launcher_round"
 | 
			
		||||
        android:supportsRtl="true"
 | 
			
		||||
        android:theme="@style/AppTheme">
 | 
			
		||||
        android:theme="@style/AppTheme"
 | 
			
		||||
        android:networkSecurityConfig="@xml/network_security_config">
 | 
			
		||||
        <!--android:usesCleartextTraffic="true"-->
 | 
			
		||||
 | 
			
		||||
        <provider
 | 
			
		||||
            android:name="androidx.core.content.FileProvider"
 | 
			
		||||
 | 
			
		||||
@ -63,13 +63,21 @@ public class Transfer {
 | 
			
		||||
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
 | 
			
		||||
 | 
			
		||||
        host = prefs.getString("host", null);
 | 
			
		||||
        port = valueOf(prefs.getString("port", null));
 | 
			
		||||
        root = prefs.getString("root", null);
 | 
			
		||||
        local_storage = prefs.getString("local_storage", null);
 | 
			
		||||
        if(prefs.getBoolean("protocol", false))
 | 
			
		||||
            protocol = "https";
 | 
			
		||||
        else
 | 
			
		||||
            protocol = "http";
 | 
			
		||||
        String portValue = prefs.getString("port", null);
 | 
			
		||||
        if(portValue.equals("")){
 | 
			
		||||
            if(protocol.equals("http"))
 | 
			
		||||
                port = 80;
 | 
			
		||||
            else if(protocol.equals("https"))
 | 
			
		||||
                port = 443;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
            port = valueOf(portValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private URL checkRedirection(URL url) throws IOException {
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@
 | 
			
		||||
    <string name="server_protocol">Use secure https</string>
 | 
			
		||||
    <string name="server_host_def">www.netdldata.net</string>
 | 
			
		||||
    <string name="server_port">Port</string>
 | 
			
		||||
    <string name="server_port_def">80</string>
 | 
			
		||||
    <string name="server_port_def"></string>
 | 
			
		||||
    <string name="server_root">Root</string>
 | 
			
		||||
    <string name="server_root_def">/transfer</string>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								app/src/main/res/xml/network_security_config.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/src/main/res/xml/network_security_config.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<network-security-config>
 | 
			
		||||
    <domain-config cleartextTrafficPermitted="true">
 | 
			
		||||
        <domain includeSubdomains="true">netdldata.net</domain>
 | 
			
		||||
    </domain-config>
 | 
			
		||||
</network-security-config>
 | 
			
		||||
		Reference in New Issue
	
	Block a user