- Removed context var from BaresipService.
This commit is contained in:
@ -51,7 +51,6 @@ class BaresipService: Service() {
|
|||||||
intent.setPackage("com.tutpro.baresip")
|
intent.setPackage("com.tutpro.baresip")
|
||||||
|
|
||||||
filesPath = filesDir.absolutePath
|
filesPath = filesDir.absolutePath
|
||||||
context = applicationContext
|
|
||||||
|
|
||||||
am = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
am = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||||
val rtUri = RingtoneManager.getActualDefaultRingtoneUri(applicationContext,
|
val rtUri = RingtoneManager.getActualDefaultRingtoneUri(applicationContext,
|
||||||
@ -771,7 +770,6 @@ class BaresipService: Service() {
|
|||||||
var callVolume = 0
|
var callVolume = 0
|
||||||
|
|
||||||
var filesPath = ""
|
var filesPath = ""
|
||||||
var context: Context? = null
|
|
||||||
var uas = ArrayList<UserAgent>()
|
var uas = ArrayList<UserAgent>()
|
||||||
var status = ArrayList<Int>()
|
var status = ArrayList<Int>()
|
||||||
var calls = ArrayList<Call>()
|
var calls = ArrayList<Call>()
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
package com.tutpro.baresip
|
package com.tutpro.baresip
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object Config {
|
object Config {
|
||||||
|
|
||||||
private val path = BaresipService.filesPath + "/config"
|
private val path = BaresipService.filesPath + "/config"
|
||||||
private val file = File(path)
|
private val file = File(path)
|
||||||
private val context = BaresipService.context
|
|
||||||
|
|
||||||
private var config = Utils.getFileContents(file)
|
private var config = Utils.getFileContents(file)
|
||||||
|
|
||||||
fun initialize() {
|
fun initialize() {
|
||||||
@ -75,8 +74,8 @@ object Config {
|
|||||||
add(variable, value)
|
add(variable, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reset() {
|
fun reset(ctx: Context) {
|
||||||
Utils.copyAssetToFile(context!!, "config", path)
|
Utils.copyAssetToFile(ctx, "config", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun save() {
|
fun save() {
|
||||||
|
|||||||
@ -193,7 +193,7 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reset.isChecked) {
|
if (reset.isChecked) {
|
||||||
Config.reset()
|
Config.reset(this)
|
||||||
save = false
|
save = false
|
||||||
restart = true
|
restart = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user