This commit is contained in:
Phillip Thelen 2022-05-13 14:06:08 +02:00
parent d882328398
commit 037fd43a4a
4 changed files with 8 additions and 5 deletions

View file

@ -1261,4 +1261,5 @@
<string name="december">December</string>
<string name="cds_subtitle">Adjust when your day switches over past the default time of midnight.</string>
<string name="buy_set">Buy Set</string>
<string name="tutorial_reset_confirmation">Your Tutorials were reset</string>
</resources>

View file

@ -33,7 +33,7 @@ interface UserRepository : BaseRepository {
fun revive(): Flowable<User>
fun resetTutorial()
fun resetTutorial(): Maybe<User>
fun sleep(user: User): Flowable<User>

View file

@ -108,8 +108,8 @@ class UserRepositoryImpl(
}
.flatMap { retrieveUser(false, true) }
override fun resetTutorial() {
localRepository.getTutorialSteps()
override fun resetTutorial(): Maybe<User> {
return localRepository.getTutorialSteps()
.firstElement()
.map<Map<String, Any>> { tutorialSteps ->
val updateData = HashMap<String, Any>()
@ -119,7 +119,6 @@ class UserRepositoryImpl(
updateData
}
.flatMap { updateData -> updateUser(updateData).firstElement() }
.subscribe({ }, RxErrorHandler.handleEmptyError())
}
override fun sleep(user: User): Flowable<User> {

View file

@ -12,6 +12,7 @@ import com.habitrpg.android.habitica.data.FAQRepository
import com.habitrpg.android.habitica.databinding.FragmentSupportMainBinding
import com.habitrpg.android.habitica.helpers.AppConfigManager
import com.habitrpg.android.habitica.helpers.MainNavigationController
import com.habitrpg.android.habitica.helpers.RxErrorHandler
import com.habitrpg.android.habitica.modules.AppModule
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
import javax.inject.Inject
@ -57,7 +58,9 @@ class SupportMainFragment : BaseMainFragment<FragmentSupportMainBinding>() {
}
binding?.resetTutorialButton?.setOnClickListener {
userRepository.resetTutorial()
userRepository.resetTutorial().subscribe( {
activity?.showSnackbar(null, getString(R.string.tutorial_reset_confirmation))
}, RxErrorHandler.handleEmptyError())
}
}