@@ -47,6 +47,7 @@ import org.session.libsession.utilities.TextSecurePreferences
4747import org.session.libsession.utilities.withMutableUserConfigs
4848import org.session.libsignal.utilities.Log
4949import org.thoughtcrime.securesms.debugmenu.DebugLogGroup
50+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel
5051import org.thoughtcrime.securesms.preferences.prosettings.ProSettingsViewModel.Commands.ShowOpenUrlDialog
5152import org.thoughtcrime.securesms.pro.ProDataState
5253import org.thoughtcrime.securesms.pro.ProDetailsRepository
@@ -850,10 +851,18 @@ class ProSettingsViewModel @AssistedInject constructor(
850851
851852 private fun refreshProStats (){
852853 viewModelScope.launch {
854+ // if we have a debug toggle for the loading state, respect it
855+ val currentDebugState = prefs.getDebugProPlanStatus()
856+ val debugState = when (currentDebugState) {
857+ DebugMenuViewModel .DebugProPlanStatus .LOADING -> State .Loading
858+ DebugMenuViewModel .DebugProPlanStatus .ERROR -> State .Error (Exception ())
859+ else -> null
860+ }
861+
853862 // show a loader for the stats
854863 _proSettingsUIState .update {
855864 it.copy(
856- proStats = State .Loading
865+ proStats = debugState ? : State .Loading
857866 )
858867 }
859868
@@ -882,14 +891,14 @@ class ProSettingsViewModel @AssistedInject constructor(
882891
883892 // update ui with results
884893 _proSettingsUIState .update {
885- it.copy(proStats = State .Success (stats))
894+ it.copy(proStats = debugState ? : State .Success (stats))
886895 }
887896 } catch (e: Exception ) {
888897 // currently the UI doesn't have an error display
889898 // it will look like it's still loading
890899 // but the logic is there in case we have a look for stats errors
891900 _proSettingsUIState .update {
892- it.copy(proStats = State .Error (e))
901+ it.copy(proStats = debugState ? : State .Error (e))
893902 }
894903 }
895904 }
0 commit comments