Fix IM terms of review path

This commit is contained in:
ganfra 2020-07-08 17:32:54 +02:00
parent 3aabb17ea5
commit 85e8e652f1
1 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@
package im.vector.riotx.features.widgets package im.vector.riotx.features.widgets
import android.net.Uri
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.airbnb.mvrx.ActivityViewModelContext import com.airbnb.mvrx.ActivityViewModelContext
import com.airbnb.mvrx.Fail import com.airbnb.mvrx.Fail
@ -236,7 +237,9 @@ class WidgetViewModel @AssistedInject constructor(@Assisted val initialState: Wi
_viewEvents.post(WidgetViewEvents.OnURLFormatted(formattedUrl)) _viewEvents.post(WidgetViewEvents.OnURLFormatted(formattedUrl))
} catch (failure: Throwable) { } catch (failure: Throwable) {
if (failure is WidgetManagementFailure.TermsNotSignedException) { if (failure is WidgetManagementFailure.TermsNotSignedException) {
_viewEvents.post(WidgetViewEvents.DisplayTerms(initialState.baseUrl, failure.token)) // Terms for IM shouldn't have path appended
val displayTermsBaseUrl = Uri.parse(initialState.baseUrl).buildUpon().path("").toString()
_viewEvents.post(WidgetViewEvents.DisplayTerms(displayTermsBaseUrl, failure.token))
} }
setState { copy(formattedURL = Fail(failure)) } setState { copy(formattedURL = Fail(failure)) }
} }