Added "SIM Manager" link to mobile account's settings
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package com.tutpro.baresip
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@ -86,6 +88,7 @@ import java.io.StringReader
|
||||
import java.net.URL
|
||||
import java.util.Locale
|
||||
import javax.net.ssl.HttpsURLConnection
|
||||
import android.provider.Settings
|
||||
import android.telephony.SubscriptionManager
|
||||
|
||||
fun NavGraphBuilder.accountScreenRoute(navController: NavController) {
|
||||
@ -335,6 +338,35 @@ private fun AccountContent(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SimManager() {
|
||||
Row(
|
||||
Modifier.fillMaxWidth().padding(top = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Start
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.sim_manager),
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.clickable {
|
||||
try {
|
||||
val action =
|
||||
if (Build.VERSION.SDK_INT >= 31)
|
||||
Settings.ACTION_MANAGE_ALL_SIM_PROFILES_SETTINGS
|
||||
else
|
||||
Settings.ACTION_WIRELESS_SETTINGS
|
||||
ctx.startActivity(Intent(action))
|
||||
} catch (_: Exception) {
|
||||
ctx.startActivity(Intent(Settings.ACTION_SETTINGS))
|
||||
}
|
||||
},
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DisplayName() {
|
||||
val displayNameTitle = stringResource(R.string.display_name)
|
||||
@ -1291,6 +1323,8 @@ private fun AccountContent(
|
||||
) {
|
||||
AoR(resumeToggle)
|
||||
Nickname()
|
||||
if (ua.account.isMobile)
|
||||
SimManager()
|
||||
if (!ua.account.isMobile) {
|
||||
DisplayName()
|
||||
AuthUser()
|
||||
|
||||
@ -525,6 +525,7 @@ object Utils {
|
||||
return true
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun copyToClipboard(ctx: Context, text: String) {
|
||||
val clipboard = ctx.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText("text", text)
|
||||
|
||||
@ -117,6 +117,7 @@
|
||||
<string name="account_nickname_help">Lempinimi (jos annettu) millä tämä tili identifioidaan
|
||||
baresip sovelluksessa.</string>
|
||||
<string name="nickname">Lempinimi</string>
|
||||
<string name="sim_manager">SIM-kortin hallinta</string>
|
||||
<string name="invalid_account_nickname">Virheellinen tilin lempinimi \'%1$s\'</string>
|
||||
<string name="non_unique_account_nickname">Lempinimi \'%1$s\' on jo olemassa</string>
|
||||
<string name="display_name">Tilin käyttäjän nimi</string>
|
||||
|
||||
@ -126,6 +126,7 @@
|
||||
<string name="account_nickname_help">Nickname (if any) used to identify this account within
|
||||
baresip app.</string>
|
||||
<string name="nickname">Nickname</string>
|
||||
<string name="sim_manager">SIM Manager</string>
|
||||
<string name="invalid_account_nickname">Invalid Account Nickname \'%1$s\'</string>
|
||||
<string name="non_unique_account_nickname">Nickname \'%1$s\' already exists</string>
|
||||
<string name="display_name">Display Name</string>
|
||||
|
||||
Reference in New Issue
Block a user