Move VFS Activation at earlier stage
This commit is contained in:
parent
9ccab891ab
commit
571349953b
3 changed files with 102 additions and 102 deletions
|
@ -44,6 +44,10 @@ class LinphoneApplication : Application() {
|
|||
corePreferences = CorePreferences(context)
|
||||
corePreferences.copyAssetsFromPackage()
|
||||
|
||||
if (corePreferences.vfsEnabled) {
|
||||
CoreContext.activateVFS()
|
||||
}
|
||||
|
||||
val config = Factory.instance().createConfigWithFactory(corePreferences.configPath, corePreferences.factoryConfigPath)
|
||||
corePreferences.config = config
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.main.settings.SettingListenerStub
|
||||
import org.linphone.core.CoreContext
|
||||
import org.linphone.core.Factory
|
||||
import org.linphone.mediastream.Version
|
||||
import org.linphone.utils.AppUtils
|
||||
|
@ -107,7 +108,7 @@ class AdvancedSettingsViewModel : GenericSettingsViewModel() {
|
|||
val vfsListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
prefs.vfsEnabled = newValue
|
||||
if (newValue) coreContext.activateVFS()
|
||||
if (newValue) CoreContext.activateVFS()
|
||||
}
|
||||
}
|
||||
val vfs = MutableLiveData<Boolean>()
|
||||
|
|
|
@ -291,9 +291,6 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
Log.i("[Context] Crashlytics enabled, register logging service listener")
|
||||
}
|
||||
|
||||
if (corePreferences.vfsEnabled) {
|
||||
activateVFS()
|
||||
}
|
||||
core = Factory.instance().createCoreWithConfig(coreConfig, context)
|
||||
|
||||
stopped = false
|
||||
|
@ -685,8 +682,6 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
private const val LINPHONE_VFS_ENCRYPTION_AES256GCM128_SHA256 = 2
|
||||
private const val VFS_IV = "vfsiv"
|
||||
private const val VFS_KEY = "vfskey"
|
||||
}
|
||||
|
||||
@Throws(java.lang.Exception::class)
|
||||
private fun generateSecretKey() {
|
||||
val keyGenerator =
|
||||
|
@ -766,7 +761,6 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
Base64.decode(sharedPreferences.getString(VFS_IV, null), Base64.DEFAULT)
|
||||
)
|
||||
}
|
||||
|
||||
fun activateVFS() {
|
||||
try {
|
||||
Log.i("[Context] Activating VFS")
|
||||
|
@ -793,3 +787,4 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue