Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #259

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-30
environment:
ANDROID_HOME: "/opt/android/sdk"
JAVA_OPTIONS: "-Xms512m -Xmx3200m"
Expand Down
27 changes: 18 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ apply from: 'config/jacoco.gradle'
apply from: 'config/sonarqube.gradle'
android {
viewBinding.enabled = true
lintOptions {
abortOnError false
}
signingConfigs {
umbrella_beta {
keyAlias 'umbrella'
Expand All @@ -27,12 +24,20 @@ android {
exclude module: 'httpclient'
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-iid'
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.google.dagger') {
details.useVersion "HEAD-SNAPSHOT"
}
}
}
}
packagingOptions {
exclude 'META-INF/LICENSE*'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE*'
jniLibs {
excludes += ['META-INF/LICENSE*', 'META-INF/NOTICE*']
}
resources {
excludes += ['META-INF/LICENSE*', 'META-INF/DEPENDENCIES', 'META-INF/NOTICE*']
}
}

androidExtensions {
Expand All @@ -41,8 +46,8 @@ android {
defaultConfig {
applicationId "org.secfirst.umbrella"
minSdkVersion 16
compileSdkVersion 28
targetSdkVersion 28
compileSdkVersion 31
targetSdkVersion 31
versionCode 56
versionName "1.0.32"
multiDexEnabled true
Expand All @@ -68,6 +73,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lint {
abortOnError false
}
}

dependencies {
Expand All @@ -92,7 +100,8 @@ dependencies {

//Framework for replacing fragments
implementation "com.bluelinelabs:conductor:$conductor_version"
implementation "com.bluelinelabs:conductor-support:$conductor_version_support"
// implementation "com.bluelinelabs:conductor-support:$conductor_version_support"
implementation "com.bluelinelabs:conductor-viewpager:$conductor_version_support"

//OkHttp
implementation "com.squareup.okhttp3:okhttp:$okhttp3"
Expand Down
40 changes: 22 additions & 18 deletions app/config/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,33 @@ jacoco {
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
group = "Reporting"
description = "Generate Jacoco coverage reports for Debug build"
classDirectories = fileTree(
dir: "$buildDir/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewBinder*.*',
'**/*$InjectAdapter*.*',
'**/*Injector*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'**/*Activity*.*',
'**/CiMattersApplication*.*',
'android/**/*.*']
getClassDirectories().setFrom(
fileTree(
dir: "$buildDir/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewBinder*.*',
'**/*$InjectAdapter*.*',
'**/*Injector*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'**/*Activity*.*',
'**/CiMattersApplication*.*',
'android/**/*.*']
)
)
reports {
xml.enabled = true
html.enabled = true
}
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
getAdditionalSourceDirs().setFrom(files(coverageSourceDirs))
getSourceDirectories().setFrom(files(coverageSourceDirs))
getExecutionData().setFrom(
fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
)
// Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
// We iterate through the compiled .class tree and rename $$ to $.
doFirst {
Expand Down
11 changes: 11 additions & 0 deletions app/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="your.package">

<uses-sdk
android:targetSdkVersion="22"
android:minSdkVersion="16"
tools:overrideLibrary="android.support.test.uiautomator.v18"/>

</manifest>
10 changes: 7 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<activity
android:name=".feature.main.MainActivity"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -39,7 +41,8 @@
android:label="@string/app_calc"
android:roundIcon="@mipmap/calc"
android:screenOrientation="portrait"
android:targetActivity=".feature.main.MainActivity">
android:targetActivity=".feature.main.MainActivity"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />

Expand All @@ -55,7 +58,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_umbrella"
android:screenOrientation="portrait"
android:targetActivity=".feature.main.MainActivity">
android:targetActivity=".feature.main.MainActivity"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DialogManager(private val controller: Controller) {
}

init {
controller.addLifecycleListener(object : Controller.LifecycleListener {
controller.addLifecycleListener(object : Controller.LifecycleListener() {
override fun postCreateView(controller: Controller, view: View) {
for (combo in combos) {
combo.dialog = combo.factory.createDialog(controller.activity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WebViewController(bundle: Bundle) : BaseController(bundle) {

private fun setUpWebView() {
webView?.let {
it.loadUrl(url)
url?.let { it1 -> it.loadUrl(it1) }
it.webViewClient = object : WebViewClient() {
override fun onReceivedError(view: WebView, errorCode: Int, description: String, failingUrl: String) {
webViewLoad?.visibility = INVISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.secfirst.umbrella.feature.checklist.view.adapter
import com.bluelinelabs.conductor.Controller
import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.support.RouterPagerAdapter
import com.bluelinelabs.conductor.viewpager.RouterPagerAdapter
import org.secfirst.umbrella.R
import org.secfirst.umbrella.feature.checklist.view.controller.DashboardController

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ChecklistController(bundle: Bundle) : BaseController(bundle), ChecklistVie
.setView(checklistViewDialog)
.create()
presenter.onAttach(this)
presenter.submitChecklist(checklistId)
checklistId?.let { presenter.submitChecklist(it) }
checklistView.addNewItemChecklist.setOnClickListener { onAddItemClicked() }
swipeToDeleteCallback()
checkIsNavigation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ class ChecklistCustomController(bundle: Bundle) : BaseController(bundle), Checkl

private fun submitChecklist() {
if (adapter.getChecklistItems().isNotEmpty())
presenter.submitInsertCustomChecklist(checklistName,
checklistId, adapter.getChecklistItems())
checklistName?.let {
checklistId?.let { it1 ->
presenter.submitInsertCustomChecklist(
it,
it1, adapter.getChecklistItems())
}
}
}

private fun initDeleteChecklistItem(view: View) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,17 @@ class DashboardController(bundle: Bundle) : BaseController(bundle), ChecklistVie
private fun shareDocument(fileToShare: File) {
val pm = context.packageManager
val uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, fileToShare)
val shareIntent = ShareCompat.IntentBuilder.from(activity)
val shareIntent = activity?.let {
ShareCompat.IntentBuilder(it)
.setType(context.contentResolver.getType(uri))
.setStream(uri)
.intent
}

shareIntent.action = Intent.ACTION_SEND
shareIntent.putExtra(Intent.EXTRA_SUBJECT, FilenameUtils.removeExtension(fileToShare.name))
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
if (shareIntent.resolveActivity(pm) != null)
shareIntent?.action = Intent.ACTION_SEND
shareIntent?.putExtra(Intent.EXTRA_SUBJECT, FilenameUtils.removeExtension(fileToShare.name))
shareIntent?.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
if (shareIntent?.resolveActivity(pm) != null)
startActivity(Intent.createChooser(shareIntent, context.getString(R.string.export_lesson)))

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class DifficultyController(bundle: Bundle) : BaseController(bundle), DifficultyV

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedViewState: Bundle?): View {
presenter.onAttach(this)
presenter.submitDifficulty(subjectId)
subjectId?.let { presenter.submitDifficulty(it) }
return inflater.inflate(R.layout.difficulty_view, container, false)
}

private fun onDifficultClick(position: Int) {
val itemSelected = difficultyAdapter.getItem(position)
presenter.saveDifficultySelect(itemSelected, subjectId)
subjectId?.let { presenter.saveDifficultySelect(itemSelected, it) }
presenter.submitDifficultySelect(difficultyAdapter.getItems(position))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.attachRouter
import com.bluelinelabs.conductor.Conductor.attachRouter
import com.github.tbouron.shakedetector.library.ShakeDetector
import com.google.android.material.bottomnavigation.BottomNavigationView
import dagger.android.AndroidInjection
Expand Down Expand Up @@ -59,7 +59,7 @@ class MainActivity : AppCompatActivity(), AdvancedSearchPresenter {
super.onCreate(savedInstanceState)
setLanguage()
setContentView(R.layout.main_view)
router = attachRouter(baseContainer, savedInstanceState)
router = attachRouter(this@MainActivity, baseContainer, savedInstanceState)
performDI()
isDeepLink()
initNavigation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.secfirst.umbrella.feature.reader.view
import com.bluelinelabs.conductor.Controller
import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.support.RouterPagerAdapter
import com.bluelinelabs.conductor.viewpager.RouterPagerAdapter
import org.secfirst.umbrella.R
import org.secfirst.umbrella.feature.reader.view.feed.FeedSettingsController
import org.secfirst.umbrella.feature.reader.view.rss.RssController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.secfirst.umbrella.feature.search.interactor.SearchBaseInteractor
import org.secfirst.umbrella.feature.search.view.SearchView
import org.secfirst.umbrella.misc.wrapTextWithElement
import javax.inject.Inject
import kotlin.collections.ArrayList


class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject constructor(
Expand Down Expand Up @@ -102,7 +103,7 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
),
// We leave this one alone cause it renders the main search view
SearchCriteria(
ItemCriteria.TEXT.type.toLowerCase(),
ItemCriteria.TEXT.type.lowercase(),
FieldTypes.FREE_TEXT,
null,
null)
Expand All @@ -111,9 +112,9 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const

override fun getDataProvider(): DataProvider = object : DataProvider {
override fun findByCriteria(text: String, vararg additional: Pair<String, List<String>>): Flowable<List<SearchResult>> {
val trimmedText = text.toLowerCase().trim()
val type = additional.find { it.first.toLowerCase().contains(ItemCriteria.TYPE.type.toLowerCase()) }?.second
val category = additional.find { it.first.toLowerCase().contains(ItemCriteria.CATEGORY.type.toLowerCase()) }?.second
val trimmedText = text.lowercase().trim()
val type = additional.find { it.first.lowercase().contains(ItemCriteria.TYPE.type.lowercase()) }?.second
val category = additional.find { it.first.lowercase().contains(ItemCriteria.CATEGORY.type.lowercase()) }?.second
val categoryId = ArrayList<String>()
if (category != null) {
val categoriesId = SQLite.select()
Expand All @@ -122,7 +123,7 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
categoriesId.forEach { categoryId.add(it.id) }
}

val difficulty = additional.find { it.first.toLowerCase().contains(ItemCriteria.DIFFICULTY.type.toLowerCase()) }?.second
val difficulty = additional.find { it.first.lowercase().contains(ItemCriteria.DIFFICULTY.type.lowercase()) }?.second

val mutableMap: MutableList<SearchResult> = mutableListOf()
when (type == null) {
Expand Down Expand Up @@ -160,7 +161,7 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
val doc = Jsoup.parse(htmlText)
for (e in doc.body().allElements) {
for (tn in e.textNodes()) {
tn.wrapTextWithElement(text, "<b>");
tn.wrapTextWithElement(text, "<b>")
}
}
doc.toString()
Expand All @@ -180,7 +181,7 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
false -> {
SQLite.select()
.from(Form::class.java)
.where(Form_Table.path.like("%${text.toLowerCase().trim()}%"))
.where(Form_Table.path.like("%${text.lowercase().trim()}%"))
.queryList().map { it.toSearchResult() }
}
}
Expand All @@ -195,17 +196,20 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
category.forEach { cat.or(Content_Table.checklist_id.like("%$it%")) }
op.and(cat)
}
else -> {}
}
when (difficulty?.isNotEmpty()) {
true -> {
difficulty.forEach { dif.or(Content_Table.checklist_id.like("%/$it/%")) }
op.and(dif)
}
else -> {}
}
when (text.isNotEmpty()) {
true -> {
op.and(Content_Table.check.like("%${text.toLowerCase().trim()}%"))
op.and(Content_Table.check.like("%${text.lowercase().trim()}%"))
}
else -> {}
}

return SQLite.select()
Expand All @@ -225,17 +229,20 @@ class SearchPresenterImp<V : SearchView, I : SearchBaseInteractor> @Inject const
category.forEach { cat.or(Markdown_Table.difficulty_id.like("%$it%")) }
op.and(cat)
}
else -> {}
}
when (difficulty?.isNotEmpty()) {
true -> {
difficulty.forEach { dif.or(Markdown_Table.difficulty_id.like("%/$it/%")) }
op.and(dif)
}
else -> {}
}
when (text.isNotEmpty()) {
true -> {
op.and(Markdown_Table.text.like("%${text.toLowerCase().trim()}%"))
op.and(Markdown_Table.text.like("%${text.lowercase().trim()}%"))
}
else -> {}
}
return SQLite.select()
.from(Markdown::class.java)
Expand Down
Loading