mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Make sure friend lists subscruptions are enabled for sip.linphone.org accounts and disabled for others
This commit is contained in:
parent
44af8bb340
commit
254d8619fe
3 changed files with 19 additions and 3 deletions
|
|
@ -30,7 +30,4 @@
|
|||
<entry name="media_encryption" overwrite="true">zrtp</entry>
|
||||
<entry name="media_encryption_mandatory" overwrite="true">1</entry>
|
||||
</section>
|
||||
<section name="net">
|
||||
<entry name="friendlist_subscription_enabled" overwrite="true">1</entry>
|
||||
</section>
|
||||
</config>
|
||||
|
|
|
|||
|
|
@ -238,6 +238,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
|
||||
core.videoCodecPriorityPolicy = CodecPriorityPolicy.Auto
|
||||
|
||||
updateFriendListsSubscriptionDependingOnDefaultAccount()
|
||||
|
||||
computeUserAgent()
|
||||
Log.i("$TAG Core has been created with user-agent [${core.userAgent}], starting it")
|
||||
core.start()
|
||||
|
|
@ -473,6 +475,22 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun updateFriendListsSubscriptionDependingOnDefaultAccount() {
|
||||
val account = core.defaultAccount
|
||||
if (account != null) {
|
||||
val enabled = account.params.domain == corePreferences.defaultDomain
|
||||
if (enabled != core.isFriendListSubscriptionEnabled) {
|
||||
core.isFriendListSubscriptionEnabled = enabled
|
||||
Log.i(
|
||||
"$TAG Friend list(s) subscription are now ${if (enabled) "enabled" else "disabled"}"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.e("$TAG Default account is null, do not touch friend lists subscription")
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeUserAgent() {
|
||||
val deviceName = AppUtils.getDeviceName(context)
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ class MainViewModel @UiThread constructor() : ViewModel() {
|
|||
Log.i(
|
||||
"$TAG Default account changed, now is [${account.params.identityAddress?.asStringUriOnly()}]"
|
||||
)
|
||||
coreContext.updateFriendListsSubscriptionDependingOnDefaultAccount()
|
||||
|
||||
if (defaultAccountRegistrationFailed && account.state != RegistrationState.Failed) {
|
||||
Log.i(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue