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
|
||||
}
|
||||
|
||||
override fun getHeader(): GenericTextHeaderItem = MessagesTextHeaderItem(context, viewThemeUtils)
|
||||
override fun getHeader(): GenericTextHeaderItem =
|
||||
MessagesTextHeaderItem(context, viewThemeUtils)
|
||||
.apply {
|
||||
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
|
||||
|
||||
private fun isGroupConversation() = currentConversation != null && currentConversation?.type != null &&
|
||||
private fun isGroupConversation() =
|
||||
currentConversation != null && currentConversation?.type != null &&
|
||||
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
|
||||
|
||||
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 {
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
||||
|
@ -374,7 +374,8 @@ data class ChatMessage(
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun getNullsafeActorDisplayName() = if (!TextUtils.isEmpty(actorDisplayName)) {
|
||||
private fun getNullsafeActorDisplayName() =
|
||||
if (!TextUtils.isEmpty(actorDisplayName)) {
|
||||
actorDisplayName
|
||||
} else {
|
||||
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
|
||||
else -> newTypes.toList().first()
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
}.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyType(proxyType: String?) = runBlocking<Unit> {
|
||||
override fun setProxyType(proxyType: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (proxyType != null) {
|
||||
writeString(PROXY_TYPE, proxyType)
|
||||
@ -62,7 +63,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(PROXY_HOST).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyHost(proxyHost: String?) = runBlocking<Unit> {
|
||||
override fun setProxyHost(proxyHost: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (proxyHost != null) {
|
||||
writeString(PROXY_HOST, proxyHost)
|
||||
@ -78,7 +80,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(PROXY_PORT).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyPort(proxyPort: String?) = runBlocking<Unit> {
|
||||
override fun setProxyPort(proxyPort: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (proxyPort != null) {
|
||||
writeString(PROXY_PORT, proxyPort)
|
||||
@ -94,7 +97,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(PROXY_CRED).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) = runBlocking<Unit> {
|
||||
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(PROXY_CRED, proxyNeedsCredentials)
|
||||
}
|
||||
@ -108,7 +112,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(PROXY_USERNAME).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyUsername(proxyUsername: String?) = runBlocking<Unit> {
|
||||
override fun setProxyUsername(proxyUsername: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (proxyUsername != null) {
|
||||
writeString(PROXY_USERNAME, proxyUsername)
|
||||
@ -124,7 +129,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(PROXY_PASSWORD).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setProxyPassword(proxyPassword: String?) = runBlocking<Unit> {
|
||||
override fun setProxyPassword(proxyPassword: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (proxyPassword != null) {
|
||||
writeString(PROXY_PASSWORD, proxyPassword)
|
||||
@ -140,7 +146,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(PUSH_TOKEN).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setPushToken(pushToken: String?) = runBlocking<Unit> {
|
||||
override fun setPushToken(pushToken: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (pushToken != null) {
|
||||
writeString(PUSH_TOKEN, pushToken)
|
||||
@ -156,7 +163,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
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 {
|
||||
if (alias != null) {
|
||||
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()
|
||||
}
|
||||
|
||||
override fun setPushToTalkIntroShown(shown: Boolean) = runBlocking<Unit> {
|
||||
override fun setPushToTalkIntroShown(shown: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
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()
|
||||
}
|
||||
|
||||
override fun setCallRingtoneUri(value: String?) = runBlocking<Unit> {
|
||||
override fun setCallRingtoneUri(value: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (value != null) {
|
||||
writeString(CALL_RINGTONE, value)
|
||||
@ -202,7 +212,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readString(MESSAGE_RINGTONE).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setMessageRingtoneUri(value: String?) = runBlocking<Unit> {
|
||||
override fun setMessageRingtoneUri(value: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (value != null) {
|
||||
writeString(MESSAGE_RINGTONE, value)
|
||||
@ -218,7 +229,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V2).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(NOTIFY_UPGRADE_V2, value)
|
||||
}
|
||||
@ -232,7 +244,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V3).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(NOTIFY_UPGRADE_V3, value)
|
||||
}
|
||||
@ -246,7 +259,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(SCREEN_SECURITY).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setScreenSecurity(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setScreenSecurity(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(SCREEN_SECURITY, value)
|
||||
}
|
||||
@ -260,7 +274,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(SCREEN_LOCK).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setScreenLock(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setScreenLock(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(SCREEN_LOCK, value)
|
||||
}
|
||||
@ -275,7 +290,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return read
|
||||
}
|
||||
|
||||
override fun setIncognitoKeyboard(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setIncognitoKeyboard(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(INCOGNITO_KEYBOARD, value)
|
||||
}
|
||||
@ -289,13 +305,15 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(PHONE_BOOK_INTEGRATION).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setPhoneBookIntegration(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setPhoneBookIntegration(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(PHONE_BOOK_INTEGRATION, value)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeLinkPreviews() = runBlocking<Unit> {
|
||||
override fun removeLinkPreviews() =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(LINK_PREVIEWS, false)
|
||||
}
|
||||
@ -307,7 +325,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return read.ifEmpty { default }
|
||||
}
|
||||
|
||||
override fun setScreenLockTimeout(value: String?) = runBlocking<Unit> {
|
||||
override fun setScreenLockTimeout(value: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (value != null) {
|
||||
writeString(SCREEN_LOCK_TIMEOUT, value)
|
||||
@ -326,7 +345,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return read.ifEmpty { default }
|
||||
}
|
||||
|
||||
override fun setTheme(value: String?) = runBlocking<Unit> {
|
||||
override fun setTheme(value: String?) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
if (value != null) {
|
||||
val key = context.resources.getString(R.string.nc_settings_theme_key)
|
||||
@ -344,7 +364,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return read
|
||||
}
|
||||
|
||||
override fun setDbCypherToUpgrade(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setDbCypherToUpgrade(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
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()
|
||||
}
|
||||
|
||||
override fun setIsDbRoomMigrated(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setIsDbRoomMigrated(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(DB_ROOM_MIGRATED, value)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) = runBlocking<Unit> {
|
||||
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeLong(PHONE_BOOK_INTEGRATION_LAST_RUN, currentTimeMillis)
|
||||
}
|
||||
@ -376,7 +399,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
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)
|
||||
async {
|
||||
writeBoolean(key, value)
|
||||
@ -388,7 +412,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
return runBlocking { async { readBoolean(key).first() } }.getCompleted()
|
||||
}
|
||||
|
||||
override fun setTypingStatus(value: Boolean) = runBlocking<Unit> {
|
||||
override fun setTypingStatus(value: Boolean) =
|
||||
runBlocking<Unit> {
|
||||
async {
|
||||
writeBoolean(TYPING_STATUS, value)
|
||||
}
|
||||
@ -398,7 +423,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
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)
|
||||
async {
|
||||
if (value != null) {
|
||||
@ -414,7 +440,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
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 {
|
||||
writeString(filename, array.contentToString())
|
||||
}
|
||||
@ -427,7 +454,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
|
||||
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[
|
||||
stringPreferencesKey(
|
||||
key
|
||||
@ -439,11 +467,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
* Returns a Flow of type String
|
||||
* @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
|
||||
}
|
||||
|
||||
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[
|
||||
booleanPreferencesKey(
|
||||
key
|
||||
@ -460,15 +490,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||
preferences[booleanPreferencesKey(key)] ?: defaultValue
|
||||
}
|
||||
|
||||
private suspend fun writeLong(key: String, value: Long) = context.dataStore.edit { settings ->
|
||||
settings[
|
||||
longPreferencesKey(
|
||||
key
|
||||
)
|
||||
] = value
|
||||
private suspend fun writeLong(key: String, value: Long) =
|
||||
context.dataStore.edit { settings ->
|
||||
settings[longPreferencesKey(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
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ class SSLSocketFactoryCompat(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getDefaultCipherSuites(): Array<String>? = cipherSuites
|
||||
?: delegate.defaultCipherSuites
|
||||
override fun getDefaultCipherSuites(): Array<String>? =
|
||||
cipherSuites ?: delegate.defaultCipherSuites
|
||||
|
||||
override fun getSupportedCipherSuites(): Array<String>? = cipherSuites
|
||||
?: delegate.supportedCipherSuites
|
||||
override fun getSupportedCipherSuites(): Array<String>? =
|
||||
cipherSuites ?: delegate.supportedCipherSuites
|
||||
|
||||
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
|
||||
val ssl = delegate.createSocket(s, host, port, autoClose)
|
||||
|
Loading…
Reference in New Issue
Block a user