Due to Google's requirement, ask user's consent if Android contacts is chosen in Settings

This commit is contained in:
Juha Heinanen
2022-04-02 08:18:50 +03:00
parent 08d327d2d0
commit ea5bebda02
3 changed files with 31 additions and 1 deletions
@@ -9,6 +9,7 @@ import android.content.pm.PackageManager
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.PowerManager import android.os.PowerManager
import android.text.method.LinkMovementMethod
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
@@ -321,8 +322,23 @@ class ConfigActivity : AppCompatActivity() {
contactsMode = contactsModeKeys[position] contactsMode = contactsModeKeys[position]
if (contactsMode != "baresip" && Build.VERSION.SDK_INT >= 23 && if (contactsMode != "baresip" && Build.VERSION.SDK_INT >= 23 &&
!Utils.checkPermissions(applicationContext, contactsPermissions)) !Utils.checkPermissions(applicationContext, contactsPermissions))
with(MaterialAlertDialogBuilder(this@ConfigActivity, R.style.AlertDialogTheme)) {
setTitle(getText(R.string.consent_request))
setMessage(getText(R.string.contacts_consent))
setPositiveButton(getText(R.string.accept)) { dialog, _ ->
dialog.dismiss()
requestPermissions(contactsPermissions, CONTACTS_PERMISSION_REQUEST_CODE) requestPermissions(contactsPermissions, CONTACTS_PERMISSION_REQUEST_CODE)
} }
setNegativeButton(getText(R.string.deny)) { dialog, _ ->
contactsSpinner.setSelection(contactsModeKeys.indexOf(oldContactsMode))
dialog.dismiss()
}
show().apply {
findViewById<TextView>(android.R.id.message)
?.movementMethod = LinkMovementMethod.getInstance()
}
}
}
override fun onNothingSelected(parent: AdapterView<*>) {} override fun onNothingSelected(parent: AdapterView<*>) {}
} }
+7
View File
@@ -387,6 +387,13 @@
<string name="config_restart">baresip täytyy käynnistää uudelleen, jotta saat uudet asetukset <string name="config_restart">baresip täytyy käynnistää uudelleen, jotta saat uudet asetukset
käyttöön. Käynnistä nyt? käyttöön. Käynnistä nyt?
</string> </string>
<string name="consent_request">Suostumuspyyntö</string>
<string name="contacts_consent">Jos Androidin yhteystiedot on valittu, voit käyttää niitä
puheluissa ja viesteissä SIP ja tel URI:en ohella. baresip ei talleta Androidin yhteystietoja
eikä jaa niitä kenellekään. Jotta baresip saisi käyttöönsä Androidin yhteystiedot,
Google vaatii, että annat siihen siihen suostumuksen hyväksymällä baresip-sovelluksen
<a href="https://github.com/juha-h/baresip-studio/blob/master/PrivacyPolicy.txt?">yksityisyyskäytännöt</a>.
</string>
<!-- Contact Activity --> <!-- Contact Activity -->
<string name="contact">Yhteystieto</string> <string name="contact">Yhteystieto</string>
<string name="new_contact">Uusi yhteystieto</string> <string name="new_contact">Uusi yhteystieto</string>
+7
View File
@@ -346,6 +346,13 @@
<string name="config_restart">You need to restart baresip in order to activate the new <string name="config_restart">You need to restart baresip in order to activate the new
settings. Restart now? settings. Restart now?
</string> </string>
<string name="consent_request">Consent Request</string>
<string name="contacts_consent">If Android contacts is chosen, they can be used
in calling and messaging as references to SIP and tel URIs. baresip app does not store Android
contacts nor share them with anyone. In order to make Android contacts available in baresip,
Google requires that you accept their use as described here and in app\'s
<a href="https://github.com/juha-h/baresip-studio/blob/master/PrivacyPolicy.txt?">Privacy Policy</a>.
</string>
<!-- Contact Activity --> <!-- Contact Activity -->
<string name="contact">Contact</string> <string name="contact">Contact</string>
<string name="new_contact">New Contact</string> <string name="new_contact">New Contact</string>