From bd8657eca2bcdc6a61eccd20e47bcee9c5b76cbb Mon Sep 17 00:00:00 2001 From: gouri-panda Date: Wed, 11 Nov 2020 15:47:04 +0530 Subject: [PATCH] #1351 reformated code again and lint fixes --- app/detekt_baseline.xml | 5 +++-- .../kiwixmobile/localFileTransfer/WifiDirectManager.kt | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/detekt_baseline.xml b/app/detekt_baseline.xml index 83ad25373..ca023d9c3 100644 --- a/app/detekt_baseline.xml +++ b/app/detekt_baseline.xml @@ -12,7 +12,7 @@ MagicNumber:ZimManageViewModel.kt$ZimManageViewModel$5 MagicNumber:ZimManageViewModel.kt$ZimManageViewModel$500 MagicNumber:ZimManageViewModel.kt$ZimManageViewModel$60 - NestedBlockDepth:PeerGroupHandshake.kt$PeerGroupHandshake$exchangeFileTransferMetadata + NestedBlockDepth:ReceiverHandShake.kt$ReceiverHandShake$exchangeFileTransferMetadata PackageNaming:AvailableSpaceCalculator.kt$package org.kiwix.kiwixmobile.zim_manager.library_view PackageNaming:ConnectivityBroadcastReceiver.kt$package org.kiwix.kiwixmobile.zim_manager PackageNaming:DefaultLanguageProvider.kt$package org.kiwix.kiwixmobile.zim_manager @@ -38,8 +38,9 @@ PackageNaming:ZimManageViewModel.kt$package org.kiwix.kiwixmobile.zim_manager ReturnCount:Fat32Checker.kt$Fat32Checker$private fun canCreate4GbFile(storage: String): Boolean TooGenericExceptionCaught:FileWritingFileSystemChecker.kt$FileWritingFileSystemChecker$e: Exception - TooGenericExceptionCaught:PeerGroupHandshake.kt$PeerGroupHandshake$e: Exception TooGenericExceptionCaught:PeerGroupHandshake.kt$PeerGroupHandshake$ex: Exception + TooGenericExceptionCaught:ReceiverHandShake.kt$ReceiverHandShake$e: Exception + TooGenericExceptionCaught:SenderHandShake.kt$SenderHandShake$e: Exception TooGenericExceptionThrown:ActivityExtensions.kt$throw RuntimeException( """ applicationContext is ${applicationContext::class.java.simpleName} application is ${application::class.java.simpleName} """.trimIndent() ) TooGenericExceptionThrown:LibraryViewHolder.kt$LibraryViewHolder.LibraryBookViewHolder$throw RuntimeException("impossible invalid state: ${item.fileSystemState}") TooGenericExceptionThrown:ZimManageViewModel.kt$ZimManageViewModel$throw RuntimeException("Impossible state") diff --git a/app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/WifiDirectManager.kt b/app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/WifiDirectManager.kt index 985055258..7bdbf691f 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/WifiDirectManager.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/WifiDirectManager.kt @@ -240,11 +240,12 @@ class WifiDirectManager @Inject constructor( } var inetAddress: InetAddress? lifecycleCoroutineScope.launch { - inetAddress = if (isFileSender) { - SenderHandShake(this@WifiDirectManager).handshake() + val peerGroupHandshake = if (isFileSender) { + SenderHandShake(this@WifiDirectManager) } else { - ReceiverHandShake(this@WifiDirectManager).handshake() + ReceiverHandShake(this@WifiDirectManager) } + inetAddress = peerGroupHandshake.handshake() if (inetAddress != null) { setClientAddress(inetAddress!!) } else {