mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
ktlint: Newline expected before expression body
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
627e9d5c20
commit
88970c59a5
@ -95,7 +95,8 @@ data class MessageResultItem constructor(
|
|||||||
const val VIEW_TYPE = FlexibleItemViewType.MESSAGE_RESULT_ITEM
|
const val VIEW_TYPE = FlexibleItemViewType.MESSAGE_RESULT_ITEM
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getHeader(): GenericTextHeaderItem = MessagesTextHeaderItem(context, viewThemeUtils)
|
override fun getHeader(): GenericTextHeaderItem =
|
||||||
|
MessagesTextHeaderItem(context, viewThemeUtils)
|
||||||
.apply {
|
.apply {
|
||||||
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
|
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
|
||||||
}
|
}
|
||||||
|
@ -1714,13 +1714,16 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isOneToOneConversation() = currentConversation != null && currentConversation?.type != null &&
|
fun isOneToOneConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||||
|
|
||||||
private fun isGroupConversation() = currentConversation != null && currentConversation?.type != null &&
|
private fun isGroupConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_GROUP_CALL
|
currentConversation?.type == ConversationType.ROOM_GROUP_CALL
|
||||||
|
|
||||||
private fun isPublicConversation() = currentConversation != null && currentConversation?.type != null &&
|
private fun isPublicConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
|
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
|
||||||
|
|
||||||
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
|
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
|
||||||
|
@ -335,7 +335,8 @@ class LocationPickerActivity :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun delayedMapListener() = DelayedMapListener(
|
private fun delayedMapListener() =
|
||||||
|
DelayedMapListener(
|
||||||
object : MapListener {
|
object : MapListener {
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
||||||
|
@ -374,7 +374,8 @@ data class ChatMessage(
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getNullsafeActorDisplayName() = if (!TextUtils.isEmpty(actorDisplayName)) {
|
private fun getNullsafeActorDisplayName() =
|
||||||
|
if (!TextUtils.isEmpty(actorDisplayName)) {
|
||||||
actorDisplayName
|
actorDisplayName
|
||||||
} else {
|
} else {
|
||||||
sharedApplication!!.getString(R.string.nc_guest)
|
sharedApplication!!.getString(R.string.nc_guest)
|
||||||
|
@ -98,7 +98,8 @@ class SharedItemsViewModel @Inject constructor(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun chooseInitialType(newTypes: Set<SharedItemType>): SharedItemType = when {
|
private fun chooseInitialType(newTypes: Set<SharedItemType>): SharedItemType =
|
||||||
|
when {
|
||||||
newTypes.contains(SharedItemType.MEDIA) -> SharedItemType.MEDIA
|
newTypes.contains(SharedItemType.MEDIA) -> SharedItemType.MEDIA
|
||||||
else -> newTypes.toList().first()
|
else -> newTypes.toList().first()
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
}.getCompleted()
|
}.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyType(proxyType: String?) = runBlocking<Unit> {
|
override fun setProxyType(proxyType: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyType != null) {
|
if (proxyType != null) {
|
||||||
writeString(PROXY_TYPE, proxyType)
|
writeString(PROXY_TYPE, proxyType)
|
||||||
@ -62,7 +63,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_HOST).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_HOST).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyHost(proxyHost: String?) = runBlocking<Unit> {
|
override fun setProxyHost(proxyHost: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyHost != null) {
|
if (proxyHost != null) {
|
||||||
writeString(PROXY_HOST, proxyHost)
|
writeString(PROXY_HOST, proxyHost)
|
||||||
@ -78,7 +80,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_PORT).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_PORT).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyPort(proxyPort: String?) = runBlocking<Unit> {
|
override fun setProxyPort(proxyPort: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyPort != null) {
|
if (proxyPort != null) {
|
||||||
writeString(PROXY_PORT, proxyPort)
|
writeString(PROXY_PORT, proxyPort)
|
||||||
@ -94,7 +97,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PROXY_CRED).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PROXY_CRED).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) = runBlocking<Unit> {
|
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PROXY_CRED, proxyNeedsCredentials)
|
writeBoolean(PROXY_CRED, proxyNeedsCredentials)
|
||||||
}
|
}
|
||||||
@ -108,7 +112,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_USERNAME).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_USERNAME).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyUsername(proxyUsername: String?) = runBlocking<Unit> {
|
override fun setProxyUsername(proxyUsername: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyUsername != null) {
|
if (proxyUsername != null) {
|
||||||
writeString(PROXY_USERNAME, proxyUsername)
|
writeString(PROXY_USERNAME, proxyUsername)
|
||||||
@ -124,7 +129,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_PASSWORD).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_PASSWORD).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyPassword(proxyPassword: String?) = runBlocking<Unit> {
|
override fun setProxyPassword(proxyPassword: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyPassword != null) {
|
if (proxyPassword != null) {
|
||||||
writeString(PROXY_PASSWORD, proxyPassword)
|
writeString(PROXY_PASSWORD, proxyPassword)
|
||||||
@ -140,7 +146,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PUSH_TOKEN).first() } }.getCompleted()
|
return runBlocking { async { readString(PUSH_TOKEN).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPushToken(pushToken: String?) = runBlocking<Unit> {
|
override fun setPushToken(pushToken: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (pushToken != null) {
|
if (pushToken != null) {
|
||||||
writeString(PUSH_TOKEN, pushToken)
|
writeString(PUSH_TOKEN, pushToken)
|
||||||
@ -156,7 +163,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(TEMP_CLIENT_CERT_ALIAS).first() } }.getCompleted()
|
return runBlocking { async { readString(TEMP_CLIENT_CERT_ALIAS).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTemporaryClientCertAlias(alias: String?) = runBlocking<Unit> {
|
override fun setTemporaryClientCertAlias(alias: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (alias != null) {
|
if (alias != null) {
|
||||||
writeString(TEMP_CLIENT_CERT_ALIAS, alias)
|
writeString(TEMP_CLIENT_CERT_ALIAS, alias)
|
||||||
@ -172,7 +180,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PUSH_TO_TALK_INTRO_SHOWN).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PUSH_TO_TALK_INTRO_SHOWN).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPushToTalkIntroShown(shown: Boolean) = runBlocking<Unit> {
|
override fun setPushToTalkIntroShown(shown: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PUSH_TO_TALK_INTRO_SHOWN, shown)
|
writeBoolean(PUSH_TO_TALK_INTRO_SHOWN, shown)
|
||||||
}
|
}
|
||||||
@ -186,7 +195,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(CALL_RINGTONE).first() } }.getCompleted()
|
return runBlocking { async { readString(CALL_RINGTONE).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setCallRingtoneUri(value: String?) = runBlocking<Unit> {
|
override fun setCallRingtoneUri(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(CALL_RINGTONE, value)
|
writeString(CALL_RINGTONE, value)
|
||||||
@ -202,7 +212,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(MESSAGE_RINGTONE).first() } }.getCompleted()
|
return runBlocking { async { readString(MESSAGE_RINGTONE).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setMessageRingtoneUri(value: String?) = runBlocking<Unit> {
|
override fun setMessageRingtoneUri(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(MESSAGE_RINGTONE, value)
|
writeString(MESSAGE_RINGTONE, value)
|
||||||
@ -218,7 +229,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V2).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V2).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) = runBlocking<Unit> {
|
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(NOTIFY_UPGRADE_V2, value)
|
writeBoolean(NOTIFY_UPGRADE_V2, value)
|
||||||
}
|
}
|
||||||
@ -232,7 +244,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V3).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V3).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) = runBlocking<Unit> {
|
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(NOTIFY_UPGRADE_V3, value)
|
writeBoolean(NOTIFY_UPGRADE_V3, value)
|
||||||
}
|
}
|
||||||
@ -246,7 +259,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(SCREEN_SECURITY).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(SCREEN_SECURITY).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenSecurity(value: Boolean) = runBlocking<Unit> {
|
override fun setScreenSecurity(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(SCREEN_SECURITY, value)
|
writeBoolean(SCREEN_SECURITY, value)
|
||||||
}
|
}
|
||||||
@ -260,7 +274,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(SCREEN_LOCK).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(SCREEN_LOCK).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenLock(value: Boolean) = runBlocking<Unit> {
|
override fun setScreenLock(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(SCREEN_LOCK, value)
|
writeBoolean(SCREEN_LOCK, value)
|
||||||
}
|
}
|
||||||
@ -275,7 +290,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read
|
return read
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setIncognitoKeyboard(value: Boolean) = runBlocking<Unit> {
|
override fun setIncognitoKeyboard(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(INCOGNITO_KEYBOARD, value)
|
writeBoolean(INCOGNITO_KEYBOARD, value)
|
||||||
}
|
}
|
||||||
@ -289,13 +305,15 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PHONE_BOOK_INTEGRATION).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PHONE_BOOK_INTEGRATION).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPhoneBookIntegration(value: Boolean) = runBlocking<Unit> {
|
override fun setPhoneBookIntegration(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PHONE_BOOK_INTEGRATION, value)
|
writeBoolean(PHONE_BOOK_INTEGRATION, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removeLinkPreviews() = runBlocking<Unit> {
|
override fun removeLinkPreviews() =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(LINK_PREVIEWS, false)
|
writeBoolean(LINK_PREVIEWS, false)
|
||||||
}
|
}
|
||||||
@ -307,7 +325,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenLockTimeout(value: String?) = runBlocking<Unit> {
|
override fun setScreenLockTimeout(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(SCREEN_LOCK_TIMEOUT, value)
|
writeString(SCREEN_LOCK_TIMEOUT, value)
|
||||||
@ -326,7 +345,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTheme(value: String?) = runBlocking<Unit> {
|
override fun setTheme(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
val key = context.resources.getString(R.string.nc_settings_theme_key)
|
val key = context.resources.getString(R.string.nc_settings_theme_key)
|
||||||
@ -344,7 +364,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read
|
return read
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDbCypherToUpgrade(value: Boolean) = runBlocking<Unit> {
|
override fun setDbCypherToUpgrade(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(DB_CYPHER_V4_UPGRADE, value)
|
writeBoolean(DB_CYPHER_V4_UPGRADE, value)
|
||||||
}
|
}
|
||||||
@ -354,13 +375,15 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(DB_ROOM_MIGRATED).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(DB_ROOM_MIGRATED).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setIsDbRoomMigrated(value: Boolean) = runBlocking<Unit> {
|
override fun setIsDbRoomMigrated(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(DB_ROOM_MIGRATED, value)
|
writeBoolean(DB_ROOM_MIGRATED, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) = runBlocking<Unit> {
|
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeLong(PHONE_BOOK_INTEGRATION_LAST_RUN, currentTimeMillis)
|
writeLong(PHONE_BOOK_INTEGRATION_LAST_RUN, currentTimeMillis)
|
||||||
}
|
}
|
||||||
@ -376,7 +399,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setReadPrivacy(value: Boolean) = runBlocking<Unit> {
|
override fun setReadPrivacy(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
val key = context.resources.getString(R.string.nc_settings_read_privacy_key)
|
val key = context.resources.getString(R.string.nc_settings_read_privacy_key)
|
||||||
async {
|
async {
|
||||||
writeBoolean(key, value)
|
writeBoolean(key, value)
|
||||||
@ -388,7 +412,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(key).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(key).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTypingStatus(value: Boolean) = runBlocking<Unit> {
|
override fun setTypingStatus(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(TYPING_STATUS, value)
|
writeBoolean(TYPING_STATUS, value)
|
||||||
}
|
}
|
||||||
@ -398,7 +423,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(TYPING_STATUS).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(TYPING_STATUS).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setSorting(value: String?) = runBlocking<Unit> {
|
override fun setSorting(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
val key = context.resources.getString(R.string.nc_file_browser_sort_by_key)
|
val key = context.resources.getString(R.string.nc_file_browser_sort_by_key)
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -414,7 +440,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun saveWaveFormForFile(filename: String, array: Array<Float>) = runBlocking<Unit> {
|
override fun saveWaveFormForFile(filename: String, array: Array<Float>) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeString(filename, array.contentToString())
|
writeString(filename, array.contentToString())
|
||||||
}
|
}
|
||||||
@ -427,7 +454,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
|
|
||||||
override fun clear() {}
|
override fun clear() {}
|
||||||
|
|
||||||
private suspend fun writeString(key: String, value: String) = context.dataStore.edit { settings ->
|
private suspend fun writeString(key: String, value: String) =
|
||||||
|
context.dataStore.edit { settings ->
|
||||||
settings[
|
settings[
|
||||||
stringPreferencesKey(
|
stringPreferencesKey(
|
||||||
key
|
key
|
||||||
@ -439,11 +467,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
* Returns a Flow of type String
|
* Returns a Flow of type String
|
||||||
* @param key the key of the persisted data to be observed
|
* @param key the key of the persisted data to be observed
|
||||||
*/
|
*/
|
||||||
fun readString(key: String, defaultValue: String = ""): Flow<String> = context.dataStore.data.map { preferences ->
|
fun readString(key: String, defaultValue: String = ""): Flow<String> =
|
||||||
|
context.dataStore.data.map { preferences ->
|
||||||
preferences[stringPreferencesKey(key)] ?: defaultValue
|
preferences[stringPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun writeBoolean(key: String, value: Boolean) = context.dataStore.edit { settings ->
|
private suspend fun writeBoolean(key: String, value: Boolean) =
|
||||||
|
context.dataStore.edit { settings ->
|
||||||
settings[
|
settings[
|
||||||
booleanPreferencesKey(
|
booleanPreferencesKey(
|
||||||
key
|
key
|
||||||
@ -460,15 +490,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
preferences[booleanPreferencesKey(key)] ?: defaultValue
|
preferences[booleanPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun writeLong(key: String, value: Long) = context.dataStore.edit { settings ->
|
private suspend fun writeLong(key: String, value: Long) =
|
||||||
settings[
|
context.dataStore.edit { settings ->
|
||||||
longPreferencesKey(
|
settings[longPreferencesKey(key)] = value
|
||||||
key
|
|
||||||
)
|
|
||||||
] = value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readLong(key: String, defaultValue: Long = 0): Flow<Long> = context.dataStore.data.map { preferences ->
|
private fun readLong(key: String, defaultValue: Long = 0): Flow<Long> =
|
||||||
|
context.dataStore.data.map { preferences ->
|
||||||
preferences[longPreferencesKey(key)] ?: defaultValue
|
preferences[longPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,11 @@ class SSLSocketFactoryCompat(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDefaultCipherSuites(): Array<String>? = cipherSuites
|
override fun getDefaultCipherSuites(): Array<String>? =
|
||||||
?: delegate.defaultCipherSuites
|
cipherSuites ?: delegate.defaultCipherSuites
|
||||||
|
|
||||||
override fun getSupportedCipherSuites(): Array<String>? = cipherSuites
|
override fun getSupportedCipherSuites(): Array<String>? =
|
||||||
?: delegate.supportedCipherSuites
|
cipherSuites ?: delegate.supportedCipherSuites
|
||||||
|
|
||||||
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
|
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
|
||||||
val ssl = delegate.createSocket(s, host, port, autoClose)
|
val ssl = delegate.createSocket(s, host, port, autoClose)
|
||||||
|
Loading…
Reference in New Issue
Block a user