removed unused config variables

This commit is contained in:
Daniel Gultsch 2016-04-27 16:43:02 +02:00
parent ebcb13c8eb
commit 29616d02a8
10 changed files with 14 additions and 64 deletions

View File

@ -39,10 +39,6 @@ public final class Config {
public static final String DOMAIN_LOCK = null; //only allow account creation for this domain public static final String DOMAIN_LOCK = null; //only allow account creation for this domain
public static final String MAGIC_CREATE_DOMAIN = null; public static final String MAGIC_CREATE_DOMAIN = null;
public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain
public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains
public static final boolean LOCK_SETTINGS = false; //set to true to disallow account and settings editing
public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox
public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true
@ -51,8 +47,6 @@ public final class Config {
public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
public static final boolean SHOW_DISABLE_FOREGROUND = true; //if set to true the foreground notification has a button to disable it public static final boolean SHOW_DISABLE_FOREGROUND = true; //if set to true the foreground notification has a button to disable it
public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false;
public static final int PING_MAX_INTERVAL = 300; public static final int PING_MAX_INTERVAL = 300;
public static final int PING_MIN_INTERVAL = 30; public static final int PING_MIN_INTERVAL = 30;
public static final int PING_TIMEOUT = 15; public static final int PING_TIMEOUT = 15;

View File

@ -63,9 +63,7 @@ public class Bookmark extends Element implements ListItem {
@Override @Override
public String getDisplayJid() { public String getDisplayJid() {
Jid jid = getJid(); Jid jid = getJid();
if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { if (jid != null) {
return jid.getLocalpart();
} else if (jid != null) {
return jid.toString(); return jid.toString();
} else { } else {
return null; return null;

View File

@ -124,9 +124,7 @@ public class Contact implements ListItem, Blockable {
@Override @Override
public String getDisplayJid() { public String getDisplayJid() {
if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.DOMAIN_LOCK)) { if (jid != null) {
return jid.getLocalpart();
} else if (jid != null) {
return jid.toString(); return jid.toString();
} else { } else {
return null; return null;

View File

@ -528,11 +528,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
mAccountJid.setText(getString(R.string.using_account, account)); mAccountJid.setText(getString(R.string.using_account, account));
mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48))); mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48)));
setTitle(mConversation.getName()); setTitle(mConversation.getName());
if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && mConversation.getJid().getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { mFullJid.setText(mConversation.getJid().toBareJid().toString());
mFullJid.setText(mConversation.getJid().getLocalpart());
} else {
mFullJid.setText(mConversation.getJid().toBareJid().toString());
}
mYourNick.setText(mucOptions.getActualNick()); mYourNick.setText(mucOptions.getActualNick());
mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
if (mucOptions.online()) { if (mucOptions.online()) {

View File

@ -674,12 +674,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
} }
mPassword.setEnabled(!Config.LOCK_SETTINGS);
mAccountJid.setEnabled(!Config.LOCK_SETTINGS);
mHostname.setEnabled(!Config.LOCK_SETTINGS);
mPort.setEnabled(!Config.LOCK_SETTINGS);
mPasswordConfirm.setEnabled(!Config.LOCK_SETTINGS);
mRegisterNew.setEnabled(!Config.LOCK_SETTINGS);
if (!mInitMode) { if (!mInitMode) {
this.mAvatar.setVisibility(View.VISIBLE); this.mAvatar.setVisibility(View.VISIBLE);

View File

@ -43,17 +43,14 @@ public class EnterJidDialog {
final String title, final String positiveButton, final String title, final String positiveButton,
final String prefilledJid, final String account, boolean allowEditJid final String prefilledJid, final String account, boolean allowEditJid
) { ) {
final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null;
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title); builder.setTitle(title);
View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null); View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null);
final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id);
jabberIdDesc.setText(lock ? R.string.username : R.string.account_settings_jabber_id); jabberIdDesc.setText(R.string.account_settings_jabber_id);
final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
if (!lock) { jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts));
jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts));
}
if (prefilledJid != null) { if (prefilledJid != null) {
jid.append(prefilledJid); jid.append(prefilledJid);
if (!allowEditJid) { if (!allowEditJid) {
@ -64,7 +61,7 @@ public class EnterJidDialog {
} }
} }
jid.setHint(Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null ? R.string.username_hint : R.string.account_settings_example_jabber_id); jid.setHint(R.string.account_settings_example_jabber_id);
if (account == null) { if (account == null) {
StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner); StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner);
@ -100,13 +97,9 @@ public class EnterJidDialog {
} }
final Jid contactJid; final Jid contactJid;
try { try {
if (lock) { contactJid = Jid.fromString(jid.getText().toString());
contactJid = Jid.fromParts(jid.getText().toString(), Config.DOMAIN_LOCK, null);
} else {
contactJid = Jid.fromString(jid.getText().toString());
}
} catch (final InvalidJidException e) { } catch (final InvalidJidException e) {
jid.setError(context.getString(lock ? R.string.invalid_username : R.string.invalid_jid)); jid.setError(context.getString(R.string.invalid_jid));
return; return;
} }

