Merge pull request #6000 from vector-im/dependabot/gradle/androidx.preference-preference-ktx-1.2.0
Bump preference-ktx from 1.1.1 to 1.2.0
This commit is contained in:
commit
deb0f1ad1b
@ -53,7 +53,7 @@ ext.libs = [
|
|||||||
'constraintLayout' : "androidx.constraintlayout:constraintlayout:2.1.3",
|
'constraintLayout' : "androidx.constraintlayout:constraintlayout:2.1.3",
|
||||||
'work' : "androidx.work:work-runtime-ktx:2.7.1",
|
'work' : "androidx.work:work-runtime-ktx:2.7.1",
|
||||||
'autoFill' : "androidx.autofill:autofill:1.1.0",
|
'autoFill' : "androidx.autofill:autofill:1.1.0",
|
||||||
'preferenceKtx' : "androidx.preference:preference-ktx:1.1.1",
|
'preferenceKtx' : "androidx.preference:preference-ktx:1.2.0",
|
||||||
'junit' : "androidx.test.ext:junit:1.1.3",
|
'junit' : "androidx.test.ext:junit:1.1.3",
|
||||||
'lifecycleCommon' : "androidx.lifecycle:lifecycle-common:$lifecycle",
|
'lifecycleCommon' : "androidx.lifecycle:lifecycle-common:$lifecycle",
|
||||||
'lifecycleLivedata' : "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle",
|
'lifecycleLivedata' : "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle",
|
||||||
|
@ -22,16 +22,16 @@ import org.matrix.android.sdk.internal.network.executeRequest
|
|||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal abstract class GetTurnServerTask : Task<GetTurnServerTask.Params, TurnServerResponse> {
|
internal abstract class GetTurnServerTask : Task<Unit, TurnServerResponse>
|
||||||
object Params
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class DefaultGetTurnServerTask @Inject constructor(private val voipAPI: VoipApi,
|
internal class DefaultGetTurnServerTask @Inject constructor(
|
||||||
private val globalErrorReceiver: GlobalErrorReceiver) : GetTurnServerTask() {
|
private val voipApi: VoipApi,
|
||||||
|
private val globalErrorReceiver: GlobalErrorReceiver
|
||||||
|
) : GetTurnServerTask() {
|
||||||
|
|
||||||
override suspend fun execute(params: Params): TurnServerResponse {
|
override suspend fun execute(params: Unit): TurnServerResponse {
|
||||||
return executeRequest(globalErrorReceiver) {
|
return executeRequest(globalErrorReceiver) {
|
||||||
voipAPI.getTurnServer()
|
voipApi.getTurnServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ internal class TurnServerDataSource @Inject constructor(private val turnServerTa
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getTurnServer(): TurnServerResponse {
|
suspend fun getTurnServer(): TurnServerResponse {
|
||||||
return cachedTurnServerResponse.data ?: turnServerTask.execute(GetTurnServerTask.Params).also {
|
return cachedTurnServerResponse.data ?: turnServerTask.execute(Unit).also {
|
||||||
cachedTurnServerResponse.data = it
|
cachedTurnServerResponse.data = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@ inline fun <T> T.ooi(block: (T) -> Unit): T = also(block)
|
|||||||
*/
|
*/
|
||||||
fun CharSequence.isEmail() = Patterns.EMAIL_ADDRESS.matcher(this).matches()
|
fun CharSequence.isEmail() = Patterns.EMAIL_ADDRESS.matcher(this).matches()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return empty CharSequence if the CharSequence is null
|
||||||
|
*/
|
||||||
|
fun CharSequence?.orEmpty() = this ?: ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a CharSequence is a phone number
|
* Check if a CharSequence is a phone number
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@ import androidx.preference.Preference
|
|||||||
import androidx.preference.PreferenceViewHolder
|
import androidx.preference.PreferenceViewHolder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.features.themes.ThemeUtils
|
import im.vector.app.features.themes.ThemeUtils
|
||||||
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,16 +153,12 @@ open class VectorPreference : Preference {
|
|||||||
*/
|
*/
|
||||||
private fun addClickListeners(view: View) {
|
private fun addClickListeners(view: View) {
|
||||||
view.setOnLongClickListener {
|
view.setOnLongClickListener {
|
||||||
if (null != onPreferenceLongClickListener) {
|
onPreferenceLongClickListener?.onPreferenceLongClick(this@VectorPreference).orFalse()
|
||||||
onPreferenceLongClickListener!!.onPreferenceLongClick(this@VectorPreference)
|
|
||||||
} else false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setOnClickListener {
|
view.setOnClickListener {
|
||||||
// call only the click listener
|
// call only the click listener
|
||||||
if (onPreferenceClickListener != null) {
|
onPreferenceClickListener?.onPreferenceClick(this@VectorPreference)
|
||||||
onPreferenceClickListener.onPreferenceClick(this@VectorPreference)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import android.os.Bundle
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.extensions.orEmpty
|
||||||
import im.vector.app.core.preference.VectorPreference
|
import im.vector.app.core.preference.VectorPreference
|
||||||
import im.vector.app.core.utils.FirstThrottler
|
import im.vector.app.core.utils.FirstThrottler
|
||||||
import im.vector.app.core.utils.copyToClipboard
|
import im.vector.app.core.utils.copyToClipboard
|
||||||
@ -72,7 +73,7 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
it.setOnPreferenceClickListener { pref ->
|
it.setOnPreferenceClickListener { pref ->
|
||||||
copyToClipboard(requireContext(), pref.summary)
|
copyToClipboard(requireContext(), pref.summary.orEmpty())
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +83,7 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
|
|||||||
it.summary = Matrix.getSdkVersion()
|
it.summary = Matrix.getSdkVersion()
|
||||||
|
|
||||||
it.setOnPreferenceClickListener { pref ->
|
it.setOnPreferenceClickListener { pref ->
|
||||||
copyToClipboard(requireContext(), pref.summary)
|
copyToClipboard(requireContext(), pref.summary.orEmpty())
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||||||
findPreference<VectorSwitchPreference>("SETTINGS_USER_ANALYTICS_CONSENT_KEY")!!
|
findPreference<VectorSwitchPreference>("SETTINGS_USER_ANALYTICS_CONSENT_KEY")!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateRecyclerView(inflater: LayoutInflater?, parent: ViewGroup?, savedInstanceState: Bundle?): RecyclerView {
|
override fun onCreateRecyclerView(inflater: LayoutInflater, parent: ViewGroup, savedInstanceState: Bundle?): RecyclerView {
|
||||||
return super.onCreateRecyclerView(inflater, parent, savedInstanceState).also {
|
return super.onCreateRecyclerView(inflater, parent, savedInstanceState).also {
|
||||||
// Insert animation are really annoying the first time the list is shown
|
// Insert animation are really annoying the first time the list is shown
|
||||||
// due to the way preference fragment is done, it's not trivial to disable it for first appearance only..
|
// due to the way preference fragment is done, it's not trivial to disable it for first appearance only..
|
||||||
|
@ -352,8 +352,8 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||||||
super.onDetach()
|
super.onDetach()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
|
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||||
return when (preference?.key) {
|
return when (preference.key) {
|
||||||
VectorPreferences.SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY -> {
|
VectorPreferences.SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY -> {
|
||||||
updateEnabledForAccount(preference)
|
updateEnabledForAccount(preference)
|
||||||
true
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user