From 029a807ee00bfa5312c24f89176f462d302e6568 Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 20 Aug 2020 20:45:24 +0200 Subject: [PATCH] moved to Kotlin 1.4 --- .idea/compiler.xml | 2 +- .idea/misc.xml | 2 +- build.gradle | 6 +++--- lib/build.gradle | 4 ++++ sampleapp/build.gradle | 4 ++++ .../sampleapp/testing/unitTesting/ModelsFetchTest.kt | 3 ++- .../kirkbushman/sampleapp/activities/ApiDetailActivity.kt | 6 ++---- sampleapp/src/main/res/values/strings.xml | 1 - 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130c..fb7f4a8a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 33782299..a740c72b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ - + diff --git a/build.gradle b/build.gradle index 0344cc20..249d8cd3 100644 --- a/build.gradle +++ b/build.gradle @@ -10,14 +10,14 @@ buildscript { min_sdk_ver = 19 compile_sdk_ver = 30 - kotlin_ver = '1.3.72' - coroutines_ver = '1.3.8' + kotlin_ver = '1.4.0' + coroutines_ver = '1.3.9' ktx_core_ver = '1.3.1' ktlint_ver = '0.37.2' constr_ver = '2.0.0-rc1' annot_ver = '1.1.0' retrofit_ver = '2.9.0' - moshi_ver = '1.9.3' // '1.10.0-SNAPSHOT' + moshi_ver = '1.9.3' okhttp_ver = '4.8.1' oauth2_ver = '1.2.1' mdc_ver = '1.2.0' diff --git a/lib/build.gradle b/lib/build.gradle index 132d9c96..d0b0fe06 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -30,6 +30,10 @@ android { jvmTarget = '1.8' noReflect = true } + + lintOptions { + warningsAsErrors true + } } androidExtensions { diff --git a/sampleapp/build.gradle b/sampleapp/build.gradle index ebc9cb66..54948fb6 100644 --- a/sampleapp/build.gradle +++ b/sampleapp/build.gradle @@ -37,6 +37,10 @@ android { testOptions { unitTests.includeAndroidResources = true } + lintOptions { + warningsAsErrors true + } + packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' diff --git a/sampleapp/src/androidTest/java/com/kirkbushman/sampleapp/testing/unitTesting/ModelsFetchTest.kt b/sampleapp/src/androidTest/java/com/kirkbushman/sampleapp/testing/unitTesting/ModelsFetchTest.kt index 0659d1ac..fd7c2c83 100644 --- a/sampleapp/src/androidTest/java/com/kirkbushman/sampleapp/testing/unitTesting/ModelsFetchTest.kt +++ b/sampleapp/src/androidTest/java/com/kirkbushman/sampleapp/testing/unitTesting/ModelsFetchTest.kt @@ -199,7 +199,7 @@ class ModelsFetchTest { val fetcher = client?.subredditsClient?.all(limit = LIMIT) val submissions = fetcher?.fetchNext() - val randomSub = submissions?.random() + val randomSub = submissions?.randomOrNull() assertNotEquals("Assert that this random submission is not null", null, randomSub) @@ -219,6 +219,7 @@ class ModelsFetchTest { val randomSub = subreddits.random() val pages = client?.wikisClient?.wikiPages(subreddit = randomSub) + assertNotEquals("Assert that pages in the sub wiki are not null", null, pages) assertTrue("Assert that pages in the sub wiki are not empty", pages?.isNotEmpty() ?: false) } catch (ex: Exception) { diff --git a/sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/ApiDetailActivity.kt b/sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/ApiDetailActivity.kt index 25ffc0ac..4f315e0c 100644 --- a/sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/ApiDetailActivity.kt +++ b/sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/ApiDetailActivity.kt @@ -507,7 +507,7 @@ class ApiDetailActivity : BaseActivity() { API_SUBREDDITS -> { val subIds = getRandomSubredditIds() val subreddits = client?.subredditsClient?.subreddits( - ids = *subIds.toTypedArray(), + ids = subIds.toTypedArray(), disableLegacyEncoding = disableLegacyEncoding ) @@ -661,7 +661,7 @@ class ApiDetailActivity : BaseActivity() { private fun getRandomSubredditIds(): List { - val list = listOf( + return listOf( // centuryclub // testing private subreddit @@ -761,8 +761,6 @@ class ApiDetailActivity : BaseActivity() { // writingPrompts "2s3nb" ) - - return list } private fun getRandomSubmissionIdFromRandomSubreddit(): String { diff --git a/sampleapp/src/main/res/values/strings.xml b/sampleapp/src/main/res/values/strings.xml index 53744aea..a0afa941 100644 --- a/sampleapp/src/main/res/values/strings.xml +++ b/sampleapp/src/main/res/values/strings.xml @@ -66,7 +66,6 @@ Link Post Comment Comments - Poll Vote Wiki Wiki Pages Wiki Revision