Auto-review

This commit is contained in:
Benoit Marty 2021-12-08 23:41:58 +01:00 committed by Benoit Marty
parent 7f7199abd4
commit 72bb58645b
4 changed files with 5 additions and 36 deletions

View File

@ -124,19 +124,19 @@ class LegalsController @Inject constructor(
private fun buildThirdPartyNotices() {
val host = this
settingsSectionTitleItem {
id("appTitle")
id("thirdTitle")
titleResId(R.string.legals_third_party_notices)
}
discoveryPolicyItem {
id("elcp1")
id("eltpn1")
name(host.stringProvider.getString(R.string.settings_third_party_notices))
clickListener { host.listener?.openThirdPartyNotice() }
}
// Only on Gplay
if (resources.getBoolean(R.bool.isGplay)) {
discoveryPolicyItem {
id("elcp2")
id("eltpn2")
name(host.stringProvider.getString(R.string.settings_other_third_party_notices))
clickListener { host.listener?.openThirdPartyNoticeGplay() }
}

View File

@ -25,7 +25,6 @@ import com.airbnb.mvrx.withState
import im.vector.app.R
import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.exhaustive
import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.utils.FirstThrottler
import im.vector.app.core.utils.displayInWebView
@ -53,14 +52,6 @@ class LegalsFragment @Inject constructor(
controller.listener = this
views.genericRecyclerView.configureWith(controller)
viewModel.observeViewEvents {
when (it) {
is LegalsViewEvents.Failure -> {
displayErrorDialog(it.throwable)
}
}.exhaustive
}
}
override fun onDestroyView() {

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2021 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.settings.legals
import im.vector.app.core.platform.VectorViewEvents
sealed interface LegalsViewEvents : VectorViewEvents {
data class Failure(val throwable: Throwable) : LegalsViewEvents
}

View File

@ -26,6 +26,7 @@ import im.vector.app.R
import im.vector.app.core.di.MavericksAssistedViewModelFactory
import im.vector.app.core.di.hiltMavericksViewModelFactory
import im.vector.app.core.extensions.exhaustive
import im.vector.app.core.platform.EmptyViewEvents
import im.vector.app.core.platform.VectorViewModel
import im.vector.app.core.resources.StringProvider
import im.vector.app.features.discovery.fetchHomeserverWithTerms
@ -37,7 +38,7 @@ class LegalsViewModel @AssistedInject constructor(
@Assisted initialState: LegalsState,
private val session: Session,
private val stringProvider: StringProvider
) : VectorViewModel<LegalsState, LegalsAction, LegalsViewEvents>(initialState) {
) : VectorViewModel<LegalsState, LegalsAction, EmptyViewEvents>(initialState) {
@AssistedFactory
interface Factory : MavericksAssistedViewModelFactory<LegalsViewModel, LegalsState> {