Fix compilation warnings

This commit is contained in:
Benoit Marty 2019-10-22 12:21:50 +02:00
parent 9092b97fb8
commit 3dc5ef54ab
5 changed files with 5 additions and 14 deletions

View file

@ -134,7 +134,7 @@ data class Event(
}
fun toContentStringWithIndent(): String {
val contentMap = toContent()?.toMutableMap() ?: HashMap()
val contentMap = toContent().toMutableMap()
return JSONObject(contentMap).toString(4)
}

View file

@ -244,13 +244,6 @@ internal class MXMegolmDecryption(private val userId: String,
keysClaimed = event.getKeysClaimed().toMutableMap()
}
if (roomKeyContent.sessionId == null
|| roomKeyContent.sessionKey == null
|| roomKeyContent.roomId == null) {
Timber.e("## invalid roomKeyContent")
return
}
val added = olmDevice.addInboundGroupSession(roomKeyContent.sessionId,
roomKeyContent.sessionKey,
roomKeyContent.roomId,

View file

@ -66,7 +66,7 @@ internal class MXOlmEncryption(
)
messageEncrypter.encryptMessage(messageMap, deviceInfos)
return messageMap.toContent()!!
return messageMap.toContent()
}
/**

View file

@ -126,7 +126,7 @@ fun getFileExtension(fileUri: String): String? {
* Size
* ========================================================================================== */
fun getSizeOfFiles(context: Context, root: File): Int {
fun getSizeOfFiles(root: File): Int {
return root.walkTopDown()
.onEnter {
Timber.v("Get size of ${it.absolutePath}")

View file

@ -185,8 +185,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
// clear medias cache
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY)!!.let {
val size = getSizeOfFiles(requireContext(),
File(requireContext().cacheDir, DiskCache.Factory.DEFAULT_DISK_CACHE_DIR))
val size = getSizeOfFiles(File(requireContext().cacheDir, DiskCache.Factory.DEFAULT_DISK_CACHE_DIR))
it.summary = TextUtils.formatFileSize(requireContext(), size.toLong())
@ -203,8 +202,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
// On BG thread
Glide.get(requireContext()).clearDiskCache()
newSize = getSizeOfFiles(requireContext(),
File(requireContext().cacheDir, DiskCache.Factory.DEFAULT_DISK_CACHE_DIR))
newSize = getSizeOfFiles(File(requireContext().cacheDir, DiskCache.Factory.DEFAULT_DISK_CACHE_DIR))
}
it.summary = TextUtils.formatFileSize(requireContext(), newSize.toLong())