Commit 423dc854 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

need to resolve insets issue (status bar? )

parent 3dfee915
package com.biganto.visual.roompark.data.local
import android.content.Context
import com.afollestad.rxkprefs.Pref
import com.afollestad.rxkprefs.rxkPrefs
import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import dagger.Binds
......@@ -28,6 +29,8 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
}
private val prefs = rxkPrefs(context)
private val userSession : Pref<String> = prefs.string(RECENT_UUID_KEY, EMPTY_PREF_VALUE_KEY)
companion object {
const val RECENT_UUID_KEY = "com.biganto.visual.androidplayer.LAST_USER_UUD"
const val EMPTY_PREF_VALUE_KEY = "NO_ACTIVE_SESSION"
......@@ -46,15 +49,16 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
.observe()
override fun recentUser(): Observable<in UserState> =
prefs.string(RECENT_UUID_KEY, EMPTY_PREF_VALUE_KEY)
userSession
.observe()
.map {
Timber.d(" AUTH VALUE: $it")
if (it == EMPTY_PREF_VALUE_KEY) return@map UserState.NotAuthenticated()
else return@map UserState.Authenticated(it)
}
override fun setRecentUser(uuid: String?) =
Completable.fromObservable(prefs.string(RECENT_UUID_KEY, uuid ?: EMPTY_PREF_VALUE_KEY).observe())
Completable.fromCallable{userSession.set(uuid?:EMPTY_PREF_VALUE_KEY)}
}
sealed class UserState{
......
......@@ -59,7 +59,8 @@ class AuthContractModule @Inject constructor(
api.authenticate(email,password)
.map ( ::fromRaw )
.flatMap{ db.upsertUser(it) }
.doOnNext { local.setRecentUser(it.uuid.toString()) }
.doOnNext{Timber.d("user id: ${it.uuid}")}
.doOnNext { local.setRecentUser(it.uuid.toString()).blockingAwait() }
.map(::fromEntity)
override fun validateAuthState(): Observable<Boolean> = local.recentUser()
......
......@@ -10,11 +10,8 @@ import javax.inject.Inject
class AuthUseCase @Inject constructor(
private val authContract: AuthContract
){
fun validateAuth() = authContract.validateAuthState()
fun signIn(login:String,pwd:String) = authContract.signIn(login,pwd)
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.home.home_routing
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.annotation.IdRes
import androidx.annotation.NonNull
......@@ -43,7 +42,7 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
}
override fun getStartupMenuId(): Int =
args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds)
args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds)
@Inject
......@@ -56,40 +55,34 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
override lateinit var injectedPresenter: HomeScreenPresenter
fun getComponent() = DaggerHomeScreenComponent
.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.create(RoomParkApplication.component, activity as RoomParkMainActivity)
.inject(this)
override fun render(viewState: HomeScreenViewState) {
when(viewState){
when (viewState) {
is HomeScreenViewState.Idle -> render(viewState)
is HomeScreenViewState.ToScreen -> render(viewState)
is HomeScreenViewState.SomeError -> render(viewState)
}
}
private fun render(viewState: HomeScreenViewState.Idle){
private fun render(viewState: HomeScreenViewState.Idle) {
}
private fun render(viewState: HomeScreenViewState.SomeError) =
showError(viewState.exception)
private fun render(viewState: HomeScreenViewState.ToScreen){
private fun render(viewState: HomeScreenViewState.ToScreen) {
// snacky.showSnackBar("lul")
}
override fun getLayoutId() = R.layout.tab_routing_screen_view
override val tag: String
......@@ -100,7 +93,8 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
bottomNavigation.show()
Timber.d(" onViewBound: ${this::class}")
bottomNavigationView = ((activity as RoomParkMainActivity) as IBottomNavigation).bottomNavigation
bottomNavigationView =
((activity as RoomParkMainActivity) as IBottomNavigation).bottomNavigation
bottomNavigationView.visibility = BottomNavigationView.VISIBLE
controllerContainer = view.findViewById(R.id.tabContainer)
bottomNavigationView.setOnNavigationItemSelectedListener { item ->
......@@ -146,19 +140,21 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
val childRouter = getChildRouter(currentlySelectedItemId)
Timber.d("in back stack - ${childRouter?.backstackSize}")
if (childRouter != null) {
val backStackSizeCondition = childRouter.backstackSize < 0
val backStackResult = childRouter.handleBack()
if (backStackResult
&& backStackSizeCondition
)
if (childRouter.backstackSize<2) return false
if (childRouter.handleBack())
navigateTo(getControllerFor(R.id.tab_feeds), false)
return backStackResult
return true
} else {
Log.e(TAG, "handleBack called with getChildRouter(currentlySelectedItemId) == null.",
IllegalStateException(
"handleBack called with getChildRouter(currentlySelectedItemId) == null."))
Timber.e(
IllegalStateException(
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
),
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
)
}
return false
}
......
......@@ -72,8 +72,8 @@ class SplashScreenController :
private fun render(viewState: SplashScreenViewState.ToHomeScreen){
router.setRoot(RouterTransaction.with(HomeBottomNavigationController())
.popChangeHandler(FadeChangeHandler())
.pushChangeHandler(FadeChangeHandler())
.popChangeHandler(FadeChangeHandler(200L))
.pushChangeHandler(FadeChangeHandler(300L))
)
}
......
......@@ -4,6 +4,9 @@ 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 io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
import javax.inject.Inject
/**
......@@ -29,7 +32,10 @@ class SplashScreenPresenter @Inject constructor(
if (it) SplashScreenViewState.ToHomeScreen()
else SplashScreenViewState.ToAuthScreen()
}
.delay (250, TimeUnit.MILLISECONDS)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(SplashScreenViewState::class.java), SplashScreen::render)
}
......
......@@ -5,7 +5,6 @@
android:id="@+id/bottom_drawer_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".base.RoomParkMainActivity">
......@@ -24,11 +23,11 @@
android:clipToPadding="true"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:expanded="false"
app:liftOnScroll="true"
app:layout_behavior=".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:liftOnScroll="true"
tools:visibility="visible">
<com.google.android.material.appbar.CollapsingToolbarLayout
......@@ -47,9 +46,9 @@
android:layout_height="?android:attr/actionBarSize"
android:visibility="invisible"
app:layout_collapseMode="pin"
app:titleTextAppearance="@style/Header_TextView.Main_Header"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:showAsAction="always"
app:titleTextAppearance="@style/Header_TextView.Main_Header"
tools:visibility="invisible">
</androidx.appcompat.widget.Toolbar>
......@@ -62,7 +61,7 @@
android:id="@+id/conductor_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" >
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<include
layout="@layout/test_progress_status"
......@@ -71,12 +70,12 @@
</FrameLayout>
<!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout-->
<!-- android:id="@+id/conductor_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/colorBackground"-->
<!-- app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />-->
<!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout-->
<!-- android:id="@+id/conductor_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/colorBackground"-->
<!-- app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />-->
<!--</android.support.constraint.ConstraintLayout>-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment