#1386 remove lint inspection profile, update dependencies, minor fixes

This commit is contained in:
Sean Mac Gillicuddy 2019-09-04 13:58:47 +01:00
parent c2244476fb
commit 0323af70ad
11 changed files with 17 additions and 1231 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 {

View File

@ -51,6 +51,7 @@ internal object ExternalPaths {
"/mnt/extsd",
"/extsd",
"/mnt/sdcard",
"/misc/android"
"/misc/android",
"/mnt"
)
}

View File

@ -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)

View File

@ -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
)
}

View File

@ -48,10 +48,6 @@ class FetchDownloadNotificationManager(context: Context) :
}
}
override fun notify(groupId: Int) {
super.notify(groupId)
}
override fun updateNotification(
notificationBuilder: NotificationCompat.Builder,
downloadNotification: DownloadNotification,

View File

@ -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;

View File

@ -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<File>(), { 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> = File(directory).listFiles()
?.fold(

View File

@ -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" />
</LinearLayout>

View File

@ -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]

View File

@ -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 {