- Removed context var from BaresipService.

This commit is contained in:
Juha Heinanen
2019-05-08 14:09:41 +03:00
parent 64d96a10d7
commit 8a29dc1c6c
3 changed files with 4 additions and 7 deletions

View File

@ -51,7 +51,6 @@ class BaresipService: Service() {
intent.setPackage("com.tutpro.baresip")
filesPath = filesDir.absolutePath
context = applicationContext
am = getSystemService(Context.AUDIO_SERVICE) as AudioManager
val rtUri = RingtoneManager.getActualDefaultRingtoneUri(applicationContext,
@ -771,7 +770,6 @@ class BaresipService: Service() {
var callVolume = 0
var filesPath = ""
var context: Context? = null
var uas = ArrayList<UserAgent>()
var status = ArrayList<Int>()
var calls = ArrayList<Call>()

View File

@ -1,13 +1,12 @@
package com.tutpro.baresip
import android.content.Context
import java.io.File
object Config {
private val path = BaresipService.filesPath + "/config"
private val file = File(path)
private val context = BaresipService.context
private var config = Utils.getFileContents(file)
fun initialize() {
@ -75,8 +74,8 @@ object Config {
add(variable, value)
}
fun reset() {
Utils.copyAssetToFile(context!!, "config", path)
fun reset(ctx: Context) {
Utils.copyAssetToFile(ctx, "config", path)
}
fun save() {

View File

@ -193,7 +193,7 @@ class ConfigActivity : AppCompatActivity() {
}
if (reset.isChecked) {
Config.reset()
Config.reset(this)
save = false
restart = true
}