Dan Ballard pushed to branch firefox-android-115.2.1-13.5-1 at The Tor Project / Applications / firefox-android
Commits: e2bd6fda by clairehurst at 2024-05-14T00:00:14+00:00 fixup! Implement Android-native Connection Assist UI
- - - - -
2 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistFragment.kt - fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt
Changes:
===================================== fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistFragment.kt ===================================== @@ -62,6 +62,7 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler { override fun onResume() { super.onResume() hideToolbar() + viewModel.handleTorConnectStateToScreen() // Covers the case where the app is backgrounded when the bootstrap finishes }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -86,6 +87,7 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler { viewModel.shouldOpenHome().observe( viewLifecycleOwner, ) { + Log.d(TAG, "shouldOpenHome() = $it") if (it) { openHome() }
===================================== fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt ===================================== @@ -46,6 +46,7 @@ class TorConnectionAssistViewModel( init { Log.d(TAG, "initiating TorConnectionAssistViewModel") _torController.registerTorListener(this) + handleTorConnectStateToScreen() // should cover the case of when we have an onBootStrapStateChange() event before this is initialized, which lead to being stuck on the splash screen }
private fun handleConnect( @@ -95,6 +96,10 @@ class TorConnectionAssistViewModel( _progress.value = progress.toInt() }
+ handleTorConnectStateToScreen() + } + + fun handleTorConnectStateToScreen() { when (_torController.lastKnownStatus) { TorConnectState.Initial -> _torConnectScreen.value = ConnectAssistUiState.Splash TorConnectState.Configuring -> handleConfiguring() @@ -144,7 +149,11 @@ class TorConnectionAssistViewModel( /** stay here */ }
- else -> _torConnectScreen.value = ConnectAssistUiState.Connecting + else -> _torConnectScreen.value = + ConnectAssistUiState.Connecting.also { connectAssistUiState -> + // covers the case of when the bootstrap is already in progress when the UiState "catches up" + connectAssistUiState.progress = _progress.value ?: 0 + } } }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/e2bd...
tor-commits@lists.torproject.org