mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 20:40:07 +03:00
Bump fragment from 1.6.0-alpha04 to 1.6.0-alpha06 (#8165)
* Bump fragment from 1.6.0-alpha04 to 1.6.0-alpha06 Bumps `fragment` from 1.6.0-alpha04 to 1.6.0-alpha06. Updates `androidx.fragment:fragment-ktx` from 1.6.0-alpha04 to 1.6.0-alpha06 Updates `androidx.fragment:fragment-testing` from 1.6.0-alpha04 to 1.6.0-alpha06 Updates `androidx.fragment:fragment-testing-manifest` from 1.6.0-alpha04 to 1.6.0-alpha06 --- updated-dependencies: - dependency-name: androidx.fragment:fragment-ktx dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.fragment:fragment-testing dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.fragment:fragment-testing-manifest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Replace deprecated methods * Fix tests --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yostyle <y.pintas@gmail.com>
This commit is contained in:
parent
6491d0d89f
commit
ea6279ee89
12 changed files with 120 additions and 88 deletions
|
@ -29,7 +29,7 @@ def jjwt = "0.11.5"
|
||||||
def vanniktechEmoji = "0.16.0-SNAPSHOT"
|
def vanniktechEmoji = "0.16.0-SNAPSHOT"
|
||||||
def sentry = "6.15.0"
|
def sentry = "6.15.0"
|
||||||
// Use 1.6.0 alpha to fix issue with test
|
// Use 1.6.0 alpha to fix issue with test
|
||||||
def fragment = "1.6.0-alpha04"
|
def fragment = "1.6.0-alpha06"
|
||||||
// Testing
|
// Testing
|
||||||
def mockk = "1.12.3" // We need to use 1.12.3 to have mocking in androidTest until a new version is released: https://github.com/mockk/mockk/issues/819
|
def mockk = "1.12.3" // We need to use 1.12.3 to have mocking in androidTest until a new version is released: https://github.com/mockk/mockk/issues/819
|
||||||
def espresso = "3.5.1"
|
def espresso = "3.5.1"
|
||||||
|
|
|
@ -150,7 +150,7 @@ fun initialSyncIdlingResource(session: Session): IdlingResource {
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChanged(t: SyncState?) {
|
override fun onChanged(value: SyncState) {
|
||||||
val isIdle = session.syncService().hasAlreadySynced()
|
val isIdle = session.syncService().hasAlreadySynced()
|
||||||
if (isIdle) {
|
if (isIdle) {
|
||||||
callback?.onTransitionToIdle()
|
callback?.onTransitionToIdle()
|
||||||
|
@ -241,10 +241,10 @@ fun allSecretsKnownIdling(session: Session): IdlingResource {
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChanged(t: Optional<PrivateKeysInfo>?) {
|
override fun onChanged(value: Optional<PrivateKeysInfo>) {
|
||||||
println("*** [$name] allSecretsKnownIdling ${t?.getOrNull()}")
|
println("*** [$name] allSecretsKnownIdling ${value.getOrNull()}")
|
||||||
privateKeysInfo = t?.getOrNull()
|
privateKeysInfo = value.getOrNull()
|
||||||
if (t?.getOrNull()?.allKnown() == true) {
|
if (value.getOrNull()?.allKnown() == true) {
|
||||||
session.cryptoService().crossSigningService().getLiveCrossSigningPrivateKeys().removeObserver(this)
|
session.cryptoService().crossSigningService().getLiveCrossSigningPrivateKeys().removeObserver(this)
|
||||||
callback?.onTransitionToIdle()
|
callback?.onTransitionToIdle()
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ abstract class VerificationTestBase {
|
||||||
session.syncService().getSyncStateLive()
|
session.syncService().getSyncStateLive()
|
||||||
}
|
}
|
||||||
val syncObserver = object : Observer<SyncState> {
|
val syncObserver = object : Observer<SyncState> {
|
||||||
override fun onChanged(t: SyncState?) {
|
override fun onChanged(value: SyncState) {
|
||||||
if (session.syncService().hasAlreadySynced()) {
|
if (session.syncService().hasAlreadySynced()) {
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
syncLiveData.removeObserver(this)
|
syncLiveData.removeObserver(this)
|
||||||
|
|
|
@ -21,13 +21,16 @@ import android.text.Editable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.autofill.HintConstants
|
import androidx.autofill.HintConstants
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.core.platform.SimpleTextWatcher
|
import im.vector.app.core.platform.SimpleTextWatcher
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import reactivecircus.flowbinding.android.widget.textChanges
|
import reactivecircus.flowbinding.android.widget.textChanges
|
||||||
|
|
||||||
fun TextInputLayout.editText() = this.editText!!
|
fun TextInputLayout.editText() = this.editText!!
|
||||||
|
@ -85,7 +88,7 @@ fun TextInputLayout.setOnImeDoneListener(action: () -> Unit) {
|
||||||
fun TextInputLayout.setOnFocusLostListener(lifecycleOwner: LifecycleOwner, action: () -> Unit) {
|
fun TextInputLayout.setOnFocusLostListener(lifecycleOwner: LifecycleOwner, action: () -> Unit) {
|
||||||
editText().setOnFocusChangeListener { _, hasFocus ->
|
editText().setOnFocusChangeListener { _, hasFocus ->
|
||||||
when (hasFocus) {
|
when (hasFocus) {
|
||||||
false -> lifecycleOwner.lifecycleScope.launchWhenResumed { action() }
|
false -> lifecycleOwner.lifecycleScope.launch { lifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) { action() } }
|
||||||
else -> {
|
else -> {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,7 @@ open class LiveEvent<out T>(private val content: T) {
|
||||||
* [onEventUnhandledContent] is *only* called if the [LiveEvent]'s contents has not been handled.
|
* [onEventUnhandledContent] is *only* called if the [LiveEvent]'s contents has not been handled.
|
||||||
*/
|
*/
|
||||||
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<LiveEvent<T>> {
|
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<LiveEvent<T>> {
|
||||||
override fun onChanged(event: LiveEvent<T>?) {
|
override fun onChanged(value: LiveEvent<T>) {
|
||||||
event?.getContentIfNotHandled()?.let { value ->
|
value.getContentIfNotHandled()?.let { onEventUnhandledContent(it) }
|
||||||
onEventUnhandledContent(value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@ import androidx.core.view.isVisible
|
||||||
import androidx.drawerlayout.widget.DrawerLayout
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.airbnb.mvrx.Mavericks
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -402,8 +404,8 @@ class HomeActivity :
|
||||||
|
|
||||||
private fun handleStartRecoverySetup() {
|
private fun handleStartRecoverySetup() {
|
||||||
// To avoid IllegalStateException in case the transaction was executed after onSaveInstanceState
|
// To avoid IllegalStateException in case the transaction was executed after onSaveInstanceState
|
||||||
lifecycleScope.launchWhenResumed {
|
lifecycleScope.launch {
|
||||||
navigator.open4SSetup(this@HomeActivity, SetupMode.NORMAL)
|
repeatOnLifecycle(Lifecycle.State.RESUMED) { navigator.open4SSetup(this@HomeActivity, SetupMode.NORMAL) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,9 @@ import androidx.core.view.isInvisible
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import androidx.fragment.app.setFragmentResultListener
|
import androidx.fragment.app.setFragmentResultListener
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper
|
import androidx.recyclerview.widget.ItemTouchHelper
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -1109,29 +1111,31 @@ class TimelineFragment :
|
||||||
|
|
||||||
private fun updateJumpToReadMarkerViewVisibility() {
|
private fun updateJumpToReadMarkerViewVisibility() {
|
||||||
if (isThreadTimeLine()) return
|
if (isThreadTimeLine()) return
|
||||||
viewLifecycleOwner.lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
val state = timelineViewModel.awaitState()
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
val showJumpToUnreadBanner = when (state.unreadState) {
|
val state = timelineViewModel.awaitState()
|
||||||
UnreadState.Unknown,
|
val showJumpToUnreadBanner = when (state.unreadState) {
|
||||||
UnreadState.HasNoUnread -> false
|
UnreadState.Unknown,
|
||||||
is UnreadState.ReadMarkerNotLoaded -> true
|
UnreadState.HasNoUnread -> false
|
||||||
is UnreadState.HasUnread -> {
|
is UnreadState.ReadMarkerNotLoaded -> true
|
||||||
if (state.canShowJumpToReadMarker) {
|
is UnreadState.HasUnread -> {
|
||||||
val lastVisibleItem = layoutManager.findLastCompletelyVisibleItemPosition()
|
if (state.canShowJumpToReadMarker) {
|
||||||
val positionOfReadMarker = withContext(Dispatchers.Default) {
|
val lastVisibleItem = layoutManager.findLastCompletelyVisibleItemPosition()
|
||||||
timelineEventController.getPositionOfReadMarker()
|
val positionOfReadMarker = withContext(Dispatchers.Default) {
|
||||||
}
|
timelineEventController.getPositionOfReadMarker()
|
||||||
if (positionOfReadMarker == null) {
|
}
|
||||||
false
|
if (positionOfReadMarker == null) {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
positionOfReadMarker > lastVisibleItem
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
positionOfReadMarker > lastVisibleItem
|
false
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
views.jumpToReadMarkerView.isVisible = showJumpToUnreadBanner
|
||||||
}
|
}
|
||||||
views.jumpToReadMarkerView.isVisible = showJumpToUnreadBanner
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1621,14 +1625,16 @@ class TimelineFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRoomCreateLinkClicked(url: String) {
|
override fun onRoomCreateLinkClicked(url: String) {
|
||||||
viewLifecycleOwner.lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
permalinkHandler
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
.launch(requireActivity(), url, object : NavigationInterceptor {
|
permalinkHandler
|
||||||
override fun navToRoom(roomId: String?, eventId: String?, deepLink: Uri?, rootThreadEventId: String?): Boolean {
|
.launch(requireActivity(), url, object : NavigationInterceptor {
|
||||||
requireActivity().finish()
|
override fun navToRoom(roomId: String?, eventId: String?, deepLink: Uri?, rootThreadEventId: String?): Boolean {
|
||||||
return false
|
requireActivity().finish()
|
||||||
}
|
return false
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@ import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.setFragmentResultListener
|
import androidx.fragment.app.setFragmentResultListener
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -47,6 +49,7 @@ import im.vector.app.features.location.live.duration.ChooseLiveDurationBottomShe
|
||||||
import im.vector.app.features.location.live.tracking.LocationSharingAndroidService
|
import im.vector.app.features.location.live.tracking.LocationSharingAndroidService
|
||||||
import im.vector.app.features.location.option.LocationSharingOption
|
import im.vector.app.features.location.option.LocationSharingOption
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
import org.matrix.android.sdk.api.util.MatrixItem
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -97,11 +100,13 @@ class LocationSharingFragment :
|
||||||
}.also { views.mapView.addOnDidFailLoadingMapListener(it) }
|
}.also { views.mapView.addOnDidFailLoadingMapListener(it) }
|
||||||
views.mapView.onCreate(savedInstanceState)
|
views.mapView.onCreate(savedInstanceState)
|
||||||
|
|
||||||
lifecycleScope.launchWhenCreated {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
views.mapView.initialize(
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
url = urlMapProvider.getMapUrl(),
|
views.mapView.initialize(
|
||||||
locationTargetChangeListener = this@LocationSharingFragment
|
url = urlMapProvider.getMapUrl(),
|
||||||
)
|
locationTargetChangeListener = this@LocationSharingFragment
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initLocateButton()
|
initLocateButton()
|
||||||
|
|
|
@ -22,7 +22,9 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
|
@ -42,6 +44,7 @@ import im.vector.app.features.location.LocationSharingArgs
|
||||||
import im.vector.app.features.location.MapState
|
import im.vector.app.features.location.MapState
|
||||||
import im.vector.app.features.location.UrlMapProvider
|
import im.vector.app.features.location.UrlMapProvider
|
||||||
import im.vector.app.features.location.showUserLocationNotAvailableErrorDialog
|
import im.vector.app.features.location.showUserLocationNotAvailableErrorDialog
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -77,8 +80,10 @@ class LocationPreviewFragment :
|
||||||
}.also { views.mapView.addOnDidFailLoadingMapListener(it) }
|
}.also { views.mapView.addOnDidFailLoadingMapListener(it) }
|
||||||
views.mapView.onCreate(savedInstanceState)
|
views.mapView.onCreate(savedInstanceState)
|
||||||
|
|
||||||
lifecycleScope.launchWhenCreated {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
views.mapView.initialize(urlMapProvider.getMapUrl())
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
views.mapView.initialize(urlMapProvider.getMapUrl())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
observeViewEvents()
|
observeViewEvents()
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
package im.vector.app.features.settings
|
package im.vector.app.features.settings
|
||||||
|
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
@ -129,34 +131,36 @@ class VectorSettingsPinFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshPinCodeStatus() {
|
private fun refreshPinCodeStatus() {
|
||||||
lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
val hasPinCode = pinCodeStore.hasEncodedPin()
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
usePinCodePref.isChecked = hasPinCode
|
val hasPinCode = pinCodeStore.hasEncodedPin()
|
||||||
usePinCodePref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
usePinCodePref.isChecked = hasPinCode
|
||||||
if (hasPinCode) {
|
usePinCodePref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
lifecycleScope.launch {
|
if (hasPinCode) {
|
||||||
pinCodeStore.deletePinCode()
|
lifecycleScope.launch {
|
||||||
refreshPinCodeStatus()
|
pinCodeStore.deletePinCode()
|
||||||
|
refreshPinCodeStatus()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navigator.openPinCode(
|
||||||
|
requireContext(),
|
||||||
|
pinActivityResultLauncher,
|
||||||
|
PinMode.CREATE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
true
|
||||||
navigator.openPinCode(
|
|
||||||
requireContext(),
|
|
||||||
pinActivityResultLauncher,
|
|
||||||
PinMode.CREATE
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
changePinCodePref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
changePinCodePref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
if (hasPinCode) {
|
if (hasPinCode) {
|
||||||
navigator.openPinCode(
|
navigator.openPinCode(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
pinActivityResultLauncher,
|
pinActivityResultLauncher,
|
||||||
PinMode.MODIFY
|
PinMode.MODIFY
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
true
|
||||||
}
|
}
|
||||||
true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,9 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceCategory
|
import androidx.preference.PreferenceCategory
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
|
@ -185,11 +187,11 @@ class VectorSettingsSecurityPrivacyFragment :
|
||||||
}
|
}
|
||||||
.launchIn(viewLifecycleOwner.lifecycleScope)
|
.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||||
|
|
||||||
lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_HS_ADMIN_DISABLED_E2E_DEFAULT)?.isVisible =
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_HS_ADMIN_DISABLED_E2E_DEFAULT)?.isVisible =
|
||||||
rawService
|
rawService
|
||||||
.getElementWellknown(session.sessionParams)
|
.getElementWellknown(session.sessionParams)
|
||||||
?.isE2EByDefault() == false
|
?.isE2EByDefault() == false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,16 +418,18 @@ class VectorSettingsSecurityPrivacyFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openPinCodePreferenceScreen() {
|
private fun openPinCodePreferenceScreen() {
|
||||||
lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
val hasPinCode = pinCodeStore.hasEncodedPin()
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
if (hasPinCode) {
|
val hasPinCode = pinCodeStore.hasEncodedPin()
|
||||||
navigator.openPinCode(
|
if (hasPinCode) {
|
||||||
requireContext(),
|
navigator.openPinCode(
|
||||||
pinActivityResultLauncher,
|
requireContext(),
|
||||||
PinMode.AUTH
|
pinActivityResultLauncher,
|
||||||
)
|
PinMode.AUTH
|
||||||
} else {
|
)
|
||||||
doOpenPinCodePreferenceScreen()
|
} else {
|
||||||
|
doOpenPinCodePreferenceScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,9 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ScrollView
|
import android.widget.ScrollView
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.airbnb.mvrx.activityViewModel
|
import com.airbnb.mvrx.activityViewModel
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
|
@ -45,6 +47,7 @@ import im.vector.app.features.settings.VectorSettingsActivity
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.flow.onStart
|
import kotlinx.coroutines.flow.onStart
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.session.identity.ThreePid
|
import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||||
import org.matrix.android.sdk.api.session.user.model.User
|
import org.matrix.android.sdk.api.session.user.model.User
|
||||||
import reactivecircus.flowbinding.android.widget.textChanges
|
import reactivecircus.flowbinding.android.widget.textChanges
|
||||||
|
@ -174,8 +177,10 @@ class UserListFragment :
|
||||||
|
|
||||||
// Scroll to the bottom when adding chips. When removing chips, do not scroll
|
// Scroll to the bottom when adding chips. When removing chips, do not scroll
|
||||||
if (newNumberOfChips >= currentNumberOfChips) {
|
if (newNumberOfChips >= currentNumberOfChips) {
|
||||||
viewLifecycleOwner.lifecycleScope.launchWhenResumed {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
views.chipGroupScrollView.fullScroll(ScrollView.FOCUS_DOWN)
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
|
views.chipGroupScrollView.fullScroll(ScrollView.FOCUS_DOWN)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue