mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 18:36:21 +03:00
Fix some stupid issues
This commit is contained in:
parent
ea51420c74
commit
18c6472f32
6 changed files with 13 additions and 13 deletions
Binary file not shown.
|
@ -34,7 +34,7 @@ class RoomDetailFragment : RiotFragment() {
|
|||
}
|
||||
|
||||
private val matrix by inject<Matrix>()
|
||||
private val currentSession = matrix.currentSession!!
|
||||
private val currentSession = matrix.currentSession
|
||||
private var roomId by FragmentArgumentDelegate<String>()
|
||||
private lateinit var timelineEventController: TimelineEventController
|
||||
private lateinit var room: Room
|
||||
|
@ -77,8 +77,6 @@ class RoomDetailFragment : RiotFragment() {
|
|||
.placeholder(riotActivity.avatarDrawable(it.displayName))
|
||||
.apply(RequestOptions.circleCropTransform())
|
||||
.into(toolbarAvatarImageView)
|
||||
|
||||
toolbarAvatarImageView.setImageDrawable(riotActivity.avatarDrawable(it.displayName))
|
||||
if (it.topic.isNotEmpty()) {
|
||||
toolbarSubtitleView.visibility = View.VISIBLE
|
||||
toolbarSubtitleView.text = it.topic
|
||||
|
|
|
@ -17,7 +17,7 @@ class RoomListViewModel(initialState: RoomListViewState,
|
|||
@JvmStatic
|
||||
override fun create(activity: FragmentActivity, state: RoomListViewState): RoomListViewModel {
|
||||
val matrix = activity.get<Matrix>()
|
||||
val currentSession = matrix.currentSession!!
|
||||
val currentSession = matrix.currentSession
|
||||
return RoomListViewModel(state, currentSession)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ class LoginActivity : RiotActivity() {
|
|||
|
||||
authenticator.authenticate(homeServerConnectionConfig, login, password, object : MatrixCallback<Session> {
|
||||
override fun onSuccess(data: Session) {
|
||||
openSessionAndGoToHome(data)
|
||||
matrix.currentSession = data
|
||||
goToHome()
|
||||
}
|
||||
|
||||
override fun onFailure(failure: Failure) {
|
||||
|
@ -50,16 +51,11 @@ class LoginActivity : RiotActivity() {
|
|||
|
||||
private fun checkActiveSessions() {
|
||||
if (authenticator.hasActiveSessions()) {
|
||||
val session = authenticator.getLastActiveSession()
|
||||
session?.let {
|
||||
openSessionAndGoToHome(it)
|
||||
}
|
||||
goToHome()
|
||||
}
|
||||
}
|
||||
|
||||
private fun openSessionAndGoToHome(session: Session) {
|
||||
matrix.currentSession = session
|
||||
session.open()
|
||||
private fun goToHome() {
|
||||
val intent = HomeActivity.newIntent(this)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
|
|
|
@ -19,7 +19,7 @@ class Matrix(matrixOptions: MatrixOptions) : KoinComponent {
|
|||
private val authenticator by inject<Authenticator>()
|
||||
private val backgroundDetectionObserver by inject<BackgroundDetectionObserver>()
|
||||
|
||||
var currentSession: Session? = null
|
||||
lateinit var currentSession: Session
|
||||
|
||||
init {
|
||||
Monarchy.init(matrixOptions.context)
|
||||
|
@ -28,6 +28,11 @@ class Matrix(matrixOptions: MatrixOptions) : KoinComponent {
|
|||
val authModule = AuthModule()
|
||||
loadKoinModules(listOf(matrixModule, networkModule, authModule))
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(backgroundDetectionObserver)
|
||||
val lastActiveSession = authenticator.getLastActiveSession()
|
||||
if (lastActiveSession != null) {
|
||||
currentSession = lastActiveSession
|
||||
currentSession.open()
|
||||
}
|
||||
}
|
||||
|
||||
fun authenticator(): Authenticator {
|
||||
|
|
|
@ -54,6 +54,7 @@ class DefaultTimelineHolder(private val roomId: String,
|
|||
val pagedListConfig = PagedList.Config.Builder()
|
||||
.setEnablePlaceholders(false)
|
||||
.setPageSize(PAGE_SIZE)
|
||||
.setInitialLoadSizeHint(PAGE_SIZE)
|
||||
.setPrefetchDistance(10)
|
||||
.build()
|
||||
|
||||
|
|
Loading…
Reference in a new issue