mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-15 02:38:59 +03:00
UP dialog: app name
This commit is contained in:
parent
5f5b873414
commit
09b290e579
2 changed files with 20 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
|||
package im.vector.app.core.pushers
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.edit
|
||||
import im.vector.app.R
|
||||
|
@ -95,7 +96,7 @@ object UPHelper {
|
|||
when (distributors.size) {
|
||||
0 -> {
|
||||
/**
|
||||
* TODO: fallback with sync service : automatic ?
|
||||
* Fallback with sync service
|
||||
*/
|
||||
}
|
||||
1 -> {
|
||||
|
@ -104,10 +105,22 @@ object UPHelper {
|
|||
}
|
||||
else -> {
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(context)
|
||||
builder.setTitle("Choose a distributor")
|
||||
builder.setTitle(context.getString(R.string.unifiedpush_getdistributors_dialog_title))
|
||||
|
||||
val distributorsArray = distributors.toTypedArray()
|
||||
builder.setItems(distributorsArray) { _, which ->
|
||||
val distributorsNameArray = distributorsArray.map {
|
||||
if (it == context.packageName) {
|
||||
context.getString(R.string.unifiedpush_getdistributors_dialog_fcm_fallback)
|
||||
} else {
|
||||
try {
|
||||
val ai = context.packageManager.getApplicationInfo(it, 0)
|
||||
context.packageManager.getApplicationLabel(ai)
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
it
|
||||
} as String
|
||||
}
|
||||
}.toTypedArray()
|
||||
builder.setItems(distributorsNameArray) { _, which ->
|
||||
val distributor = distributorsArray[which]
|
||||
up.saveDistributor(context, distributor)
|
||||
Timber.i("Saving distributor: $distributor")
|
||||
|
|
|
@ -1115,6 +1115,10 @@
|
|||
<string name="settings_troubleshoot_test_endpoint_success">Endpoint successfully retrieved:\n%1$s</string>
|
||||
<string name="settings_troubleshoot_test_endpoint_failed">Failed to retrieved Endpoint.</string>
|
||||
|
||||
<!-- UnifiedPush Distributor Picker Dialog -->
|
||||
<string name="unifiedpush_getdistributors_dialog_title">Choose a distributor</string>
|
||||
<string name="unifiedpush_getdistributors_dialog_fcm_fallback">FCM Fallback</string>
|
||||
|
||||
<!-- FCM Token, not used anymore -->
|
||||
<string name="settings_troubleshoot_test_fcm_title">Firebase Token</string>
|
||||
<string name="settings_troubleshoot_test_fcm_success">FCM token successfully retrieved:\n%1$s</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue