Commit 9301af3c authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

account: disable account discovery

Change-Id: I3464e2c72b19e55452e75019c824baddc95cf9b9
parent 2fb0e347
......@@ -163,7 +163,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
for account in self.accountService.accounts {
self.accountService.setRingtonePath(forAccountId: account.id)
self.accountService.setDetails(forAccountId: account.id)
}
self.reloadDataFor(account: currentAccount)
if self.accountService.proxyEnabled() {
......
......@@ -101,6 +101,9 @@ enum ConfigKey: String {
case proxyServer = "Account.proxyServer"
case devicePushToken = "Account.proxyPushToken"
case archiveHasPassword = "Account.archiveHasPassword"
case dhtPeerDiscovery = "Account.peerDiscovery";
case accountPeerDiscovery = "Account.accountDiscovery";
case accountPublish = "Account.accountPublish";
}
/**
......
......@@ -402,15 +402,30 @@ class AccountsService: AccountAdapterDelegate {
})
}
func setRingtonePath(forAccountId accountId: String) {
func setDetails(forAccountId accountId: String) {
let details = self.getAccountDetails(fromAccountId: accountId)
if details
.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath)) == "default.wav" {
.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath)) == "default.wav" &&
details
.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.dhtPeerDiscovery)) == "false" &&
details
.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.accountPeerDiscovery)) == "false" &&
details
.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.accountPublish)) == "false" {
return
}
details
.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath),
withValue: "default.wav")
details
.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.dhtPeerDiscovery),
withValue: "false")
details
.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.accountPeerDiscovery),
withValue: "false")
details
.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.accountPublish),
withValue: "false")
setAccountDetails(forAccountId: accountId, withDetails: details)
}
......@@ -571,6 +586,11 @@ class AccountsService: AccountAdapterDelegate {
accountDetails!.updateValue("default.wav", forKey: ConfigKey.ringtonePath.rawValue)
accountDetails!.updateValue(accountType, forKey: ConfigKey.accountType.rawValue)
accountDetails!.updateValue("true", forKey: ConfigKey.accountUpnpEnabled.rawValue)
if accountType == AccountType.ring.rawValue {
accountDetails!.updateValue("false", forKey: ConfigKey.dhtPeerDiscovery.rawValue)
accountDetails!.updateValue("false", forKey: ConfigKey.accountPeerDiscovery.rawValue)
accountDetails!.updateValue("false", forKey: ConfigKey.accountPublish.rawValue)
}
return accountDetails!
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment