- Go directly to Accounts activity when baresip is started without
any accounts.
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
#
|
|
||||||
|
|||||||
@@ -190,6 +190,11 @@ class AccountsActivity : AppCompatActivity() {
|
|||||||
accounts)
|
accounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun noAccounts(): Boolean {
|
||||||
|
return Utils.getFileContents(File(BaresipService.filesPath + "/accounts"))
|
||||||
|
.length == 0
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,14 @@ class BaresipService: Service() {
|
|||||||
|
|
||||||
if (Config.variable("dyn_dns")[0] == "yes")
|
if (Config.variable("dyn_dns")[0] == "yes")
|
||||||
Config.remove("dns_server")
|
Config.remove("dns_server")
|
||||||
|
|
||||||
|
if (AccountsActivity.noAccounts()) {
|
||||||
|
val newIntent = Intent(this, MainActivity::class.java)
|
||||||
|
newIntent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
|
||||||
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
newIntent.putExtra("action", "accounts")
|
||||||
|
startActivity(newIntent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"Call Show", "Call Answer" -> {
|
"Call Show", "Call Answer" -> {
|
||||||
|
|||||||
@@ -460,6 +460,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val action = intent.getStringExtra("action")
|
val action = intent.getStringExtra("action")
|
||||||
Log.d("Baresip", "Handling intent '$action'")
|
Log.d("Baresip", "Handling intent '$action'")
|
||||||
when (action) {
|
when (action) {
|
||||||
|
"accounts" -> {
|
||||||
|
resumeAction = "accounts"
|
||||||
|
}
|
||||||
"call" -> {
|
"call" -> {
|
||||||
if (!Call.calls().isEmpty()) {
|
if (!Call.calls().isEmpty()) {
|
||||||
Toast.makeText(applicationContext, getString(R.string.call_already_active),
|
Toast.makeText(applicationContext, getString(R.string.call_already_active),
|
||||||
@@ -526,6 +529,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
Log.d("Baresip", "Main resumed with action '$resumeAction'")
|
Log.d("Baresip", "Main resumed with action '$resumeAction'")
|
||||||
visible = true
|
visible = true
|
||||||
when (resumeAction) {
|
when (resumeAction) {
|
||||||
|
"accounts" -> {
|
||||||
|
val i = Intent(this, AccountsActivity::class.java)
|
||||||
|
startActivityForResult(i, ACCOUNTS_CODE)
|
||||||
|
}
|
||||||
"call show" ->
|
"call show" ->
|
||||||
handleServiceEvent("call incoming",
|
handleServiceEvent("call incoming",
|
||||||
arrayListOf(resumeCall!!.ua.uap, resumeCall!!.callp))
|
arrayListOf(resumeCall!!.ua.uap, resumeCall!!.callp))
|
||||||
@@ -1180,7 +1187,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun restoreActivities() {
|
private fun restoreActivities() {
|
||||||
Log.d("Baresip", "Stack is ${BaresipService.activities.toString()}")
|
Log.d("Baresip", "Activity stack ${BaresipService.activities.toString()}")
|
||||||
val activity = BaresipService.activities[0].split(",")
|
val activity = BaresipService.activities[0].split(",")
|
||||||
BaresipService.activities.removeAt(0)
|
BaresipService.activities.removeAt(0)
|
||||||
when (activity[0]) {
|
when (activity[0]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user