hide IMAP folder options on chatmail (#3050)

* remove unused getConfig() variants

* hide IMAP folder options if is_chatmail == 1

* hide e2ee, show-system-contacts as well

* ignore system-contacts settings on chatmail (in case it was enabled before)
This commit is contained in:
bjoern
2024-05-15 15:10:19 +02:00
committed by GitHub
parent 0f1e03f6ff
commit cbb934e9ef
3 changed files with 14 additions and 3 deletions
+4 -2
View File
@@ -136,8 +136,6 @@ public class DcContext {
public native boolean setConfigFromQr (String qr);
public native String getConfig (String key);
public int getConfigInt (String key) { try{return Integer.parseInt(getConfig(key));} catch(Exception e) {} return 0; }
@Deprecated public String getConfig (String key, String def) { return getConfig(key); }
@Deprecated public int getConfigInt (String key, int def) { return getConfigInt(key); }
public native String getInfo ();
public native int getConnectivity ();
public native String getConnectivityHtml ();
@@ -232,6 +230,10 @@ public class DcContext {
return ret.trim();
}
public boolean isChatmail() {
return getConfigInt("is_chatmail") == 1;
}
/**
* @return true if at least one chat has location streaming enabled
*/
@@ -116,7 +116,7 @@ public class ContactSelectionListFragment extends Fragment
public void onStart() {
super.onStart();
this.getLoaderManager().initLoader(0, null, this);
if (dcContext.getConfigInt("ui.android.show_system_contacts") != 0) {
if (dcContext.getConfigInt("ui.android.show_system_contacts") != 0 && !dcContext.isChatmail()) {
Permissions.with(this)
.request(Manifest.permission.READ_CONTACTS)
.ifNecessary()
@@ -207,6 +207,15 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
}
return true;
}));
if (dcContext.isChatmail()) {
preferE2eeCheckbox.setVisible(false);
showSystemContacts.setVisible(false);
sentboxWatchCheckbox.setVisible(false);
bccSelfCheckbox.setVisible(false);
mvboxMoveCheckbox.setVisible(false);
onlyFetchMvboxCheckbox.setVisible(false);
}
}
@Override