diff --git a/app/src/main/java/org/onionshare/android/ShareManager.kt b/app/src/main/java/org/onionshare/android/ShareManager.kt index 8f702bf1..2085d746 100644 --- a/app/src/main/java/org/onionshare/android/ShareManager.kt +++ b/app/src/main/java/org/onionshare/android/ShareManager.kt @@ -134,6 +134,10 @@ class ShareManager @Inject constructor( ShareUiState.Starting(zipState?.progress ?: 0, torPercent) } + is TorState.Started -> { + ShareUiState.Starting(zipState?.progress ?: 0, 95) + } + is TorState.Published -> { // We only create the hidden service after files have been zipped and webserver was started, // so we are in sharing state once the first HS descriptor has been published. diff --git a/app/src/main/java/org/onionshare/android/tor/TorManager.kt b/app/src/main/java/org/onionshare/android/tor/TorManager.kt index 0f51d378..147f31d3 100644 --- a/app/src/main/java/org/onionshare/android/tor/TorManager.kt +++ b/app/src/main/java/org/onionshare/android/tor/TorManager.kt @@ -17,6 +17,7 @@ import kotlinx.coroutines.withContext import org.briarproject.onionwrapper.CircumventionProvider import org.briarproject.onionwrapper.LocationUtils import org.briarproject.onionwrapper.TorWrapper +import org.briarproject.onionwrapper.TorWrapper.TorState.CONNECTED import org.briarproject.onionwrapper.TorWrapper.TorState.STOPPED import org.onionshare.android.Clock import org.onionshare.android.DefaultClock @@ -143,7 +144,8 @@ class TorManager( override fun onState(s: TorWrapper.TorState) { LOG.info("new state: $s") - if (s == STOPPED) updateTorState(null, TorState.Stopped) + if (s == CONNECTED) updateTorState(TorState.Starting::class, TorState.Started) + else if (s == STOPPED) updateTorState(null, TorState.Stopped) } fun publishOnionService(port: Int) { @@ -156,7 +158,7 @@ class TorManager( } override fun onHsDescriptorUpload(onion: String) { - if (updateTorState(TorState.Starting::class, TorState.Published(onion), warn = false)) { + if (updateTorState(TorState.Started::class, TorState.Published(onion), warn = false)) { startCheckJob?.cancel() startCheckJob = null } diff --git a/app/src/main/java/org/onionshare/android/tor/TorState.kt b/app/src/main/java/org/onionshare/android/tor/TorState.kt index 56cc4b47..1e8e27f7 100644 --- a/app/src/main/java/org/onionshare/android/tor/TorState.kt +++ b/app/src/main/java/org/onionshare/android/tor/TorState.kt @@ -9,6 +9,8 @@ sealed class TorState { val lastProgressTime: Long, ) : TorState() + object Started : TorState() + data class Published( val onion: String, ) : TorState()