Small rework

This commit is contained in:
Benoit Marty 2022-06-01 16:07:18 +02:00 committed by Benoit Marty
parent 9216d8ba32
commit 74de9c82c0
2 changed files with 20 additions and 22 deletions

View file

@ -136,11 +136,13 @@ class UnifiedPushHelper @Inject constructor(
up.saveDistributor(context, context.packageName)
val distributors = up.getDistributors(context).toMutableList()
val internalDistributorName = if (FcmHelper.isPushSupported()) {
stringProvider.getString(R.string.unifiedpush_distributor_fcm_fallback)
} else {
stringProvider.getString(R.string.unifiedpush_distributor_background_sync)
}
val internalDistributorName = stringProvider.getString(
if (FcmHelper.isPushSupported()) {
R.string.unifiedpush_distributor_fcm_fallback
} else {
R.string.unifiedpush_distributor_background_sync
}
)
if (distributors.size == 1 &&
!force) {
@ -217,11 +219,9 @@ class UnifiedPushHelper @Inject constructor(
// register app_id type upfcm on sygnal
// the pushkey if FCM key
if (up.getDistributor(context) == context.packageName) {
stringProvider.getString(R.string.pusher_http_url).let {
storePushGateway(it)
onDoneRunnable?.run()
return
}
storePushGateway(stringProvider.getString(R.string.pusher_http_url))
onDoneRunnable?.run()
return
}
// else, unifiedpush, and pushkey is an endpoint
val gateway = stringProvider.getString(R.string.default_push_gateway_http_url)

View file

@ -31,19 +31,17 @@ class TestAvailableUnifiedPushDistributors @Inject constructor(
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
val distributors = unifiedPushHelper.getExternalDistributors()
if (distributors.isEmpty()) {
description = if (FcmHelper.isPushSupported()) {
stringProvider.getString(R.string.settings_troubleshoot_test_distributors_gplay)
} else {
stringProvider.getString(R.string.settings_troubleshoot_test_distributors_fdroid)
}
status = TestStatus.SUCCESS
} else {
description = stringProvider.getString(
R.string.settings_troubleshoot_test_distributors_many,
distributors.size + 1
description = if (distributors.isEmpty()) {
stringProvider.getString(
if (FcmHelper.isPushSupported()) {
R.string.settings_troubleshoot_test_distributors_gplay
} else {
R.string.settings_troubleshoot_test_distributors_fdroid
}
)
status = TestStatus.SUCCESS
} else {
stringProvider.getString(R.string.settings_troubleshoot_test_distributors_many, distributors.size + 1)
}
status = TestStatus.SUCCESS
}
}