- Minor TLS config improvements.

This commit is contained in:
Juha Heinanen
2019-08-25 12:54:05 +03:00
parent 7106b7eb74
commit 20567b0870
4 changed files with 8 additions and 25 deletions

View File

@ -209,12 +209,9 @@ class ConfigActivity : AppCompatActivity() {
if (certificateFile.isChecked != oldCertificateFile) {
if (certificateFile.isChecked) {
if (!Utils.checkPermission(applicationContext,
android.Manifest.permission.READ_EXTERNAL_STORAGE)) {
Utils.alertView(this, getString(R.string.error),
getString(R.string.no_storage_space_permission))
if (!Utils.requestPermission(this,
android.Manifest.permission.READ_EXTERNAL_STORAGE))
return false
}
val content = Utils.getFileContents(File(downloadsDir, "cert.pem"))
if (content == "Failed") {
Utils.alertView(this, getString(R.string.error),
@ -234,12 +231,9 @@ class ConfigActivity : AppCompatActivity() {
if (caFile.isChecked != oldCAFile) {
if (caFile.isChecked) {
if (!Utils.checkPermission(applicationContext,
android.Manifest.permission.READ_EXTERNAL_STORAGE)) {
Utils.alertView(this, getString(R.string.error),
getString(R.string.no_storage_space_permission))
if (!Utils.requestPermission(this,
android.Manifest.permission.READ_EXTERNAL_STORAGE))
return false
}
val content = Utils.getFileContents(File(downloadsDir, "ca_certs.crt"))
if (content == "Failed") {
Utils.alertView(this, getString(R.string.error),

View File

@ -320,10 +320,6 @@ object Utils {
}
}
fun checkPermission(ctx: Context, permission: String) : Boolean {
return ContextCompat.checkSelfPermission(ctx, permission) == PackageManager.PERMISSION_GRANTED
}
fun requestPermission(ctx: Context, permission: String) : Boolean {
if (ContextCompat.checkSelfPermission(ctx, permission) != PackageManager.PERMISSION_GRANTED) {
Log.w("Baresip", "Baresip does not have $permission permission")

View File

@ -315,8 +315,7 @@
<string name="call_is_secure">Tämä pulelu on turvallinen ja kohde on
todennettu! Haluatko poistaa todennuksen?</string>
<string name="unverify">Poista todennus</string>
<string name="no_storage_space_permission">Et ole antanut käyttölupaa tallennustilaan. Tarkista Sovellukset → baresip → Käyttöluvat → Tallennustila.</string>
<string name="tls_ca_file">TLS CA-tiedosto</string>
qqqq <string name="tls_ca_file">TLS CA-tiedosto</string>
<string name="tls_ca_file_help">Jos merkitty, tiedosto \'ca_certs.crt\', joka sisältää todennusauktoriteettien TLS-sertifikaatit, on ladattu tai ladataan Download-kansiosta.</string>
<string name="tls_certificate_file">TLS sertifikaattitiedosto</string>
<string name="tls_certificate_file_help">"Jos merkitty, tiedosto \'cert.pem\', joka sisältää tämän baresip-sovelluksen TLS-sertifikaatin ja yksityisen avaimen, on ladattu tai ladataan Download-kansiosta."</string>

View File

@ -144,10 +144,6 @@ Check Apps → baresip → Permissions → Storage and that file \'accounts.bs\'
add peer to contacts?</string>
<string name="short_chat_question">Do you want to delete chat with \'%1$s\'?</string>
<!-- Common -->
<string name="no_storage_space_permission">You have not granted storage space permission.
Check Apps → baresip → Permissions → Storage.</string>
<!-- Config Activity -->
<string name="configuration">Configuration</string>
<string name="start_automatically">Start Automatically</string>
@ -212,12 +208,10 @@ Check Apps → baresip → Permissions → Storage and that file \'accounts.bs\'
<string name="contacts_exceeded">Your maximum number of contacts %1%d has been exceeded.</string>
<string name="exported_contacts">Exported contacts to Download folder file \'contacts.bs\'.</string>
<string name="export_error">"Failed to export contacts to Download folder.
Check Apps → baresip → Permissions → Storage."
</string>
Check Apps → baresip → Permissions → Storage."</string>
<string name="imported_contacts">Imported contacts from Download folder.</string>
<string name="import_error">Failed to import contacts from Download folder.
Check Apps → baresip → Permissions → Storage and that file \'contacts.bs\' exists in the folder.
</string>
<string name="import_error">Failed to import contacts from Download folder. Check Apps →
baresip → Permissions → Storage and that file \'contacts.bs\' exists in the folder.</string>
<!-- Generic -->
<string name="alert">Alert</string>