mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
ErrorFormatter: move it's declaration to VectorBaseFragment
and avoid duplicated code to manage default onError() in Login fragment
This commit is contained in:
parent
c6b98f3654
commit
6e4830e325
23 changed files with 37 additions and 155 deletions
|
@ -21,6 +21,7 @@ import androidx.fragment.app.FragmentFactory
|
|||
import androidx.lifecycle.ViewModelProvider
|
||||
import dagger.BindsInstance
|
||||
import dagger.Component
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.preference.UserAvatarPreference
|
||||
import im.vector.riotx.features.MainActivity
|
||||
import im.vector.riotx.features.crypto.keysbackup.settings.KeysBackupManageActivity
|
||||
|
@ -79,6 +80,8 @@ interface ScreenComponent {
|
|||
|
||||
fun navigator(): Navigator
|
||||
|
||||
fun errorFormatter(): ErrorFormatter
|
||||
|
||||
fun uiStateRepository(): UiStateRepository
|
||||
|
||||
fun inject(activity: HomeActivity)
|
||||
|
|
|
@ -27,6 +27,7 @@ import im.vector.riotx.ActiveSessionDataSource
|
|||
import im.vector.riotx.EmojiCompatFontProvider
|
||||
import im.vector.riotx.EmojiCompatWrapper
|
||||
import im.vector.riotx.VectorApplication
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.pushers.PushersManager
|
||||
import im.vector.riotx.core.utils.AssetReader
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
|
@ -88,6 +89,8 @@ interface VectorComponent {
|
|||
|
||||
fun navigator(): Navigator
|
||||
|
||||
fun errorFormatter(): ErrorFormatter
|
||||
|
||||
fun homeRoomListObservableStore(): HomeRoomListDataSource
|
||||
|
||||
fun shareRoomListObservableStore(): ShareRoomListDataSource
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.bumptech.glide.util.Util.assertMainThread
|
|||
import im.vector.riotx.core.di.DaggerScreenComponent
|
||||
import im.vector.riotx.core.di.HasScreenInjector
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.features.navigation.Navigator
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
@ -49,12 +50,14 @@ abstract class VectorBaseFragment : BaseMvRxFragment(), HasScreenInjector {
|
|||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* Navigator
|
||||
* Navigator and other common objects
|
||||
* ========================================================================================== */
|
||||
|
||||
protected lateinit var navigator: Navigator
|
||||
private lateinit var screenComponent: ScreenComponent
|
||||
|
||||
protected lateinit var navigator: Navigator
|
||||
protected lateinit var errorFormatter: ErrorFormatter
|
||||
|
||||
/* ==========================================================================================
|
||||
* View model
|
||||
* ========================================================================================== */
|
||||
|
@ -74,6 +77,7 @@ abstract class VectorBaseFragment : BaseMvRxFragment(), HasScreenInjector {
|
|||
override fun onAttach(context: Context) {
|
||||
screenComponent = DaggerScreenComponent.factory().create(vectorBaseActivity.getVectorComponent(), vectorBaseActivity)
|
||||
navigator = screenComponent.navigator()
|
||||
errorFormatter = screenComponent.errorFormatter()
|
||||
viewModelFactory = screenComponent.viewModelFactory()
|
||||
childFragmentManager.fragmentFactory = screenComponent.fragmentFactory()
|
||||
injectWith(injector())
|
||||
|
|
|
@ -69,7 +69,6 @@ import im.vector.matrix.android.api.session.user.model.User
|
|||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.dialogs.withColoredButton
|
||||
import im.vector.riotx.core.epoxy.LayoutManagerStateRestorer
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.*
|
||||
import im.vector.riotx.core.files.addEntryToDownloadManager
|
||||
import im.vector.riotx.core.glide.GlideApp
|
||||
|
@ -141,7 +140,6 @@ class RoomDetailFragment @Inject constructor(
|
|||
private val notificationDrawerManager: NotificationDrawerManager,
|
||||
val roomDetailViewModelFactory: RoomDetailViewModel.Factory,
|
||||
val textComposerViewModelFactory: TextComposerViewModel.Factory,
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val eventHtmlRenderer: EventHtmlRenderer,
|
||||
private val vectorPreferences: VectorPreferences
|
||||
) :
|
||||
|
|
|
@ -35,7 +35,6 @@ import im.vector.matrix.android.api.session.room.model.RoomSummary
|
|||
import im.vector.matrix.android.api.session.room.notification.RoomNotificationState
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.epoxy.LayoutManagerStateRestorer
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.cleanup
|
||||
import im.vector.riotx.core.platform.OnBackPressed
|
||||
import im.vector.riotx.core.platform.StateView
|
||||
|
@ -61,7 +60,6 @@ data class RoomListParams(
|
|||
class RoomListFragment @Inject constructor(
|
||||
private val roomController: RoomSummaryController,
|
||||
val roomListViewModelFactory: RoomListViewModel.Factory,
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val notificationDrawerManager: NotificationDrawerManager
|
||||
|
||||
) : VectorBaseFragment(), RoomSummaryController.Listener, OnBackPressed, FabMenuView.Listener {
|
||||
|
|
|
@ -95,7 +95,13 @@ abstract class AbstractLoginFragment : VectorBaseFragment(), OnBackPressed {
|
|||
}
|
||||
}
|
||||
|
||||
abstract fun onError(throwable: Throwable)
|
||||
open fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||
return when {
|
||||
|
|
|
@ -29,7 +29,6 @@ import androidx.core.view.isVisible
|
|||
import com.airbnb.mvrx.args
|
||||
import im.vector.matrix.android.internal.di.MoshiProvider
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.utils.AssetReader
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.fragment_login_captcha.*
|
||||
|
@ -47,8 +46,7 @@ data class LoginCaptchaFragmentArgument(
|
|||
* In this screen, the user is asked to confirm he is not a robot
|
||||
*/
|
||||
class LoginCaptchaFragment @Inject constructor(
|
||||
private val assetReader: AssetReader,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val assetReader: AssetReader
|
||||
) : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_captcha
|
||||
|
@ -172,14 +170,6 @@ class LoginCaptchaFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
loginViewModel.handle(LoginAction.ResetLogin)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.jakewharton.rxbinding3.widget.textChanges
|
|||
import im.vector.matrix.android.api.failure.Failure
|
||||
import im.vector.matrix.android.api.failure.MatrixError
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
import im.vector.riotx.core.extensions.showPassword
|
||||
import im.vector.riotx.core.extensions.toReducedUrl
|
||||
|
@ -46,9 +45,7 @@ import javax.inject.Inject
|
|||
* In signup mode:
|
||||
* - the user is asked for login and password
|
||||
*/
|
||||
class LoginFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
private var passwordShown = false
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import com.jakewharton.rxbinding3.widget.textChanges
|
|||
import im.vector.matrix.android.api.auth.registration.RegisterThreePid
|
||||
import im.vector.matrix.android.api.failure.Failure
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.error.is401
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
import im.vector.riotx.core.extensions.isEmail
|
||||
|
@ -56,7 +55,7 @@ data class LoginGenericTextInputFormFragmentArgument(
|
|||
/**
|
||||
* In this screen, the user is asked for a text input
|
||||
*/
|
||||
class LoginGenericTextInputFormFragment @Inject constructor(private val errorFormatter: ErrorFormatter) : AbstractLoginFragment() {
|
||||
class LoginGenericTextInputFormFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
private val params: LoginGenericTextInputFormFragmentArgument by args()
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.airbnb.mvrx.Loading
|
|||
import com.airbnb.mvrx.Success
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
import im.vector.riotx.core.extensions.isEmail
|
||||
import im.vector.riotx.core.extensions.showPassword
|
||||
|
@ -39,9 +38,7 @@ import javax.inject.Inject
|
|||
/**
|
||||
* In this screen, the user is asked for email and new password to reset his password
|
||||
*/
|
||||
class LoginResetPasswordFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
private var passwordShown = false
|
||||
|
||||
|
@ -139,14 +136,6 @@ class LoginResetPasswordFragment @Inject constructor(
|
|||
loginViewModel.handle(LoginAction.ResetResetPassword)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun updateWithState(state: LoginViewState) {
|
||||
setupUi(state)
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import butterknife.OnClick
|
|||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Success
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.error.is401
|
||||
import kotlinx.android.synthetic.main.fragment_login_reset_password_mail_confirmation.*
|
||||
import javax.inject.Inject
|
||||
|
@ -29,9 +28,7 @@ import javax.inject.Inject
|
|||
/**
|
||||
* In this screen, the user is asked to check his email and to click on a button once it's done
|
||||
*/
|
||||
class LoginResetPasswordMailConfirmationFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginResetPasswordMailConfirmationFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_reset_password_mail_confirmation
|
||||
|
||||
|
@ -44,14 +41,6 @@ class LoginResetPasswordMailConfirmationFragment @Inject constructor(
|
|||
loginViewModel.handle(LoginAction.ResetPasswordMailConfirmed)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
loginViewModel.handle(LoginAction.ResetResetPassword)
|
||||
}
|
||||
|
|
|
@ -16,18 +16,14 @@
|
|||
|
||||
package im.vector.riotx.features.login
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* In this screen, the user is asked for email and new password to reset his password
|
||||
* In this screen, we confirm to the user that his password has been reset
|
||||
*/
|
||||
class LoginResetPasswordSuccessFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginResetPasswordSuccessFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_reset_password_success
|
||||
|
||||
|
@ -36,14 +32,6 @@ class LoginResetPasswordSuccessFragment @Inject constructor(
|
|||
loginSharedActionViewModel.post(LoginNavigation.OnResetPasswordMailConfirmationSuccessDone)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
loginViewModel.handle(LoginAction.ResetResetPassword)
|
||||
}
|
||||
|
|
|
@ -18,11 +18,9 @@ package im.vector.riotx.features.login
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.utils.openUrlInExternalBrowser
|
||||
import kotlinx.android.synthetic.main.fragment_login_server_selection.*
|
||||
import me.gujun.android.span.span
|
||||
|
@ -31,9 +29,7 @@ import javax.inject.Inject
|
|||
/**
|
||||
* In this screen, the user will choose between matrix.org, modular or other type of homeserver
|
||||
*/
|
||||
class LoginServerSelectionFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginServerSelectionFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_server_selection
|
||||
|
||||
|
@ -107,14 +103,6 @@ class LoginServerSelectionFragment @Inject constructor(
|
|||
loginViewModel.handle(LoginAction.ResetHomeServerType)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun updateWithState(state: LoginViewState) {
|
||||
updateSelectedChoice(state)
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import androidx.core.view.isVisible
|
|||
import butterknife.OnClick
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
import im.vector.riotx.core.utils.openUrlInExternalBrowser
|
||||
import kotlinx.android.synthetic.main.fragment_login_server_url_form.*
|
||||
|
@ -33,9 +32,7 @@ import javax.inject.Inject
|
|||
/**
|
||||
* In this screen, the user is prompted to enter a homeserver url
|
||||
*/
|
||||
class LoginServerUrlFormFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_server_url_form
|
||||
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
|
||||
package im.vector.riotx.features.login
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.toReducedUrl
|
||||
import kotlinx.android.synthetic.main.fragment_login_signup_signin_selection.*
|
||||
import javax.inject.Inject
|
||||
|
@ -28,9 +26,7 @@ import javax.inject.Inject
|
|||
/**
|
||||
* In this screen, the user is asked to sign up or to sign in to the homeserver
|
||||
*/
|
||||
class LoginSignUpSignInSelectionFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_signup_signin_selection
|
||||
|
||||
|
@ -85,14 +81,6 @@ class LoginSignUpSignInSelectionFragment @Inject constructor(
|
|||
loginSharedActionViewModel.post(LoginNavigation.OnSignModeSelected)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
loginViewModel.handle(LoginAction.ResetSignMode)
|
||||
}
|
||||
|
|
|
@ -16,18 +16,14 @@
|
|||
|
||||
package im.vector.riotx.features.login
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* In this screen, the user is viewing an introduction to what he can do with this application
|
||||
*/
|
||||
class LoginSplashFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : AbstractLoginFragment() {
|
||||
class LoginSplashFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_splash
|
||||
|
||||
|
@ -36,14 +32,6 @@ class LoginSplashFragment @Inject constructor(
|
|||
loginSharedActionViewModel.post(LoginNavigation.OpenServerSelection)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
|
|
@ -19,10 +19,8 @@ package im.vector.riotx.features.login
|
|||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.airbnb.mvrx.args
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.error.is401
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.fragment_login_wait_for_email.*
|
||||
|
@ -36,7 +34,7 @@ data class LoginWaitForEmailFragmentArgument(
|
|||
/**
|
||||
* In this screen, the user is asked to check his emails
|
||||
*/
|
||||
class LoginWaitForEmailFragment @Inject constructor(private val errorFormatter: ErrorFormatter) : AbstractLoginFragment() {
|
||||
class LoginWaitForEmailFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
|
||||
private val params: LoginWaitForEmailFragmentArgument by args()
|
||||
|
||||
|
@ -69,11 +67,7 @@ class LoginWaitForEmailFragment @Inject constructor(private val errorFormatter:
|
|||
// Try again, with a delay
|
||||
loginViewModel.handle(LoginAction.CheckIfEmailHasBeenValidated(10_000))
|
||||
} else {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
super.onError(throwable)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.airbnb.mvrx.activityViewModel
|
|||
import im.vector.matrix.android.api.auth.data.Credentials
|
||||
import im.vector.matrix.android.internal.di.MoshiProvider
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.utils.AssetReader
|
||||
import im.vector.riotx.features.signout.soft.SoftLogoutAction
|
||||
import im.vector.riotx.features.signout.soft.SoftLogoutViewModel
|
||||
|
@ -48,8 +47,7 @@ import javax.inject.Inject
|
|||
* of the homeserver, as a fallback to login or to create an account
|
||||
*/
|
||||
class LoginWebFragment @Inject constructor(
|
||||
private val assetReader: AssetReader,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val assetReader: AssetReader
|
||||
) : AbstractLoginFragment() {
|
||||
|
||||
private val softLogoutViewModel: SoftLogoutViewModel by activityViewModel()
|
||||
|
@ -264,14 +262,6 @@ class LoginWebFragment @Inject constructor(
|
|||
loginViewModel.handle(LoginAction.ResetLogin)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||
return when {
|
||||
toolbarButton -> super.onBackPressed(toolbarButton)
|
||||
|
|
|
@ -19,11 +19,9 @@ package im.vector.riotx.features.login.terms
|
|||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.args
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.cleanup
|
||||
import im.vector.riotx.core.extensions.configureWith
|
||||
import im.vector.riotx.core.extensions.toReducedUrl
|
||||
|
@ -45,8 +43,7 @@ data class LoginTermsFragmentArgument(
|
|||
* LoginTermsFragment displays the list of policies the user has to accept
|
||||
*/
|
||||
class LoginTermsFragment @Inject constructor(
|
||||
private val policyController: PolicyController,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val policyController: PolicyController
|
||||
) : AbstractLoginFragment(),
|
||||
PolicyController.PolicyControllerListener {
|
||||
|
||||
|
@ -107,14 +104,6 @@ class LoginTermsFragment @Inject constructor(
|
|||
loginViewModel.handle(LoginAction.AcceptTerms)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun updateWithState(state: LoginViewState) {
|
||||
policyController.homeServer = state.homeServerUrl.toReducedUrl()
|
||||
renderState()
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.google.android.material.snackbar.Snackbar
|
|||
import com.jakewharton.rxbinding3.appcompat.queryTextChanges
|
||||
import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.cleanup
|
||||
import im.vector.riotx.core.extensions.configureWith
|
||||
import im.vector.riotx.core.extensions.observeEvent
|
||||
|
@ -42,8 +41,7 @@ import javax.inject.Inject
|
|||
* - When filtering more (when entering new chars), we could filter on result we already have, during the new server request, to avoid empty screen effect
|
||||
*/
|
||||
class PublicRoomsFragment @Inject constructor(
|
||||
private val publicRoomsController: PublicRoomsController,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val publicRoomsController: PublicRoomsController
|
||||
) : VectorBaseFragment(), PublicRoomsController.Callback {
|
||||
|
||||
private val viewModel: RoomDirectoryViewModel by activityViewModel()
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.airbnb.mvrx.args
|
|||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.setTextOrHide
|
||||
import im.vector.riotx.core.platform.ButtonStateView
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
|
@ -37,7 +36,6 @@ import javax.inject.Inject
|
|||
* Note: this Fragment is also used for world readable room for the moment
|
||||
*/
|
||||
class RoomPreviewNoPreviewFragment @Inject constructor(
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
val roomPreviewViewModelFactory: RoomPreviewViewModel.Factory,
|
||||
private val avatarRenderer: AvatarRenderer
|
||||
) : VectorBaseFragment() {
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.airbnb.mvrx.Loading
|
|||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.cleanup
|
||||
import im.vector.riotx.core.extensions.configureWith
|
||||
import im.vector.riotx.core.extensions.observeEvent
|
||||
|
@ -37,8 +36,7 @@ import javax.inject.Inject
|
|||
|
||||
class VectorSettingsIgnoredUsersFragment @Inject constructor(
|
||||
val ignoredUsersViewModelFactory: IgnoredUsersViewModel.Factory,
|
||||
private val ignoredUsersController: IgnoredUsersController,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val ignoredUsersController: IgnoredUsersController
|
||||
) : VectorBaseFragment(), IgnoredUsersController.Callback {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_generic_recycler
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.airbnb.mvrx.activityViewModel
|
|||
import com.airbnb.mvrx.withState
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.dialogs.withColoredButton
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.cleanup
|
||||
import im.vector.riotx.core.extensions.configureWith
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
|
@ -43,8 +42,7 @@ import javax.inject.Inject
|
|||
* - or to cleanup all the data
|
||||
*/
|
||||
class SoftLogoutFragment @Inject constructor(
|
||||
private val softLogoutController: SoftLogoutController,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val softLogoutController: SoftLogoutController
|
||||
) : AbstractLoginFragment(), SoftLogoutController.Listener {
|
||||
|
||||
private val softLogoutViewModel: SoftLogoutViewModel by activityViewModel()
|
||||
|
@ -139,14 +137,6 @@ class SoftLogoutFragment @Inject constructor(
|
|||
softLogoutViewModel.handle(SoftLogoutAction.TogglePassword)
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.dialog_title_error)
|
||||
.setMessage(errorFormatter.toHumanReadable(throwable))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
// No op
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue