mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Merge pull request #4757 from vector-im/feature/fre/minor_code_enhancements
Some code enhancements
This commit is contained in:
commit
753d704c69
4 changed files with 14 additions and 9 deletions
|
@ -152,6 +152,13 @@ class FlowSession(private val session: Session) {
|
|||
}
|
||||
}
|
||||
|
||||
fun liveUserAccountData(type: String): Flow<Optional<UserAccountDataEvent>> {
|
||||
return session.accountDataService().getLiveUserAccountDataEvent(type).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.accountDataService().getUserAccountDataEvent(type).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveRoomAccountData(types: Set<String>): Flow<List<RoomAccountDataEvent>> {
|
||||
return session.accountDataService().getLiveRoomAccountDataEvents(types).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
|
|
|
@ -168,11 +168,8 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun renderCreationSuccess(roomId: String?) {
|
||||
// Navigate to freshly created room
|
||||
if (roomId != null) {
|
||||
navigator.openRoom(this, roomId)
|
||||
}
|
||||
private fun renderCreationSuccess(roomId: String) {
|
||||
navigator.openRoom(this, roomId)
|
||||
finish()
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,10 @@ import timber.log.Timber
|
|||
class RoomListViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: RoomListViewState,
|
||||
private val session: Session,
|
||||
private val stringProvider: StringProvider,
|
||||
private val appStateHandler: AppStateHandler,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val autoAcceptInvites: AutoAcceptInvites
|
||||
stringProvider: StringProvider,
|
||||
appStateHandler: AppStateHandler,
|
||||
vectorPreferences: VectorPreferences,
|
||||
autoAcceptInvites: AutoAcceptInvites
|
||||
) : VectorViewModel<RoomListViewState, RoomListAction, RoomListViewEvents>(initialState) {
|
||||
|
||||
@AssistedFactory
|
||||
|
|
|
@ -44,6 +44,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||
const val SETTINGS_HOME_SERVER_PREFERENCE_KEY = "SETTINGS_HOME_SERVER_PREFERENCE_KEY"
|
||||
const val SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY = "SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY"
|
||||
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
||||
const val SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY = "SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY"
|
||||
|
||||
const val SETTINGS_CLEAR_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"
|
||||
const val SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"
|
||||
|
|
Loading…
Reference in a new issue