mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Fixed: Lint Issue - Unconditional Logging.
* Re-enabled the `LogConditional` lint check. * Introduced a `Log` class that exclusively handles logging operations in the debug variant. * Removed unnecessary `if (BuildConfig.DEBUG)` conditions from the project.
This commit is contained in:
parent
fd20568841
commit
8828a8b917
@ -18,7 +18,7 @@
|
||||
package org.kiwix.kiwixmobile
|
||||
|
||||
import android.Manifest
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.IdlingPolicies
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.download
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.initial.download
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.nav.destination.library
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
|
@ -24,7 +24,7 @@ import android.content.pm.PackageManager
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.test.core.app.canTakeScreenshot
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.utils
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.webserver
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
|
@ -19,10 +19,10 @@ package org.kiwix.kiwixmobile.intro
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.animation.Interpolator
|
||||
import android.widget.Scroller
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
|
||||
/**
|
||||
* A custom implementation of [ViewPager] to decrease the speed of auto-scroll animation
|
||||
|
@ -36,7 +36,7 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
|
@ -18,11 +18,10 @@
|
||||
package org.kiwix.kiwixmobile.localFileTransfer
|
||||
|
||||
import android.net.wifi.p2p.WifiP2pInfo
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import java.io.InputStream
|
||||
import java.io.ObjectInputStream
|
||||
import java.io.ObjectOutputStream
|
||||
@ -46,14 +45,14 @@ import java.net.Socket
|
||||
abstract class PeerGroupHandshake(private var groupInfo: WifiP2pInfo) {
|
||||
private val HANDSHAKE_MESSAGE = "Request Kiwix File Sharing"
|
||||
suspend fun handshake(): InetAddress? = withContext(Dispatchers.IO) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Handshake in progress")
|
||||
}
|
||||
Log.d(TAG, "Handshake in progress")
|
||||
when {
|
||||
groupInfo.groupFormed && groupInfo.isGroupOwner && isActive ->
|
||||
readHandshakeAndExchangeMetaData()
|
||||
|
||||
groupInfo.groupFormed && isActive -> // && !groupInfo.isGroupOwner
|
||||
writeHandshakeAndExchangeMetaData()
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
@ -92,9 +91,7 @@ abstract class PeerGroupHandshake(private var groupInfo: WifiP2pInfo) {
|
||||
|
||||
// Verify that the peer trying to communicate is a kiwix app intending to transfer files
|
||||
if (isKiwixHandshake(kiwixHandShakeMessage)) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Client IP address: " + server.inetAddress)
|
||||
}
|
||||
Log.d(TAG, "Client IP address: " + server.inetAddress)
|
||||
exchangeFileTransferMetadata(server.getInputStream(), server.getOutputStream())
|
||||
server.inetAddress
|
||||
} else {
|
||||
|
@ -17,11 +17,10 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.localFileTransfer
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.localFileTransfer.WifiDirectManager.Companion.copyToOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
@ -47,15 +46,13 @@ internal class ReceiverDevice(private val wifiDirectManager: WifiDirectManager)
|
||||
val zimStorageRootPath = wifiDirectManager.zimStorageRootPath
|
||||
val fileItems = wifiDirectManager.getFilesForTransfer()
|
||||
var isTransferErrorFree = true
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Expecting " + fileItems.size + " files")
|
||||
Log.d(TAG, "Expecting " + fileItems.size + " files")
|
||||
fileItems.asSequence()
|
||||
.takeWhile { isActive }
|
||||
.forEachIndexed { fileItemIndex, fileItem ->
|
||||
try {
|
||||
serverSocket.accept().use { client ->
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Sender device connected for ${fileItem.fileName}")
|
||||
}
|
||||
Log.d(TAG, "Sender device connected for ${fileItem.fileName}")
|
||||
publishProgress(fileItemIndex, FileItem.FileStatus.SENDING)
|
||||
val clientNoteFileLocation = File(zimStorageRootPath + fileItem.fileName)
|
||||
val dirs = File(clientNoteFileLocation.parent)
|
||||
@ -64,7 +61,7 @@ internal class ReceiverDevice(private val wifiDirectManager: WifiDirectManager)
|
||||
isTransferErrorFree = false
|
||||
}
|
||||
val fileCreated = clientNoteFileLocation.createNewFile()
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "File creation: $fileCreated")
|
||||
Log.d(TAG, "File creation: $fileCreated")
|
||||
copyToOutputStream(
|
||||
client.getInputStream(),
|
||||
FileOutputStream(clientNoteFileLocation)
|
||||
|
@ -19,8 +19,7 @@
|
||||
package org.kiwix.kiwixmobile.localFileTransfer
|
||||
|
||||
import android.net.wifi.p2p.WifiP2pInfo
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.io.InputStream
|
||||
import java.io.ObjectInputStream
|
||||
import java.io.OutputStream
|
||||
@ -37,11 +36,11 @@ class ReceiverHandShake(private val wifiDirectManager: WifiDirectManager, groupI
|
||||
ObjectInputStream(inputStream).use { objectInputStream ->
|
||||
// Read the number of files
|
||||
(objectInputStream.readObject() as? Int)?.let { total ->
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Metadata: $total files")
|
||||
Log.d(TAG, "Metadata: $total files")
|
||||
// Read names of each of those files, in order
|
||||
val fileItems = (0 until total).mapNotNull {
|
||||
(objectInputStream.readObject() as? String)?.let { fileName ->
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Expecting $fileName")
|
||||
Log.d(TAG, "Expecting $fileName")
|
||||
FileItem(fileName = fileName)
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,11 @@
|
||||
package org.kiwix.kiwixmobile.localFileTransfer
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.localFileTransfer.WifiDirectManager.Companion.copyToOutputStream
|
||||
import java.io.IOException
|
||||
import java.net.InetAddress
|
||||
@ -71,7 +70,7 @@ internal class SenderDevice(
|
||||
val socketOutputStream = socket.getOutputStream()
|
||||
@Suppress("UnsafeCallOnNullableType")
|
||||
copyToOutputStream(fileInputStream!!, socketOutputStream)
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Sender: Data written")
|
||||
Log.d(TAG, "Sender: Data written")
|
||||
publishProgress(fileIndex, FileItem.FileStatus.SENT)
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
package org.kiwix.kiwixmobile.localFileTransfer
|
||||
|
||||
import android.net.wifi.p2p.WifiP2pInfo
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.io.InputStream
|
||||
import java.io.ObjectOutputStream
|
||||
import java.io.OutputStream
|
||||
|
@ -35,12 +35,11 @@ import android.net.wifi.p2p.WifiP2pManager.PeerListListener
|
||||
import android.os.Build.VERSION
|
||||
import android.os.Build.VERSION_CODES
|
||||
import android.os.Looper.getMainLooper
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.LifecycleCoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
||||
@ -219,9 +218,7 @@ class WifiDirectManager @Inject constructor(
|
||||
}
|
||||
|
||||
private fun performHandshakeWith(groupInfo: WifiP2pInfo) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Starting handshake")
|
||||
}
|
||||
Log.d(TAG, "Starting handshake")
|
||||
lifecycleCoroutineScope.launch {
|
||||
val peerGroupHandshake = if (isFileSender)
|
||||
SenderHandShake(this@WifiDirectManager, groupInfo)
|
||||
@ -232,9 +229,7 @@ class WifiDirectManager @Inject constructor(
|
||||
if (inetAddress != null) {
|
||||
startFileTransfer(groupInfo, inetAddress)
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "InetAddress is null")
|
||||
}
|
||||
Log.d(TAG, "InetAddress is null")
|
||||
onFileTransferAsyncTaskComplete(false)
|
||||
context.toast(R.string.connection_refused)
|
||||
}
|
||||
@ -262,17 +257,13 @@ class WifiDirectManager @Inject constructor(
|
||||
val senderDevice = SenderDevice(context, this, fileReceiverDeviceAddress)
|
||||
val isFileSendSuccessfully = senderDevice.send(filesForTransfer)
|
||||
onFileTransferAsyncTaskComplete(isFileSendSuccessfully)
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "SenderDevice completed $isFileSendSuccessfully")
|
||||
}
|
||||
Log.d(TAG, "SenderDevice completed $isFileSendSuccessfully")
|
||||
} else {
|
||||
callbacks?.onFilesForTransferAvailable(filesForTransfer)
|
||||
val receiverDevice = ReceiverDevice(this)
|
||||
val isReceivedFileSuccessFully = receiverDevice.receive()
|
||||
onFileTransferAsyncTaskComplete(isReceivedFileSuccessFully)
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "ReceiverDevice completed $isReceivedFileSuccessFully")
|
||||
}
|
||||
Log.d(TAG, "ReceiverDevice completed $isReceivedFileSuccessFully")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -360,7 +351,7 @@ class WifiDirectManager @Inject constructor(
|
||||
}
|
||||
|
||||
@JvmStatic fun getDeviceStatus(status: Int): String {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Peer Status: $status")
|
||||
Log.d(TAG, "Peer Status: $status")
|
||||
return when (status) {
|
||||
WifiP2pDevice.AVAILABLE -> "Available"
|
||||
WifiP2pDevice.INVITED -> "Invited"
|
||||
|
@ -24,7 +24,6 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.View
|
||||
@ -57,6 +56,7 @@ import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TAG_CURRENT_FILE
|
||||
import org.kiwix.kiwixmobile.core.utils.TAG_KIWIX
|
||||
import org.kiwix.kiwixmobile.core.utils.files.FileUtils
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.io.File
|
||||
|
||||
private const val HIDE_TAB_SWITCHER_DELAY: Long = 300
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.zimManager
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.zimManager.FileSystemCapability.CANNOT_WRITE_4GB
|
||||
import org.kiwix.kiwixmobile.zimManager.FileSystemCapability.CAN_WRITE_4GB
|
||||
import org.kiwix.kiwixmobile.zimManager.FileSystemCapability.INCONCLUSIVE
|
||||
|
@ -127,7 +127,6 @@ class AllProjectConfigurer {
|
||||
add("LockedOrientationActivity")
|
||||
// TODO stop ignoring below this
|
||||
add("LabelFor")
|
||||
add("LogConditional")
|
||||
add("ConvertToWebp")
|
||||
add("UnknownNullness")
|
||||
add("SelectableText")
|
||||
|
@ -18,9 +18,9 @@
|
||||
package org.kiwix.kiwixmobile.core
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import org.kiwix.libkiwix.JNIKiwix
|
||||
import org.kiwix.kiwixmobile.core.utils.TAG_KIWIX
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import javax.inject.Inject
|
||||
|
@ -20,7 +20,7 @@ package org.kiwix.kiwixmobile.core.dao
|
||||
|
||||
import android.os.Build
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import io.reactivex.BackpressureStrategy
|
||||
import io.reactivex.BackpressureStrategy.LATEST
|
||||
import io.reactivex.Flowable
|
||||
@ -29,7 +29,6 @@ import io.reactivex.subjects.BehaviorSubject
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.core.extensions.isFileExist
|
||||
import org.kiwix.kiwixmobile.core.page.adapter.Page
|
||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
||||
@ -152,15 +151,13 @@ class LibkiwixBookmarks @Inject constructor(
|
||||
library.addBook(libKiwixBook).also {
|
||||
// now library has changed so update our library list.
|
||||
libraryBooksList = library.booksIds.toList()
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(
|
||||
TAG,
|
||||
"Added Book to Library:\n" +
|
||||
"ZIM File Path: ${book.path}\n" +
|
||||
"Book ID: ${book.id}\n" +
|
||||
"Book Title: ${book.title}"
|
||||
)
|
||||
}
|
||||
Log.d(
|
||||
TAG,
|
||||
"Added Book to Library:\n" +
|
||||
"ZIM File Path: ${book.path}\n" +
|
||||
"Book ID: ${book.id}\n" +
|
||||
"Book Title: ${book.title}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,14 +217,12 @@ class LibkiwixBookmarks @Inject constructor(
|
||||
val book = if (isBookAlreadyExistInLibrary(bookmark.bookId)) {
|
||||
library.getBookById(bookmark.bookId)
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(
|
||||
TAG,
|
||||
"Library does not contain the book for this bookmark:\n" +
|
||||
"Book Title: ${bookmark.bookTitle}\n" +
|
||||
"Bookmark URL: ${bookmark.url}"
|
||||
)
|
||||
}
|
||||
Log.d(
|
||||
TAG,
|
||||
"Library does not contain the book for this bookmark:\n" +
|
||||
"Book Title: ${bookmark.bookTitle}\n" +
|
||||
"Bookmark URL: ${bookmark.url}"
|
||||
)
|
||||
null
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.core.data.remote
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.core.data.remote
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import io.objectbox.Box
|
||||
import io.objectbox.BoxStore
|
||||
import io.objectbox.kotlin.boxFor
|
||||
|
@ -25,7 +25,7 @@ import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
|
@ -23,7 +23,7 @@ import android.text.Editable
|
||||
import android.text.Selection
|
||||
import android.text.Spannable
|
||||
import android.text.TextWatcher
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
|
@ -40,7 +40,7 @@ import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.ActionMode
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
|
@ -20,7 +20,7 @@ package org.kiwix.kiwixmobile.core.main
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.webkit.WebResourceError
|
||||
import android.webkit.WebResourceRequest
|
||||
|
@ -31,7 +31,7 @@ import android.speech.tts.TextToSpeech.LANG_NOT_SUPPORTED
|
||||
import android.speech.tts.TextToSpeech.QUEUE_ADD
|
||||
import android.speech.tts.TextToSpeech.SUCCESS
|
||||
import android.speech.tts.UtteranceProgressListener
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebView
|
||||
import android.widget.Toast
|
||||
|
@ -24,7 +24,7 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.ContextMenu
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.core.main
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.kiwix.kiwixmobile.core.data.DataSource
|
||||
import org.kiwix.kiwixmobile.core.di.ActivityScope
|
||||
|
@ -19,7 +19,7 @@ package org.kiwix.kiwixmobile.core.main
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.GestureDetector.SimpleOnGestureListener
|
||||
import android.view.MotionEvent
|
||||
|
@ -18,7 +18,7 @@ package org.kiwix.kiwixmobile.core.page.notes.viewmodel.effects
|
||||
*
|
||||
*/
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import io.reactivex.processors.PublishProcessor
|
||||
import org.kiwix.kiwixmobile.core.base.SideEffect
|
||||
|
@ -22,7 +22,7 @@ import android.content.res.AssetFileDescriptor
|
||||
import android.net.Uri
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.core.net.toUri
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.core.settings
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.kiwix.kiwixmobile.core.base.BasePresenter
|
||||
import org.kiwix.kiwixmobile.core.data.DataSource
|
||||
|
@ -19,7 +19,7 @@ package org.kiwix.kiwixmobile.core.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.compat.CompatHelper.Companion.isNetworkAvailable
|
||||
import org.kiwix.kiwixmobile.core.compat.CompatHelper.Companion.isWifi
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.core.utils
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.net.InetAddress
|
||||
import java.net.NetworkInterface
|
||||
import java.net.SocketException
|
||||
|
@ -19,7 +19,6 @@
|
||||
package org.kiwix.kiwixmobile.core.utils.files
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.lang.System.currentTimeMillis
|
||||
|
@ -26,7 +26,6 @@ import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.DocumentsContract
|
||||
import android.util.Log
|
||||
import android.webkit.URLUtil
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Kiwix Android
|
||||
* Copyright (c) 2024 Kiwix <android.kiwix.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.core.utils.files
|
||||
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
|
||||
/**
|
||||
* Helper class for logging that provides conditional logging for the debug variant.
|
||||
*/
|
||||
object Log {
|
||||
/**
|
||||
* Logs an error message with an optional throwable, but only in debug builds.
|
||||
*
|
||||
* @param tag The tag to identify the log.
|
||||
* @param message The message to be logged.
|
||||
* @param throwable An optional throwable to be logged.
|
||||
*/
|
||||
fun e(tag: String, message: String?, throwable: Throwable? = null) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
android.util.Log.e(tag, message, throwable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a warning message with an optional throwable, but only in debug builds.
|
||||
*
|
||||
* @param tag The tag to identify the log.
|
||||
* @param message The message to be logged.
|
||||
* @param throwable An optional throwable to be logged.
|
||||
*/
|
||||
fun w(tag: String, message: String, throwable: Throwable? = null) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
android.util.Log.w(tag, message, throwable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a debug message with an optional throwable, but only in debug builds.
|
||||
*
|
||||
* @param tag The tag to identify the log.
|
||||
* @param message The message to be logged.
|
||||
* @param throwable An optional throwable to be logged.
|
||||
*/
|
||||
fun d(tag: String, message: String, throwable: Throwable? = null) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
android.util.Log.d(tag, message, throwable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an info message, but only in debug builds.
|
||||
*
|
||||
* @param tag The tag to identify the log.
|
||||
* @param message The message to be logged.
|
||||
*/
|
||||
fun i(tag: String, message: String) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
android.util.Log.i(tag, message)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a verbose message, but only in debug builds.
|
||||
*
|
||||
* @param tag The tag to identify the log.
|
||||
* @param message The message to be logged.
|
||||
*/
|
||||
fun v(tag: String?, message: String) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
android.util.Log.v(tag, message)
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
package org.kiwix.kiwixmobile.core.webserver
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
|
||||
import org.kiwix.kiwixmobile.core.utils.files.FileUtils.getDemoFilePathForCustomApp
|
||||
import org.kiwix.libkiwix.Book
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.core.webserver
|
||||
|
||||
import android.util.Log
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
@ -27,6 +26,7 @@ import org.kiwix.kiwixmobile.core.utils.ServerUtils
|
||||
import org.kiwix.kiwixmobile.core.utils.ServerUtils.INVALID_IP
|
||||
import org.kiwix.kiwixmobile.core.utils.ServerUtils.getIp
|
||||
import org.kiwix.kiwixmobile.core.utils.ServerUtils.getIpAddress
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.webserver.wifi_hotspot.IpAddressCallbacks
|
||||
import org.kiwix.kiwixmobile.core.webserver.wifi_hotspot.ServerStatus
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -30,7 +30,6 @@ import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.provider.Settings
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -39,7 +38,6 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.kiwix.kiwixmobile.core.BuildConfig
|
||||
import org.kiwix.kiwixmobile.core.CoreApp.Companion.coreComponent
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.base.BaseActivity
|
||||
@ -58,6 +56,7 @@ import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.KiwixDialog
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.KiwixDialog.StartServer
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.webserver.wifi_hotspot.HotspotService
|
||||
import org.kiwix.kiwixmobile.core.webserver.wifi_hotspot.HotspotService.Companion.ACTION_CHECK_IP_ADDRESS
|
||||
import org.kiwix.kiwixmobile.core.webserver.wifi_hotspot.HotspotService.Companion.ACTION_START_SERVER
|
||||
@ -110,12 +109,8 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
.map {
|
||||
it.file.absolutePath
|
||||
}
|
||||
.also {
|
||||
if (BuildConfig.DEBUG) {
|
||||
it.forEach { path ->
|
||||
Log.v(tag, "ZIM PATH : $path")
|
||||
}
|
||||
}
|
||||
.onEach { path ->
|
||||
Log.v(tag, "ZIM PATH : $path")
|
||||
}
|
||||
as ArrayList<String>
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.core.webserver
|
||||
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import io.reactivex.SingleObserver
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.kiwix.kiwixmobile.core.base.BasePresenter
|
||||
|
@ -19,8 +19,8 @@
|
||||
package org.kiwix.kiwixmobile.core.zim_manager.fileselect_view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.text.DecimalFormat
|
||||
import kotlin.math.log10
|
||||
import kotlin.math.pow
|
||||
|
@ -22,7 +22,7 @@ import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebView
|
||||
|
||||
|
@ -21,8 +21,8 @@ package org.kiwix.kiwixmobile.custom.main
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.AssetFileDescriptor
|
||||
import android.util.Log
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.custom.BuildConfig
|
||||
import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles
|
||||
import org.kiwix.kiwixmobile.custom.main.ValidationState.HasFile
|
||||
|
Loading…
x
Reference in New Issue
Block a user