From e370ac2a0e3856f95e83816b26081a81b88dfd2a Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Thu, 17 Sep 2020 09:34:29 +0200 Subject: [PATCH 1/9] Update Kotlin, Coroutines and Serialization across projects --- WordPress/build.gradle | 2 +- build.gradle | 9 +++++---- libs/WordPressAnnotations/build.gradle | 4 ++-- libs/utils/WordPressUtils/build.gradle | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/WordPress/build.gradle b/WordPress/build.gradle index e32fe6a573df..13ecc7a4c070 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -254,7 +254,7 @@ dependencies { testImplementation "org.mockito:mockito-core:$mockitoCoreVersion" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$nhaarmanMockitoVersion" testImplementation "org.assertj:assertj-core:$assertJVersion" - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.2.1' + testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" testImplementation 'androidx.test:core:1.2.0' androidTestImplementation 'org.mockito:mockito-android:2.27.0' diff --git a/build.gradle b/build.gradle index 1e72fb75be23..9c9c117a5eb5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,9 @@ buildscript { - ext.kotlinVersion = '1.3.61' - ext.serializationVersion = '0.14.0' + ext.kotlinVersion = '1.4.10' + ext.serializationVersion = '1.0-M1-1.4.0-rc' ext.navComponentVersion = '2.0.0' - ext.kotlin_coroutines_version = '1.3.3' + ext.kotlin_coroutines_version = '1.3.9' + ext.coroutinesVersion = '1.3.9' ext.kotlin_ktx_version = '1.2.0' ext.androidx_work_version = "2.0.1" ext.buildGutenbergMobileJSBundle = 1 @@ -129,7 +130,7 @@ ext { minSdkVersion = 21 targetSdkVersion = 28 - coroutinesVersion = '1.3.3' + coroutinesVersion = '1.3.9' androidxWorkVersion = "2.0.1" daggerVersion = '2.22.1' diff --git a/libs/WordPressAnnotations/build.gradle b/libs/WordPressAnnotations/build.gradle index f827f544e24a..dbdee96d9592 100644 --- a/libs/WordPressAnnotations/build.gradle +++ b/libs/WordPressAnnotations/build.gradle @@ -1,9 +1,9 @@ apply plugin: 'kotlin' dependencies { - ext.kotlinVersion = '1.3.61' + ext.kotlinVersion = '1.4.10' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" } sourceCompatibility = "7" diff --git a/libs/utils/WordPressUtils/build.gradle b/libs/utils/WordPressUtils/build.gradle index d182429e1547..eb5131dbb469 100644 --- a/libs/utils/WordPressUtils/build.gradle +++ b/libs/utils/WordPressUtils/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.3.61' + ext.kotlinVersion = '1.4.10' ext.kotlin_ktx_version = '1.2.0' repositories { From 0c54203e0b13a8ab9d49cd2294fb76e2c321c8be Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Thu, 17 Sep 2020 09:47:48 +0200 Subject: [PATCH 2/9] Remove ExperimentalCoroutinesApi annotation when not necessary --- .../test/java/org/wordpress/android/CoroutinesUtils.kt | 3 +-- .../android/ui/posts/PostListMainViewModelTest.kt | 2 -- .../discover/ReaderPostCardActionsHandlerTest.kt | 2 -- .../repository/ReaderDiscoverDataProviderTest.kt | 10 ---------- .../android/ui/stats/refresh/StatsViewModelTest.kt | 1 - .../ui/stats/refresh/lists/UiModelMapperTest.kt | 1 - 6 files changed, 1 insertion(+), 18 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/CoroutinesUtils.kt b/WordPress/src/test/java/org/wordpress/android/CoroutinesUtils.kt index 09805610db47..9c7ffb0fa0ac 100644 --- a/WordPress/src/test/java/org/wordpress/android/CoroutinesUtils.kt +++ b/WordPress/src/test/java/org/wordpress/android/CoroutinesUtils.kt @@ -6,7 +6,6 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Delay import kotlinx.coroutines.Dispatchers.Unconfined -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.runBlocking import org.mockito.Mockito @@ -24,7 +23,7 @@ fun KStubbing.onBlocking(methodCall: suspend T.() -> R): Ongoing return runBlocking { Mockito.`when`(mock.methodCall()) } } -@ExperimentalCoroutinesApi val TEST_SCOPE = CoroutineScope(Unconfined) +val TEST_SCOPE = CoroutineScope(Unconfined) @InternalCoroutinesApi val TEST_DISPATCHER: CoroutineDispatcher = TestDispatcher() @InternalCoroutinesApi diff --git a/WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt index 0658af6c6500..32686979359b 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt @@ -9,7 +9,6 @@ import com.nhaarman.mockitokotlin2.times import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.whenever import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import org.assertj.core.api.Assertions.assertThat import org.junit.Before @@ -39,7 +38,6 @@ class PostListMainViewModelTest : BaseUnitTest() { private lateinit var viewModel: PostListMainViewModel @InternalCoroutinesApi - @UseExperimental(ExperimentalCoroutinesApi::class) @Before fun setUp() { val prefs = mock { diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostCardActionsHandlerTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostCardActionsHandlerTest.kt index 823f675e8846..58393319aa4a 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostCardActionsHandlerTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostCardActionsHandlerTest.kt @@ -6,7 +6,6 @@ import com.nhaarman.mockitokotlin2.eq import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.flowOf import org.assertj.core.api.Assertions.assertThat @@ -72,7 +71,6 @@ import org.wordpress.android.ui.utils.HtmlMessageUtils import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper import org.wordpress.android.viewmodel.ResourceProvider -@ExperimentalCoroutinesApi @InternalCoroutinesApi @RunWith(MockitoJUnitRunner::class) class ReaderPostCardActionsHandlerTest { diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt index e484a79f4ca7..856e31a184db 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt @@ -68,7 +68,6 @@ class ReaderDiscoverDataProviderTest { ) } - @ExperimentalCoroutinesApi @Test fun `when refreshCards is requested started gets posted on comm channel`() = test { whenever(fetchDiscoverCardsUseCase.fetch(REQUEST_FIRST_PAGE)).thenReturn(Started(REQUEST_FIRST_PAGE)) @@ -81,7 +80,6 @@ class ReaderDiscoverDataProviderTest { .isEqualTo(Started(REQUEST_FIRST_PAGE)) } - @ExperimentalCoroutinesApi @Test fun `when fetch request fails then failure gets posted to comm channel`() = test { // Arrange @@ -95,7 +93,6 @@ class ReaderDiscoverDataProviderTest { .isEqualTo(RemoteRequestFailure(REQUEST_FIRST_PAGE)) } - @ExperimentalCoroutinesApi @Test fun `when fetch request succeeds success gets posted to comm channel`() = test { // Arrange @@ -109,7 +106,6 @@ class ReaderDiscoverDataProviderTest { .isEqualTo(Success(REQUEST_FIRST_PAGE)) } - @ExperimentalCoroutinesApi @Test fun `when fetch request unchanged success gets posted to comm channel`() = test { // Arrange @@ -123,7 +119,6 @@ class ReaderDiscoverDataProviderTest { .isEqualTo(Success(REQUEST_FIRST_PAGE)) } - @ExperimentalCoroutinesApi @Test fun `on cards updated has new the data gets posted to discover feed`() = test { // Arrange @@ -141,7 +136,6 @@ class ReaderDiscoverDataProviderTest { .isEqualTo(NUMBER_OF_ITEMS) } - @ExperimentalCoroutinesApi @Test fun `when loadMoreRequest in progress another started not posted to comm channel`() = test { whenever(fetchDiscoverCardsUseCase.fetch(REQUEST_MORE)).thenReturn(Started(REQUEST_MORE)) @@ -166,7 +160,6 @@ class ReaderDiscoverDataProviderTest { } // The following test the loadData(), which is kicked off when discoverFeed obtains observers - @ExperimentalCoroutinesApi @Test fun `when loadData with refresh request is started and posted to comm channel`() = test { whenever(fetchDiscoverCardsUseCase.fetch(REQUEST_FIRST_PAGE)).thenReturn(Started(REQUEST_FIRST_PAGE)) @@ -180,7 +173,6 @@ class ReaderDiscoverDataProviderTest { Assertions.assertThat(requireNotNull(started)).isEqualTo(Started(REQUEST_FIRST_PAGE)) } - @ExperimentalCoroutinesApi @Test fun `when loadData without refresh no start message posted to comm channel`() = test { whenever(getDiscoverCardsUseCase.get()).thenReturn(createDummyReaderCardsList()) @@ -193,7 +185,6 @@ class ReaderDiscoverDataProviderTest { Assertions.assertThat(started).isNull() } - @ExperimentalCoroutinesApi @Test fun `when loadData with forceReload true data posted to discover channel`() = test { whenever(getDiscoverCardsUseCase.get()).thenReturn(createDummyReaderCardsList()) @@ -209,7 +200,6 @@ class ReaderDiscoverDataProviderTest { Assertions.assertThat(data).isNotNull } - @ExperimentalCoroutinesApi @Test fun `when loadData with existsInMemory data posted to discover feed`() = test { val discoverFeedObserver = Observer { } diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt index 8cfa3cf6d9a4..85dac5a078c2 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt @@ -48,7 +48,6 @@ class StatsViewModelTest : BaseUnitTest() { private lateinit var viewModel: StatsViewModel private val _liveSelectedSection = MutableLiveData() private val liveSelectedSection: LiveData = _liveSelectedSection - @ExperimentalCoroutinesApi @Before fun setUp() { whenever(baseListUseCase.snackbarMessage).thenReturn(MutableLiveData()) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt index da954058cbca..37c35922badd 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt @@ -18,7 +18,6 @@ import org.wordpress.android.util.NetworkUtilsWrapper class UiModelMapperTest : BaseUnitTest() { @Mock lateinit var networkUtilsWrapper: NetworkUtilsWrapper private lateinit var mapper: UiModelMapper - @ExperimentalCoroutinesApi @Before fun setUp() { mapper = UiModelMapper(networkUtilsWrapper) From c3ff46206d557981c4bee37498c47cccd10658d6 Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Thu, 17 Sep 2020 10:01:07 +0200 Subject: [PATCH 3/9] Remove unused imports --- .../ui/reader/repository/ReaderDiscoverDataProviderTest.kt | 1 - .../org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt | 1 - .../android/ui/stats/refresh/lists/UiModelMapperTest.kt | 1 - 3 files changed, 3 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt index 856e31a184db..f81af73acdeb 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt @@ -3,7 +3,6 @@ package org.wordpress.android.ui.reader.repository import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.lifecycle.Observer import com.nhaarman.mockitokotlin2.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import org.assertj.core.api.Assertions import org.junit.Before diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt index 85dac5a078c2..453b36f92b5f 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/StatsViewModelTest.kt @@ -5,7 +5,6 @@ import androidx.lifecycle.MutableLiveData import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.whenever import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt index 37c35922badd..ca5c168e988f 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapperTest.kt @@ -1,6 +1,5 @@ package org.wordpress.android.ui.stats.refresh.lists -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test From 3ba13aa853a1d96392aa3296f40df38867eab8a9 Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Thu, 17 Sep 2020 10:01:53 +0200 Subject: [PATCH 4/9] Updates to stories-android --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index 81d9fe073010..9abf0acd33c3 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit 81d9fe073010346d244b402541ea552dbdb36f8b +Subproject commit 9abf0acd33c3132edb86c861b8bc29a3db424a1c From af781d34c977a6365edae7a5b70ff3fc1e53a19e Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Thu, 17 Sep 2020 10:03:46 +0200 Subject: [PATCH 5/9] Revert "Updates to stories-android" This reverts commit 3ba13aa853a1d96392aa3296f40df38867eab8a9. --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index 9abf0acd33c3..81d9fe073010 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit 9abf0acd33c3132edb86c861b8bc29a3db424a1c +Subproject commit 81d9fe073010346d244b402541ea552dbdb36f8b From 5e5fa7c2ff01657005e12365fe31a2431575e10e Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Fri, 6 Nov 2020 10:26:16 +0100 Subject: [PATCH 6/9] Update stories --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index b05f8197dbc1..b4ed83bbab31 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit b05f8197dbc144fc024379c462c76efbb7c5440c +Subproject commit b4ed83bbab31fac1096371b3023bb643a64cf09d From 710f926c7b00bcd326d90ca3738403fb66e26aef Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Fri, 6 Nov 2020 14:30:17 +0100 Subject: [PATCH 7/9] Implement method to fix stories --- .../wordpress/android/ui/stories/StoryComposerActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stories/StoryComposerActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/stories/StoryComposerActivity.kt index 67e28e829481..08fc213f505a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stories/StoryComposerActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stories/StoryComposerActivity.kt @@ -396,6 +396,11 @@ class StoryComposerActivity : ComposeLoopFrameActivity(), viewModel.onStoryDiscarded() } + override fun onFrameRemove(storyIndex: StoryIndex, storyFrameIndex: Int) { + // no op + // TODO this will be implemented after the Story block support lands in develop + } + private fun openPrepublishingBottomSheet() { val fragment = supportFragmentManager.findFragmentByTag(PrepublishingBottomSheetFragment.TAG) if (fragment == null) { From 9bf32842790008a90635d9fe7cf5db4cc2223d90 Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Mon, 9 Nov 2020 12:34:36 +0100 Subject: [PATCH 8/9] Remove unnecessary annotation --- .../ui/reader/repository/ReaderDiscoverDataProviderTest.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt index f12514b51a0f..82a69f482f2c 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/repository/ReaderDiscoverDataProviderTest.kt @@ -229,7 +229,6 @@ class ReaderDiscoverDataProviderTest { Assertions.assertThat(data?.cards?.size).isEqualTo(NUMBER_OF_ITEMS) } - @ExperimentalCoroutinesApi @Test fun `when followed tags change the discover feed gets refreshed`() = test { // Act From 9c24f0d0032d66296caf522f5d9a5c8b5ba1936b Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Mon, 9 Nov 2020 13:01:34 +0100 Subject: [PATCH 9/9] Update stories version to fix lint issues --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index b4ed83bbab31..d5a2798d4d20 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit b4ed83bbab31fac1096371b3023bb643a64cf09d +Subproject commit d5a2798d4d204738eb733e95e4ea7d4706b4a77e