Skip to content
Snippets Groups Projects
Commit 8f0d3201 authored by Torsten Grote's avatar Torsten Grote
Browse files

Merge branch '98-translatable-progress-info' into 'main'

Map lifecycle/tor plugin state to translatable messages

Closes #98

See merge request !67
parents d2190a7f b8ffe3e2
No related branches found
No related tags found
1 merge request!67Map lifecycle/tor plugin state to translatable messages
Pipeline #10470 passed
......@@ -33,6 +33,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOn
import org.briarproject.android.dontkillmelib.DozeHelper
import org.briarproject.mailbox.R
import org.briarproject.mailbox.android.MailboxService
import org.briarproject.mailbox.android.QrCodeUtils
import org.briarproject.mailbox.core.lifecycle.LifecycleManager
......@@ -78,9 +79,16 @@ class MailboxViewModel @Inject constructor(
val setupState = combine(
lifecycleState, torPluginState, setupManager.setupComplete
) { ls, ts, sc ->
val resources = getApplication<Application>().resources
when {
ls != LifecycleState.RUNNING -> Starting(ls.name)
ts != TorPlugin.State.PUBLISHED -> Starting(ts.name + " TOR")
ls != LifecycleState.RUNNING -> Starting(
resources.getString(R.string.startup_starting_services)
)
ts != TorPlugin.State.PUBLISHED -> when {
ts < TorPlugin.State.ACTIVE ->
Starting(resources.getString(R.string.startup_starting_tor))
else -> Starting(resources.getString(R.string.startup_publishing_onion_service))
}
sc == SetupComplete.FALSE -> {
val dm = Resources.getSystem().displayMetrics
val size = min(dm.widthPixels, dm.heightPixels)
......
......@@ -28,4 +28,8 @@
<string name="link_title">Link via QR code</string>
<string name="link_description">Scan this QR code with Briar</string>
<string name="link_cancel">Cancel Setup</string>
<string name="startup_starting_services">Starting services</string>
<string name="startup_starting_tor">Starting Tor</string>
<string name="startup_publishing_onion_service">Publishing onion service</string>
</resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment