diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java
index 0f79d265ba..7a6ba0761a 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java
@@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2026 by Marcel Bokhorst (M66B)
*/
+import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -115,6 +116,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private SwitchCompat swBouncyCastle;
private SwitchCompat swFipsMode;
private ImageButton ibBouncyCastle;
+ private Button btnLocalNetwork;
private Button btnManage;
private TextView tvNetworkMetered;
private TextView tvNetworkRoaming;
@@ -189,6 +191,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swBouncyCastle = view.findViewById(R.id.swBouncyCastle);
swFipsMode = view.findViewById(R.id.swFipsMode);
ibBouncyCastle = view.findViewById(R.id.ibBouncyCastle);
+ btnLocalNetwork = view.findViewById(R.id.btnLocalNetwork);
btnManage = view.findViewById(R.id.btnManage);
tvNetworkMetered = view.findViewById(R.id.tvNetworkMetered);
@@ -509,6 +512,16 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
+ btnLocalNetwork.setVisibility(BuildConfig.PLAY_STORE_RELEASE || Build.VERSION.SDK_INT < Build.VERSION_CODES.CINNAMON_BUN
+ ? View.GONE : View.VISIBLE);
+ btnLocalNetwork.setEnabled(!Helper.hasPermission(getContext(), Manifest.permission.ACCESS_LOCAL_NETWORK));
+ btnLocalNetwork.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ requestPermissions(new String[]{Manifest.permission.ACCESS_LOCAL_NETWORK}, REQUEST_PERMISSIONS);
+ }
+ });
+
final Intent manage = getIntentConnectivity();
PackageManager pm = getContext().getPackageManager();
btnManage.setVisibility(
@@ -769,6 +782,11 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
return super.onOptionsItemSelected(item);
}
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ btnLocalNetwork.setEnabled(!Helper.hasPermission(getContext(), Manifest.permission.ACCESS_LOCAL_NETWORK));
+ }
+
private void setOptions() {
try {
if (view == null || getContext() == null)
diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java
index 98ca61febb..7e4c6f7705 100644
--- a/app/src/main/java/eu/faircode/email/Helper.java
+++ b/app/src/main/java/eu/faircode/email/Helper.java
@@ -512,8 +512,6 @@ public class Helper {
permissions.add(Manifest.permission.READ_CONTACTS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
permissions.add(Manifest.permission.POST_NOTIFICATIONS);
- if (!BuildConfig.PLAY_STORE_RELEASE)
- permissions.add(Manifest.permission.ACCESS_LOCAL_NETWORK);
try {
PackageManager pm = context.getPackageManager();
diff --git a/app/src/main/res/layout/fragment_options_connection.xml b/app/src/main/res/layout/fragment_options_connection.xml
index 3fa943ae46..a046f70260 100644
--- a/app/src/main/res/layout/fragment_options_connection.xml
+++ b/app/src/main/res/layout/fragment_options_connection.xml
@@ -717,6 +717,18 @@
app:layout_constraintTop_toBottomOf="@id/swFipsMode"
app:srcCompat="@drawable/twotone_info_24" />
+
+
+ app:layout_constraintTop_toBottomOf="@id/btnLocalNetwork" />
Allow connection redirection
Use Bouncy Castle\'s secure socket provider (JSSE)
FIPS mode
+ Local network permissions
Manage connectivity
General