View File

@ -156,10 +156,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
if (Config.X509_VERIFICATION) { if (Config.X509_VERIFICATION) {
addAccount.setVisible(false); addAccount.setVisible(false);
addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
} else {
addAccount.setVisible(!Config.LOCK_SETTINGS);
} }
addAccountWithCertificate.setVisible(!Config.LOCK_SETTINGS);
if (!accountsLeftToEnable()) { if (!accountsLeftToEnable()) {
enableAll.setVisible(false); enableAll.setVisible(false);

View File

@ -390,13 +390,10 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null); final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null);
final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.CONFERENCE_DOMAIN_LOCK != null;
final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id);
jabberIdDesc.setText(lock ? R.string.conference_name : R.string.conference_address); jabberIdDesc.setText(R.string.conference_address);
jid.setHint(lock ? R.string.conference_name : R.string.conference_address_example); jid.setHint(R.string.conference_address_example);
if (!lock) { jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts));
jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts));
}
if (prefilledJid != null) { if (prefilledJid != null) {
jid.append(prefilledJid); jid.append(prefilledJid);
} }
@ -422,13 +419,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
} }
final Jid conferenceJid; final Jid conferenceJid;
try { try {
if (lock) { conferenceJid = Jid.fromString(jid.getText().toString());
conferenceJid = Jid.fromParts(jid.getText().toString(),Config.CONFERENCE_DOMAIN_LOCK, null);
} else {
conferenceJid = Jid.fromString(jid.getText().toString());
}
} catch (final InvalidJidException e) { } catch (final InvalidJidException e) {
jid.setError(getString(lock ? R.string.invalid_conference_name : R.string.invalid_jid)); jid.setError(getString(R.string.invalid_jid));
return; return;
} }

View File

@ -378,19 +378,6 @@ public abstract class XmppActivity extends Activity {
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final MenuItem menuSettings = menu.findItem(R.id.action_settings);
final MenuItem menuManageAccounts = menu.findItem(R.id.action_accounts);
if (menuSettings != null) {
menuSettings.setVisible(!Config.LOCK_SETTINGS);
}
if (menuManageAccounts != null) {
menuManageAccounts.setVisible(!Config.LOCK_SETTINGS);
}
return super.onCreateOptionsMenu(menu);
}
protected boolean isOptimizingBattery() { protected boolean isOptimizingBattery() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);

View File

@ -7,5 +7,5 @@ public final class Xmlns {
public static final String ROSTER = "jabber:iq:roster"; public static final String ROSTER = "jabber:iq:roster";
public static final String REGISTER = "jabber:iq:register"; public static final String REGISTER = "jabber:iq:register";
public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams"; public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams";
public static final String HTTP_UPLOAD = Config.LEGACY_NAMESPACE_HTTP_UPLOAD ? "eu:siacs:conversations:http:upload" : "urn:xmpp:http:upload"; public static final String HTTP_UPLOAD = "urn:xmpp:http:upload";
} }