From 32399724e6b1782f6165660f9d0e0fc69c0c2e06 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Thu, 26 Sep 2019 12:25:38 +0300 Subject: [PATCH] - Fixed saving of accounts. --- .../kotlin/com/tutpro/baresip/AccountsActivity.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt index b3efe654..05b19822 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt @@ -27,8 +27,6 @@ class AccountsActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_accounts) - filesPath = applicationContext.filesDir.absolutePath - BaresipService.activities.add(0, "accounts") val listView = findViewById(R.id.accounts) as ListView @@ -159,8 +157,6 @@ class AccountsActivity : AppCompatActivity() { companion object { - internal var filesPath = "" - var accounts = ArrayList() fun generateAccounts() { @@ -173,8 +169,8 @@ class AccountsActivity : AppCompatActivity() { fun saveAccounts() { var accounts = "" for (a in Account.accounts()) accounts = accounts + a.print() + "\n" - Utils.putFileContents(File(filesPath + "/accounts"), accounts) - // Log.d("Baresip", "Saved accounts '${accounts}' to '${filesPath}/accounts'") + Utils.putFileContents(File(BaresipService.filesPath + "/accounts"), accounts) + // Log.d("Baresip", "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'") } fun exportAccounts(path: File, password: String): Boolean { @@ -190,7 +186,8 @@ class AccountsActivity : AppCompatActivity() { if (content == "Failed") return false val accounts = Utils.decrypt(content, password) if (accounts == "") return false - return Utils.putFileContents(File(filesPath + "/accounts"), accounts) + return Utils.putFileContents(File(BaresipService.filesPath + "/accounts"), + accounts) } }