From b2d4823eb9657516332d4c82d6950dd777c10caf Mon Sep 17 00:00:00 2001 From: sufyanAbbasi Date: Fri, 1 Mar 2024 09:43:08 -0800 Subject: [PATCH 01/10] Remove dependency on survey.tileSources, instead use default Firebase storage imagery path (#2271) * Remove dependency on survey.tileSources, instead use default Firebase storage path: /offline-imagery/default. * Code formatting and checks * Fix broken tests due to hardcoding offline imagery option. * Better TODO and code cleanup. * Rename default mog path/location, clean up dependencies. * More formatting * Remove unused parameter in lambda * Formatting and fix checkCode issues. * ktfmt --------- Co-authored-by: Sufyan Abbasi Co-authored-by: Gino Miceli Co-authored-by: Gino Miceli <228050+gino-m@users.noreply.github.com> --- .../java/com/google/android/ground/Config.kt | 3 +- .../com/google/android/ground/model/Survey.kt | 1 + .../repository/OfflineAreaRepository.kt | 19 ++++++----- .../ground/ui/home/HomeScreenViewModel.kt | 9 ++---- .../selector/OfflineAreaSelectorViewModel.kt | 2 +- .../ground/ui/home/HomeScreenFragmentTest.kt | 32 ++----------------- 6 files changed, 19 insertions(+), 47 deletions(-) diff --git a/ground/src/main/java/com/google/android/ground/Config.kt b/ground/src/main/java/com/google/android/ground/Config.kt index 10f45bb180..28ad6845bc 100644 --- a/ground/src/main/java/com/google/android/ground/Config.kt +++ b/ground/src/main/java/com/google/android/ground/Config.kt @@ -55,10 +55,11 @@ object Config { const val MAX_MEDIA_UPLOAD_RETRY_COUNT = 5 // TODO(#1730): Make sub-paths configurable and stop hardcoding here. + const val DEFAULT_MOG_TILE_LOCATION = "/offline-imagery/default" const val DEFAULT_MOG_MIN_ZOOM = 8 const val DEFAULT_MOG_MAX_ZOOM = 14 - fun getMogSources(path: String = "/offline-imagery/default/") = + fun getMogSources(path: String) = listOf( MogSource( 0 ..< DEFAULT_MOG_MIN_ZOOM, diff --git a/ground/src/main/java/com/google/android/ground/model/Survey.kt b/ground/src/main/java/com/google/android/ground/model/Survey.kt index 95c2d7b433..a6b433d876 100644 --- a/ground/src/main/java/com/google/android/ground/model/Survey.kt +++ b/ground/src/main/java/com/google/android/ground/model/Survey.kt @@ -24,6 +24,7 @@ data class Survey( val title: String, val description: String, val jobMap: Map, + // TODO(#1730): Remove tileSources from survey. val tileSources: List = listOf(), val acl: Map = mapOf() ) { diff --git a/ground/src/main/java/com/google/android/ground/repository/OfflineAreaRepository.kt b/ground/src/main/java/com/google/android/ground/repository/OfflineAreaRepository.kt index d0ee6fa105..b8c180f834 100644 --- a/ground/src/main/java/com/google/android/ground/repository/OfflineAreaRepository.kt +++ b/ground/src/main/java/com/google/android/ground/repository/OfflineAreaRepository.kt @@ -108,8 +108,8 @@ constructor( private suspend fun getLocalTileSourcePath(): String = File(fileUtil.getFilesDir(), "tiles").path fun getOfflineTileSourcesFlow() = - surveyRepository.activeSurveyFlow.combine(getOfflineAreaBounds()) { survey, bounds -> - applyBounds(survey?.tileSources, bounds) + surveyRepository.activeSurveyFlow.combine(getOfflineAreaBounds()) { _, bounds -> + applyBounds(getDefaultTileSources(), bounds) } private suspend fun applyBounds( @@ -143,15 +143,14 @@ constructor( return MogClient(mogCollection, remoteStorageManager) } - private fun getMogSources(): List = Config.getMogSources(getFirstTileSourceUrl()) + private fun getMogSources(): List = + Config.getMogSources(getDefaultTileSources().first().url) - /** - * Returns the URL of the first tile source in the current survey, or throws an error if no survey - * is active or if no tile sources are defined. - */ - private fun getFirstTileSourceUrl() = - surveyRepository.activeSurvey?.tileSources?.firstOrNull()?.url - ?: error("Survey has no tile sources") + /** Returns the default configured tile sources. */ + fun getDefaultTileSources(): List = + listOf( + TileSource(url = Config.DEFAULT_MOG_TILE_LOCATION, type = TileSource.Type.MOG_COLLECTION) + ) suspend fun hasHiResImagery(bounds: Bounds): Boolean { val client = getMogClient() diff --git a/ground/src/main/java/com/google/android/ground/ui/home/HomeScreenViewModel.kt b/ground/src/main/java/com/google/android/ground/ui/home/HomeScreenViewModel.kt index 61824315d1..bcc45a612f 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/HomeScreenViewModel.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/HomeScreenViewModel.kt @@ -16,9 +16,8 @@ package com.google.android.ground.ui.home import androidx.lifecycle.LiveData -import androidx.lifecycle.asLiveData +import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope -import com.google.android.ground.repository.SurveyRepository import com.google.android.ground.ui.common.AbstractViewModel import com.google.android.ground.ui.common.Navigator import com.google.android.ground.ui.common.SharedViewModel @@ -26,7 +25,6 @@ import javax.inject.Inject import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.asSharedFlow -import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch @SharedViewModel @@ -34,14 +32,13 @@ class HomeScreenViewModel @Inject internal constructor( private val navigator: Navigator, - private val surveyRepository: SurveyRepository, ) : AbstractViewModel() { private val _openDrawerRequests: MutableSharedFlow = MutableSharedFlow() val openDrawerRequestsFlow: SharedFlow = _openDrawerRequests.asSharedFlow() - val showOfflineAreaMenuItem: LiveData = - surveyRepository.activeSurveyFlow.map { it?.tileSources?.isNotEmpty() ?: false }.asLiveData() + // TODO(#1730): Allow tile source configuration from a non-survey accessible source. + val showOfflineAreaMenuItem: LiveData = MutableLiveData(true) fun openNavDrawer() { viewModelScope.launch { _openDrawerRequests.emit(Unit) } diff --git a/ground/src/main/java/com/google/android/ground/ui/offlineareas/selector/OfflineAreaSelectorViewModel.kt b/ground/src/main/java/com/google/android/ground/ui/offlineareas/selector/OfflineAreaSelectorViewModel.kt index f04c45287b..8ee7e1d172 100644 --- a/ground/src/main/java/com/google/android/ground/ui/offlineareas/selector/OfflineAreaSelectorViewModel.kt +++ b/ground/src/main/java/com/google/android/ground/ui/offlineareas/selector/OfflineAreaSelectorViewModel.kt @@ -90,7 +90,7 @@ internal constructor( ) init { - remoteTileSources = surveyRepository.activeSurvey!!.tileSources + remoteTileSources = offlineAreaRepository.getDefaultTileSources() } fun onDownloadClick() { diff --git a/ground/src/test/java/com/google/android/ground/ui/home/HomeScreenFragmentTest.kt b/ground/src/test/java/com/google/android/ground/ui/home/HomeScreenFragmentTest.kt index 59cf986b8c..a666429177 100644 --- a/ground/src/test/java/com/google/android/ground/ui/home/HomeScreenFragmentTest.kt +++ b/ground/src/test/java/com/google/android/ground/ui/home/HomeScreenFragmentTest.kt @@ -42,7 +42,6 @@ import dagger.hilt.android.testing.HiltAndroidTest import javax.inject.Inject import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle -import org.hamcrest.CoreMatchers.not import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -131,30 +130,11 @@ class HomeScreenFragmentTest : AbstractHomeScreenFragmentTest() { mapOf(Pair(FakeData.USER.email, "data-collector")) ) - private val surveyWithTileSources: Survey = - surveyWithoutBasemap.copy( - tileSources = - listOf( - TileSource("http://google.com", TileSource.Type.MOG_COLLECTION), - ), - id = "SURVEY_WITH_TILE_SOURCES" - ) - @Test - fun offlineMapImageryMenuIsDisabledWhenActiveSurveyHasNoBasemap() = runWithTestDispatcher { + fun `offline map imagery menu is always enabled`() = runWithTestDispatcher { surveyRepository.selectedSurveyId = surveyWithoutBasemap.id advanceUntilIdle() - openDrawer() - onView(withId(R.id.nav_offline_areas)).check(matches(not(isEnabled()))) - } - - @Test - fun offlineMapImageryMenuIsEnabledWhenActiveSurveyHasBasemap() = runWithTestDispatcher { - localSurveyStore.insertOrUpdateSurvey(surveyWithTileSources) - surveyRepository.selectedSurveyId = surveyWithTileSources.id - advanceUntilIdle() - openDrawer() onView(withId(R.id.nav_offline_areas)).check(matches(isEnabled())) } @@ -172,6 +152,7 @@ class NavigationDrawerItemClickTest( ) : AbstractHomeScreenFragmentTest() { @Inject lateinit var navigator: Navigator + @Inject lateinit var surveyRepository: SurveyRepository @Test @@ -219,19 +200,12 @@ class NavigationDrawerItemClickTest( true, "Clicking 'sync status' should navigate to fragment" ), - arrayOf( - "Offline map imagery", - TEST_SURVEY_WITHOUT_OFFLINE_TILES, - null, - false, - "Clicking 'offline map imagery' when survey doesn't have offline tiles should do nothing" - ), arrayOf( "Offline map imagery", TEST_SURVEY_WITH_OFFLINE_TILES, HomeScreenFragmentDirections.showOfflineAreas(), true, - "Clicking 'offline map imagery' when survey has offline tiles should navigate to fragment" + "Clicking 'offline map imagery' should navigate to fragment" ), arrayOf( "Settings", From 398ec34722653ad59d425184c6b36e718e3b1d83 Mon Sep 17 00:00:00 2001 From: Gino Miceli <228050+gino-m@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:51:53 -0500 Subject: [PATCH 02/10] Fix crash on startup (#2284) * Add missing call to super impl * Use viewLifecycleOwner * Tweak error messages * Fail gracefully on race conditions --- .../mapcontainer/HomeScreenMapContainerFragment.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt index 8f63a0ac4e..24cae8fa69 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt @@ -51,6 +51,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import timber.log.Timber /** Main app view, displaying the map and related controls (center cross-hairs, add button, etc). */ @AndroidEntryPoint @@ -117,6 +118,7 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { container: ViewGroup?, savedInstanceState: Bundle?, ): View { + super.onCreateView(inflater, container, savedInstanceState) binding = BasemapLayoutBinding.inflate(inflater, container, false) binding.fragment = this binding.viewModel = mapContainerViewModel @@ -128,7 +130,7 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { super.onViewCreated(view, savedInstanceState) setupMenuFab() setupBottomLoiCards() - lifecycleScope.launch { showDataCollectionHint() } + viewLifecycleOwner.lifecycleScope.launch { showDataCollectionHint() } } /** @@ -138,13 +140,13 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { * This method should only be called after view creation. */ private suspend fun showDataCollectionHint() { - check(this::mapContainerViewModel.isInitialized) { - "showDataCollectionHint called before mapContainerViewModel was initialized" - } - check(this::binding.isInitialized) { - "showDataCollectionHint called before binding was initialized" + if (!this::mapContainerViewModel.isInitialized) { + return Timber.w("showDataCollectionHint() called before mapContainerViewModel initialized") } mapContainerViewModel.surveyUpdateFlow.collect { + if (!this::binding.isInitialized) { + return@collect Timber.w("showDataCollectionHint() called before binding initialized") + } val messageId = when { it.addLoiPermitted -> R.string.suggest_data_collection_hint From 8023b3d0089fb3c55fce6ec6412d75a20b5b82f1 Mon Sep 17 00:00:00 2001 From: Gino Miceli <228050+gino-m@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:03:59 -0500 Subject: [PATCH 03/10] Workaround undismissable snackbar (#2288) --- .../ui/home/mapcontainer/HomeScreenMapContainerFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt index 24cae8fa69..c42cce242d 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt @@ -155,7 +155,7 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { } ephemeralPopups .InfoPopup() - .show(binding.root, messageId, EphemeralPopups.PopupDuration.INDEFINITE) + .show(binding.root, messageId, EphemeralPopups.PopupDuration.SHORT) } } From c06407b2d654f019d0ac550fd68a43f6b2abd6df Mon Sep 17 00:00:00 2001 From: sufyanAbbasi Date: Fri, 1 Mar 2024 14:27:53 -0800 Subject: [PATCH 04/10] Add a small delay after the page scroll is idle to calculate the progress bar position. (#2280) * Add a small delay after the page scroll is idle to calculate the progress bar position. * Remove broken test * ktfmtFormat * Lint fix * detekt error fix --------- Co-authored-by: Sufyan Abbasi Co-authored-by: Shobhit Agarwal Co-authored-by: Gino Miceli --- .../datacollection/DataCollectionFragment.kt | 36 ++++++++++++++----- .../HomeScreenMapContainerFragment.kt | 29 ++++++++------- .../HomeScreenMapContainerViewModel.kt | 6 ++-- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionFragment.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionFragment.kt index 18c3e1b1c2..1ae570df6b 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionFragment.kt @@ -17,11 +17,14 @@ package com.google.android.ground.ui.datacollection import android.animation.ValueAnimator import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ProgressBar import androidx.constraintlayout.widget.Guideline +import androidx.core.view.WindowInsetsCompat import androidx.hilt.navigation.fragment.hiltNavGraphViewModels import androidx.interpolator.view.animation.FastOutSlowInInterpolator import androidx.lifecycle.lifecycleScope @@ -40,6 +43,7 @@ import kotlinx.coroutines.launch @AndroidEntryPoint class DataCollectionFragment : AbstractFragment(), BackPressListener { @Inject lateinit var navigator: Navigator + @Inject lateinit var viewPagerAdapterFactory: DataCollectionViewPagerAdapterFactory private val viewModel: DataCollectionViewModel by hiltNavGraphViewModels(R.id.data_collection) @@ -76,20 +80,34 @@ class DataCollectionFragment : AbstractFragment(), BackPressListener { viewPager.registerOnPageChangeCallback( object : ViewPager2.OnPageChangeCallback() { - override fun onPageSelected(position: Int) { - super.onPageSelected(position) - - val buttonContainer = view.findViewById(R.id.action_buttons) ?: return - val anchorLocation = IntArray(2) - buttonContainer.getLocationInWindow(anchorLocation) - val guidelineTop = - anchorLocation[1] - buttonContainer.rootWindowInsets.systemWindowInsetTop - guideline.setGuidelineBegin(guidelineTop) + override fun onPageScrollStateChanged(state: Int) { + super.onPageScrollStateChanged(state) + if (state == ViewPager2.SCROLL_STATE_IDLE) { + Handler(Looper.getMainLooper()) + .postDelayed( + { + // Reset the progress bar position after a delay to wait for the keyboard to + // close. + setProgressBarPosition(view) + }, + 100 + ) + } } } ) } + private fun setProgressBarPosition(view: View) { + val buttonContainer = view.findViewById(R.id.action_buttons) ?: return + val anchorLocation = IntArray(2) + buttonContainer.getLocationInWindow(anchorLocation) + val windowInsets = WindowInsetsCompat.toWindowInsetsCompat(buttonContainer.rootWindowInsets) + val guidelineTop = + anchorLocation[1] - windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()).top + guideline.setGuidelineBegin(guidelineTop) + } + private fun loadTasks(tasks: List) { val currentAdapter = viewPager.adapter as? DataCollectionViewPagerAdapter if (currentAdapter == null || currentAdapter.tasks != tasks) { diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt index c42cce242d..dcc278f596 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt @@ -40,6 +40,7 @@ import com.google.android.ground.ui.common.BaseMapViewModel import com.google.android.ground.ui.common.EphemeralPopups import com.google.android.ground.ui.home.HomeScreenFragmentDirections import com.google.android.ground.ui.home.HomeScreenViewModel +import com.google.android.ground.ui.home.mapcontainer.HomeScreenMapContainerViewModel.SurveyProperties import com.google.android.ground.ui.home.mapcontainer.cards.LoiCardUtil import com.google.android.ground.ui.home.mapcontainer.cards.MapCardAdapter import com.google.android.ground.ui.home.mapcontainer.cards.MapCardUiData @@ -143,20 +144,22 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { if (!this::mapContainerViewModel.isInitialized) { return Timber.w("showDataCollectionHint() called before mapContainerViewModel initialized") } - mapContainerViewModel.surveyUpdateFlow.collect { - if (!this::binding.isInitialized) { - return@collect Timber.w("showDataCollectionHint() called before binding initialized") - } - val messageId = - when { - it.addLoiPermitted -> R.string.suggest_data_collection_hint - it.readOnly -> R.string.read_only_data_collection_hint - else -> R.string.predefined_data_collection_hint - } - ephemeralPopups - .InfoPopup() - .show(binding.root, messageId, EphemeralPopups.PopupDuration.SHORT) + mapContainerViewModel.surveyUpdateFlow.collect(this::onSurveyUpdate) + } + + private fun onSurveyUpdate(surveyProperties: SurveyProperties) { + if (!this::binding.isInitialized) { + return Timber.w("showDataCollectionHint() called before binding initialized") } + val messageId = + when { + surveyProperties.addLoiPermitted -> R.string.suggest_data_collection_hint + surveyProperties.readOnly -> R.string.read_only_data_collection_hint + else -> R.string.predefined_data_collection_hint + } + ephemeralPopups + .InfoPopup() + .show(binding.root, messageId, EphemeralPopups.PopupDuration.INDEFINITE) } private fun setupMenuFab() { diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerViewModel.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerViewModel.kt index af42275831..6b997ca07d 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerViewModel.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerViewModel.kt @@ -90,9 +90,9 @@ internal constructor( * determine if and how behavior should change based on differing survey properties. */ val surveyUpdateFlow: Flow = - activeSurvey.filterNotNull().map { - val lois = loiRepository.getLocationsOfInterests(it).first() - SurveyProperties(it.jobs.any { it.canDataCollectorsAddLois }, lois.isEmpty()) + activeSurvey.filterNotNull().map { survey -> + val lois = loiRepository.getLocationsOfInterests(survey).first() + SurveyProperties(survey.jobs.any { job -> job.canDataCollectorsAddLois }, lois.isEmpty()) } /** Set of [Feature] to render on the map. */ From bc5b643c1c7fdcaba6964dea0509b152e769f74b Mon Sep 17 00:00:00 2001 From: Gino Miceli Date: Fri, 1 Mar 2024 17:57:30 -0500 Subject: [PATCH 05/10] Fix bad merge --- .../ui/home/mapcontainer/HomeScreenMapContainerFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt index dcc278f596..d15034fda4 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt @@ -159,7 +159,7 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { } ephemeralPopups .InfoPopup() - .show(binding.root, messageId, EphemeralPopups.PopupDuration.INDEFINITE) + .show(binding.root, messageId, EphemeralPopups.PopupDuration.SHORT) } private fun setupMenuFab() { From 8d86e36cc0bdbeb669914b390abf6bc3ce2a1b9c Mon Sep 17 00:00:00 2001 From: Shobhit Agarwal Date: Sun, 3 Mar 2024 02:42:22 +0530 Subject: [PATCH 06/10] Generate code coverage reports only on merge (#2293) * Run ktfmtFormat * Run code coverage plugin only when merging with master * Upload stats only when on master --- cloudbuild.yaml | 14 ++++++++------ .../mapcontainer/HomeScreenMapContainerFragment.kt | 4 +--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 32fff1970f..a3fabddf5e 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -117,8 +117,9 @@ steps: ./gradlew -PdisablePreDex testDevStagingUnitTest --no-daemon 2> unit-test-logs.txt || echo "fail" > build-status.txt cat unit-test-logs.txt - # TODO: Add a check for _PUSH_TO_MASTER - ./gradlew jacocoTestStagingUnitTestReport --no-daemon + if [[ "${_PUSH_TO_MASTER}" ]]; then + ./gradlew jacocoTestStagingUnitTestReport --no-daemon + fi - name: 'gcr.io/$PROJECT_ID/android:34' id: &authenticate_gcloud 'Authorize gcloud' @@ -219,10 +220,11 @@ steps: args: - '-c' - | - # TODO: Add a check for _PUSH_TO_MASTER - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -t ${_CODECOV_TOKEN} + if [[ "${_PUSH_TO_MASTER}" ]]; then + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + ./codecov -t ${_CODECOV_TOKEN} + fi - name: 'gcr.io/$PROJECT_ID/android:base' id: &compress_cache 'Compress gradle build cache' diff --git a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt index d15034fda4..5bd6632678 100644 --- a/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt @@ -157,9 +157,7 @@ class HomeScreenMapContainerFragment : AbstractMapContainerFragment() { surveyProperties.readOnly -> R.string.read_only_data_collection_hint else -> R.string.predefined_data_collection_hint } - ephemeralPopups - .InfoPopup() - .show(binding.root, messageId, EphemeralPopups.PopupDuration.SHORT) + ephemeralPopups.InfoPopup().show(binding.root, messageId, EphemeralPopups.PopupDuration.SHORT) } private fun setupMenuFab() { From 864aa2c5a2270adda256c1695530dc8a851517f6 Mon Sep 17 00:00:00 2001 From: Shobhit Agarwal Date: Sun, 3 Mar 2024 03:44:40 +0530 Subject: [PATCH 07/10] Fix dependencyUpdates plugin (#2294) --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4732550734..7b4feeabb1 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ buildscript { } plugins { - id "com.github.ben-manes.versions" version "0.36.0" + id "com.github.ben-manes.versions" version "0.51.0" id "org.jetbrains.kotlin.android" version "$kotlinVersion" apply false id "org.jetbrains.kotlin.plugin.serialization" version "$kotlinVersion" id "com.ncorti.ktfmt.gradle" version "0.17.0" @@ -111,6 +111,9 @@ gitVersioner { baseBranch "master" } +// https://github.com/ben-manes/gradle-versions-plugin/issues/746 +apply plugin: 'jvm-ecosystem' + def isNonStable = { String version -> def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) } def regex = /^[0-9,.v-]+(-r)?$/ From 956e9f110d75430f27633abb70f8bc9198ec2787 Mon Sep 17 00:00:00 2001 From: Shobhit Agarwal Date: Sun, 3 Mar 2024 10:48:03 +0530 Subject: [PATCH 08/10] Update gradle dependencies (#2295) --- .idea/codeStyles/Project.xml | 1 - build.gradle | 12 ++--- ground/build.gradle | 47 +++++++++---------- .../android/ground/GroundApplication.kt | 6 +-- .../ui/map/gms/features/FeatureClusterItem.kt | 2 + .../persistence/sync/FakeWorkManager.kt | 35 ++++++++++++-- 6 files changed, 62 insertions(+), 41 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 767e4a9940..ce76f22c22 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -7,7 +7,6 @@ -