mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Fix flow listening in SettingsController
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
b9d2ca2517
commit
f7786e1b93
@ -101,7 +101,9 @@ import io.reactivex.disposables.Disposable
|
|||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener
|
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
@ -147,16 +149,13 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
get() =
|
get() =
|
||||||
resources!!.getString(R.string.nc_settings)
|
resources!!.getString(R.string.nc_settings)
|
||||||
|
|
||||||
private fun getCurrentUser() {
|
private suspend fun getCurrentUser() {
|
||||||
scope.launch {
|
val user = currentUserProvider.currentUser.first()
|
||||||
currentUserProvider.currentUser.collect {
|
Log.e(TAG, "User: $user")
|
||||||
Log.e(TAG, "User: $it")
|
currentUser = user
|
||||||
this@SettingsController.currentUser = it
|
credentials =
|
||||||
this@SettingsController.credentials =
|
|
||||||
ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewBound(view: View) {
|
override fun onViewBound(view: View) {
|
||||||
super.onViewBound(view)
|
super.onViewBound(view)
|
||||||
@ -164,6 +163,8 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
|
|
||||||
ViewCompat.setTransitionName((binding.avatarImage), "userAvatar.transitionTag")
|
ViewCompat.setTransitionName((binding.avatarImage), "userAvatar.transitionTag")
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
getCurrentUser()
|
getCurrentUser()
|
||||||
|
|
||||||
if (saveStateHandler == null) {
|
if (saveStateHandler == null) {
|
||||||
@ -202,6 +203,7 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
|
|
||||||
setupClientCertView()
|
setupClientCertView()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupPhoneBookIntegration() {
|
private fun setupPhoneBookIntegration() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@ -484,6 +486,9 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
super.onAttach(view)
|
super.onAttach(view)
|
||||||
actionBar?.show()
|
actionBar?.show()
|
||||||
dispose(null)
|
dispose(null)
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
|
||||||
getCurrentUser()
|
getCurrentUser()
|
||||||
|
|
||||||
binding.settingsVersion.setOnClickListener {
|
binding.settingsVersion.setOnClickListener {
|
||||||
@ -548,6 +553,7 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupProxyTypeSettings() {
|
private fun setupProxyTypeSettings() {
|
||||||
if (("No proxy" == appPreferences!!.proxyType) || appPreferences!!.proxyType == null) {
|
if (("No proxy" == appPreferences!!.proxyType) || appPreferences!!.proxyType == null) {
|
||||||
|
@ -38,8 +38,8 @@ class PushConfigurationConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun fromStringToPushConfiguration(value: String): PushConfigurationState? {
|
fun fromStringToPushConfiguration(value: String?): PushConfigurationState? {
|
||||||
if (value.isBlank()) {
|
if (value.isNullOrBlank()) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user