diff --git a/.idea/inspectionProfiles/Lint_Only.xml b/.idea/inspectionProfiles/Lint_Only.xml deleted file mode 100644 index 18557bbf1..000000000 --- a/.idea/inspectionProfiles/Lint_Only.xml +++ /dev/null @@ -1,1200 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 9c275479c..89d700fb9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -132,9 +132,8 @@ dependencies { implementation "io.objectbox:objectbox-rxjava:$objectboxVersion" implementation 'com.google.android.gms:play-services-location:17.0.0' - implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4" - implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.4" - implementation "androidx.tonyodev.fetch2rx:xfetch2rx:3.1.4" + implementation "androidx.tonyodev.fetch2:xfetch2:$fetchVersion" + implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:$fetchVersion" testImplementation "org.junit.jupiter:junit-jupiter:5.4.2" testImplementation "io.mockk:mockk:1.9" @@ -145,7 +144,7 @@ dependencies { androidTestImplementation "io.mockk:mockk-android:1.9" androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' androidTestImplementation "org.assertj:assertj-core:3.11.1" - androidTestImplementation ("org.simpleframework:simple-xml:2.7.1"){ + androidTestImplementation("org.simpleframework:simple-xml:2.7.1") { exclude module: 'stax' exclude module: 'stax-api' exclude module: 'xpp3' @@ -253,9 +252,9 @@ android { 'LogConditional' warning 'UnknownNullness', - 'SelectableText', - 'IconDensities', - 'SyntheticAccessor' + 'SelectableText', + 'IconDensities', + 'SyntheticAccessor' baseline file("lint-baseline.xml") } @@ -281,7 +280,6 @@ android { } } - flavorDimensions "default" signingConfigs { diff --git a/app/src/main/java/eu/mhutti1/utils/storage/ExternalPaths.kt b/app/src/main/java/eu/mhutti1/utils/storage/ExternalPaths.kt index 9da96562f..f4ba30def 100644 --- a/app/src/main/java/eu/mhutti1/utils/storage/ExternalPaths.kt +++ b/app/src/main/java/eu/mhutti1/utils/storage/ExternalPaths.kt @@ -51,6 +51,7 @@ internal object ExternalPaths { "/mnt/extsd", "/extsd", "/mnt/sdcard", - "/misc/android" + "/misc/android", + "/mnt" ) } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/di/modules/DownloaderModule.kt b/app/src/main/java/org/kiwix/kiwixmobile/di/modules/DownloaderModule.kt index 64ab1413e..aca8f8243 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/di/modules/DownloaderModule.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/di/modules/DownloaderModule.kt @@ -26,7 +26,7 @@ import com.tonyodev.fetch2okhttp.OkHttpDownloader import dagger.Module import dagger.Provides import okhttp3.OkHttpClient -import org.kiwix.kiwixmobile.BuildConfig.DEBUG +import org.kiwix.kiwixmobile.BuildConfig import org.kiwix.kiwixmobile.data.remote.KiwixService import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao import org.kiwix.kiwixmobile.downloader.DownloadRequester @@ -72,7 +72,7 @@ object DownloaderModule { ): FetchConfiguration = FetchConfiguration.Builder(context).apply { setDownloadConcurrentLimit(5) - enableLogging(DEBUG) + enableLogging(BuildConfig.DEBUG) enableRetryOnNetworkGain(true) setHttpDownloader(okHttpDownloader) setNotificationManager(fetchNotificationManager) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadMonitor.kt b/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadMonitor.kt index e04f23e3e..bdd4e4bdb 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadMonitor.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadMonitor.kt @@ -106,9 +106,7 @@ class FetchDownloadMonitor @Inject constructor(fetch: Fetch, fetchDownloadDao: F init { fetch.addListener(fetchListener, true) updater.subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe( - { - it.invoke() - }, + { it.invoke() }, Throwable::printStackTrace ) } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadNotificationManager.kt b/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadNotificationManager.kt index 6be106db2..a8b31d57e 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadNotificationManager.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/downloader/fetch/FetchDownloadNotificationManager.kt @@ -48,10 +48,6 @@ class FetchDownloadNotificationManager(context: Context) : } } - override fun notify(groupId: Int) { - super.notify(groupId) - } - override fun updateNotification( notificationBuilder: NotificationCompat.Builder, downloadNotification: DownloadNotification, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/utils/SharedPreferenceUtil.java b/app/src/main/java/org/kiwix/kiwixmobile/utils/SharedPreferenceUtil.java index f4e04d7ac..dad2358a4 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/utils/SharedPreferenceUtil.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/utils/SharedPreferenceUtil.java @@ -84,12 +84,10 @@ public class SharedPreferenceUtil { } public String getPrefStorage() { - String storage = sharedPreferences.getString(PREF_STORAGE, - null); + String storage = sharedPreferences.getString(PREF_STORAGE, null); if (storage == null) { storage = - ContextCompat.getExternalFilesDirs(KiwixApplication.getInstance(), null)[0] - .getPath(); + ContextCompat.getExternalFilesDirs(KiwixApplication.getInstance(), null)[0].getPath(); putPrefStorage(storage); } return storage; diff --git a/app/src/main/java/org/kiwix/kiwixmobile/utils/files/FileSearch.kt b/app/src/main/java/org/kiwix/kiwixmobile/utils/files/FileSearch.kt index b49856d23..f876d499d 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/utils/files/FileSearch.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/utils/files/FileSearch.kt @@ -22,7 +22,6 @@ package org.kiwix.kiwixmobile.utils.files import android.content.Context import android.provider.MediaStore.Files import android.provider.MediaStore.MediaColumns -import android.util.Log import eu.mhutti1.utils.storage.StorageDevice import eu.mhutti1.utils.storage.StorageDeviceUtils import io.reactivex.Flowable @@ -65,17 +64,13 @@ class FileSearch @Inject constructor(private val context: Context) { private fun scanFileSystem() = directoryRoots() - .also { Log.d("FileSearch", "searching at distinct: $it") } .fold(mutableListOf(), { acc, root -> acc.apply { addAll(scanDirectory(root)) } }) .distinctBy { it.canonicalPath } - .also { Log.d("FileSearch", "found distinct files: $it") } - private fun directoryRoots() = listOf( - "/mnt", - *StorageDeviceUtils.getReadableStorage(context).map(StorageDevice::name).toTypedArray() - ) + private fun directoryRoots() = + StorageDeviceUtils.getReadableStorage(context).map(StorageDevice::name) private fun scanDirectory(directory: String): List = File(directory).listFiles() ?.fold( diff --git a/app/src/main/res/layout/download_item.xml b/app/src/main/res/layout/download_item.xml index 0d71469b1..6be0a0639 100644 --- a/app/src/main/res/layout/download_item.xml +++ b/app/src/main/res/layout/download_item.xml @@ -68,7 +68,6 @@ android:id="@+id/eta" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="end" android:textAppearance="?android:attr/textAppearanceSmall" tools:text="1min 10secs" /> diff --git a/app/src/test/java/org/kiwix/kiwixmobile/utils/files/FileSearchTest.kt b/app/src/test/java/org/kiwix/kiwixmobile/utils/files/FileSearchTest.kt index 8e9f2394e..6babb0b30 100644 --- a/app/src/test/java/org/kiwix/kiwixmobile/utils/files/FileSearchTest.kt +++ b/app/src/test/java/org/kiwix/kiwixmobile/utils/files/FileSearchTest.kt @@ -107,7 +107,7 @@ class FileSearchTest { ".zim", File("$tempRoot${File.separator}dir").apply { mkdirs() }) every { contentResolver.query(any(), any(), any(), any(), any()) } returns null - every { storageDevice.name } returns tempRoot + every { storageDevice.name } returns zimFile.parentFile.parent val fileList = fileSearch.scan() .test() .values()[0] diff --git a/build.gradle.kts b/build.gradle.kts index 561c5a2fc..a87e0bcbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,7 @@ ext { set("baristaVersion", "2.7.1") set("kotlinVersion", "1.3.50") set("objectboxVersion", "2.3.4") + set("fetchVersion", "3.1.4") } allprojects {