Removed unused MaxConnections setting
This commit is contained in:
parent
68cb2253d9
commit
ab5370cd86
6 changed files with 3 additions and 30 deletions
|
@ -99,9 +99,6 @@
|
|||
<!-- Preference title -->
|
||||
<string name="notification_sounds">Notification Sounds</string>
|
||||
|
||||
<!-- Preference title (debug only)-->
|
||||
<string name="max_connections" translatable="false">Maximum Number of Connections</string>
|
||||
|
||||
<!-- Preference title -->
|
||||
<string name="servers">Servers</string>
|
||||
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
android:inputType="number"
|
||||
android:numeric="integer" />
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/max_connections"
|
||||
android:key="max_connections"
|
||||
android:inputType="number"
|
||||
android:numeric="integer" />
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/servers"
|
||||
android:key="servers" />
|
||||
|
|
|
@ -82,7 +82,6 @@ class FirstStartActivity extends AppCompatActivity with OnEditorActionListener w
|
|||
.putString(KeyUserStatus, SettingsInterface.DefaultUserStatus)
|
||||
.putBoolean(KeyNotificationSoundsOn, DefaultNotificationSoundsOn)
|
||||
.putString(KeyScanInterval, DefaultScanInterval.toString)
|
||||
.putString(KeyMaxConnections, DefaultMaxConnections.toString)
|
||||
.putString(KeyAddresses, DefaultAddresses)
|
||||
.apply()
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|||
import android.content.{Intent, SharedPreferences}
|
||||
import android.os.Bundle
|
||||
import android.preference.{PreferenceFragment, PreferenceManager}
|
||||
import com.nutomic.ensichat.R
|
||||
import com.nutomic.ensichat.activities.EnsichatActivity
|
||||
import com.nutomic.ensichat.core.messages.body.UserInfo
|
||||
import com.nutomic.ensichat.core.interfaces.SettingsInterface._
|
||||
import com.nutomic.ensichat.core.messages.body.UserInfo
|
||||
import com.nutomic.ensichat.fragments.SettingsFragment._
|
||||
import com.nutomic.ensichat.service.ChatService
|
||||
import com.nutomic.ensichat.{BuildConfig, R}
|
||||
|
||||
object SettingsFragment {
|
||||
val Version = "version"
|
||||
|
@ -22,8 +22,7 @@ class SettingsFragment extends PreferenceFragment with OnSharedPreferenceChangeL
|
|||
|
||||
private lazy val activity = getActivity.asInstanceOf[EnsichatActivity]
|
||||
|
||||
private lazy val maxConnections = findPreference(KeyMaxConnections)
|
||||
private lazy val version = findPreference(Version)
|
||||
private lazy val version = findPreference(Version)
|
||||
|
||||
private lazy val prefs = PreferenceManager.getDefaultSharedPreferences(getActivity)
|
||||
|
||||
|
@ -32,9 +31,6 @@ class SettingsFragment extends PreferenceFragment with OnSharedPreferenceChangeL
|
|||
|
||||
addPreferencesFromResource(R.xml.settings)
|
||||
|
||||
if (!BuildConfig.DEBUG)
|
||||
getPreferenceScreen.removePreference(maxConnections)
|
||||
|
||||
val packageInfo = getActivity.getPackageManager.getPackageInfo(getActivity.getPackageName, 0)
|
||||
version.setSummary(packageInfo.versionName)
|
||||
prefs.registerOnSharedPreferenceChangeListener(this)
|
||||
|
|
|
@ -363,13 +363,6 @@ final class ConnectionHandler(settings: SettingsInterface, database: Database,
|
|||
* @return True if the connection is valid
|
||||
*/
|
||||
def onConnectionOpened(msg: Message): Boolean = {
|
||||
val maxConnections = settings.get(SettingsInterface.KeyMaxConnections,
|
||||
SettingsInterface.DefaultMaxConnections.toString).toInt
|
||||
if (connections().size == maxConnections) {
|
||||
logger.info("Maximum number of connections reached")
|
||||
return false
|
||||
}
|
||||
|
||||
val info = msg.body.asInstanceOf[messages.body.ConnectionInfo]
|
||||
val sender = crypto.calculateAddress(info.key)
|
||||
if (sender == Address.Broadcast || sender == Address.Null) {
|
||||
|
|
|
@ -11,11 +11,6 @@ object SettingsInterface {
|
|||
*/
|
||||
val KeyScanInterval = "scan_interval_seconds"
|
||||
|
||||
/**
|
||||
* NOTE: Stored as string.
|
||||
*/
|
||||
val KeyMaxConnections = "max_connections"
|
||||
|
||||
/**
|
||||
* NOTE: Stored as comma separated string.
|
||||
*/
|
||||
|
@ -24,7 +19,6 @@ object SettingsInterface {
|
|||
val DefaultUserStatus = "Let's chat!"
|
||||
val DefaultScanInterval = 15
|
||||
val DefaultNotificationSoundsOn = true
|
||||
val DefaultMaxConnections = 1000000
|
||||
// When updating this, be sure to adjust the code in [[InternetInterface.create]].
|
||||
val DefaultAddresses = Set("ensichat.nutomic.com:26344", "trinity.nutomic.com:26344").mkString(", ")
|
||||
|
||||
|
|
Reference in a new issue