mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Small cleanup
This commit is contained in:
parent
f1e57d2970
commit
9216d8ba32
1 changed files with 17 additions and 19 deletions
|
@ -18,7 +18,6 @@ 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 com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
@ -149,9 +148,6 @@ class UnifiedPushHelper @Inject constructor(
|
|||
up.registerApp(context)
|
||||
onDoneRunnable?.run()
|
||||
} else {
|
||||
val builder: AlertDialog.Builder = MaterialAlertDialogBuilder(context)
|
||||
builder.setTitle(stringProvider.getString(R.string.unifiedpush_getdistributors_dialog_title))
|
||||
|
||||
val distributorsArray = distributors.toTypedArray()
|
||||
val distributorsNameArray = distributorsArray.map {
|
||||
if (it == context.packageName) {
|
||||
|
@ -165,21 +161,23 @@ class UnifiedPushHelper @Inject constructor(
|
|||
} as String
|
||||
}
|
||||
}.toTypedArray()
|
||||
builder.setItems(distributorsNameArray) { _, which ->
|
||||
val distributor = distributorsArray[which]
|
||||
up.saveDistributor(context, distributor)
|
||||
Timber.i("Saving distributor: $distributor")
|
||||
up.registerApp(context)
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
builder.setOnDismissListener {
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
builder.setOnCancelListener {
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
val dialog: AlertDialog = builder.create()
|
||||
dialog.show()
|
||||
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle(stringProvider.getString(R.string.unifiedpush_getdistributors_dialog_title))
|
||||
.setItems(distributorsNameArray) { _, which ->
|
||||
val distributor = distributorsArray[which]
|
||||
up.saveDistributor(context, distributor)
|
||||
Timber.i("Saving distributor: $distributor")
|
||||
up.registerApp(context)
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
.setOnDismissListener {
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
.setOnCancelListener {
|
||||
onDoneRunnable?.run()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue