Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
28a39fa1
Commit
28a39fa1
authored
Nov 15, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add default error handler to all screens
parent
3de637c8
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
96 additions
and
12 deletions
+96
-12
BigantoBaseController.kt
...iganto/visual/roompark/conductor/BigantoBaseController.kt
+4
-0
BigantoBasePresenter.kt
...biganto/visual/roompark/conductor/BigantoBasePresenter.kt
+4
-2
ScreenPresenter.kt
...l/roompark/presentation/screen/article/ScreenPresenter.kt
+3
-0
ScreenViewState.kt
...l/roompark/presentation/screen/article/ScreenViewState.kt
+2
-0
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+3
-4
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+3
-3
ScreenController.kt
...al/roompark/presentation/screen/deals/ScreenController.kt
+4
-2
ScreenPresenter.kt
...ual/roompark/presentation/screen/deals/ScreenPresenter.kt
+3
-0
ScreenViewState.kt
...ual/roompark/presentation/screen/deals/ScreenViewState.kt
+2
-0
ScreenController.kt
...oompark/presentation/screen/favorites/ScreenController.kt
+4
-0
ScreenPresenter.kt
...roompark/presentation/screen/favorites/ScreenPresenter.kt
+3
-0
ScreenViewState.kt
...roompark/presentation/screen/favorites/ScreenViewState.kt
+2
-0
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+3
-0
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+3
-0
ScreenViewState.kt
...roompark/presentation/screen/feed_list/ScreenViewState.kt
+2
-0
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+4
-0
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+5
-0
ScreenViewState.kt
...ual/roompark/presentation/screen/feeds/ScreenViewState.kt
+3
-0
ScreenPresenter.kt
...sual/roompark/presentation/screen/home/ScreenPresenter.kt
+4
-0
ScreenViewState.kt
...sual/roompark/presentation/screen/home/ScreenViewState.kt
+2
-0
HomeBottomNavigationController.kt
...creen/home/home_routing/HomeBottomNavigationController.kt
+4
-0
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+4
-0
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+3
-0
ScreenViewState.kt
.../roompark/presentation/screen/settings/ScreenViewState.kt
+2
-0
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+4
-1
ScreenPresenter.kt
...al/roompark/presentation/screen/splash/ScreenPresenter.kt
+4
-0
ScreenViewState.kt
...al/roompark/presentation/screen/splash/ScreenViewState.kt
+2
-0
ScreenController.kt
.../roompark/presentation/screen/to_flat/ScreenController.kt
+4
-0
ScreenPresenter.kt
...l/roompark/presentation/screen/to_flat/ScreenPresenter.kt
+4
-0
ScreenViewState.kt
...l/roompark/presentation/screen/to_flat/ScreenViewState.kt
+2
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBaseController.kt
View file @
28a39fa1
...
...
@@ -15,6 +15,7 @@ import com.biganto.visual.roompark.base.ICollapsingToolBar
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.mosby.mvi.BigantoMviController
import
com.biganto.visual.roompark.di.dagger.ActivityModule
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.view_utils.snackbar.ISnackBarProvider
import
com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import
io.reactivex.disposables.CompositeDisposable
...
...
@@ -93,6 +94,9 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
return
super
.
handleBack
()
}
fun
showError
(
e
:
ExceptionString
)
=
e
.
selectHandler
(
snackbar
::
showSnackBar
,
snackbar
::
showSnackBar
)
protected
val
isTablet
get
()
=
resources
?.
getBoolean
(
R
.
bool
.
isTablet
)
?:
false
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBasePresenter.kt
View file @
28a39fa1
...
...
@@ -22,8 +22,10 @@ abstract class BigantoBasePresenter<V : MvpView, VS>
Observable
.
defer
{
Observable
.
just
(
parseError
(
t
))
}
abstract
fun
vsByCode
(
code
:
Int
):
(
ExceptionString
)
->
VS
abstract
fun
vsByThrowable
(
t
:
Throwable
):
(
ExceptionString
)
->
VS
abstract
fun
defaultErrorViewStateHandler
():
(
ExceptionString
)
->
VS
open
fun
vsByCode
(
code
:
Int
)
=
defaultErrorViewStateHandler
()
open
fun
vsByThrowable
(
t
:
Throwable
)
=
defaultErrorViewStateHandler
()
open
fun
parseError
(
t
:
Throwable
):
VS
=
when
(
t
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.article
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticleInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -16,6 +17,8 @@ class ArticleScreenPresenter @Inject constructor(
private
val
interactor
:
ArticleInteractor
)
:
BigantoBasePresenter
<
ArticleScreen
,
ArticleScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()=
{
e
:
ExceptionString
->
ArticleScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.article
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.ArticleModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -11,4 +12,5 @@ import com.biganto.visual.roompark.domain.model.ArticleModel
sealed
class
ArticleScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
ArticleScreenViewState
()
class
ArticleLoaded
(
val
item
:
ArticleModel
)
:
ArticleScreenViewState
()
class
SomeError
(
val
error
:
ExceptionString
)
:
ArticleScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
28a39fa1
...
...
@@ -93,13 +93,12 @@ class AuthScreenController :
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SignInError
){
viewState
.
exception
.
selectHandler
(
snackbar
::
showSnackBar
,
snackbar
::
showSnackBar
)
showError
(
viewState
.
exception
)
signInButton
.
isEnabled
=
true
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
){
viewState
.
exception
.
selectHandler
(
snackbar
::
showSnackBar
,
snackbar
::
showSnackBar
)
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
override
fun
getLayoutId
():
Int
=
R
.
layout
.
authentication_screen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -18,15 +18,15 @@ class AuthScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
override
fun
vsByCode
(
code
:
Int
):
(
ExceptionString
)
->
AuthScreenViewState
=
when
(
code
)
{
101
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
SignInError
(
e
)}
else
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
}
override
fun
vsByThrowable
(
t
:
Throwable
):
(
ExceptionString
)
->
AuthScreenViewState
=
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
val
onAuth
=
intent
(
AuthScreen
::
tryAuth
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenController.kt
View file @
28a39fa1
...
...
@@ -69,6 +69,7 @@ class DealsScreenController :
when
(
viewState
){
is
DealsScreenViewState
.
Idle
->
render
(
viewState
)
is
DealsScreenViewState
.
DealsLoaded
->
render
(
viewState
)
is
DealsScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -76,12 +77,13 @@ class DealsScreenController :
}
private
fun
render
(
viewState
:
DealsScreenViewState
.
DealsLoaded
){
(
favoritesRecyclerView
.
adapter
as
DealsListAdapter
).
addItems
(
viewState
.
items
)
}
private
fun
render
(
viewState
:
DealsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
getComponent
()
=
DaggerDealsScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.deals
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.DealsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -17,6 +18,8 @@ class DealsScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
DealsScreen
,
DealsScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
DealsScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenViewState.kt
View file @
28a39fa1
package
com.biganto.visual.roompark.presentation.screen.deals
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -10,5 +11,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed
class
DealsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
DealsScreenViewState
()
class
DealsLoaded
(
val
items
:
List
<
DealPreviewModel
>)
:
DealsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
DealsScreenViewState
()
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenController.kt
View file @
28a39fa1
...
...
@@ -70,6 +70,7 @@ class FavoritesScreenController :
when
(
viewState
){
is
FavoritesScreenViewState
.
Idle
->
render
(
viewState
)
is
FavoritesScreenViewState
.
FavoriteEstatesLoaded
->
render
(
viewState
)
is
FavoritesScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -77,6 +78,9 @@ class FavoritesScreenController :
}
private
fun
render
(
viewState
:
FavoritesScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
FavoritesScreenViewState
.
FavoriteEstatesLoaded
)
{
(
favoritesRecyclerView
.
adapter
as
FavoritesListAdapter
).
addItems
(
viewState
.
items
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.FavoritesInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -17,6 +18,8 @@ class FavoritesScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
FavoritesScreen
,
FavoritesScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
FavoritesScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -11,4 +12,5 @@ import com.biganto.visual.roompark.domain.model.EstateModel
sealed
class
FavoritesScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
FavoritesScreenViewState
()
class
FavoriteEstatesLoaded
(
val
items
:
List
<
EstateModel
>)
:
FavoritesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FavoritesScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenController.kt
View file @
28a39fa1
...
...
@@ -86,6 +86,7 @@ class ArticlesScreenController :
when
(
viewState
){
is
ArticlesScreenViewState
.
Idle
->
render
(
viewState
)
is
ArticlesScreenViewState
.
ArticlesLoaded
->
render
(
viewState
)
is
ArticlesScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -93,6 +94,8 @@ class ArticlesScreenController :
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesLoaded
)
{
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
setItems
(
viewState
.
items
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticlesInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -19,6 +20,8 @@ class ArticlesScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
ArticlesScreen
,
ArticlesScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
ArticlesScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
Timber
.
d
(
"feedId : $feedId"
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -11,4 +12,5 @@ import com.biganto.visual.roompark.domain.model.ArticlePreviewModel
sealed
class
ArticlesScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
ArticlesScreenViewState
()
class
ArticlesLoaded
(
val
items
:
List
<
ArticlePreviewModel
>)
:
ArticlesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
ArticlesScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
28a39fa1
...
...
@@ -123,6 +123,7 @@ class FeedsScreenController :
is
FeedsScreenViewState
.
CamsList
->
render
(
viewState
)
is
FeedsScreenViewState
.
GetFeedArticlesPreview
->
render
(
viewState
)
is
FeedsScreenViewState
.
RestoreView
->
render
(
viewState
)
is
FeedsScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -130,6 +131,9 @@ class FeedsScreenController :
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
allFeedName
(
feedId
:
Int
)
=
if
(
feedId
==
1
)
"НОВОСТИ"
else
"БЛОГИ"
@SuppressLint
(
"SetTextI18n"
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.feeds
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.FeedsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -17,6 +18,10 @@ class FeedsScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
FeedsScreen
,
FeedsScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
FeedsScreenViewState
.
SomeError
(
e
)}
private
val
restoreModel
=
RestoreModel
(
arrayListOf
(),
arrayListOf
(),
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -5,6 +5,7 @@ import com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.WebCamModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -20,6 +21,8 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
class
GetFeedArticlesPreview
(
val
items
:
List
<
ArticlePreviewModel
>)
:
FeedsScreenViewState
()
class
RestoreView
(
val
restore
:
RestoreModel
)
:
FeedsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FeedsScreenViewState
()
}
data class
RestoreModel
(
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/ScreenPresenter.kt
View file @
28a39fa1
package
com.biganto.visual.roompark.presentation.screen.home
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
javax.inject.Inject
/**
...
...
@@ -13,6 +14,9 @@ class HomeScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
HomeScreen
,
HomeScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
HomeScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
subscribeViewState
(
state
.
cast
(
HomeScreenViewState
::
class
.
java
),
HomeScreen
::
render
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/ScreenViewState.kt
View file @
28a39fa1
package
com.biganto.visual.roompark.presentation.screen.home
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -10,4 +11,5 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed
class
HomeScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
HomeScreenViewState
()
class
ToScreen
(
val
message
:
String
)
:
HomeScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
HomeScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/home_routing/HomeBottomNavigationController.kt
View file @
28a39fa1
...
...
@@ -68,6 +68,7 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
when
(
viewState
){
is
HomeScreenViewState
.
Idle
->
render
(
viewState
)
is
HomeScreenViewState
.
ToScreen
->
render
(
viewState
)
is
HomeScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -75,6 +76,9 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
}
private
fun
render
(
viewState
:
HomeScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
HomeScreenViewState
.
ToScreen
){
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
28a39fa1
...
...
@@ -93,9 +93,13 @@ class SettingsScreenController :
when
(
viewState
){
is
SettingsScreenViewState
.
Idle
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadSettingsList
->
render
(
viewState
)
is
SettingsScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
SettingsScreenViewState
.
Idle
){
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.settings
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.SettingsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -17,6 +18,8 @@ class SettingsScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
SettingsScreen
,
SettingsScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
SettingsScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.settings
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.SettingsModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -11,4 +12,5 @@ import com.biganto.visual.roompark.domain.model.SettingsModel
sealed
class
SettingsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
SettingsScreenViewState
()
class
LoadSettingsList
(
val
settings
:
SettingsModel
)
:
SettingsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
SettingsScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
28a39fa1
...
...
@@ -2,7 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.splash
import
android.view.View
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.ICollapsingToolBar
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
...
...
@@ -53,6 +52,7 @@ class SplashScreenController :
is
SplashScreenViewState
.
Idle
->
render
(
viewState
)
is
SplashScreenViewState
.
ToAuthScreen
->
render
(
viewState
)
is
SplashScreenViewState
.
ToHomeScreen
->
render
(
viewState
)
is
SplashScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -60,6 +60,9 @@ class SplashScreenController :
}
private
fun
render
(
viewState
:
SplashScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToAuthScreen
){
router
.
pushController
(
RouterTransaction
.
with
(
AuthScreenController
())
.
popChangeHandler
(
FadeChangeHandler
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.splash
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.SplashInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
javax.inject.Inject
/**
...
...
@@ -17,6 +18,9 @@ class SplashScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
SplashScreen
,
SplashScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
SplashScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenViewState.kt
View file @
28a39fa1
package
com.biganto.visual.roompark.presentation.screen.splash
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -11,4 +12,5 @@ sealed class SplashScreenViewState : BigantoBaseViewState() {
class
Idle
:
SplashScreenViewState
()
class
ToHomeScreen
()
:
SplashScreenViewState
()
class
ToAuthScreen
()
:
SplashScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
SplashScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenController.kt
View file @
28a39fa1
...
...
@@ -101,9 +101,13 @@ class FindFlatScreenController :
Timber
.
d
(
"Render state $viewState"
)
when
(
viewState
){
is
FindFlatScreenViewState
.
Idle
->
render
(
viewState
)
is
FindFlatScreenViewState
.
StartTour
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
FindFlatScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
FindFlatScreenViewState
.
Idle
){
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenPresenter.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.to_flat
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.FindFlatInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
...
...
@@ -18,6 +19,9 @@ class FindFlatScreenPresenter @Inject constructor(
)
:
BigantoBasePresenter
<
FindFlatScreen
,
FindFlatScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
FindFlatScreenViewState
.
SomeError
(
e
)}
override
fun
bindIntents
()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenViewState.kt
View file @
28a39fa1
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.to_flat
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -14,4 +15,5 @@ sealed class FindFlatScreenViewState : BigantoBaseViewState() {
class
TourFounded
(
val
items
:
List
<
TourModel
>)
:
FindFlatScreenViewState
()
class
StartTour
(
val
tourId
:
String
)
:
FindFlatScreenViewState
()
class
FlatNotFound
()
:
FindFlatScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FindFlatScreenViewState
()
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment