From 1fb424562e796ea572d9f9d6d8d88c3bc9f3bb0c Mon Sep 17 00:00:00 2001 From: Deep Panchal Date: Fri, 18 Aug 2023 15:25:01 -0500 Subject: [PATCH] style(format): run `./gradlew --init-script gradle/init.gradle.kts spotlessApply` to format + lint all files --- .../crisiscleanup/ExampleInstrumentedTest.kt | 2 +- .../ui/CrisisCleanupAppStateTest.kt | 16 +- .../crisiscleanup/AndroidLocationProvider.kt | 2 +- .../crisiscleanup/AndroidPermissionManager.kt | 16 +- .../crisiscleanup/AppVisualAlertManager.kt | 2 +- .../com/crisiscleanup/CrisisCleanupAppEnv.kt | 2 +- .../crisiscleanup/FirebaseFeedbackReceiver.kt | 2 +- .../crisiscleanup/MainActivityViewModel.kt | 9 +- .../java/com/crisiscleanup/di/AppModule.kt | 6 +- .../com/crisiscleanup/di/JankStatsModule.kt | 2 +- .../log/CrisisCleanupAppLogger.kt | 2 +- .../CrisisCleanupNavigationObserver.kt | 2 +- .../navigation/TopLevelDestination.kt | 2 +- .../CrisisCleanupInterceptorProvider.kt | 2 +- .../com/crisiscleanup/ui/CrisisCleanupApp.kt | 57 +++-- .../ui/CrisisCleanupAppHeaderUiState.kt | 2 +- .../crisiscleanup/ui/CrisisCleanupAppState.kt | 4 +- .../core/common/AndroidResourceProvider.kt | 4 +- .../com/crisiscleanup/core/common/AppEnv.kt | 2 +- .../core/common/AppMemoryStats.kt | 2 +- .../core/common/AppVersionProvider.kt | 5 +- .../core/common/CollectionUtil.kt | 2 +- .../crisiscleanup/core/common/ContextUtil.kt | 2 +- .../com/crisiscleanup/core/common/DateUtil.kt | 2 +- .../com/crisiscleanup/core/common/FlowUtil.kt | 6 +- .../core/common/HaversineDistance.kt | 6 +- .../core/common/InputValidator.kt | 9 +- .../core/common/KeyTranslator.kt | 14 +- .../core/common/LocationProvider.kt | 2 +- .../core/common/NavigationObserver.kt | 2 +- .../core/common/PermissionManager.kt | 2 +- .../core/common/PhoneNumberUtil.kt | 2 +- .../com/crisiscleanup/core/common/TextUtil.kt | 2 +- .../core/common/UuidGenerator.kt | 2 +- .../core/common/VisualAlertManager.kt | 2 +- .../core/common/WorksiteLocationEditor.kt | 2 +- .../core/common/di/ApplicationModule.kt | 12 +- .../core/common/di/CoroutineScopesModule.kt | 4 +- .../core/common/di/DispatchersModule.kt | 2 +- .../core/common/di/IdGeneratorModule.kt | 2 +- .../core/common/event/AuthEventBus.kt | 2 +- .../common/event/TrimMemoryEventManager.kt | 2 +- .../core/common/InputValidatorTest.kt | 2 +- .../core/common/PhoneNumberUtilTest.kt | 2 +- .../core/commoncase/model/Worksite.kt | 2 +- .../commoncase/ui/ExistingWorksitesList.kt | 10 +- .../commoncase/ui/IncidentDropdownSelect.kt | 8 +- .../data/IncidentOrganizationsDataCache.kt | 4 +- .../core/data/IncidentOrganizationsSyncer.kt | 6 +- .../core/data/IncidentSelectManager.kt | 2 +- .../core/data/IncidentWorksitesFullSyncer.kt | 21 +- .../core/data/IncidentWorksitesSyncer.kt | 4 +- .../crisiscleanup/core/data/SyncUtilities.kt | 14 +- .../crisiscleanup/core/data/di/DataModule.kt | 2 +- .../model/IncidentNetworkDataPageRequest.kt | 2 +- .../data/model/NetworkCaseHistoryEvent.kt | 2 +- .../core/data/model/NetworkFile.kt | 2 +- .../core/data/model/NetworkIncident.kt | 2 +- .../data/model/NetworkIncidentOrganization.kt | 25 +- .../core/data/model/NetworkLanguage.kt | 2 +- .../core/data/model/NetworkPersonContact.kt | 2 +- .../core/data/model/NetworkWorkType.kt | 2 +- .../core/data/model/NetworkWorkTypeRequest.kt | 2 +- .../data/model/NetworkWorkTypeStatusFull.kt | 2 +- .../core/data/model/NetworkWorksite.kt | 2 +- .../data/model/PopulatedWorksiteMapVisual.kt | 32 +-- .../crisiscleanup/core/data/model/SyncLog.kt | 2 +- .../core/data/model/WorksiteLocalImage.kt | 2 +- .../data/repository/AccountDataRefresher.kt | 2 +- .../data/repository/CaseHistoryRepository.kt | 2 +- .../data/repository/CasesFilterRepository.kt | 2 +- .../CrisisCleanupAccountDataRepository.kt | 8 +- .../DatabaseManagementRepository.kt | 2 +- .../data/repository/IncidentsRepository.kt | 2 +- .../LanguageTranslationsRepository.kt | 2 +- .../data/repository/LocalImageRepository.kt | 9 +- .../data/repository/LocationsRepository.kt | 2 +- .../OfflineFirstIncidentsRepository.kt | 6 +- .../OfflineFirstLocationsRepository.kt | 2 +- .../repository/OrganizationsRepository.kt | 2 +- .../repository/SearchWorksiteRepository.kt | 6 +- .../core/data/repository/SyncLogRepository.kt | 4 +- .../core/data/repository/UsersRepository.kt | 2 +- .../repository/WorksiteChangeRepository.kt | 10 +- .../data/repository/WorksitesRepository.kt | 2 +- .../repository/fake/FakeAccountRepository.kt | 7 +- .../util/ConnectivityManagerNetworkMonitor.kt | 15 +- .../data/util/IncidentDataPullReporter.kt | 4 +- .../CrisisCleanupAccountDataRepositoryTest.kt | 2 +- ...eFirstLocalAppPreferencesRepositoryTest.kt | 10 +- .../core/database/MigrationTest.kt | 6 +- .../crisiscleanup/core/database/TestUtil.kt | 6 +- .../core/database/WorksiteTestUtil.kt | 2 +- .../database/dao/IncidentDaoFormFieldTest.kt | 6 +- .../core/database/dao/IncidentDaoTest.kt | 22 +- .../core/database/dao/LanguageDaoTest.kt | 20 +- .../core/database/dao/LocationDaoTest.kt | 14 +- .../core/database/dao/WorkTypeDaoTest.kt | 6 +- .../dao/WorkTypeTransferRequestDaoTest.kt | 20 +- .../database/dao/WorksiteChangeDaoTest.kt | 85 ++++--- .../dao/WorksiteChangeTransferDaoTest.kt | 18 +- .../dao/WorksiteChangeUpdateSyncTest.kt | 37 +-- .../core/database/dao/WorksiteDaoTest.kt | 3 +- .../dao/WorksiteFormDataFlagNoteTest.kt | 42 +++- .../core/database/dao/WorksiteSyncFillTest.kt | 13 +- .../core/database/dao/WorksiteWorkTypeTest.kt | 8 +- .../database/model/CaseNumberOrderTest.kt | 2 +- .../database/model/CoordinateGridQueryTest.kt | 2 +- .../core/database/DatabaseMigration.kt | 2 +- .../core/database/dao/CaseHistoryDao.kt | 2 +- .../core/database/dao/CaseHistoryDaoPlus.kt | 2 +- .../core/database/dao/IncidentDao.kt | 10 +- .../core/database/dao/IncidentDaoPlus.kt | 2 +- .../database/dao/IncidentOrganizationDao.kt | 2 +- .../dao/IncidentOrganizationDaoPlus.kt | 2 +- .../core/database/dao/LanguageDao.kt | 4 +- .../core/database/dao/LanguageDaoPlus.kt | 2 +- .../core/database/dao/LocalImageDao.kt | 8 +- .../core/database/dao/LocalImageDaoPlus.kt | 2 +- .../core/database/dao/LocationDao.kt | 2 +- .../core/database/dao/LocationDaoPlus.kt | 17 +- .../core/database/dao/NetworkFileDao.kt | 8 +- .../core/database/dao/PersonContactDao.kt | 4 +- .../core/database/dao/PersonContactDaoPlus.kt | 2 +- .../core/database/dao/RecentWorksiteDao.kt | 6 +- .../core/database/dao/SyncLogDao.kt | 2 +- .../core/database/dao/WorkTypeDao.kt | 10 +- .../core/database/dao/WorkTypeStatusDao.kt | 2 +- .../dao/WorkTypeTransferRequestDao.kt | 12 +- .../core/database/dao/WorksiteChangeDao.kt | 10 +- .../database/dao/WorksiteChangeDaoPlus.kt | 71 ++++-- .../core/database/dao/WorksiteDao.kt | 1 - .../core/database/dao/WorksiteDaoPlus.kt | 48 ++-- .../core/database/dao/WorksiteFlagDao.kt | 10 +- .../core/database/dao/WorksiteFormDataDao.kt | 4 +- .../core/database/dao/WorksiteNoteDao.kt | 8 +- .../core/database/dao/WorksiteSyncStatDao.kt | 12 +- .../core/database/dao/fts/IncidentFts.kt | 6 +- .../core/database/dao/fts/OrganizationFts.kt | 2 +- .../core/database/dao/fts/WorksiteTextFts.kt | 14 +- .../core/database/di/DaoModule.kt | 2 +- .../core/database/di/DatabaseModule.kt | 2 +- .../model/BoundedSyncedWorksiteIds.kt | 2 +- .../database/model/CaseHistoryEventEntity.kt | 4 +- .../core/database/model/CasesFilter.kt | 11 +- .../database/model/CoordinateGridQuery.kt | 16 +- .../core/database/model/IncidentEntity.kt | 18 +- .../model/LanguageTranslationEntity.kt | 2 +- .../core/database/model/LocationEntity.kt | 4 +- .../core/database/model/NetworkFileEntity.kt | 2 +- .../model/NetworkFileLocalImageEntity.kt | 2 +- .../database/model/PersonContactEntity.kt | 4 +- .../model/PopulatedCaseHistoryEvent.kt | 2 +- .../core/database/model/PopulatedEntityIds.kt | 2 +- .../model/PopulatedFilterDataWorksite.kt | 2 +- .../core/database/model/PopulatedIncident.kt | 8 +- .../model/PopulatedIncidentOrganization.kt | 2 +- .../model/PopulatedIncidentSyncStats.kt | 2 +- .../database/model/PopulatedLocalImage.kt | 2 +- .../database/model/PopulatedLocalWorksite.kt | 18 +- .../core/database/model/PopulatedLocation.kt | 2 +- .../PopulatedPersonContactOrganization.kt | 4 +- .../database/model/PopulatedRecentWorksite.kt | 2 +- .../model/PopulatedTableDataWorksite.kt | 6 +- .../core/database/model/PopulatedWorksite.kt | 4 +- .../database/model/RecentWorksiteEntity.kt | 4 +- .../core/database/model/SyncLogEntity.kt | 4 +- .../database/model/WorkTypeStatusEntity.kt | 2 +- .../core/database/model/Worksite.kt | 2 +- .../database/model/WorksiteChangeEntity.kt | 2 +- .../core/database/model/WorksiteEntities.kt | 2 +- .../core/database/model/WorksiteEntity.kt | 9 +- .../model/WorksiteLocalImageEntity.kt | 4 +- .../database/model/WorksiteSyncStatsEntity.kt | 16 +- .../core/database/util/FtsUtil.kt | 4 +- .../core/datastore/AccountInfoDataSource.kt | 14 +- .../core/datastore/CasesFiltersDataSource.kt | 4 +- .../LocalAppPreferencesDataSource.kt | 5 +- .../core/datastore/SecureDataSource.kt | 4 +- .../core/datastore/di/DataStoreModule.kt | 6 +- .../datastore/AccountInfoDataSourceTest.kt | 2 +- .../AccountInfoProtoSerializerTest.kt | 4 +- .../LocalAppPreferencesDataSourceTest.kt | 2 +- .../UserPreferencesSerializerTest.kt | 2 +- .../core/designsystem/LocalTranslator.kt | 8 +- .../designsystem/component/AlertDialog.kt | 13 +- .../core/designsystem/component/Background.kt | 4 +- .../core/designsystem/component/Button.kt | 9 +- .../core/designsystem/component/Checkbox.kt | 4 +- .../designsystem/component/CollapsibleIcon.kt | 10 +- .../component/DatePickerDialog.kt | 4 +- .../ExplainLocationPermissionDialog.kt | 6 +- .../component/FocusSectionSlider.kt | 6 +- .../core/designsystem/component/HelpDialog.kt | 6 +- .../core/designsystem/component/IconButton.kt | 20 +- .../designsystem/component/IconTextButton.kt | 2 +- .../designsystem/component/LinkifyText.kt | 2 +- .../core/designsystem/component/Navigation.kt | 19 +- .../component/ProgressIndicator.kt | 2 +- .../designsystem/component/RadioButton.kt | 2 +- .../core/designsystem/component/TextArea.kt | 2 +- .../core/designsystem/component/TextField.kt | 40 +-- .../core/designsystem/component/TopAppBar.kt | 24 +- .../core/designsystem/theme/Background.kt | 2 +- .../core/designsystem/theme/Multipreviews.kt | 2 +- .../core/designsystem/theme/StyleModifier.kt | 2 +- .../core/designsystem/theme/Theme.kt | 8 +- .../core/designsystem/theme/Type.kt | 50 ++-- .../src/main/res/font/nunito_sans_bold.xml | 1 - .../main/res/font/nunito_sans_bold_italic.xml | 1 - .../src/main/res/font/nunito_sans_family.xml | 1 - .../src/main/res/values/colors.xml | 1 - .../src/main/res/values/font_certs.xml | 1 - .../src/main/res/values/preloaded_fonts.xml | 1 - .../src/main/res/values/styles.xml | 1 - .../core/domain/LoadIncidentDataUseCase.kt | 9 +- .../CrisisCleanupLocationBoundsConverter.kt | 2 +- .../core/mapmarker/MapCaseDotProvider.kt | 2 +- .../core/mapmarker/MapCaseIconProvider.kt | 2 +- .../core/mapmarker/MapMarkerIconProvider.kt | 4 +- .../mapmarker/MapsIncidentBoundsProvider.kt | 9 +- .../core/mapmarker/WorkTypeIconProvider.kt | 12 +- .../core/mapmarker/di/MapMarkerModule.kt | 8 +- .../core/mapmarker/tiler/BorderTile.kt | 8 +- .../core/mapmarker/ui/MapUtil.kt | 13 +- .../core/mapmarker/util/CoordinatesUtil.kt | 23 +- .../mapmarker/model/TileCoordinatesTest.kt | 2 +- .../core/model/data/AccountData.kt | 4 +- .../core/model/data/CaseStatus.kt | 2 +- .../core/model/data/CasesFilter.kt | 14 +- .../crisiscleanup/core/model/data/Incident.kt | 2 +- .../core/model/data/IncidentDataSyncStats.kt | 4 +- .../core/model/data/IncidentWorksiteCount.kt | 2 +- .../crisiscleanup/core/model/data/Language.kt | 2 +- .../core/model/data/LocationAreaBounds.kt | 2 +- .../model/data/PhotoChangeDataProvider.kt | 2 +- .../core/model/data/SavedWorksiteChange.kt | 2 +- .../core/model/data/SyncAttempt.kt | 6 +- .../core/model/data/TableDataWorksite.kt | 9 +- .../crisiscleanup/core/model/data/WorkType.kt | 2 +- .../model/data/WorksiteChangeSerializer.kt | 2 +- .../core/model/data/WorksiteSyncResult.kt | 32 ++- .../core/model/data/SyncAttemptTest.kt | 2 +- core/network/lint.xml | 16 -- .../core/network/di/FlavoredNetworkModule.kt | 2 +- .../core/network/di/FlavoredNetworkModule.kt | 2 +- .../network/CrisisCleanupNetworkDataSource.kt | 2 +- .../core/network/CrisisCleanupWriteApi.kt | 6 +- .../core/network/fake/FakeAuthApi.kt | 2 +- .../core/network/model/KeyDynamicValuePair.kt | 2 +- .../core/network/model/NetworkAuth.kt | 2 +- .../core/network/model/NetworkCaseHistory.kt | 4 +- .../core/network/model/NetworkError.kt | 9 +- .../core/network/model/NetworkEvent.kt | 2 +- .../core/network/model/NetworkLanguage.kt | 2 +- .../core/network/model/NetworkLocation.kt | 8 +- .../core/network/model/NetworkOrganization.kt | 2 +- .../core/network/model/NetworkShareDetails.kt | 2 +- .../core/network/model/NetworkType.kt | 2 +- .../network/model/NetworkWorkTypeChange.kt | 2 +- .../network/model/NetworkWorkTypeStatus.kt | 2 +- .../core/network/model/NetworkWorksite.kt | 10 +- .../core/network/model/Worksite.kt | 6 +- .../network/model/WorksiteSearchFilter.kt | 18 +- .../network/model/util/InstantSerializer.kt | 2 +- .../core/network/retrofit/AuthApiClient.kt | 2 +- .../core/network/retrofit/DataApiClient.kt | 7 +- .../RequestHeaderCallAdapterFactory.kt | 19 +- .../network/retrofit/RetrofitApiBuilders.kt | 10 +- .../retrofit/TokenAuthenticationHeader.kt | 2 +- .../network/retrofit/WrapResponseHeader.kt | 2 +- .../core/network/retrofit/WriteApiClient.kt | 14 +- .../NetworkWorksiteChangeSerializer.kt | 11 +- .../network/worksitechange/StringChange.kt | 14 +- .../worksitechange/WorksiteChangeProcessor.kt | 104 ++++---- .../worksitechange/WorksiteChangeSet.kt | 10 +- .../WorksiteChangeSetOperator.kt | 40 +-- .../WorksitePhotoChangeSyncer.kt | 2 +- .../worksitechange/WorksiteSnapshot.kt | 25 +- .../core/network/di/FlavoredNetworkModule.kt | 2 +- .../core/network/model/NetworkAuthTest.kt | 11 +- .../network/model/NetworkCaseHistoryTest.kt | 3 +- .../network/model/NetworkFileUploadTest.kt | 6 +- .../network/model/NetworkFormFieldTest.kt | 2 +- .../core/network/model/NetworkIncidentTest.kt | 43 ++-- .../core/network/model/NetworkLanguageTest.kt | 4 +- .../core/network/model/NetworkLocationTest.kt | 12 +- .../network/model/NetworkOrganizationTest.kt | 6 +- .../model/NetworkWorkTypeRequestTest.kt | 4 +- .../model/NetworkWorkTypeStatusTest.kt | 2 +- .../network/model/NetworkWorksitesAllTest.kt | 10 +- .../network/model/NetworkWorksitesFullTest.kt | 10 +- .../network/model/NetworkWorksitesPageTest.kt | 6 +- .../model/NetworkWorksitesSearchTest.kt | 2 +- .../core/network/model/NewestWorkTypesTest.kt | 10 +- .../core/network/model/TestUtil.kt | 40 +-- .../model/util/DynamicValueSerializerTest.kt | 4 +- .../network/worksitechange/ChangeTestUtil.kt | 2 +- .../worksitechange/FormDataChangeTest.kt | 4 +- .../worksitechange/NetworkFlagChangeTest.kt | 13 +- .../network/worksitechange/NewNoteTest.kt | 12 +- .../worksitechange/StringChangeTest.kt | 2 +- .../worksitechange/WorkTypeChangeTest.kt | 36 +-- .../worksitechange/WorksiteCoreChangeTest.kt | 14 +- .../src/main/AndroidManifest.xml | 1 - .../google/android/renderscript/Toolkit.kt | 229 +++++++++--------- .../ScreenshotFeedbackTrigger.kt | 4 +- .../testerfeedback/ShakeFeedbackTrigger.kt | 2 +- .../TesterFeedbackTriggerProvider.kt | 2 +- .../di/AdditionalFeedbackTriggersModule.kt | 2 +- .../FeedbackTriggerProvider.kt | 2 +- .../core/testerfeedbackapi/UserFeedback.kt | 2 +- .../di/FeedbackTriggerModule.kt | 4 +- .../core/testing/model/WorksiteModelUtil.kt | 8 +- .../TestLocalAppPreferencesRepository.kt | 2 +- .../testing/util/TestNavigationObserver.kt | 2 +- .../crisiscleanup/core/ui/AppLayoutArea.kt | 2 +- .../core/ui/JankStatsExtensions.kt | 4 +- .../com/crisiscleanup/core/ui/KeyboardUtil.kt | 2 +- .../core/ui/MapOverlayMessage.kt | 4 +- .../com/crisiscleanup/core/ui/ScrollUtil.kt | 4 +- .../authentication/AccessTokenDecoder.kt | 4 +- .../authentication/AuthenticateScreen.kt | 12 +- .../authentication/AuthenticationViewModel.kt | 6 +- .../src/main/res/values/strings.xml | 1 - .../AuthenticationViewModelTest.kt | 10 +- .../caseeditor/CaseAddFlagViewModel.kt | 16 +- .../caseeditor/CaseEditorDataLoader.kt | 31 ++- .../feature/caseeditor/CaseEditorViewModel.kt | 51 ++-- .../caseeditor/CaseHistoryViewModel.kt | 4 +- .../feature/caseeditor/CaseShareViewModel.kt | 8 +- .../caseeditor/EditCaseBaseViewModel.kt | 2 +- .../caseeditor/EditCaseLocationViewModel.kt | 43 ++-- .../caseeditor/EditableWorksiteProvider.kt | 12 +- .../caseeditor/ExistingCaseViewModel.kt | 51 ++-- .../caseeditor/ExistingWorksiteSelector.kt | 4 +- .../feature/caseeditor/FormDataEditor.kt | 2 +- .../caseeditor/LocationSearchManager.kt | 14 +- .../caseeditor/NetworkRefreshClient.kt | 2 +- .../caseeditor/QueryIncidentsManager.kt | 2 +- .../caseeditor/ResidentNameSearchManager.kt | 4 +- .../feature/caseeditor/RruleExtension.kt | 24 +- .../SingleTransferWorkTypeProvider.kt | 4 +- .../caseeditor/TransferWorkTypeViewModel.kt | 38 ++- .../caseeditor/WrongLocationFlagManager.kt | 4 +- .../feature/caseeditor/model/CaseImage.kt | 2 +- .../caseeditor/model/ExistingCaseLocation.kt | 2 +- .../caseeditor/model/FieldDynamicValue.kt | 4 +- .../caseeditor/model/FormFieldsInputData.kt | 17 +- .../caseeditor/model/IncidentOrganization.kt | 2 +- .../caseeditor/model/LocationInputData.kt | 40 +-- .../caseeditor/model/NotesFlagsInputData.kt | 4 +- .../caseeditor/model/PropertyInputData.kt | 8 +- .../feature/caseeditor/model/Worksite.kt | 6 +- .../feature/caseeditor/model/WorksiteNote.kt | 2 +- .../navigation/CaseEditorNavigation.kt | 9 +- .../feature/caseeditor/ui/CaseEditorScreen.kt | 19 +- .../caseeditor/ui/CaseHistoryScreen.kt | 9 +- .../feature/caseeditor/ui/CaseIncidentView.kt | 4 +- .../feature/caseeditor/ui/ClipboardViews.kt | 11 +- .../caseeditor/ui/DynamicFormCronSelect.kt | 8 +- .../feature/caseeditor/ui/DynamicFormInput.kt | 28 ++- .../caseeditor/ui/EditExistingCaseScreen.kt | 58 +++-- .../feature/caseeditor/ui/EditNoteDialog.kt | 2 +- .../caseeditor/ui/ExistingCaseMediaViews.kt | 12 +- .../caseeditor/ui/ExistingWorkTypeViews.kt | 13 +- .../feature/caseeditor/ui/FormDataScreen.kt | 9 +- .../feature/caseeditor/ui/LocalCaseEditor.kt | 2 +- .../ui/LocationOutOfBoundsDialog.kt | 2 +- .../feature/caseeditor/ui/LocationScreen.kt | 7 +- .../feature/caseeditor/ui/LocationSearch.kt | 6 +- .../caseeditor/ui/MoveLocationOnMapScreen.kt | 9 +- .../feature/caseeditor/ui/NotesFlagsScreen.kt | 20 +- .../caseeditor/ui/PropertyDataScreen.kt | 8 +- .../caseeditor/ui/PropertyNotesFlagsView.kt | 19 +- .../feature/caseeditor/ui/SectionHeader.kt | 11 +- .../feature/caseeditor/ui/ShareCaseScreen.kt | 17 +- .../caseeditor/ui/TransferWorkTypesScreen.kt | 6 +- .../feature/caseeditor/ui/ViewUtil.kt | 2 +- .../caseeditor/ui/WorkTypeStatusOptions.kt | 5 +- .../caseeditor/ui/addflag/AddFlagScreen.kt | 4 +- .../ui/addflag/HighPriorityFlagView.kt | 4 +- .../ui/addflag/ReportAbuseFlagView.kt | 4 +- .../ui/addflag/UpsetClientFlagView.kt | 4 +- .../ui/addflag/WrongIncidentFlagView.kt | 14 +- .../ui/addflag/WrongLocationFlagView.kt | 2 +- .../feature/caseeditor/util/CommonCaseView.kt | 2 +- .../feature/caseeditor/util/WorkTypeUtil.kt | 14 +- .../caseeditor/RruleHumanReadableTextTest.kt | 6 +- .../model/FormDataCopyModifiedTest.kt | 71 +++--- .../LocationInputDataFlagFormDataTest.kt | 40 +-- .../model/WorksiteFormDataChangeTest.kt | 16 +- .../feature/cases/CasesConstant.kt | 2 +- .../feature/cases/CasesQueryStateManager.kt | 2 +- .../feature/cases/CasesSearchViewModel.kt | 10 +- .../feature/cases/CasesTableViewDataLoader.kt | 20 +- .../feature/cases/CasesViewModel.kt | 30 ++- .../feature/cases/MemoryWorksiteProvider.kt | 4 +- .../feature/cases/SelectIncidentViewModel.kt | 2 +- .../feature/cases/di/MapTileModule.kt | 4 +- .../cases/map/CasesMapBoundsManager.kt | 2 +- .../cases/map/CasesMapTileLayerManager.kt | 2 +- .../cases/map/CasesOverviewMapTileRenderer.kt | 7 +- .../feature/cases/map/CoordinateUtil.kt | 13 +- .../feature/cases/map/DrawnDotManager.kt | 4 +- .../cases/navigation/CasesFilterNavigation.kt | 2 +- .../cases/navigation/CasesNavigation.kt | 2 +- .../cases/navigation/CasesSearchNavigation.kt | 2 +- .../feature/cases/ui/CasesActionBar.kt | 7 +- .../feature/cases/ui/CasesFilterScreen.kt | 30 +-- .../feature/cases/ui/CasesScreen.kt | 8 +- .../feature/cases/ui/CasesScreenTableView.kt | 21 +- .../feature/cases/ui/CasesSearchScreen.kt | 9 +- .../feature/cases/ui/FilterButtonBadge.kt | 2 +- .../feature/cases/ui/SelectIncidentScreen.kt | 4 +- .../feature/cases/map/CoordinateUtilTest.kt | 2 +- .../feature/dashboard/DashboardScreen.kt | 10 +- .../feature/dashboard/DashboardViewModel.kt | 3 +- .../feature/mediamanage/ViewImageViewModel.kt | 23 +- .../feature/mediamanage/ui/ViewImageScreen.kt | 13 +- .../crisiscleanup/feature/menu/MenuScreen.kt | 2 +- .../feature/menu/MenuViewModel.kt | 9 +- .../syncinsights/SyncInsightsViewModel.kt | 11 +- .../navigation/SyncInsightsNavigation.kt | 2 +- .../syncinsights/ui/SyncInsightsScreen.kt | 22 +- .../crisiscleanup/feature/team/TeamScreen.kt | 10 +- .../feature/team/TeamViewModel.kt | 3 +- .../userfeedback/UserFeedbackViewModel.kt | 4 +- .../navigation/UserFeedbackNavigation.kt | 3 +- .../userfeedback/ui/UserFeedbackScreen.kt | 14 +- 430 files changed, 2189 insertions(+), 1687 deletions(-) diff --git a/app/src/androidTest/java/com/crisiscleanup/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/crisiscleanup/ExampleInstrumentedTest.kt index f9710e4aa..b69dc732f 100644 --- a/app/src/androidTest/java/com/crisiscleanup/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/crisiscleanup/ExampleInstrumentedTest.kt @@ -19,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext Assert.assertEquals("com.crisiscleanup.demo.debug", appContext.packageName) } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/com/crisiscleanup/ui/CrisisCleanupAppStateTest.kt b/app/src/androidTest/java/com/crisiscleanup/ui/CrisisCleanupAppStateTest.kt index c558a6eab..e63a328dd 100644 --- a/app/src/androidTest/java/com/crisiscleanup/ui/CrisisCleanupAppStateTest.kt +++ b/app/src/androidTest/java/com/crisiscleanup/ui/CrisisCleanupAppStateTest.kt @@ -57,7 +57,7 @@ class CrisisCleanupAppStateTest { windowSizeClass = getCompactWindowClass(), navController = navController, networkMonitor = networkMonitor, - coroutineScope = backgroundScope + coroutineScope = backgroundScope, ) } @@ -88,7 +88,7 @@ class CrisisCleanupAppStateTest { for (i in destinations.indices) { assertEquals( destinations[i], - state.topLevelDestinations[i].name.lowercase(Locale.getDefault()) + state.topLevelDestinations[i].name.lowercase(Locale.getDefault()), ) } } @@ -100,7 +100,7 @@ class CrisisCleanupAppStateTest { windowSizeClass = getCompactWindowClass(), navController = NavHostController(LocalContext.current), networkMonitor = networkMonitor, - coroutineScope = backgroundScope + coroutineScope = backgroundScope, ) } @@ -115,7 +115,7 @@ class CrisisCleanupAppStateTest { windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(800.dp, 800.dp)), navController = NavHostController(LocalContext.current), networkMonitor = networkMonitor, - coroutineScope = backgroundScope + coroutineScope = backgroundScope, ) } @@ -125,13 +125,12 @@ class CrisisCleanupAppStateTest { @Test fun CrisisCleanupAppState_showNavRail_large() = runTest { - composeTestRule.setContent { state = CrisisCleanupAppState( windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(900.dp, 1200.dp)), navController = NavHostController(LocalContext.current), networkMonitor = networkMonitor, - coroutineScope = backgroundScope + coroutineScope = backgroundScope, ) } @@ -141,13 +140,12 @@ class CrisisCleanupAppStateTest { @Test fun stateIsOfflineWhenNetworkMonitorIsOffline() = runTest(UnconfinedTestDispatcher()) { - composeTestRule.setContent { state = CrisisCleanupAppState( windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(900.dp, 1200.dp)), navController = NavHostController(LocalContext.current), networkMonitor = networkMonitor, - coroutineScope = backgroundScope + coroutineScope = backgroundScope, ) } @@ -155,7 +153,7 @@ class CrisisCleanupAppStateTest { networkMonitor.setConnected(false) assertEquals( true, - state.isOffline.value + state.isOffline.value, ) } diff --git a/app/src/main/java/com/crisiscleanup/AndroidLocationProvider.kt b/app/src/main/java/com/crisiscleanup/AndroidLocationProvider.kt index 60155cd35..35350902b 100644 --- a/app/src/main/java/com/crisiscleanup/AndroidLocationProvider.kt +++ b/app/src/main/java/com/crisiscleanup/AndroidLocationProvider.kt @@ -53,4 +53,4 @@ class AndroidLocationProvider @Inject constructor( } return null } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/AndroidPermissionManager.kt b/app/src/main/java/com/crisiscleanup/AndroidPermissionManager.kt index a6f19266b..6ca998a17 100644 --- a/app/src/main/java/com/crisiscleanup/AndroidPermissionManager.kt +++ b/app/src/main/java/com/crisiscleanup/AndroidPermissionManager.kt @@ -37,8 +37,11 @@ class AndroidPermissionManager @Inject constructor( private var activityWr: WeakReference = WeakReference(null) private val screenshotReadPermission = - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) READ_MEDIA_IMAGES - else READ_EXTERNAL_STORAGE + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + READ_MEDIA_IMAGES + } else { + READ_EXTERNAL_STORAGE + } override fun onCreate(owner: LifecycleOwner) { (owner as? ComponentActivity)?.let { activity -> @@ -50,8 +53,11 @@ class AndroidPermissionManager @Inject constructor( // Assume unchanged permission since requested val permission = permissionChanges.value.first val status = - if (isGranted) PermissionStatus.Granted - else PermissionStatus.Denied + if (isGranted) { + PermissionStatus.Granted + } else { + PermissionStatus.Denied + } permissionChanges.value = Pair(permission, status) if (permission == ACCESS_COARSE_LOCATION || permission == ACCESS_FINE_LOCATION) { @@ -67,7 +73,7 @@ class AndroidPermissionManager @Inject constructor( private fun publishLocationPermission() { hasLocationPermission.value = hasPermission(ACCESS_COARSE_LOCATION) || - hasPermission(ACCESS_FINE_LOCATION) + hasPermission(ACCESS_FINE_LOCATION) } private fun hasPermission(permission: String): Boolean { diff --git a/app/src/main/java/com/crisiscleanup/AppVisualAlertManager.kt b/app/src/main/java/com/crisiscleanup/AppVisualAlertManager.kt index fcfdeb7f3..d0cb93002 100644 --- a/app/src/main/java/com/crisiscleanup/AppVisualAlertManager.kt +++ b/app/src/main/java/com/crisiscleanup/AppVisualAlertManager.kt @@ -16,4 +16,4 @@ class AppVisualAlertManager @Inject constructor() : VisualAlertManager { override fun setNonProductionAppAlert(show: Boolean) { showNonProductionAlert.set(show) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/CrisisCleanupAppEnv.kt b/app/src/main/java/com/crisiscleanup/CrisisCleanupAppEnv.kt index c5b1a60ef..8eb9bdf8e 100644 --- a/app/src/main/java/com/crisiscleanup/CrisisCleanupAppEnv.kt +++ b/app/src/main/java/com/crisiscleanup/CrisisCleanupAppEnv.kt @@ -15,4 +15,4 @@ class CrisisCleanupAppEnv @Inject constructor() : AppEnv { block() } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/FirebaseFeedbackReceiver.kt b/app/src/main/java/com/crisiscleanup/FirebaseFeedbackReceiver.kt index 80f7820db..3f9bdd959 100644 --- a/app/src/main/java/com/crisiscleanup/FirebaseFeedbackReceiver.kt +++ b/app/src/main/java/com/crisiscleanup/FirebaseFeedbackReceiver.kt @@ -17,4 +17,4 @@ class FirebaseFeedbackReceiver @Inject constructor( Firebase.appDistribution.startFeedback("Do share O_o") } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/MainActivityViewModel.kt b/app/src/main/java/com/crisiscleanup/MainActivityViewModel.kt index 6b8c626c1..93a12e224 100644 --- a/app/src/main/java/com/crisiscleanup/MainActivityViewModel.kt +++ b/app/src/main/java/com/crisiscleanup/MainActivityViewModel.kt @@ -69,8 +69,11 @@ class MainActivityViewModel @Inject constructor( .map { isAccountExpired.value = !it.areTokensValid - if (it.hasAuthenticated) AuthState.Authenticated(it) - else AuthState.NotAuthenticated + if (it.hasAuthenticated) { + AuthState.Authenticated(it) + } else { + AuthState.NotAuthenticated + } } .stateIn( scope = viewModelScope, @@ -134,4 +137,4 @@ sealed interface AuthState { data object Loading : AuthState data class Authenticated(val accountData: AccountData) : AuthState data object NotAuthenticated : AuthState -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/di/AppModule.kt b/app/src/main/java/com/crisiscleanup/di/AppModule.kt index 9a7c796a9..2f1d6ef80 100644 --- a/app/src/main/java/com/crisiscleanup/di/AppModule.kt +++ b/app/src/main/java/com/crisiscleanup/di/AppModule.kt @@ -38,13 +38,13 @@ interface AppModule { @Singleton @Binds fun bindsCrisisCleanupAuthInterceptorProvider( - provider: CrisisCleanupAuthInterceptorProvider + provider: CrisisCleanupAuthInterceptorProvider, ): AuthInterceptorProvider @Singleton @Binds fun bindsCrisisCleanupInterceptorProvider( - provider: CrisisCleanupInterceptorProvider + provider: CrisisCleanupInterceptorProvider, ): RetrofitInterceptorProvider @Singleton @@ -78,4 +78,4 @@ object AppObjectModule { fun providesContentResolver( @ApplicationContext context: Context, ): ContentResolver = context.contentResolver -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/di/JankStatsModule.kt b/app/src/main/java/com/crisiscleanup/di/JankStatsModule.kt index f019e2ce3..10c2c648c 100644 --- a/app/src/main/java/com/crisiscleanup/di/JankStatsModule.kt +++ b/app/src/main/java/com/crisiscleanup/di/JankStatsModule.kt @@ -31,7 +31,7 @@ object JankStatsModule { @Provides fun providesJankStats( window: Window, - frameListener: JankStats.OnFrameListener + frameListener: JankStats.OnFrameListener, ): JankStats { return JankStats.createAndTrack(window, frameListener) } diff --git a/app/src/main/java/com/crisiscleanup/log/CrisisCleanupAppLogger.kt b/app/src/main/java/com/crisiscleanup/log/CrisisCleanupAppLogger.kt index 92c523433..f5eefb2c3 100644 --- a/app/src/main/java/com/crisiscleanup/log/CrisisCleanupAppLogger.kt +++ b/app/src/main/java/com/crisiscleanup/log/CrisisCleanupAppLogger.kt @@ -41,4 +41,4 @@ class CrisisCleanupAppLogger @Inject constructor( crashlytics.log(message) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/navigation/CrisisCleanupNavigationObserver.kt b/app/src/main/java/com/crisiscleanup/navigation/CrisisCleanupNavigationObserver.kt index 3450848d8..8ca2c9281 100644 --- a/app/src/main/java/com/crisiscleanup/navigation/CrisisCleanupNavigationObserver.kt +++ b/app/src/main/java/com/crisiscleanup/navigation/CrisisCleanupNavigationObserver.kt @@ -23,4 +23,4 @@ class CrisisCleanupNavigationObserver @Inject constructor( override fun onRouteChange(route: String?, arguments: Bundle?) { navigationRoute.value = Pair(navigationRoute.value.second, route) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/navigation/TopLevelDestination.kt b/app/src/main/java/com/crisiscleanup/navigation/TopLevelDestination.kt index ac10fc5aa..a219e22a5 100644 --- a/app/src/main/java/com/crisiscleanup/navigation/TopLevelDestination.kt +++ b/app/src/main/java/com/crisiscleanup/navigation/TopLevelDestination.kt @@ -29,5 +29,5 @@ enum class TopLevelDestination( selectedIcon = ImageVectorIcon(CrisisCleanupIcons.Menu), unselectedIcon = ImageVectorIcon(CrisisCleanupIcons.Menu), titleTranslateKey = "nav.menu", - ) + ), } diff --git a/app/src/main/java/com/crisiscleanup/network/CrisisCleanupInterceptorProvider.kt b/app/src/main/java/com/crisiscleanup/network/CrisisCleanupInterceptorProvider.kt index c6b439a87..2c9d67d88 100644 --- a/app/src/main/java/com/crisiscleanup/network/CrisisCleanupInterceptorProvider.kt +++ b/app/src/main/java/com/crisiscleanup/network/CrisisCleanupInterceptorProvider.kt @@ -280,4 +280,4 @@ class CrisisCleanupAuthInterceptorProvider @Inject constructor() : AuthIntercept } } -private class NetworkAuthException(message: String) : IOException(message) \ No newline at end of file +private class NetworkAuthException(message: String) : IOException(message) diff --git a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupApp.kt b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupApp.kt index 401f61c42..d1c28f358 100644 --- a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupApp.kt +++ b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupApp.kt @@ -94,7 +94,6 @@ fun CrisisCleanupApp( ) { CrisisCleanupBackground { Box(Modifier.fillMaxSize()) { - val snackbarHostState = remember { SnackbarHostState() } val isOffline by appState.isOffline.collectAsStateWithLifecycle() @@ -104,11 +103,13 @@ fun CrisisCleanupApp( LaunchedEffect(isOffline) { val notConnectedMessage = translator("info.no_internet") - if (isOffline) snackbarHostState.showSnackbar( - message = notConnectedMessage, - duration = SnackbarDuration.Indefinite, - withDismissAction = true, - ) + if (isOffline) { + snackbarHostState.showSnackbar( + message = notConnectedMessage, + duration = SnackbarDuration.Indefinite, + withDismissAction = true, + ) + } } val authState by viewModel.authState.collectAsStateWithLifecycle() @@ -222,14 +223,14 @@ private fun AuthenticateContent( .consumeWindowInsets(padding) .windowInsetsPadding( WindowInsets.safeDrawing.only( - WindowInsetsSides.Horizontal - ) + WindowInsetsSides.Horizontal, + ), ), enableBackHandler = enableBackHandler, closeAuthentication = { toggleAuthentication(false) }, isDebug = isDebuggable, ) - } + }, ) } @@ -295,7 +296,7 @@ private fun NavigableContent( destinations = appState.topLevelDestinations, onNavigateToDestination = appState::navigateToTopLevelDestination, currentDestination = appState.currentDestination, - modifier = Modifier.testTag("CrisisCleanupBottomBar") + modifier = Modifier.testTag("CrisisCleanupBottomBar"), ) } @@ -304,7 +305,7 @@ private fun NavigableContent( Spacer( Modifier .fillMaxWidth() - .windowInsetsPadding(windowInsets) + .windowInsetsPadding(windowInsets), ) } }, @@ -315,9 +316,12 @@ private fun NavigableContent( .padding(padding) .consumeWindowInsets(padding) .windowInsetsPadding( - if (isFullscreen) WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal) - else WindowInsets.safeDrawing - ) + if (isFullscreen) { + WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal) + } else { + WindowInsets.safeDrawing + }, + ), ) { if (showNavigation && appState.shouldShowNavRail) { CrisisCleanupNavRail( @@ -326,7 +330,7 @@ private fun NavigableContent( currentDestination = appState.currentDestination, modifier = Modifier .testTag("CrisisCleanupNavRail") - .safeDrawingPadding() + .safeDrawingPadding(), ) } @@ -336,10 +340,14 @@ private fun NavigableContent( if (!showNavigation && snackbarHostState.currentSnackbarData != null && keyboardVisibility == ScreenKeyboardVisibility.NotVisible - ) 64.dp else 0.dp + ) { + 64.dp + } else { + 0.dp + } CompositionLocalProvider( - LocalAppLayout provides AppLayoutArea(snackbarHostState) + LocalAppLayout provides AppLayoutArea(snackbarHostState), ) { CrisisCleanupNavHost( navController = appState.navController, @@ -351,7 +359,7 @@ private fun NavigableContent( Spacer( Modifier .height(snackbarAreaHeight) - .animateContentSize() + .animateContentSize(), ) } } @@ -420,14 +428,17 @@ private fun AppHeader( isLoading = isAppHeaderLoading, ) } - } + }, ) } @Composable private fun TopLevelDestination.Icon(isSelected: Boolean, description: String) { - val icon = if (isSelected) selectedIcon - else unselectedIcon + val icon = if (isSelected) { + selectedIcon + } else { + unselectedIcon + } when (icon) { is ImageVectorIcon -> Icon( imageVector = icon.imageVector, @@ -473,7 +484,7 @@ private fun CrisisCleanupBottomBar( destinations: List, onNavigateToDestination: (TopLevelDestination) -> Unit, currentDestination: NavDestination?, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val translator = LocalAppTranslator.current CrisisCleanupNavigationBar(modifier = modifier) { @@ -484,7 +495,7 @@ private fun CrisisCleanupBottomBar( selected = selected, onClick = { onNavigateToDestination(destination) }, icon = { destination.Icon(selected, title) }, - modifier = Modifier.testTag("navItem_${title}"), + modifier = Modifier.testTag("navItem_$title"), label = { Text( title, diff --git a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppHeaderUiState.kt b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppHeaderUiState.kt index a5d08070a..2bdb470e6 100644 --- a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppHeaderUiState.kt +++ b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppHeaderUiState.kt @@ -28,4 +28,4 @@ class CrisisCleanupAppHeaderUiState @Inject constructor( override fun setTitle(title: String) { this.title.value = title } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppState.kt b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppState.kt index 6a7b30902..105188d5f 100644 --- a/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppState.kt +++ b/app/src/main/java/com/crisiscleanup/ui/CrisisCleanupAppState.kt @@ -45,7 +45,7 @@ fun rememberCrisisCleanupAppState( networkMonitor: NetworkMonitor, navigationObserver: NavigationObserver, coroutineScope: CoroutineScope = rememberCoroutineScope(), - navController: NavHostController = rememberNavController() + navController: NavHostController = rememberNavController(), ): CrisisCleanupAppState { NavigationTrackingSideEffect(navController) NavigationObserverSideEffect(navController, navigationObserver) @@ -97,7 +97,7 @@ class CrisisCleanupAppState( .stateIn( scope = coroutineScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = false + initialValue = false, ) val hideLoginAlert: Boolean diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/AndroidResourceProvider.kt b/core/common/src/main/java/com/crisiscleanup/core/common/AndroidResourceProvider.kt index e27d39ea6..1e2a6c0da 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/AndroidResourceProvider.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/AndroidResourceProvider.kt @@ -24,7 +24,7 @@ interface AndroidResourceProvider { @Singleton class ApplicationResourceProvider @Inject constructor( - @ApplicationContext private val context: Context + @ApplicationContext private val context: Context, ) : AndroidResourceProvider { override val resources: Resources = context.resources @@ -38,4 +38,4 @@ class ApplicationResourceProvider @Inject constructor( override fun getDrawable(drawableId: Int, theme: Resources.Theme?): Drawable = resources.getDrawable(drawableId, theme) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/AppEnv.kt b/core/common/src/main/java/com/crisiscleanup/core/common/AppEnv.kt index 4deade34c..f36c97c13 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/AppEnv.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/AppEnv.kt @@ -5,4 +5,4 @@ interface AppEnv { val isProduction: Boolean val isNotProduction: Boolean fun runInNonProd(block: () -> Unit) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/AppMemoryStats.kt b/core/common/src/main/java/com/crisiscleanup/core/common/AppMemoryStats.kt index fd1e1d94d..fcb456ec7 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/AppMemoryStats.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/AppMemoryStats.kt @@ -27,4 +27,4 @@ class AndroidAppMemoryStats @Inject constructor( override val availableMemory: Int get() = activityManager.memoryClass -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/AppVersionProvider.kt b/core/common/src/main/java/com/crisiscleanup/core/common/AppVersionProvider.kt index 20ceb47f9..302913d9b 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/AppVersionProvider.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/AppVersionProvider.kt @@ -28,7 +28,8 @@ class AndroidAppVersionProvider @Inject constructor( private val packageInfo: PackageInfo get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { context.packageManager.getPackageInfo( - context.packageName, PackageInfoFlags.of(0) + context.packageName, + PackageInfoFlags.of(0), ) } else { context.packageManager.getPackageInfo(context.packageName, 0) @@ -46,4 +47,4 @@ class AndroidAppVersionProvider @Inject constructor( override val versionName: String get() = version.second -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/CollectionUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/CollectionUtil.kt index 493a80643..c3028cebd 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/CollectionUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/CollectionUtil.kt @@ -14,4 +14,4 @@ fun Collection.split(predicate: (t: T) -> Boolean): Pair, C } } return Pair(trueBucket, falseBucket) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/ContextUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/ContextUtil.kt index f34ee043e..06aadf5ac 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/ContextUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/ContextUtil.kt @@ -21,4 +21,4 @@ fun Context.openMaps(locationQuery: String) { } catch (t: Throwable) { Log.w("open-maps", t.message ?: "Unknown exception") } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/DateUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/DateUtil.kt index 280466efd..9bae2e92f 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/DateUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/DateUtil.kt @@ -15,4 +15,4 @@ val Instant.noonTime: Instant val javaDate = toJavaInstant() val startOfDay = javaDate.truncatedTo(ChronoUnit.DAYS) return startOfDay.toKotlinInstant().plus(12.hours) - } \ No newline at end of file + } diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/FlowUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/FlowUtil.kt index f701b3754..a662955a7 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/FlowUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/FlowUtil.kt @@ -89,7 +89,7 @@ fun combine( ): Flow = kCombine( kCombine(flow, flow2, flow3, ::Triple), kCombine(flow4, flow5, ::Pair), - kCombine(flow6, flow7, ::Pair) + kCombine(flow6, flow7, ::Pair), ) { t1, t2, t3 -> transform( t1.first, @@ -115,7 +115,7 @@ fun combine( ): Flow = kCombine( kCombine(flow, flow2, flow3, ::Triple), kCombine(flow4, flow5, flow6, ::Triple), - kCombine(flow7, flow8, ::Pair) + kCombine(flow7, flow8, ::Pair), ) { t1, t2, t3 -> transform( t1.first, @@ -143,7 +143,7 @@ fun combine( ): Flow = kCombine( kCombine(flow, flow2, flow3, ::Triple), kCombine(flow4, flow5, flow6, ::Triple), - kCombine(flow7, flow8, flow9, ::Triple) + kCombine(flow7, flow8, flow9, ::Triple), ) { t1, t2, t3 -> transform( t1.first, diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/HaversineDistance.kt b/core/common/src/main/java/com/crisiscleanup/core/common/HaversineDistance.kt index b5c1323cc..a29462a95 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/HaversineDistance.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/HaversineDistance.kt @@ -29,8 +29,10 @@ val Double.kmToMiles: Double * @see kmToMiles */ fun haversineDistance( - latA: Double, lngA: Double, - latB: Double, lngB: Double, + latA: Double, + lngA: Double, + latB: Double, + lngB: Double, ): Double { val deltaLat = latA - latB val deltaLng = lngA - lngB diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/InputValidator.kt b/core/common/src/main/java/com/crisiscleanup/core/common/InputValidator.kt index ad7848b1c..cfa724856 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/InputValidator.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/InputValidator.kt @@ -21,8 +21,11 @@ class CommonInputValidator @Inject constructor() : InputValidator { Patterns.EMAIL_ADDRESS.matcher(emailAddress).matches() override fun validatePhoneNumber(value: String, allowSpaces: Boolean) = - if (allowSpaces) phoneNumbersAndSpacesRegex.matches(value) - else phoneNumbersRegex.matches(value) + if (allowSpaces) { + phoneNumbersAndSpacesRegex.matches(value) + } else { + phoneNumbersRegex.matches(value) + } override fun hasEmailAddress(text: String) = commonEmailRegex.containsMatchIn(text) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/KeyTranslator.kt b/core/common/src/main/java/com/crisiscleanup/core/common/KeyTranslator.kt index ac51a1ec9..6afb5453b 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/KeyTranslator.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/KeyTranslator.kt @@ -27,7 +27,13 @@ class AndroidResourceTranslator @Inject constructor( override fun translate(phraseKey: String) = keyTranslator.translate(phraseKey) override fun translate(phraseKey: String, @StringRes fallbackResId: Int) = - keyTranslator.translate(phraseKey) ?: (if (fallbackResId != 0) context.getString( - fallbackResId - ) else phraseKey) -} \ No newline at end of file + keyTranslator.translate(phraseKey) ?: ( + if (fallbackResId != 0) { + context.getString( + fallbackResId, + ) + } else { + phraseKey + } + ) +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/LocationProvider.kt b/core/common/src/main/java/com/crisiscleanup/core/common/LocationProvider.kt index 34dac6c0b..aaa114ec7 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/LocationProvider.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/LocationProvider.kt @@ -10,4 +10,4 @@ interface LocationProvider { * Latitude, longitude */ suspend fun getLocation(): Pair? -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/NavigationObserver.kt b/core/common/src/main/java/com/crisiscleanup/core/common/NavigationObserver.kt index 0a34bcfa9..fb294cbd5 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/NavigationObserver.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/NavigationObserver.kt @@ -4,4 +4,4 @@ import android.os.Bundle interface NavigationObserver { fun onRouteChange(route: String?, arguments: Bundle?) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/PermissionManager.kt b/core/common/src/main/java/com/crisiscleanup/core/common/PermissionManager.kt index b833182f8..07ddcf0d9 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/PermissionManager.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/PermissionManager.kt @@ -32,4 +32,4 @@ enum class PermissionStatus { ShowRationale, Requesting, Undefined, -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/PhoneNumberUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/PhoneNumberUtil.kt index 93a958282..8c5b3291a 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/PhoneNumberUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/PhoneNumberUtil.kt @@ -54,4 +54,4 @@ object PhoneNumberUtil { data class ParsedPhoneNumber( val source: String, val parsedNumbers: List, -) \ No newline at end of file +) diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/TextUtil.kt b/core/common/src/main/java/com/crisiscleanup/core/common/TextUtil.kt index 220d8d62d..c0bfbbc0d 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/TextUtil.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/TextUtil.kt @@ -13,4 +13,4 @@ fun Collection.combineTrimText(separator: String = ", ") = filterNotBlankTrim().joinToString(separator) fun String.urlEncode(): String = URLEncoder.encode(this, StandardCharsets.UTF_8.toString()) -fun String.urlDecode(): String = URLDecoder.decode(this, StandardCharsets.UTF_8.toString()) \ No newline at end of file +fun String.urlDecode(): String = URLDecoder.decode(this, StandardCharsets.UTF_8.toString()) diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/UuidGenerator.kt b/core/common/src/main/java/com/crisiscleanup/core/common/UuidGenerator.kt index e9f81680d..78d8f5ad0 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/UuidGenerator.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/UuidGenerator.kt @@ -9,4 +9,4 @@ interface UuidGenerator { class JavaUuidGenerator @Inject constructor() : UuidGenerator { override fun uuid() = UUID.randomUUID().toString() -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/VisualAlertManager.kt b/core/common/src/main/java/com/crisiscleanup/core/common/VisualAlertManager.kt index 8b4d6750b..0b463b4e7 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/VisualAlertManager.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/VisualAlertManager.kt @@ -3,4 +3,4 @@ package com.crisiscleanup.core.common interface VisualAlertManager { fun takeNonProductionAppAlert(): Boolean fun setNonProductionAppAlert(show: Boolean) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/WorksiteLocationEditor.kt b/core/common/src/main/java/com/crisiscleanup/core/common/WorksiteLocationEditor.kt index 0ad265158..4bc7fb9a5 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/WorksiteLocationEditor.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/WorksiteLocationEditor.kt @@ -2,4 +2,4 @@ package com.crisiscleanup.core.common interface WorksiteLocationEditor { fun takeEditedLocation(): Pair? -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/di/ApplicationModule.kt b/core/common/src/main/java/com/crisiscleanup/core/common/di/ApplicationModule.kt index 4c611e30d..030f2261f 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/di/ApplicationModule.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/di/ApplicationModule.kt @@ -15,18 +15,18 @@ interface ApplicationModule { @Singleton @Binds fun bindsAndroidResourceProvider( - resourceProvider: ApplicationResourceProvider + resourceProvider: ApplicationResourceProvider, ): AndroidResourceProvider @Binds fun bindsInputValidator( - validator: CommonInputValidator + validator: CommonInputValidator, ): InputValidator @Singleton @Binds fun bindsTrimMemoryEventManager( - manager: CrisisCleanupTrimMemoryEventManager + manager: CrisisCleanupTrimMemoryEventManager, ): TrimMemoryEventManager @Binds @@ -34,11 +34,11 @@ interface ApplicationModule { @Binds fun bindsAppVersionProvider( - versionProvider: AndroidAppVersionProvider + versionProvider: AndroidAppVersionProvider, ): AppVersionProvider @Binds fun bindsTranslator( - translator: AndroidResourceTranslator + translator: AndroidResourceTranslator, ): KeyResourceTranslator -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/di/CoroutineScopesModule.kt b/core/common/src/main/java/com/crisiscleanup/core/common/di/CoroutineScopesModule.kt index 01ee74705..8e740d2be 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/di/CoroutineScopesModule.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/di/CoroutineScopesModule.kt @@ -23,6 +23,6 @@ object CoroutinesScopesModule { @ApplicationScope @Provides fun providesApplicationScope( - @Dispatcher(Default) defaultDispatcher: CoroutineDispatcher + @Dispatcher(Default) defaultDispatcher: CoroutineDispatcher, ): CoroutineScope = CoroutineScope(SupervisorJob() + defaultDispatcher) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/di/DispatchersModule.kt b/core/common/src/main/java/com/crisiscleanup/core/common/di/DispatchersModule.kt index 459a88d26..1d333821a 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/di/DispatchersModule.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/di/DispatchersModule.kt @@ -19,4 +19,4 @@ object DispatchersModule { @Provides @Dispatcher(CrisisCleanupDispatchers.IO) fun providesIODispatcher(): CoroutineDispatcher = Dispatchers.IO -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/di/IdGeneratorModule.kt b/core/common/src/main/java/com/crisiscleanup/core/common/di/IdGeneratorModule.kt index 4bc3c74f9..2a20e7489 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/di/IdGeneratorModule.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/di/IdGeneratorModule.kt @@ -12,4 +12,4 @@ import dagger.hilt.components.SingletonComponent interface IdGeneratorModule { @Binds fun bindsUuidGenerator(generator: JavaUuidGenerator): UuidGenerator -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/event/AuthEventBus.kt b/core/common/src/main/java/com/crisiscleanup/core/common/event/AuthEventBus.kt index cc83d6207..e3acfc01f 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/event/AuthEventBus.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/event/AuthEventBus.kt @@ -35,4 +35,4 @@ class CrisisCleanupAuthEventBus @Inject constructor( refreshedTokens.emit(true) } } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/crisiscleanup/core/common/event/TrimMemoryEventManager.kt b/core/common/src/main/java/com/crisiscleanup/core/common/event/TrimMemoryEventManager.kt index 5f36ab494..0cd049463 100644 --- a/core/common/src/main/java/com/crisiscleanup/core/common/event/TrimMemoryEventManager.kt +++ b/core/common/src/main/java/com/crisiscleanup/core/common/event/TrimMemoryEventManager.kt @@ -35,4 +35,4 @@ class CrisisCleanupTrimMemoryEventManager @Inject constructor() : TrimMemoryEven // TODO Handle exceptions properly listeners.values.onEach { it.get()?.onTrimMemory(level) } } -} \ No newline at end of file +} diff --git a/core/common/src/test/java/com/crisiscleanup/core/common/InputValidatorTest.kt b/core/common/src/test/java/com/crisiscleanup/core/common/InputValidatorTest.kt index 0ceae997b..0837dca3d 100644 --- a/core/common/src/test/java/com/crisiscleanup/core/common/InputValidatorTest.kt +++ b/core/common/src/test/java/com/crisiscleanup/core/common/InputValidatorTest.kt @@ -35,4 +35,4 @@ class InputValidatorTest { assertTrue(inputValidator.hasEmailAddress(s)) } } -} \ No newline at end of file +} diff --git a/core/common/src/test/java/com/crisiscleanup/core/common/PhoneNumberUtilTest.kt b/core/common/src/test/java/com/crisiscleanup/core/common/PhoneNumberUtilTest.kt index 2a865cd1b..df81ba498 100644 --- a/core/common/src/test/java/com/crisiscleanup/core/common/PhoneNumberUtilTest.kt +++ b/core/common/src/test/java/com/crisiscleanup/core/common/PhoneNumberUtilTest.kt @@ -47,4 +47,4 @@ class PhoneNumberUtilTest { ) assertEquals(expected, actual) } -} \ No newline at end of file +} diff --git a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/model/Worksite.kt b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/model/Worksite.kt index f33a66d7f..c90638c36 100644 --- a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/model/Worksite.kt +++ b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/model/Worksite.kt @@ -21,4 +21,4 @@ val Worksite.addressQuery: Triple val addressText = fullAddress val locationQuery = "geo:$coordinates?q=$addressText" return Triple(addressText, geoQuery, locationQuery) - } \ No newline at end of file + } diff --git a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/ExistingWorksitesList.kt b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/ExistingWorksitesList.kt index d9bad2b3c..a74a26e62 100644 --- a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/ExistingWorksitesList.kt +++ b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/ExistingWorksitesList.kt @@ -39,7 +39,7 @@ private fun CaseView( Column( Modifier .weight(1f) - .listRowItemStartPadding() + .listRowItemStartPadding(), ) { with(summary) { Text(listOf(name, caseNumber).combineTrimText()) @@ -67,9 +67,9 @@ fun LazyListScope.listCaseResults( .testTag("workSearchResultItem_${it.listItemKey}") .clickable( enabled = isEditable, - onClick = { onCaseSelect(it) } + onClick = { onCaseSelect(it) }, ) - .listItemOptionPadding() + .listItemOptionPadding(), ) } } @@ -86,10 +86,10 @@ fun ExistingCaseLocationsDropdownItems( caseLocation, Modifier .fillMaxWidth() - .optionItemPadding() + .optionItemPadding(), ) }, onClick = { onCaseSelect(caseLocation) }, ) } -} \ No newline at end of file +} diff --git a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/IncidentDropdownSelect.kt b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/IncidentDropdownSelect.kt index 63fe15152..431c19cb4 100644 --- a/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/IncidentDropdownSelect.kt +++ b/core/commoncase/src/main/java/com/crisiscleanup/core/commoncase/ui/IncidentDropdownSelect.kt @@ -41,7 +41,7 @@ fun IncidentDropdownSelect( ) { val contentColor = LocalContentColor.current CompositionLocalProvider( - LocalContentColor provides if (enabled) contentColor else contentColor.disabledAlpha() + LocalContentColor provides if (enabled) contentColor else contentColor.disabledAlpha(), ) { DisasterIcon(disasterIconResId, title) TruncatedAppBarText( @@ -55,15 +55,15 @@ fun IncidentDropdownSelect( AnimatedVisibility( visible = isLoading, enter = fadeIn(), - exit = fadeOut() + exit = fadeOut(), ) { CircularProgressIndicator( modifier .testTag("incidentSelectLoadingIndicator") .size(48.dp) - .padding(8.dp) + .padding(8.dp), ) } } } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsDataCache.kt b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsDataCache.kt index d90e29e3a..8d52b6e00 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsDataCache.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsDataCache.kt @@ -46,7 +46,7 @@ class IncidentOrganizationsDataFileCache @Inject constructor( override fun loadOrganizations( incidentId: Long, dataIndex: Int, - expectedCount: Int + expectedCount: Int, ): IncidentOrganizationsPageRequest? { val cacheFileName = cacheFileName(incidentId, dataIndex) val cacheFile = File(context.cacheDir, cacheFileName) @@ -100,4 +100,4 @@ class IncidentOrganizationsDataFileCache @Inject constructor( logger.logDebug("Error deleting cache file $cacheFileName. ${e.message}") } } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsSyncer.kt b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsSyncer.kt index e313e2d4a..12a7d1c3d 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsSyncer.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentOrganizationsSyncer.kt @@ -38,7 +38,7 @@ class IncidentOrganizationsSyncer @Inject constructor( override suspend fun sync(incidentId: Long) { val statsUpdater = IncidentDataPullStatsUpdater( - updatePullStats = { stats -> dataPullStats.value = stats } + updatePullStats = { stats -> dataPullStats.value = stats }, ).also { it.beginPull(incidentId) } @@ -149,7 +149,7 @@ class IncidentOrganizationsSyncer @Inject constructor( targetCount = syncCount, successfulSync = syncStart, appBuildVersionCode = appVersionProvider.versionCode, - ) + ), ) } @@ -159,4 +159,4 @@ class IncidentOrganizationsSyncer @Inject constructor( personContactDao.trimIncidentOrganizationContacts() } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentSelectManager.kt b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentSelectManager.kt index 2043bf14f..cb4adcc4a 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentSelectManager.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentSelectManager.kt @@ -49,4 +49,4 @@ interface IncidentSelectModule { @Singleton @Binds fun bindsIncidentSelector(selector: IncidentSelectManager): IncidentSelector -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesFullSyncer.kt b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesFullSyncer.kt index 6c50c6ed3..5eceb45c7 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesFullSyncer.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesFullSyncer.kt @@ -216,7 +216,7 @@ class IncidentWorksitesFullSyncer @Inject constructor( queryBounds, ) { val syncWorksite = now - it.syncedAt > recentSyncDuration || - it.formData.isEmpty() + it.formData.isEmpty() if (!syncWorksite) { skipCount++ } @@ -225,11 +225,16 @@ class IncidentWorksitesFullSyncer @Inject constructor( val splitBoundedIds = boundedIds.size > byIdPageCount val networkQueryIds = - if (splitBoundedIds) boundedIds.subList(0, byIdPageCount) - else boundedIds - boundedIds = if (boundedIds.size > byIdPageCount) + if (splitBoundedIds) { + boundedIds.subList(0, byIdPageCount) + } else { + boundedIds + } + boundedIds = if (boundedIds.size > byIdPageCount) { boundedIds.subList(byIdPageCount, boundedIds.size).toMutableList() - else mutableListOf() + } else { + mutableListOf() + } if (networkQueryIds.isEmpty()) { continue @@ -287,8 +292,8 @@ private suspend fun IncidentWorksitesFullSyncStatsEntity.asQueryParameters( val locationChangeLength = searchRadius * 0.5 val hasLocation = abs(latitude) <= 90 && abs(longitude) <= 180 && searchRadius > 0 val hasLocationChange = hasLocation && - abs(latitude - this.latitude) * 111 > locationChangeLength && - abs(longitude - this.longitude) * 111 > locationChangeLength + abs(latitude - this.latitude) * 111 > locationChangeLength && + abs(longitude - this.longitude) * 111 > locationChangeLength return LocationQueryParameters( hasLocation, @@ -297,4 +302,4 @@ private suspend fun IncidentWorksitesFullSyncStatsEntity.asQueryParameters( longitude, searchRadius, ) -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesSyncer.kt b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesSyncer.kt index 1a656075d..730e35f9b 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesSyncer.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/IncidentWorksitesSyncer.kt @@ -63,7 +63,7 @@ class IncidentWorksitesSyncer @Inject constructor( syncStats: IncidentDataSyncStats, ) { val statsUpdater = IncidentDataPullStatsUpdater( - updatePullStats = { stats -> dataPullStats.value = stats } + updatePullStats = { stats -> dataPullStats.value = stats }, ).also { it.beginPull(incidentId) } @@ -108,7 +108,7 @@ class IncidentWorksitesSyncer @Inject constructor( pageCount, networkPullPage, syncCount, - updatedAfter + updatedAfter, ) networkPullPage++ requestingCount += pageCount diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/SyncUtilities.kt b/core/data/src/main/java/com/crisiscleanup/core/data/SyncUtilities.kt index e2fd4eac3..cf43623a2 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/SyncUtilities.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/SyncUtilities.kt @@ -42,19 +42,19 @@ private suspend fun suspendRunCatching(block: suspend () -> T): Result = Log.i( "suspendRunCatching", "Failed to evaluate a suspendRunCatchingBlock. Returning failure Result", - exception + exception, ) Result.failure(exception) } // See starting file for full change list version syncing logic -//suspend fun Synchronizer.changeListSync( +// suspend fun Synchronizer.changeListSync( // versionReader: (ChangeListVersions) -> Int, // changeListFetcher: suspend (Int) -> List, // versionUpdater: ChangeListVersions.(Int) -> ChangeListVersions, // modelDeleter: suspend (List) -> Unit, // modelUpdater: suspend (List) -> Unit, -//) = suspendRunCatching { +// ) = suspendRunCatching { // See starting file for sync logic // Flow was // 1. Get change list version for specific syncable @@ -62,7 +62,7 @@ private suspend fun suspendRunCatching(block: suspend () -> T): Result = // 1. Split changes into deletes and updated changes // 1. Process deleted and updated separately // 1. Update change list version for specific syncable with highest water mark in changes from network -//}.isSuccess +// }.isSuccess /** * Returns a [Flow] whose values are generated by [transform] function that process the most @@ -75,10 +75,10 @@ fun combine( flow4: Flow, flow5: Flow, flow6: Flow, - transform: suspend (T1, T2, T3, T4, T5, T6) -> R + transform: suspend (T1, T2, T3, T4, T5, T6) -> R, ): Flow = combine( combine(flow, flow2, flow3, ::Triple), - combine(flow4, flow5, flow6, ::Triple) + combine(flow4, flow5, flow6, ::Triple), ) { t1, t2 -> transform( t1.first, @@ -86,6 +86,6 @@ fun combine( t1.third, t2.first, t2.second, - t2.third + t2.third, ) } diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/di/DataModule.kt b/core/data/src/main/java/com/crisiscleanup/core/data/di/DataModule.kt index ffbaaa7f6..6d87294d9 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/di/DataModule.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/di/DataModule.kt @@ -139,4 +139,4 @@ interface DataInternalModule { fun providesIncidentOrganizationsNetworkDataCache( cache: IncidentOrganizationsDataFileCache, ): IncidentOrganizationsDataCache -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/IncidentNetworkDataPageRequest.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/IncidentNetworkDataPageRequest.kt index fc1efd2d4..174e8fcb9 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/IncidentNetworkDataPageRequest.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/IncidentNetworkDataPageRequest.kt @@ -22,4 +22,4 @@ data class IncidentOrganizationsPageRequest( val offset: Int, val totalCount: Int, val organizations: List, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkCaseHistoryEvent.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkCaseHistoryEvent.kt index 992b1a1ca..86c7ce89a 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkCaseHistoryEvent.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkCaseHistoryEvent.kt @@ -33,4 +33,4 @@ fun NetworkCaseHistoryEvent.asEntities(worksiteId: Long): Pair.asEntities( ): OrganizationEntities { val organizations = map { it.asEntity() } val primaryContacts = - if (getContacts) flatMap { - it.primaryContacts?.map(NetworkPersonContact::asEntity) ?: emptyList() + if (getContacts) { + flatMap { + it.primaryContacts?.map(NetworkPersonContact::asEntity) ?: emptyList() + } + } else { + emptyList() } - else emptyList() val organizationContactCrossRefs = - if (getReferences) flatMap(NetworkIncidentOrganization::primaryContactCrossReferences) - else emptyList() + if (getReferences) { + flatMap(NetworkIncidentOrganization::primaryContactCrossReferences) + } else { + emptyList() + } val organizationAffiliates = - if (getReferences) flatMap(NetworkIncidentOrganization::affiliateOrganizationCrossReferences) - else emptyList() + if (getReferences) { + flatMap(NetworkIncidentOrganization::affiliateOrganizationCrossReferences) + } else { + emptyList() + } return OrganizationEntities( organizations, primaryContacts, @@ -49,4 +58,4 @@ data class OrganizationEntities( val primaryContacts: List, val organizationContactCrossRefs: List, val orgAffiliates: List, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkLanguage.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkLanguage.kt index 332d11b92..a1b1239f3 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkLanguage.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkLanguage.kt @@ -19,4 +19,4 @@ fun NetworkLanguageTranslation.asEntity(syncedAt: Instant) = LanguageTranslation name = name, translationsJson = Json.encodeToString(translations), syncedAt = syncedAt, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkPersonContact.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkPersonContact.kt index 73cb9dccb..afd4157c1 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkPersonContact.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkPersonContact.kt @@ -44,4 +44,4 @@ data class PersonContactEntities( val organizationAffiliates: Collection, val personContact: PersonContactEntity, val personToOrganization: PersonOrganizationCrossRef, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkType.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkType.kt index 892e2e490..247f515b1 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkType.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkType.kt @@ -29,4 +29,4 @@ fun WorkTypeShort.asEntity() = WorkTypeEntity( recur = null, status = status, workType = workType, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeRequest.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeRequest.kt index 69cba2cbe..46504d041 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeRequest.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeRequest.kt @@ -15,4 +15,4 @@ fun NetworkWorkTypeRequest.asEntity(worksiteId: Long) = WorkTypeTransferRequestE approvedAt = approvedAt, rejectedAt = rejectedAt, approvedRejectedReason = acceptedRejectedReason ?: "", -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeStatusFull.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeStatusFull.kt index c2656355b..bdbeba414 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeStatusFull.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorkTypeStatusFull.kt @@ -8,4 +8,4 @@ fun NetworkWorkTypeStatusFull.asEntity() = WorkTypeStatusEntity( name = name, primaryState = primaryState, listOrder = listOrder, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorksite.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorksite.kt index b4c9711d3..a41518dad 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorksite.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/NetworkWorksite.kt @@ -201,4 +201,4 @@ fun NetworkWorksiteCoreData.asEntities(): WorksiteEntities { workTypes, emptyList(), ) -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/PopulatedWorksiteMapVisual.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/PopulatedWorksiteMapVisual.kt index b5919d3ed..c363a5872 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/PopulatedWorksiteMapVisual.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/PopulatedWorksiteMapVisual.kt @@ -26,8 +26,10 @@ fun List.filter( return mapNotNull { val distance = if (filterByDistance) { haversineDistance( - latRad, lngRad, - it.latitude.radians, it.longitude.radians, + latRad, + lngRad, + it.latitude.radians, + it.longitude.radians, ).kmToMiles } else { 0.0 @@ -42,19 +44,19 @@ fun List.filter( } val isFilteredOut = filters.hasAdditionalFilters && - !filters.passesFilter( - organizationAffiliates, - it.flags, - it.formData, - it.workTypes, - it.createdAt, - it.isFavorite, - it.reportedBy, - it.updatedAt, - it.latitude, - it.longitude, - locationAreaBounds, - ) + !filters.passesFilter( + organizationAffiliates, + it.flags, + it.formData, + it.workTypes, + it.createdAt, + it.isFavorite, + it.reportedBy, + it.updatedAt, + it.latitude, + it.longitude, + locationAreaBounds, + ) it.asExternalModel(isFilteredOut) } } diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/SyncLog.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/SyncLog.kt index f21f245db..1bf400ce0 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/SyncLog.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/SyncLog.kt @@ -9,4 +9,4 @@ fun SyncLog.asEntity() = SyncLogEntity( logType = logType, message = message, details = details, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/model/WorksiteLocalImage.kt b/core/data/src/main/java/com/crisiscleanup/core/data/model/WorksiteLocalImage.kt index 8de69b143..685994efe 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/model/WorksiteLocalImage.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/model/WorksiteLocalImage.kt @@ -10,4 +10,4 @@ fun WorksiteLocalImage.asEntity() = WorksiteLocalImageEntity( uri = uri, tag = tag, rotateDegrees = rotateDegrees, -) \ No newline at end of file +) diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/AccountDataRefresher.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/AccountDataRefresher.kt index 2bd60dcd0..ba5173a93 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/AccountDataRefresher.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/AccountDataRefresher.kt @@ -49,4 +49,4 @@ class AccountDataRefresher @Inject constructor( organizationsRepository.syncOrganization(organizationId, force, true) } } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CaseHistoryRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CaseHistoryRepository.kt index 98b99c0e8..29e37d316 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CaseHistoryRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CaseHistoryRepository.kt @@ -151,4 +151,4 @@ class OfflineFirstCaseHistoryRepository @Inject constructor( } return 0 } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CasesFilterRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CasesFilterRepository.kt index f692bc89a..fccfcbb30 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CasesFilterRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CasesFilterRepository.kt @@ -64,4 +64,4 @@ class CrisisCleanupCasesFilterRepository @Inject constructor( override fun updateWorkTypeFilters(workTypes: Collection) { // TODO Update work types removing non-matching } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepository.kt index 8a09c777f..aa7ada41a 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepository.kt @@ -88,13 +88,13 @@ class CrisisCleanupAccountDataRepository @Inject constructor( override suspend fun updateAccountTokens( refreshToken: String, accessToken: String, - expirySeconds: Long + expirySeconds: Long, ) { val isClearing = refreshToken.isBlank() dataSource.updateAccountTokens( refreshToken, if (isClearing) "" else accessToken, - if (isClearing) 0 else expirySeconds + if (isClearing) 0 else expirySeconds, ) } @@ -109,7 +109,7 @@ class CrisisCleanupAccountDataRepository @Inject constructor( updateAccountTokens( refreshResult.refreshToken, refreshResult.accessToken, - now.plus(refreshResult.expiresIn.seconds).epochSeconds + now.plus(refreshResult.expiresIn.seconds).epochSeconds, ) logger.logDebug("Refreshed soon/expiring account tokens") } @@ -134,4 +134,4 @@ class CrisisCleanupAccountDataRepository @Inject constructor( dataSource.updateAccountTokens(refreshToken, "", 1) } } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/DatabaseManagementRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/DatabaseManagementRepository.kt index 73262af91..90bb9d85c 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/DatabaseManagementRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/DatabaseManagementRepository.kt @@ -22,4 +22,4 @@ class CrisisCleanupDatabaseManagementRepository @Inject constructor( organizationDaoPlus.rebuildOrganizationFts() worksiteDaoPlus.rebuildWorksiteTextFts() } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/IncidentsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/IncidentsRepository.kt index c0b802ae0..32c03dde0 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/IncidentsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/IncidentsRepository.kt @@ -29,4 +29,4 @@ interface IncidentsRepository { suspend fun pullIncidentOrganizations(incidentId: Long, force: Boolean = false) suspend fun getMatchingIncidents(q: String): List -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LanguageTranslationsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LanguageTranslationsRepository.kt index 04e33df4e..c6fb021f0 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LanguageTranslationsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LanguageTranslationsRepository.kt @@ -187,4 +187,4 @@ class OfflineFirstLanguageTranslationsRepository @Inject constructor( override fun translate(phraseKey: String): String? { return translations.value[phraseKey] ?: statusRepository.translateStatus(phraseKey) } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocalImageRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocalImageRepository.kt index 029b179b4..7c18d1f5e 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocalImageRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocalImageRepository.kt @@ -69,8 +69,11 @@ class CrisisCleanupLocalImageRepository @Inject constructor( override fun streamLocalImageUri(id: Long) = localImageDao.streamLocalImageUri(id) override fun getImageRotation(id: Long, isNetworkImage: Boolean): Int { - return if (isNetworkImage) localImageDao.getNetworkFileLocalImage(id)?.rotateDegrees ?: 0 - else localImageDao.getLocalImage(id)?.rotateDegrees ?: 0 + return if (isNetworkImage) { + localImageDao.getNetworkFileLocalImage(id)?.rotateDegrees ?: 0 + } else { + localImageDao.getLocalImage(id)?.rotateDegrees ?: 0 + } } override suspend fun setImageRotation(id: Long, isNetworkImage: Boolean, rotationDegrees: Int) { @@ -223,4 +226,4 @@ class CrisisCleanupLocalImageRepository @Inject constructor( return saveCount } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocationsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocationsRepository.kt index 9f2bdcd1c..d9d885415 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocationsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/LocationsRepository.kt @@ -6,4 +6,4 @@ import kotlinx.coroutines.flow.Flow interface LocationsRepository { fun streamLocations(ids: Collection): Flow> fun getLocations(ids: Collection): List -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstIncidentsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstIncidentsRepository.kt index 6ad914bbe..9cd4292d8 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstIncidentsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstIncidentsRepository.kt @@ -121,7 +121,9 @@ class OfflineFirstIncidentsRepository @Inject constructor( private suspend fun syncInternal(forcePullAll: Boolean = false) = coroutineScope { isSyncing.value = true try { - val pullAll = if (forcePullAll) true else { + val pullAll = if (forcePullAll) { + true + } else { val localIncidentsCount = incidentDao.getIncidentCount() localIncidentsCount < 10 } @@ -194,4 +196,4 @@ class OfflineFirstIncidentsRepository @Inject constructor( } override suspend fun getMatchingIncidents(q: String) = incidentDaoPlus.getMatchingIncidents(q) -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstLocationsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstLocationsRepository.kt index a6eb37f50..fff263ed0 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstLocationsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OfflineFirstLocationsRepository.kt @@ -16,4 +16,4 @@ class OfflineFirstLocationsRepository @Inject constructor( override fun getLocations(ids: Collection) = locationDao.getLocations(ids).map(PopulatedLocation::asExternalModel) -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OrganizationsRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OrganizationsRepository.kt index b17502cef..a2f907844 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/OrganizationsRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/OrganizationsRepository.kt @@ -156,4 +156,4 @@ class OfflineFirstOrganizationsRepository @Inject constructor( override suspend fun getMatchingOrganizations(q: String) = incidentOrganizationDaoPlus.getMatchingOrganizations(q) -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/SearchWorksiteRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/SearchWorksiteRepository.kt index a0842a566..a3d5c8b4c 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/SearchWorksiteRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/SearchWorksiteRepository.kt @@ -133,8 +133,10 @@ class MemoryCacheSearchWorksitesRepository @Inject constructor( val distance = if (filterByDistance) { val (resultLongitude, resultLatitude) = result.location.coordinates haversineDistance( - locationLatitudeRad, locationLongitudeRad, - resultLatitude.radians, resultLongitude.radians, + locationLatitudeRad, + locationLongitudeRad, + resultLatitude.radians, + resultLongitude.radians, ).kmToMiles } else { null diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/SyncLogRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/SyncLogRepository.kt index d6afde28e..dcf5204fd 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/SyncLogRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/SyncLogRepository.kt @@ -50,7 +50,7 @@ class PagingSyncLogRepository @Inject constructor( logType = type.ifEmpty { this.type }, message = message, details = details, - ) + ), ) return this } @@ -93,4 +93,4 @@ interface SyncLogModule { @Binds fun bindsSyncLogRepository(repository: PagingSyncLogRepository): SyncLogRepository -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/UsersRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/UsersRepository.kt index e2e0c1ee7..36d80ffed 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/UsersRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/UsersRepository.kt @@ -34,4 +34,4 @@ class OfflineFirstUsersRepository @Inject constructor( } return emptyList() } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksiteChangeRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksiteChangeRepository.kt index 90545396a..5c9df1c86 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksiteChangeRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksiteChangeRepository.kt @@ -349,8 +349,11 @@ class CrisisCleanupWorksiteChangeRepository @Inject constructor( val newestChange = sortedChanges.last() if (hasSnapshotChanges || !newestChange.isArchived) { val syncChanges = - if (hasSnapshotChanges) sortedChanges.subList(startingSyncIndex, sortedChanges.size) - else listOf(newestChange) + if (hasSnapshotChanges) { + sortedChanges.subList(startingSyncIndex, sortedChanges.size) + } else { + listOf(newestChange) + } val hasPriorUnsyncedChanges = startingSyncIndex > oldestReferenceChangeIndex + 1 val worksiteId = newestChange.worksiteId val networkWorksiteId = worksiteDao.getWorksiteNetworkId(worksiteId) @@ -395,7 +398,8 @@ class CrisisCleanupWorksiteChangeRepository @Inject constructor( .forEach { when (it) { is NoInternetConnectionException, - is ExpiredTokenException -> throw it + is ExpiredTokenException, + -> throw it } } } else { diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksitesRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksitesRepository.kt index cc797f9e7..25a08745d 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksitesRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/WorksitesRepository.kt @@ -97,4 +97,4 @@ interface WorksitesRepository { searchRadius: Float = 100f, count: Int = 360, ): List -} \ No newline at end of file +} diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/repository/fake/FakeAccountRepository.kt b/core/data/src/main/java/com/crisiscleanup/core/data/repository/fake/FakeAccountRepository.kt index 59c5b32f8..4165aeb8e 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/repository/fake/FakeAccountRepository.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/repository/fake/FakeAccountRepository.kt @@ -22,7 +22,6 @@ class FakeAccountRepository : AccountDataRepository { override val accountData: Flow = _accountData.filterNotNull() - override val isAuthenticated: Flow = accountData.map { it.hasAuthenticated } override var refreshToken: String = "" @@ -55,18 +54,18 @@ class FakeAccountRepository : AccountDataRepository { emailAddress = email, profilePictureUri = profilePictureUri, org = org, - ) + ), ) } override suspend fun updateAccountTokens( refreshToken: String, accessToken: String, - expirySeconds: Long + expirySeconds: Long, ) { setAccountTokens(refreshToken, accessToken) _accountData.tryEmit( - current.copy(tokenExpiry = Instant.fromEpochSeconds(expirySeconds)) + current.copy(tokenExpiry = Instant.fromEpochSeconds(expirySeconds)), ) } diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/util/ConnectivityManagerNetworkMonitor.kt b/core/data/src/main/java/com/crisiscleanup/core/data/util/ConnectivityManagerNetworkMonitor.kt index cfc559ade..1f990ec09 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/util/ConnectivityManagerNetworkMonitor.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/util/ConnectivityManagerNetworkMonitor.kt @@ -19,7 +19,7 @@ import javax.inject.Singleton @Singleton class ConnectivityManagerNetworkMonitor @Inject constructor( - @ApplicationContext private val context: Context + @ApplicationContext private val context: Context, ) : NetworkMonitor { override val isOnline: Flow = callbackFlow { val connectivityManager = context.getSystemService() @@ -40,7 +40,7 @@ class ConnectivityManagerNetworkMonitor @Inject constructor( override fun onCapabilitiesChanged( network: Network, - networkCapabilities: NetworkCapabilities + networkCapabilities: NetworkCapabilities, ) { channel.trySend(connectivityManager.isCurrentlyConnected()) } @@ -50,7 +50,7 @@ class ConnectivityManagerNetworkMonitor @Inject constructor( Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) .build(), - callback + callback, ) channel.trySend(connectivityManager.isCurrentlyConnected()) @@ -65,9 +65,10 @@ class ConnectivityManagerNetworkMonitor @Inject constructor( private fun ConnectivityManager?.isCurrentlyConnected() = when (this) { null -> false - else -> activeNetwork - ?.let(::getNetworkCapabilities) - ?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) - ?: false + else -> + activeNetwork + ?.let(::getNetworkCapabilities) + ?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) + ?: false } } diff --git a/core/data/src/main/java/com/crisiscleanup/core/data/util/IncidentDataPullReporter.kt b/core/data/src/main/java/com/crisiscleanup/core/data/util/IncidentDataPullReporter.kt index 5a83762e9..e2d358bcd 100644 --- a/core/data/src/main/java/com/crisiscleanup/core/data/util/IncidentDataPullReporter.kt +++ b/core/data/src/main/java/com/crisiscleanup/core/data/util/IncidentDataPullReporter.kt @@ -85,7 +85,7 @@ internal class IncidentDataPullStatsUpdater( isStarted = true, incidentId = incidentId, pullStart = Clock.System.now(), - ) + ), ) } @@ -108,4 +108,4 @@ internal class IncidentDataPullStatsUpdater( fun endPull() { reportChange(pullStats.copy(isEnded = true)) } -} \ No newline at end of file +} diff --git a/core/data/src/test/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepositoryTest.kt b/core/data/src/test/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepositoryTest.kt index dcc3f6a8e..153c9dcf1 100644 --- a/core/data/src/test/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepositoryTest.kt +++ b/core/data/src/test/java/com/crisiscleanup/core/data/repository/CrisisCleanupAccountDataRepositoryTest.kt @@ -137,4 +137,4 @@ class CrisisCleanupAccountDataRepositoryTest { // assertEquals(expectedData, accountInfoDataSource.accountData.first()) // assertFalse(repository.isAuthenticated.first()) // } -} \ No newline at end of file +} diff --git a/core/data/src/test/java/com/crisiscleanup/core/data/repository/OfflineFirstLocalAppPreferencesRepositoryTest.kt b/core/data/src/test/java/com/crisiscleanup/core/data/repository/OfflineFirstLocalAppPreferencesRepositoryTest.kt index 5d236fca0..96ae154b9 100644 --- a/core/data/src/test/java/com/crisiscleanup/core/data/repository/OfflineFirstLocalAppPreferencesRepositoryTest.kt +++ b/core/data/src/test/java/com/crisiscleanup/core/data/repository/OfflineFirstLocalAppPreferencesRepositoryTest.kt @@ -29,13 +29,13 @@ class OfflineFirstLocalAppPreferencesRepositoryTest { @Before fun setup() { preferencesDataSource = LocalAppPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore() + tmpFolder.testUserPreferencesDataStore(), ) } private fun setupTestRepository( testScheduler: TestCoroutineScheduler, - testScope: CoroutineScope + testScope: CoroutineScope, ): Pair { val dispatcher = StandardTestDispatcher(testScheduler) val bus = CrisisCleanupAuthEventBus(testScope) @@ -62,7 +62,7 @@ class OfflineFirstLocalAppPreferencesRepositoryTest { disableSaveCredentialsPrompt = false, languageKey = "", ), - repository.userPreferences.first() + repository.userPreferences.first(), ) repository.observeJobs.forEach(Job::cancel) @@ -78,13 +78,13 @@ class OfflineFirstLocalAppPreferencesRepositoryTest { DarkThemeConfig.DARK, repository.userPreferences .map { it.darkThemeConfig } - .first() + .first(), ) assertEquals( DarkThemeConfig.DARK, preferencesDataSource.userData .map { it.darkThemeConfig } - .first() + .first(), ) repository.observeJobs.forEach(Job::cancel) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/MigrationTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/MigrationTest.kt index e22deb4d1..c8adf366d 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/MigrationTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/MigrationTest.kt @@ -16,7 +16,7 @@ class MigrationTest { @get:Rule val helper = MigrationTestHelper( InstrumentationRegistry.getInstrumentation(), - CrisisCleanupDatabase::class.java + CrisisCleanupDatabase::class.java, ) @Test @@ -32,7 +32,7 @@ class MigrationTest { Room.databaseBuilder( InstrumentationRegistry.getInstrumentation().targetContext, CrisisCleanupDatabase::class.java, - TEST_DB + TEST_DB, ) } -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/TestUtil.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/TestUtil.kt index 08480a82e..3d6c97e44 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/TestUtil.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/TestUtil.kt @@ -68,7 +68,7 @@ object TestUtil { val context = ApplicationProvider.getApplicationContext() return Room.inMemoryDatabaseBuilder( context, - CrisisCleanupDatabase::class.java + CrisisCleanupDatabase::class.java, ).build() } @@ -76,9 +76,9 @@ object TestUtil { val context = ApplicationProvider.getApplicationContext() return Room.inMemoryDatabaseBuilder( context, - TestCrisisCleanupDatabase::class.java + TestCrisisCleanupDatabase::class.java, ).build() } } -fun Instant.isNearNow(duration: Duration = 1.seconds) = Clock.System.now().minus(this) < duration \ No newline at end of file +fun Instant.isNearNow(duration: Duration = 1.seconds) = Clock.System.now().minus(this) < duration diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/WorksiteTestUtil.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/WorksiteTestUtil.kt index 909c06e59..c648f02ab 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/WorksiteTestUtil.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/WorksiteTestUtil.kt @@ -37,4 +37,4 @@ object WorksiteTestUtil { override fun translate(phraseKey: String) = "$phraseKey-translated" } -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoFormFieldTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoFormFieldTest.kt index 1c10ccc89..632fb665e 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoFormFieldTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoFormFieldTest.kt @@ -41,7 +41,7 @@ class IncidentDaoFormFieldTest { testFormFieldEntity(23, "field-a"), testFormFieldEntity(23, "field-b"), testFormFieldEntity(23, "field-c"), - ) + ), ) val expected1 = listOf( @@ -66,7 +66,7 @@ class IncidentDaoFormFieldTest { testFormFieldEntity(23, "field-d"), testFormFieldEntity(23, "field-b", label = "label-b"), testFormFieldEntity(23, "field-c"), - ) + ), ) val expected2 = expected1.toMutableList().also { it.add(testFormField("field-d")) @@ -126,4 +126,4 @@ private fun testFormField(fieldKey: String) = IncidentFormField( fieldKey = fieldKey, parentKey = "", selectToggleWorkType = "", -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoTest.kt index a1685eebe..f97dde166 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/IncidentDaoTest.kt @@ -45,7 +45,7 @@ class IncidentDaoTest { assertEquals( listOf(2L, 1, 3), - savedIncidents.map { it.entity.id } + savedIncidents.map { it.entity.id }, ) } @@ -63,7 +63,7 @@ class IncidentDaoTest { for ((incidentId, locationIds) in idMap.entries) { for (locationId in locationIds) { incidentCrossRefs.add( - IncidentIncidentLocationCrossRef(incidentId, locationId) + IncidentIncidentLocationCrossRef(incidentId, locationId), ) } } @@ -82,7 +82,7 @@ class IncidentDaoTest { 48L to setOf(15L, 226), 18L to setOf(226L, 31), 954L to setOf(15L), - ) + ), ) return Triple(incidentLocations, incidents, incidentToIncidentLocations) } @@ -97,7 +97,7 @@ class IncidentDaoTest { incidentDaoPlus.saveIncidents( incidents, incidentLocations, - incidentToIncidentLocations + incidentToIncidentLocations, ) val savedIncidents = incidentDao.streamIncidents().first() @@ -111,7 +111,7 @@ class IncidentDaoTest { ), savedIncidents.map { incident -> incident.locations.map(IncidentLocationEntity::id) - } + }, ) } @@ -152,7 +152,7 @@ class IncidentDaoTest { // New incidents phoneIncidentEntity(5, "new-incident"), phoneIncidentEntity(6, "phone-1, phone-2"), - ) + ), ) // Assert @@ -192,11 +192,11 @@ class IncidentDaoTest { incidentDaoPlus.saveIncidents( incidents, incidentLocations, - incidentToIncidentLocations + incidentToIncidentLocations, ) // Incident without location incidentDao.upsertIncidents( - listOf(testIncidentEntity(35L, testStartAtSeconds + 11)) + listOf(testIncidentEntity(35L, testStartAtSeconds + 11)), ) // incidentToIncidentLocations IDs @@ -222,7 +222,7 @@ class IncidentDaoTest { mapOf( 18L to setOf(31L), 35L to setOf(321L, 852), - ) + ), ) incidentDaoPlus.saveIncidents( syncingIncidents, @@ -243,7 +243,7 @@ class IncidentDaoTest { ), savedIncidents.map { incident -> incident.locations.map(IncidentLocationEntity::id) - } + }, ) } @@ -267,4 +267,4 @@ class IncidentDaoTest { fun testIncidentEntity( id: Long, startAtSeconds: Long, -) = IncidentEntity(id, Instant.fromEpochSeconds(startAtSeconds), "", "", "") \ No newline at end of file +) = IncidentEntity(id, Instant.fromEpochSeconds(startAtSeconds), "", "", "") diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LanguageDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LanguageDaoTest.kt index c89a707c1..8360d5f61 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LanguageDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LanguageDaoTest.kt @@ -46,17 +46,17 @@ class LanguageDaoTest { key = languages1[0].key, name = languages1[0].name, translationsJson = Json.encodeToString( - mapOf("a" to "b") + mapOf("a" to "b"), ), syncedAt = syncedAt, - ) + ), ) languageDaoPlus.saveLanguages( listOf( testLanguageEntity("sp-MX", "Spanish Mexico"), testLanguageEntity("en-GB", "British"), - ) + ), ) val languages2 = languages1.toMutableList().also { @@ -70,11 +70,13 @@ class LanguageDaoTest { translations = mapOf("a" to "b"), syncedAt = syncedAt, ) - } else LanguageTranslations( - Language(it.key, it.name), - translations = emptyMap(), - syncedAt = Instant.fromEpochSeconds(0) - ) + } else { + LanguageTranslations( + Language(it.key, it.name), + translations = emptyMap(), + syncedAt = Instant.fromEpochSeconds(0), + ) + } assertEquals(expected, translations!!.asExternalModel()) } } @@ -85,4 +87,4 @@ private fun testLanguageEntity(key: String, name: String) = LanguageTranslationE name = name, translationsJson = null, syncedAt = null, -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LocationDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LocationDaoTest.kt index 48d5224a7..45625bc95 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LocationDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/LocationDaoTest.kt @@ -30,7 +30,9 @@ class LocationDaoTest { LocationEntitySource(1, "Point", listOf(-3.4, 5.1), null), LocationEntitySource(2, "Polygon", listOf(-13.4, 55.1, 41.2, -81.2), null), LocationEntitySource( - 3, "MultiPolygon", null, + 3, + "MultiPolygon", + null, listOf( listOf(-5.3, 14.5, 82.24, 4.14), listOf(51.28, 42.1, 48.123, -1.88, 6.42, -7.14), @@ -49,14 +51,16 @@ class LocationDaoTest { Location(1, "Point", listOf(-3.4, 5.1), null), Location(2, "Polygon", listOf(-13.4, 55.1, 41.2, -81.2), null), Location( - 3, "MultiPolygon", null, listOf( + 3, + "MultiPolygon", + null, + listOf( listOf(-5.3, 14.5, 82.24, 4.14), listOf(51.28, 42.1, 48.123, -1.88, 6.42, -7.14), - ) + ), ), Location(5, "Triangle", listOf(-51.342, -9.3413), null), ) assertEquals(expecteds, locations) - } -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeDaoTest.kt index dce80532c..070b09e37 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeDaoTest.kt @@ -53,7 +53,7 @@ class WorkTypeDaoTest { listOf( testWorkTypeEntity(111), testWorkTypeEntity(112, workType = "work-type-b"), - ) + ), ) val workTypeFull = fullWorkTypeEntity( @@ -88,14 +88,14 @@ class WorkTypeDaoTest { listOf( workTypeFull, testWorkTypeEntity(112, workType = "work-type-b"), - ) + ), ) workTypeDaoPlus.syncUpsert( listOf( testWorkTypeEntity(111, "s", "work-type-a"), testWorkTypeEntity(350, "sa", "wa"), - ) + ), ) val expecteds = listOf( // Inserts diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDaoTest.kt index 6cfe14975..8993492d8 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDaoTest.kt @@ -65,7 +65,7 @@ class WorkTypeTransferRequestDaoTest { toOrg = 513, networkId = 593, rejectedAt = updatedAtA, - approvedRejectedReason = "rejected" + approvedRejectedReason = "rejected", ), // Update testWorkTypeTransferRequestEntity( @@ -76,7 +76,7 @@ class WorkTypeTransferRequestDaoTest { toOrg = 513, networkId = 93, approvedAt = updatedAtA, - approvedRejectedReason = "approved" + approvedRejectedReason = "approved", ), // New, different byOrg testWorkTypeTransferRequestEntity( @@ -104,12 +104,14 @@ class WorkTypeTransferRequestDaoTest { ).apply { val entityIds = listOf(2L, 3, 7, 8) val reasons = listOf("reason", "reason", "reason-new", "reason") - addAll(newRequests.mapIndexed { index, entity -> - entity.copy( - id = entityIds[index], - reason = reasons[index], - ) - }) + addAll( + newRequests.mapIndexed { index, entity -> + entity.copy( + id = entityIds[index], + reason = reasons[index], + ) + }, + ) sortBy(WorkTypeTransferRequestEntity::id) } val actual = db.testWorkTypeRequestDao().getEntities(1) @@ -142,4 +144,4 @@ private fun testWorkTypeTransferRequestEntity( approvedAt = approvedAt, rejectedAt = rejectedAt, approvedRejectedReason = approvedRejectedReason, -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoTest.kt index c6ef5bfa9..879d83e20 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoTest.kt @@ -88,7 +88,7 @@ class WorksiteChangeDaoTest { testWorksiteFlag( 0, createdAtA, - "reason-a" + "reason-a", ), testWorksiteFlag( 33, @@ -169,7 +169,7 @@ class WorksiteChangeDaoTest { testWorksiteFlag( 1, createdAtC, - "reason-a" + "reason-a", ), // Delete 33 (from full) // Insert and map 11 (network ID) @@ -304,8 +304,11 @@ class WorksiteChangeDaoTest { var entityIndex = 1L val expectedFlags = entityData.flags.map { flag -> - if (flag.id <= 0) flag.copy(id = entityIndex++) - else flag + if (flag.id <= 0) { + flag.copy(id = entityIndex++) + } else { + flag + } } val actualFlags = db.testFlagDao().getEntities(worksiteId) assertEquals(expectedFlags, actualFlags) @@ -316,16 +319,22 @@ class WorksiteChangeDaoTest { entityIndex = 1 val expectedNotes = entityData.notes.map { note -> - if (note.id <= 0) note.copy(id = entityIndex++) - else note + if (note.id <= 0) { + note.copy(id = entityIndex++) + } else { + note + } } val actualNotes = db.testNoteDao().getEntities(worksiteId) assertEquals(expectedNotes, actualNotes) entityIndex = 1 val expectedWorkTypes = entityData.workTypes.map { workType -> - if (workType.id <= 0) workType.copy(id = entityIndex++) - else workType + if (workType.id <= 0) { + workType.copy(id = entityIndex++) + } else { + workType + } } val actualWorkTypes = db.testWorkTypeDao().getEntities(worksiteId) assertEquals(expectedWorkTypes, actualWorkTypes) @@ -511,7 +520,7 @@ class WorksiteChangeDaoTest { 0, worksite.networkId, worksite.incidentId, - ) + ), ) db.worksiteDao().insert(entities.core) db.worksiteFlagDao().insertIgnore(entities.flags) @@ -535,8 +544,8 @@ class WorksiteChangeDaoTest { "", "reason-c", "", - ) - ) + ), + ), ) db.worksiteFlagDao().updateNetworkId(21, 221) @@ -551,8 +560,8 @@ class WorksiteChangeDaoTest { createdAtB, false, "note-e", - ) - ) + ), + ), ) db.workTypeDao().updateNetworkId(1, 301) @@ -569,8 +578,8 @@ class WorksiteChangeDaoTest { null, "status-existing", "work-type-existing", - ) - ) + ), + ), ) db.workTypeDao().updateNetworkId(37, 237) @@ -589,7 +598,7 @@ class WorksiteChangeDaoTest { createdAtB, "reason-network-synced-local-deleted", isHighPriority = true, - ) + ), ) }, workTypes = worksiteFull.workTypes.toMutableList().apply { @@ -602,7 +611,7 @@ class WorksiteChangeDaoTest { "work-type-c", ), ) - } + }, ) /* * Flags @@ -632,17 +641,26 @@ class WorksiteChangeDaoTest { worksiteSynced, worksiteModified.copy( flags = worksiteModified.flags!!.map { - if (it.id == 0L) it.copy(id = 34) - else it + if (it.id == 0L) { + it.copy(id = 34) + } else { + it + } }, notes = worksiteModified.notes.mapIndexed { index, note -> - if (note.id == 0L) note.copy(id = index + 63L) - else note + if (note.id == 0L) { + note.copy(id = index + 63L) + } else { + note + } }, workTypes = worksiteModified.workTypes.map { - if (it.id == 0L) it.copy(id = 58) - else it - } + if (it.id == 0L) { + it.copy(id = 58) + } else { + it + } + }, ), mapOf( 1L to 201, @@ -821,7 +839,6 @@ class WorksiteChangeDaoTest { verify(exactly = 0) { appLogger.logException(any()) } } - /** * Establishes initial conditions for [editSyncedWorksite_deleteExistingFlags] */ @@ -847,7 +864,7 @@ class WorksiteChangeDaoTest { 0, worksite.networkId, worksite.incidentId, - ) + ), ) db.worksiteDao().insert(entities.core) db.worksiteFlagDao().insertIgnore(entities.flags) @@ -874,7 +891,7 @@ class WorksiteChangeDaoTest { createdAtB, "reason-network-synced-local-deleted", isHighPriority = true, - ) + ), ) }, ) @@ -887,12 +904,18 @@ class WorksiteChangeDaoTest { flags = emptyList(), formData = worksiteSynced.formData, notes = worksiteSynced.notes.mapIndexed { index, note -> - if (note.id == 0L) note.copy(id = index + 1L) - else note + if (note.id == 0L) { + note.copy(id = index + 1L) + } else { + note + } }, workTypes = worksiteSynced.workTypes.map { - if (it.id == 0L) it.copy(id = 1) - else it + if (it.id == 0L) { + it.copy(id = 1) + } else { + it + } }, ) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeTransferDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeTransferDaoTest.kt index 886b3f199..5a9f8fb6a 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeTransferDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeTransferDaoTest.kt @@ -152,8 +152,8 @@ class WorksiteChangeTransferDaoTest { notes = "notes", reasonT = "reason", requestedAction = "", - ) - ) + ), + ), ) db.worksiteNoteDao().insertIgnoreNote( WorksiteNoteEntity( @@ -164,7 +164,7 @@ class WorksiteChangeTransferDaoTest { createdAt = createdAtA, isSurvivor = false, note = "note", - ) + ), ) db.workTypeDao().insertIgnoreWorkType( @@ -179,7 +179,7 @@ class WorksiteChangeTransferDaoTest { recur = null, status = "status-existing", workType = "work-type-existing", - ) + ), ) db.workTypeDao().updateNetworkId(3, 353) db.workTypeDao().updateNetworkId(57, 357) @@ -205,7 +205,7 @@ class WorksiteChangeTransferDaoTest { syncAttempt = 0, networkId = worksite.networkId, incidentId = worksite.incidentId, - ) + ), ) db.worksiteDao().insert(entities.core) } @@ -326,7 +326,6 @@ class WorksiteChangeTransferDaoTest { verify(exactly = 0) { appLogger.logException(any()) } } - @Test fun releaseClaimedUnclaimed() = runTest { var workTypeInsertId = 60L @@ -339,8 +338,9 @@ class WorksiteChangeTransferDaoTest { createdAt = now, ), workTypes = testWorksite.workTypes.map { workType -> - if (workType.orgClaim == null) workType - else { + if (workType.orgClaim == null) { + workType + } else { WorkType( id = workTypeInsertId++, createdAt = now, @@ -471,4 +471,4 @@ private fun testWorkTypeTransferRequestEntity( byOrg = byOrg, toOrg = toOrg, createdAt = createdAt, -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeUpdateSyncTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeUpdateSyncTest.kt index 44e9f1bd3..4c459d757 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeUpdateSyncTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteChangeUpdateSyncTest.kt @@ -81,7 +81,7 @@ class WorksiteChangeUpdateSyncTest { rootEntity.copy( id = 65, localGlobalUuid = "local-global-uuid-2", - ) + ), ) val changesB = listOf( testWorksiteChange(65), @@ -94,7 +94,7 @@ class WorksiteChangeUpdateSyncTest { rootEntity.copy( id = 77, localGlobalUuid = "local-global-uuid-3", - ) + ), ) val changesC = listOf( testWorksiteChange(77, archiveAction = WorksiteChangeArchiveAction.Synced), @@ -127,8 +127,8 @@ class WorksiteChangeUpdateSyncTest { 51, createdAtA, "reason-a", - ) - ) + ), + ), ) val noteDao = db.worksiteNoteDao() @@ -140,8 +140,8 @@ class WorksiteChangeUpdateSyncTest { createdAtA, "note-a", localGlobalUuid = "local-global-uuid-2", - ) - ) + ), + ), ) val workTypeDao = db.workTypeDao() @@ -157,7 +157,7 @@ class WorksiteChangeUpdateSyncTest { workType = "work-type-b", worksiteId = 51, ), - ) + ), ) val workTypeRequestsDao = db.workTypeTransferRequestDao() @@ -181,7 +181,7 @@ class WorksiteChangeUpdateSyncTest { "work-type-b", 538, ), - ) + ), ) worksiteChangeDaoPlus.updateSyncIds( @@ -196,7 +196,7 @@ class WorksiteChangeUpdateSyncTest { workTypeRequestIdMap = mapOf( "work-type-a" to 524, "work-type-b" to 529, - ) + ), ), ) @@ -298,7 +298,8 @@ class WorksiteChangeUpdateSyncTest { @Test fun updateSyncChanges_oneFail() = runTest { worksiteChangeDaoPlus.updateSyncChanges( - 51, listOf(testChangeResult(1, isFail = true)) + 51, + listOf(testChangeResult(1, isFail = true)), ) val actual = db.testWorksiteChangeDao().getEntitiesOrderId(51) @@ -308,7 +309,7 @@ class WorksiteChangeUpdateSyncTest { 1, saveAttempt = 3, saveAttemptAt = actual[0].saveAttemptAt, - ) + ), ) assertEquals(expected, actual) actual[0].saveAttemptAt.assertRecentTime() @@ -317,7 +318,8 @@ class WorksiteChangeUpdateSyncTest { @Test fun updateSyncChanges_onePartiallySuccessful() = runTest { worksiteChangeDaoPlus.updateSyncChanges( - 51, listOf(testChangeResult(1, isPartiallySuccessful = true)) + 51, + listOf(testChangeResult(1, isPartiallySuccessful = true)), ) val actual = db.testWorksiteChangeDao().getEntitiesOrderId(51) @@ -337,7 +339,8 @@ class WorksiteChangeUpdateSyncTest { @Test fun updateSyncChanges_oneSuccessful() = runTest { worksiteChangeDaoPlus.updateSyncChanges( - 51, listOf(testChangeResult(1, isSuccessful = true)) + 51, + listOf(testChangeResult(1, isSuccessful = true)), ) val actual = db.testWorksiteChangeDao().getEntitiesOrderId(51) @@ -426,7 +429,7 @@ class WorksiteChangeUpdateSyncTest { 4, saveAttempt = 1, saveAttemptAt = actual[0].saveAttemptAt, - ) + ), ) assertEquals(expected, actual) actual[0].saveAttemptAt.assertRecentTime() @@ -452,7 +455,7 @@ class WorksiteChangeUpdateSyncTest { saveAttempt = 4, saveAttemptAt = actual[0].saveAttemptAt, ), - testWorksiteChange(77, 9, saveAttempt = 4) + testWorksiteChange(77, 9, saveAttempt = 4), ) assertEquals(expected, actual) actual[0].saveAttemptAt.assertRecentTime() @@ -477,7 +480,7 @@ class WorksiteChangeUpdateSyncTest { 9, saveAttempt = 5, saveAttemptAt = actual[0].saveAttemptAt, - ) + ), ) assertEquals(expected, actual) actual[0].saveAttemptAt.assertRecentTime() @@ -569,4 +572,4 @@ class WorksiteChangeUpdateSyncTest { toOrg = toOrg, createdAt = createdAt, ) -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteDaoTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteDaoTest.kt index c7bf339b0..4ec61b190 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteDaoTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteDaoTest.kt @@ -429,7 +429,6 @@ fun testWorksiteFullEntity( updatedAt = createdAt.plus(99.seconds), ) - // Defines all fields not nullable fun testWorksiteShortEntity( networkId: Long, @@ -464,4 +463,4 @@ fun testWorksiteShortEntity( svi = 0.548f, what3Words = null, updatedAt = createdAt.plus(66.seconds), -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteFormDataFlagNoteTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteFormDataFlagNoteTest.kt index d6e8890c7..b190eb417 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteFormDataFlagNoteTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteFormDataFlagNoteTest.kt @@ -75,7 +75,7 @@ class WorksiteFormDataFlagNoteTest { "form-field-c", value = "doesn't matter", isBoolValue = true, - valueBool = false + valueBool = false, ), ) val syncingFlags = listOf( @@ -108,8 +108,12 @@ class WorksiteFormDataFlagNoteTest { val expectedFormDataEntities = listOf( WorksiteFormDataEntity( - 1, "form-field-c", true, "doesn't matter", false - ) + 1, + "form-field-c", + true, + "doesn't matter", + false, + ), ) assertEquals(expectedFormDataEntities, actualPopulatedWorksite.formData) @@ -124,16 +128,28 @@ class WorksiteFormDataFlagNoteTest { "notes-new-a", "reason-new-a", "requested-action-new-a", - ) + ), ) assertEquals(expectedFlagEntities, actualPopulatedWorksite.flags) val expectedNoteEntities = listOf( WorksiteNoteEntity( - 1, "", 34, 1, updatedAtB, true, "note-new-a" + 1, + "", + 34, + 1, + updatedAtB, + true, + "note-new-a", ), WorksiteNoteEntity( - 2, "", 45, 1, updatedAtA, false, "note-new-b" + 2, + "", + 45, + 1, + updatedAtA, + false, + "note-new-b", ), ) assertEquals(expectedNoteEntities, actualPopulatedWorksite.notes) @@ -184,19 +200,19 @@ class WorksiteFormDataFlagNoteTest { testFormDataEntity(1, "form-field-a"), testFormDataEntity(1, "form-field-b"), testFormDataEntity(1, "form-field-c", isBoolValue = true, valueBool = true), - ) + ), ) db.worksiteFlagDao().insertIgnore( listOf( testFlagEntity(11, 1, createdAtA, "flag-a"), testFlagEntity(12, 1, createdAtA, "flag-b"), - ) + ), ) db.worksiteNoteDao().insertIgnore( listOf( testNotesEntity(21, 1, createdAtA, "note-a"), testNotesEntity(22, 1, createdAtA, "note-b"), - ) + ), ) // Sync @@ -209,7 +225,7 @@ class WorksiteFormDataFlagNoteTest { "form-field-c", value = "doesn't matter", isBoolValue = true, - valueBool = false + valueBool = false, ), // Delete form-field-a // New @@ -322,7 +338,9 @@ class WorksiteFormDataFlagNoteTest { val syncingWorksite = testWorksiteEntity(1, 1, "sync-address", updatedAtB) val syncingFormData = listOf( testFormDataEntity( - 1, "form-field-a", "doesn't-matter", + 1, + "form-field-a", + "doesn't-matter", isBoolValue = true, valueBool = false, ), @@ -489,4 +507,4 @@ internal fun testNotesEntity( createdAt = createdAt, isSurvivor = isSurvivor, note = note, -) \ No newline at end of file +) diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteSyncFillTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteSyncFillTest.kt index 18a27d756..8aae73f78 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteSyncFillTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteSyncFillTest.kt @@ -59,8 +59,7 @@ class WorksiteSyncFillTest { worksiteDao.insertRoot(rootB) worksiteDao.insertRoot(rootD) - val coreA = testWorksiteFullEntity(rootA.networkId, incidentId, now, id = rootA.id).copy( - ) + val coreA = testWorksiteFullEntity(rootA.networkId, incidentId, now, id = rootA.id).copy() val coreB = coreA.copy( id = rootB.id, networkId = rootB.networkId, @@ -91,7 +90,7 @@ class WorksiteSyncFillTest { testWorksiteFlagEntity("reason-b", rootB.id, 35), testWorksiteFlagEntity("reason-c", rootA.id, 36), testWorksiteFlagEntity("reason-d", rootA.id, 37), - ) + ), ) formDataDao.upsert( @@ -99,7 +98,7 @@ class WorksiteSyncFillTest { testWorksiteFormDataEntity(rootA.id, "field-a", "value-a"), testWorksiteFormDataEntity(rootA.id, "field-b", "value-b"), testWorksiteFormDataEntity(rootB.id, "field-c", "value-c"), - ) + ), ) noteDao.insertIgnore( @@ -110,7 +109,7 @@ class WorksiteSyncFillTest { testWorksiteNoteEntity("note-d", rootA.id, 60, 1.hours, 16), testWorksiteNoteEntity("note-e", rootB.id, 61, (-1).hours, 17), testWorksiteNoteEntity("note-f", rootB.id, 62, 1.hours, 18), - ) + ), ) workTypeDao.insertIgnore( @@ -119,7 +118,7 @@ class WorksiteSyncFillTest { testWorkTypeEntity(36, "status-b", "type-b", 26, rootA.id), testWorkTypeEntity(37, "status-c", "type-c", 26, rootA.id), testWorkTypeEntity(38, "status-d", "type-d", 25, rootB.id), - ) + ), ) val updateCore = coreA.copy( @@ -382,4 +381,4 @@ class WorksiteSyncFillTest { isSurvivor = false, note = note, ) -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteWorkTypeTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteWorkTypeTest.kt index 6b9adf568..cb598262d 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteWorkTypeTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/dao/WorksiteWorkTypeTest.kt @@ -83,7 +83,7 @@ class WorksiteWorkTypeTest { listOf( testWorkTypeEntity(1, worksiteId = 1, workType = "work-type-a"), testWorkTypeEntity(11, worksiteId = 1, workType = "work-type-b"), - ) + ), ) // Sync @@ -205,7 +205,7 @@ class WorksiteWorkTypeTest { ) assertEquals( expectedWorkTypes, - actual.asExternalModel(515).worksite.workTypes.sortedBy(WorkType::id) + actual.asExternalModel(515).worksite.workTypes.sortedBy(WorkType::id), ) actual = worksiteDao.getWorksite(2) @@ -242,7 +242,7 @@ class WorksiteWorkTypeTest { testWorkTypeEntity(11, worksiteId = 1, workType = "work-type-b"), testWorkTypeEntity(22, worksiteId = 2, workType = "work-type-a"), testWorkTypeEntity(24, worksiteId = 2, workType = "work-type-b"), - ) + ), ) // Sync @@ -320,4 +320,4 @@ class WorksiteWorkTypeTest { assertEquals(existingWorksites[1], actual.entity) assertEquals(expectedWorkTypes, actual.workTypes) } -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CaseNumberOrderTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CaseNumberOrderTest.kt index aa69441c8..318dcd85a 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CaseNumberOrderTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CaseNumberOrderTest.kt @@ -30,4 +30,4 @@ class CaseNumberOrderTest { assertEquals(it.second, parseCaseNumberOrder(it.first)) } } -} \ No newline at end of file +} diff --git a/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CoordinateGridQueryTest.kt b/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CoordinateGridQueryTest.kt index cdb267ae3..a504fae73 100644 --- a/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CoordinateGridQueryTest.kt +++ b/core/database/src/androidTest/java/com/crisiscleanup/core/database/model/CoordinateGridQueryTest.kt @@ -36,4 +36,4 @@ class CoordinateGridQueryTest { assertTrue(radiiSqr5[i] >= radiiSqr5[i - 1]) } } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/DatabaseMigration.kt b/core/database/src/main/java/com/crisiscleanup/core/database/DatabaseMigration.kt index 0239ad6ba..f49cbea51 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/DatabaseMigration.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/DatabaseMigration.kt @@ -60,4 +60,4 @@ object DatabaseMigrations { ), ) class Schema35To36 : AutoMigrationSpec -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDao.kt index fc505daff..0aaba6731 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDao.kt @@ -31,4 +31,4 @@ interface CaseHistoryDao { """, ) fun streamEvents(worksiteId: Long): Flow> -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDaoPlus.kt index 03a599224..073a3b99d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/CaseHistoryDaoPlus.kt @@ -22,4 +22,4 @@ class CaseHistoryDaoPlus @Inject constructor( historyDao.upsertAttrs(eventAttrs) } } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDao.kt index f1e114090..b7a1a313d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDao.kt @@ -31,7 +31,7 @@ interface IncidentDao { FROM incidents WHERE is_archived==0 ORDER BY start_at DESC, id DESC - """ + """, ) fun streamIncidents(): Flow> @@ -62,13 +62,13 @@ interface IncidentDao { """ DELETE FROM incident_to_incident_location WHERE incident_id IN (:incidentIds) - """ + """, ) suspend fun deleteIncidentLocationCrossRefs(incidentIds: Collection) @Insert(onConflict = OnConflictStrategy.IGNORE) suspend fun insertIgnoreIncidentLocationCrossRefs( - incidentCrossRefs: Collection + incidentCrossRefs: Collection, ) @Transaction @@ -77,7 +77,7 @@ interface IncidentDao { UPDATE incident_form_fields SET is_invalidated=1 WHERE incident_id=:incidentId - """ + """, ) suspend fun invalidateFormFields(incidentId: Long) @@ -100,7 +100,7 @@ interface IncidentDao { FROM incident_fts f INNER JOIN incidents i ON f.docid=i.id WHERE incident_fts MATCH :query - """ + """, ) fun matchIncidentTokens(query: String): List } diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDaoPlus.kt index acc365174..6de87cf1f 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentDaoPlus.kt @@ -46,4 +46,4 @@ class IncidentDaoPlus @Inject constructor( incidents.forEach { updateFormFields(it.first, it.second) } } } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDao.kt index d527a6b00..cfbcb7347 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDao.kt @@ -93,4 +93,4 @@ interface IncidentOrganizationDao { @Transaction @Query("SELECT id FROM incident_organizations WHERE id=:id") fun findOrganization(id: Long): Long? -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDaoPlus.kt index 503e69e00..11b9e7f20 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/IncidentOrganizationDaoPlus.kt @@ -53,4 +53,4 @@ class IncidentOrganizationDaoPlus @Inject constructor( organizationsDao.upsert(newOrganizations) organizationsDao.insertIgnoreAffiliateOrganization(newAffiliates) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDao.kt index 8fa68f494..606aca621 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDao.kt @@ -31,10 +31,10 @@ interface LanguageDao { """ INSERT OR IGNORE INTO language_translations(key, name) VALUES(:key, :name) - """ + """, ) fun insertIgnoreLanguage( key: String, name: String, ) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDaoPlus.kt index c110ae903..69e036a83 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LanguageDaoPlus.kt @@ -16,4 +16,4 @@ class LanguageDaoPlus @Inject constructor( } } } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDao.kt index 60ebc4ff6..60643e120 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDao.kt @@ -45,7 +45,7 @@ interface LocalImageDao { UPDATE worksite_local_images SET tag=:tag WHERE worksite_id=:worksiteId AND local_document_id=:documentId - """ + """, ) fun update( worksiteId: Long, @@ -68,7 +68,7 @@ interface LocalImageDao { FROM worksite_local_images WHERE worksite_id=:worksiteId ORDER BY id ASC - """ + """, ) fun getWorksiteLocalImages(worksiteId: Long): List @@ -82,7 +82,7 @@ interface LocalImageDao { GROUP BY worksite_id ORDER BY min_id ASC ) - """ + """, ) fun getUploadImageWorksiteIds(): List -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDaoPlus.kt index d2d66302c..1d6d1297c 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocalImageDaoPlus.kt @@ -62,4 +62,4 @@ class LocalImageDaoPlus @Inject constructor( val deletedFileIds = db.networkFileDao().getDeletedPhotoNetworkFileIds(worksiteId) Pair(networkWorksiteId, deletedFileIds) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDao.kt index e97936590..86f06f130 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDao.kt @@ -20,4 +20,4 @@ interface LocationDao { @Transaction @Query("SELECT * FROM locations WHERE id in (:ids)") fun getLocations(ids: Collection): List -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDaoPlus.kt index 3a09d0113..14d93c0f0 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/LocationDaoPlus.kt @@ -21,12 +21,15 @@ class LocationDaoPlus @Inject constructor( } } ?: "" } - if (coordinates.isEmpty()) null - else LocationEntity( - id = source.id, - shapeType = source.shapeType, - coordinates = coordinates, - ) + if (coordinates.isEmpty()) { + null + } else { + LocationEntity( + id = source.id, + shapeType = source.shapeType, + coordinates = coordinates, + ) + } } db.locationDao().upsertLocations(locations) } @@ -37,4 +40,4 @@ data class LocationEntitySource( val shapeType: String, val coordinates: List?, val multiCoordinates: List>?, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/NetworkFileDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/NetworkFileDao.kt index 629a1d362..b8c753a7b 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/NetworkFileDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/NetworkFileDao.kt @@ -26,7 +26,7 @@ interface NetworkFileDao { INNER JOIN worksite_to_network_file w ON w.network_file_id=i.id WHERE worksite_id=:worksiteId AND is_deleted<>0 AND i.id NOT IN(:keepIds) ) - """ + """, ) fun deleteDeleted(worksiteId: Long, keepIds: Collection) @@ -35,7 +35,7 @@ interface NetworkFileDao { """ DELETE FROM worksite_to_network_file WHERE worksite_id=:worksiteId AND network_file_id NOT IN(:networkFileIds) - """ + """, ) fun deleteUnspecifiedCrossReferences(worksiteId: Long, networkFileIds: Collection) @@ -61,7 +61,7 @@ interface NetworkFileDao { LEFT JOIN network_file_local_images fi ON f.id=fi.id INNER JOIN worksite_to_network_file wf ON f.id=wf.network_file_id WHERE worksite_id=:worksiteId AND fi.is_deleted<>0 - """ + """, ) fun getDeletedPhotoNetworkFileIds(worksiteId: Long): List -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDao.kt index 6b0e0f734..f518030f3 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDao.kt @@ -27,11 +27,11 @@ interface PersonContactDao { ON pc.id=o2pc.contact_id WHERE o2pc.contact_id IS NULL ) - """ + """, ) fun trimIncidentOrganizationContacts() @Transaction @Query("SELECT * FROM person_contacts WHERE id=:id") fun getContact(id: Long): PopulatedPersonContactOrganization? -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDaoPlus.kt index 76260ca6c..b142d2d38 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/PersonContactDaoPlus.kt @@ -21,4 +21,4 @@ class PersonContactDaoPlus @Inject constructor( contactDao.upsertPersonOrganizations(personOrganizations) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/RecentWorksiteDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/RecentWorksiteDao.kt index 688a83cd9..023a0f4fc 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/RecentWorksiteDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/RecentWorksiteDao.kt @@ -19,11 +19,11 @@ interface RecentWorksiteDao { ORDER BY viewed_at DESC LIMIT :limit OFFSET :offset - """ + """, ) fun streamRecentWorksites( incidentId: Long, limit: Int = 16, - offset: Int = 0 + offset: Int = 0, ): Flow> -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/SyncLogDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/SyncLogDao.kt index 4cbdb149b..6b08c7522 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/SyncLogDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/SyncLogDao.kt @@ -27,4 +27,4 @@ interface SyncLogDao { @Transaction @Query("DELETE FROM sync_logs WHERE log_time<:minLogTime") fun trimOldSyncLogs(minLogTime: Instant = Clock.System.now().minus(14.days)) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeDao.kt index e411cb41d..0b340d362 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeDao.kt @@ -22,7 +22,7 @@ interface WorkTypeDao { recur =:recur, status =:status WHERE worksite_id=:worksiteId AND work_type=:workType - """ + """, ) fun syncUpdateWorkType( worksiteId: Long, @@ -41,7 +41,7 @@ interface WorkTypeDao { """ DELETE FROM work_types WHERE worksite_id=:worksiteId AND network_id NOT IN(:networkIds) - """ + """, ) fun syncDeleteUnspecified(worksiteId: Long, networkIds: Collection) @@ -59,7 +59,7 @@ interface WorkTypeDao { SELECT id, network_id FROM work_types WHERE worksite_id=:worksiteId AND network_id>-1 - """ + """, ) fun getNetworkedIdMap(worksiteId: Long): List @@ -75,7 +75,7 @@ interface WorkTypeDao { UPDATE OR IGNORE work_types SET network_id =:networkId WHERE id=:id - """ + """, ) fun updateNetworkId(id: Long, networkId: Long) @@ -85,7 +85,7 @@ interface WorkTypeDao { UPDATE OR IGNORE work_types SET network_id =:networkId WHERE worksite_id=:worksiteId AND work_type=:workType - """ + """, ) fun updateNetworkId(worksiteId: Long, workType: String, networkId: Long) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeStatusDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeStatusDao.kt index 0f6f49f81..cb1f12e3b 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeStatusDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeStatusDao.kt @@ -16,4 +16,4 @@ interface WorkTypeStatusDao { @Transaction @Query("SELECT status, name, primary_state FROM work_type_statuses ORDER BY list_order ASC") fun getStatuses(): List -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDao.kt index 48b3eaad2..9fbb7b72d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorkTypeTransferRequestDao.kt @@ -15,7 +15,7 @@ interface WorkTypeTransferRequestDao { """ DELETE FROM worksite_work_type_requests WHERE worksite_id=:worksiteId AND work_type NOT IN(:workTypes) AND network_id>0 - """ + """, ) fun syncDeleteUnspecified(worksiteId: Long, workTypes: Set) @@ -24,7 +24,7 @@ interface WorkTypeTransferRequestDao { """ DELETE FROM worksite_work_type_requests WHERE worksite_id=:worksiteId AND network_id<=0 - """ + """, ) fun deleteUnsynced(worksiteId: Long) @@ -46,7 +46,7 @@ interface WorkTypeTransferRequestDao { rejected_at =:rejectedAt, approved_rejected_reason=:approvedRejectedReason WHERE worksite_id=:worksiteId AND work_type=:workType AND by_org=:byOrg - """ + """, ) fun syncUpdateRequest( worksiteId: Long, @@ -66,12 +66,12 @@ interface WorkTypeTransferRequestDao { UPDATE OR IGNORE worksite_work_type_requests SET network_id =:networkId WHERE worksite_id=:worksiteId AND work_type=:workType AND by_org=:orgId - """ + """, ) fun updateNetworkId( worksiteId: Long, workType: String, orgId: Long, - networkId: Long + networkId: Long, ) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDao.kt index e2de0a06a..2e30bf7e8 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDao.kt @@ -29,7 +29,7 @@ interface WorksiteChangeDao { save_attempt =save_attempt+1, save_attempt_at =:savedAt WHERE id=:id - """ + """, ) fun updateAction(id: Long, action: String, savedAt: Instant = Clock.System.now()) @@ -40,7 +40,7 @@ interface WorksiteChangeDao { SET save_attempt =save_attempt+1, save_attempt_at =:savedAt WHERE id=:id - """ + """, ) fun updateSyncAttempt(id: Long, savedAt: Instant = Clock.System.now()) @@ -60,7 +60,7 @@ interface WorksiteChangeDao { FROM worksites w INNER JOIN (SELECT DISTINCT worksite_id FROM worksite_changes ORDER BY created_at) wc ON w.id = wc.worksite_id - """ + """, ) fun streamWorksitesPendingSync(): Flow> @@ -75,7 +75,7 @@ interface WorksiteChangeDao { ORDER BY min_attempt_at ASC, max_created_at ASC ) LIMIT :limit - """ + """, ) fun getWorksitesPendingSync(limit: Int): List @@ -85,7 +85,7 @@ interface WorksiteChangeDao { SELECT COUNT(id) FROM worksite_changes WHERE worksite_id=:worksiteId AND save_attempt>0 - """ + """, ) fun getSaveFailCount(worksiteId: Long): Int } diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoPlus.kt index 989250ba6..ee2543bf5 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteChangeDaoPlus.kt @@ -67,8 +67,11 @@ class WorksiteChangeDaoPlus @Inject constructor( } val logPostfix = localModifiedAt.epochSeconds.toString() - syncLogger.type = if (worksiteChange.isNew) "worksite-new-$logPostfix" - else "worksite-update-$worksiteId-$logPostfix" + syncLogger.type = if (worksiteChange.isNew) { + "worksite-new-$logPostfix" + } else { + "worksite-update-$worksiteId-$logPostfix" + } db.withTransaction { try { @@ -150,15 +153,21 @@ class WorksiteChangeDaoPlus @Inject constructor( val unsyncedLookup = inserts .mapIndexedNotNull { index, flag -> val id = insertIds[index] - if (id > 0) Pair(flag.reasonT, id) - else null + if (id > 0) { + Pair(flag.reasonT, id) + } else { + null + } } .associate { it.first to it.second } if (unsyncedLookup.isNotEmpty()) { val updatedIds = worksiteUpdatedIds.flags?.map { val localId = unsyncedLookup[it.reasonT] - if (localId == null || it.id > 0) it - else it.copy(id = localId) + if (localId == null || it.id > 0) { + it + } else { + it.copy(id = localId) + } } worksiteUpdatedIds = worksiteUpdatedIds.copy(flags = updatedIds) } @@ -186,7 +195,7 @@ class WorksiteChangeDaoPlus @Inject constructor( } } note - } + }, ) syncLogger.log("Notes. Inserted ${insertNotes.size}.") } @@ -196,15 +205,21 @@ class WorksiteChangeDaoPlus @Inject constructor( val unsyncedLookup = inserts .mapIndexedNotNull { index, flag -> val id = insertIds[index] - if (id > 0) Pair(flag.workType, id) - else null + if (id > 0) { + Pair(flag.workType, id) + } else { + null + } } .associate { it.first to it.second } if (unsyncedLookup.isNotEmpty()) { val updatedIds = worksiteUpdatedIds.workTypes.map { val localId = unsyncedLookup[it.workTypeLiteral] - if (localId == null || it.id > 0) it - else it.copy(id = localId) + if (localId == null || it.id > 0) { + it + } else { + it.copy(id = localId) + } } worksiteUpdatedIds = worksiteUpdatedIds.copy(workTypes = updatedIds) } @@ -337,17 +352,20 @@ class WorksiteChangeDaoPlus @Inject constructor( ) { workTypeLookup -> val requestEntities = requests.mapNotNull { workTypeLookup[it]?.let { workType -> - if (workType.orgClaim == null) null - else WorkTypeTransferRequestEntity( - 0, - networkId = -1, - worksiteId = worksite.id, - workType = it, - reason = reason, - byOrg = organizationId, - toOrg = workType.orgClaim!!, - createdAt = localModifiedAt, - ) + if (workType.orgClaim == null) { + null + } else { + WorkTypeTransferRequestEntity( + 0, + networkId = -1, + worksiteId = worksite.id, + workType = it, + reason = reason, + byOrg = organizationId, + toOrg = workType.orgClaim!!, + createdAt = localModifiedAt, + ) + } } } @@ -521,8 +539,11 @@ class WorksiteChangeDaoPlus @Inject constructor( if (result.isFail) { worksiteChangeDao.updateSyncAttempt(result.id) } else if (result.isSuccessful || result.isPartiallySuccessful) { - val action = if (result.isSuccessful) WorksiteChangeArchiveAction.Synced - else WorksiteChangeArchiveAction.PartiallySynced + val action = if (result.isSuccessful) { + WorksiteChangeArchiveAction.Synced + } else { + WorksiteChangeArchiveAction.PartiallySynced + } worksiteChangeDao.updateAction(result.id, action.literal) } } @@ -566,4 +587,4 @@ private data class IdNetworkIdMaps( val flag: Map = emptyMap(), val note: Map = emptyMap(), val workType: Map = emptyMap(), -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDao.kt index 3ced7d3ec..92355f8cc 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDao.kt @@ -446,7 +446,6 @@ interface WorksiteDao { OFFSET :offset """, ) - fun getTableWorksitesOrderByCounty( incidentId: Long, limit: Int, diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDaoPlus.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDaoPlus.kt index d4c4f491e..d24e0e1d9 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDaoPlus.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteDaoPlus.kt @@ -156,7 +156,6 @@ class WorksiteDaoPlus @Inject constructor( files?.let { syncFiles(id, it) } return@withTransaction true - } else if (!isLocallyModified) { if (worksiteDao.getRootCount( id = modifiedAt.id, @@ -215,7 +214,6 @@ class WorksiteDaoPlus @Inject constructor( files?.let { syncFiles(worksiteId, it) } return@withTransaction true - } else { // Resolving changes at this point is not worth the complexity. // Defer to worksite (snapshot) changes resolving successfully and completely. @@ -308,8 +306,11 @@ class WorksiteDaoPlus @Inject constructor( ) val worksiteId = - if (isUpdated) db.worksiteDao().getWorksiteId(core.networkId) - else -1 + if (isUpdated) { + db.worksiteDao().getWorksiteId(core.networkId) + } else { + -1 + } return@withTransaction Pair(isUpdated, worksiteId) } @@ -397,7 +398,7 @@ class WorksiteDaoPlus @Inject constructor( ): Int { val worksiteDao = db.worksiteDao() val isLongitudeOrdered = longitudeLeft < longitudeRight - return if (isLongitudeOrdered) + return if (isLongitudeOrdered) { worksiteDao.getWorksitesCount( incidentId, latitudeSouth, @@ -405,13 +406,15 @@ class WorksiteDaoPlus @Inject constructor( longitudeLeft, longitudeRight, ) - else worksiteDao.getWorksitesCountLongitudeCrossover( - incidentId, - latitudeSouth, - latitudeNorth, - longitudeLeft, - longitudeRight, - ) + } else { + worksiteDao.getWorksitesCountLongitudeCrossover( + incidentId, + latitudeSouth, + latitudeNorth, + longitudeLeft, + longitudeRight, + ) + } } suspend fun onSyncEnd( @@ -425,9 +428,9 @@ class WorksiteDaoPlus @Inject constructor( val workTypeChanges = db.workTypeDao().getUnsyncedCount(worksiteId) val changes = db.worksiteChangeDao().getChangeCount(worksiteId) val hasModification = flagChanges > 0 || - noteChanges > 0 || - workTypeChanges > 0 || - changes > 0 + noteChanges > 0 || + workTypeChanges > 0 || + changes > 0 return@withTransaction if (hasModification) { syncLogger.log( "Pending changes on sync end", @@ -472,8 +475,11 @@ class WorksiteDaoPlus @Inject constructor( } } - if (boundsIndex >= remainingBounds.size) emptyList() - else remainingBounds.subList(boundsIndex, remainingBounds.size) + if (boundsIndex >= remainingBounds.size) { + emptyList() + } else { + remainingBounds.subList(boundsIndex, remainingBounds.size) + } } suspend fun loadTableWorksites( @@ -646,8 +652,10 @@ class WorksiteDaoPlus @Inject constructor( val worksite = boundedWorksites[i] val entity = worksite.base.entity val distance = haversineDistance( - latRad, lngRad, - entity.latitude.radians, entity.longitude.radians, + latRad, + lngRad, + entity.latitude.radians, + entity.longitude.radians, ) withDistance.add(Pair(worksite, distance)) if (i % strideCount == 0) { @@ -779,4 +787,4 @@ class WorksiteDaoPlus @Inject constructor( IncidentIdWorksiteCount(incidentId, totalCount, count) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFlagDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFlagDao.kt index 14d94582e..419a88115 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFlagDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFlagDao.kt @@ -21,7 +21,7 @@ interface WorksiteFlagDao { notes =:notes, requested_action=:requestedAction WHERE worksite_id=:worksiteId AND reason_t=:reasonT - """ + """, ) fun syncUpdateFlag( worksiteId: Long, @@ -39,7 +39,7 @@ interface WorksiteFlagDao { """ DELETE FROM worksite_flags WHERE worksite_id=:worksiteId AND reason_t NOT IN(:reasons) - """ + """, ) fun syncDeleteUnspecified(worksiteId: Long, reasons: Collection) @@ -48,7 +48,7 @@ interface WorksiteFlagDao { """ DELETE FROM worksite_flags WHERE worksite_id=:worksiteId AND id NOT IN(:ids) - """ + """, ) fun deleteUnspecified(worksiteId: Long, ids: Collection) @@ -58,7 +58,7 @@ interface WorksiteFlagDao { SELECT id, network_id FROM worksite_flags WHERE worksite_id=:worksiteId AND network_id>-1 - """ + """, ) fun getNetworkedIdMap(worksiteId: Long): List @@ -74,7 +74,7 @@ interface WorksiteFlagDao { UPDATE OR IGNORE worksite_flags SET network_id=:networkId WHERE id=:id - """ + """, ) fun updateNetworkId(id: Long, networkId: Long) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFormDataDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFormDataDao.kt index 0dd52125e..5606372d7 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFormDataDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteFormDataDao.kt @@ -10,7 +10,7 @@ interface WorksiteFormDataDao { """ DELETE FROM worksite_form_data WHERE worksite_id=:worksiteId AND field_key NOT IN(:fieldKeys) - """ + """, ) fun deleteUnspecifiedKeys(worksiteId: Long, fieldKeys: Collection) @@ -20,4 +20,4 @@ interface WorksiteFormDataDao { @Transaction @Query("SELECT DISTINCT field_key FROM worksite_form_data WHERE worksite_id=:worksiteId") fun getDataKeys(worksiteId: Long): List -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteNoteDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteNoteDao.kt index 0cd9a89ca..32c82cc59 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteNoteDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteNoteDao.kt @@ -20,7 +20,7 @@ interface WorksiteNoteDao { is_survivor =:isSurvivor, note =:note WHERE worksite_id=:worksiteId AND network_id=:networkId AND local_global_uuid='' - """ + """, ) fun syncUpdateNote( worksiteId: Long, @@ -35,7 +35,7 @@ interface WorksiteNoteDao { """ DELETE FROM worksite_notes WHERE worksite_id=:worksiteId AND network_id NOT IN(:networkIds) - """ + """, ) fun syncDeleteUnspecified(worksiteId: Long, networkIds: Collection) @@ -45,7 +45,7 @@ interface WorksiteNoteDao { SELECT id, network_id FROM worksite_notes WHERE worksite_id=:worksiteId AND network_id>-1 - """ + """, ) fun getNetworkedIdMap(worksiteId: Long): List @@ -59,7 +59,7 @@ interface WorksiteNoteDao { SET network_id =:networkId, local_global_uuid ='' WHERE id=:id - """ + """, ) fun updateNetworkId(id: Long, networkId: Long) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteSyncStatDao.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteSyncStatDao.kt index 9ba4384ef..d9124ddbe 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteSyncStatDao.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/WorksiteSyncStatDao.kt @@ -17,7 +17,7 @@ interface WorksiteSyncStatDao { SELECT * FROM worksite_sync_stats WHERE incident_id==:incidentId - """ + """, ) fun getSyncStats(incidentId: Long): WorksiteSyncStatsEntity? @@ -30,7 +30,7 @@ interface WorksiteSyncStatDao { UPDATE OR IGNORE worksite_sync_stats SET paged_count=:pagedCount WHERE incident_id=:incidentId AND sync_start=:syncStart - """ + """, ) fun updateStatsPaged( incidentId: Long, @@ -49,7 +49,7 @@ interface WorksiteSyncStatDao { attempted_counter =:attemptedCounter, app_build_version_code=:appBuildVersionCode WHERE incident_id=:incidentId AND sync_start=:syncStart - """ + """, ) fun updateStatsSuccessful( incidentId: Long, @@ -80,7 +80,7 @@ interface WorksiteSyncStatDao { center_latitude =:latitude, center_longitude =:longitude WHERE incident_id=:incidentId - """ + """, ) fun setFullSyncCenter( incidentId: Long, @@ -95,10 +95,10 @@ interface WorksiteSyncStatDao { UPDATE incident_worksites_full_sync_stats SET query_area_radius=:radius WHERE incident_id=:incidentId - """ + """, ) fun setFullSyncRadius( incidentId: Long, radius: Double, ) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/dao/fts/IncidentFts.kt b/core/database/src/main/java/com/crisiscleanup/core/database/dao/fts/IncidentFts.kt index 1dda734ce..f8311825e 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/dao/fts/IncidentFts.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/dao/fts/IncidentFts.kt @@ -42,8 +42,8 @@ data class PopulatedIncidentIdNameMatchInfo( val sortScore by lazy { matchInfoInts.okapiBm25Score(0) * 3 + - matchInfoInts.okapiBm25Score(1) * 2 + - matchInfoInts.okapiBm25Score(2) + matchInfoInts.okapiBm25Score(1) * 2 + + matchInfoInts.okapiBm25Score(2) } override fun equals(other: Any?): Boolean { @@ -91,4 +91,4 @@ suspend fun IncidentDaoPlus.getMatchingIncidents(q: String): List= 0 && deltaY == 0 && (a.second + 0.5f) > gridCenter) || (deltaX < 0 && deltaY > 0) || (deltaX < 0 && deltaY == 0 && (a.second + 0.5f) < gridCenter) - ) -1 - else 1 + ) { + -1 + } else { + 1 + } order - } else if (a.third < b.third) -1 - else 1 + } else if (a.third < b.third) { + -1 + } else { + 1 + } } .map { Pair(it.first, it.second) } diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/IncidentEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/IncidentEntity.kt index 4828247d4..4ad95665c 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/IncidentEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/IncidentEntity.kt @@ -17,8 +17,8 @@ import kotlinx.serialization.json.Json value = ["start_at"], orders = [Index.Order.DESC], name = "idx_newest_to_oldest_incidents", - ) - ] + ), + ], ) data class IncidentEntity( @PrimaryKey @@ -75,7 +75,7 @@ fun IncidentLocationEntity.asExternalModel() = IncidentLocation( value = ["incident_location_id", "incident_id"], name = "idx_incident_location_to_incident", ), - ] + ], ) data class IncidentIncidentLocationCrossRef( @ColumnInfo("incident_id") @@ -98,7 +98,7 @@ data class IncidentIncidentLocationCrossRef( primaryKeys = ["incident_id", "parent_key", "field_key"], indices = [ Index(value = ["data_group", "parent_key", "list_order"]), - ] + ], ) data class IncidentFormFieldEntity( @ColumnInfo("incident_id") @@ -149,9 +149,13 @@ fun IncidentFormFieldEntity.asExternalModel(): IncidentFormField { val formValues = if (valuesJson?.isNotEmpty() == true) Json.decodeFromString>(valuesJson) else emptyMap() val formValuesDefault = - if (formValues.isEmpty() && valuesDefaultJson?.isNotEmpty() == true) Json.decodeFromString>( - valuesDefaultJson - ) else emptyMap() + if (formValues.isEmpty() && valuesDefaultJson?.isNotEmpty() == true) { + Json.decodeFromString>( + valuesDefaultJson, + ) + } else { + emptyMap() + } return IncidentFormField( label = label, htmlType = htmlType, diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/LanguageTranslationEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/LanguageTranslationEntity.kt index b05feae71..fc2d64aea 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/LanguageTranslationEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/LanguageTranslationEntity.kt @@ -14,4 +14,4 @@ data class LanguageTranslationEntity( val translationsJson: String?, @ColumnInfo("synced_at", defaultValue = "0") val syncedAt: Instant?, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/LocationEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/LocationEntity.kt index af8e9315c..e37694583 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/LocationEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/LocationEntity.kt @@ -12,8 +12,8 @@ data class LocationEntity( val id: Long, @ColumnInfo("shape_type", defaultValue = "") val shapeType: String, - @ColumnInfo(defaultValue = "") // Newline delimited sequences of // comma delimited latitude,longitude coordinates + @ColumnInfo(defaultValue = "") val coordinates: String, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileEntity.kt index 44aba0c0f..d3dc42584 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileEntity.kt @@ -52,7 +52,7 @@ data class NetworkFileEntity( ], indices = [ Index(value = ["network_file_id", "worksite_id"]), - ] + ], ) data class WorksiteNetworkFileCrossRef( @ColumnInfo("worksite_id") diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileLocalImageEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileLocalImageEntity.kt index 2518e950e..2b000aa4a 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileLocalImageEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/NetworkFileLocalImageEntity.kt @@ -18,7 +18,7 @@ import androidx.room.PrimaryKey ], indices = [ Index("is_deleted"), - ] + ], ) data class NetworkFileLocalImageEntity( @PrimaryKey diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PersonContactEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PersonContactEntity.kt index 135a4d884..88c8785e2 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PersonContactEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PersonContactEntity.kt @@ -46,10 +46,10 @@ fun PersonContactEntity.asExternalModel() = PersonContact( ], indices = [ Index(value = ["organization_id", "id"]), - ] + ], ) data class PersonOrganizationCrossRef( val id: Long, @ColumnInfo("organization_id") val organizationId: Long, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedCaseHistoryEvent.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedCaseHistoryEvent.kt index 58e3171b5..e25c42ddd 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedCaseHistoryEvent.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedCaseHistoryEvent.kt @@ -39,4 +39,4 @@ fun PopulatedCaseHistoryEvent.asExternalModel(translator: KeyTranslator): CaseHi recipientLocationName = recipientLocationName, ) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedEntityIds.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedEntityIds.kt index 7f33b763f..fe1f40a2c 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedEntityIds.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedEntityIds.kt @@ -8,4 +8,4 @@ data class PopulatedIdNetworkId( val networkId: Long, ) -fun List.asLookup() = associate { it.id to it.networkId } \ No newline at end of file +fun List.asLookup() = associate { it.id to it.networkId } diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedFilterDataWorksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedFilterDataWorksite.kt index 0985794e8..02f2cae77 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedFilterDataWorksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedFilterDataWorksite.kt @@ -37,4 +37,4 @@ data class PopulatedFilterDataWorksite( base.isFavorite, locationAreaBounds, ) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncident.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncident.kt index 30deca162..fc68d2b3e 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncident.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncident.kt @@ -17,9 +17,9 @@ data class PopulatedIncident( value = IncidentIncidentLocationCrossRef::class, parentColumn = "incident_id", entityColumn = "incident_location_id", - ) + ), ) - val locations: List + val locations: List, ) fun PopulatedIncident.asExternalModel() = with(entity) { @@ -49,7 +49,7 @@ data class PopulatedFormFieldsIncident( fun PopulatedFormFieldsIncident.asExternalModel() = entity.asExternalModel().copy( formFields = formFields.map(IncidentFormFieldEntity::asExternalModel) - .filter { !(it.isInvalidated || it.isDivEnd) } + .filter { !(it.isInvalidated || it.isDivEnd) }, ) data class PopulatedIncidentMatch( @@ -66,4 +66,4 @@ fun PopulatedIncidentMatch.asExternalModel() = IncidentIdNameType( name = name, shortName = shortName, disasterLiteral = type, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentOrganization.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentOrganization.kt index 8a99e713c..da07f8f0f 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentOrganization.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentOrganization.kt @@ -16,7 +16,7 @@ data class PopulatedIncidentOrganization( value = OrganizationPrimaryContactCrossRef::class, parentColumn = "organization_id", entityColumn = "contact_id", - ) + ), ) val primaryContacts: List, @Relation( diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentSyncStats.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentSyncStats.kt index 053d76778..23e108bc2 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentSyncStats.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedIncidentSyncStats.kt @@ -15,4 +15,4 @@ data class PopulatedIncidentSyncStats( fun isShortSynced() = with(entity) { successfulSync != null && pagedCount >= targetCount } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalImage.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalImage.kt index 9db68be3d..00928a6b2 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalImage.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalImage.kt @@ -4,4 +4,4 @@ data class PopulatedLocalImageDescription( val id: Long, val uri: String, val tag: String, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalWorksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalWorksite.kt index cd8d6e68c..890dfe24d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalWorksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocalWorksite.kt @@ -49,7 +49,7 @@ data class PopulatedLocalWorksite( value = WorksiteNetworkFileCrossRef::class, parentColumn = "worksite_id", entityColumn = "network_file_id", - ) + ), ) val files: List, @Relation( @@ -59,7 +59,7 @@ data class PopulatedLocalWorksite( value = WorksiteNetworkFileCrossRef::class, parentColumn = "worksite_id", entityColumn = "network_file_id", - ) + ), ) val fileImages: List, @Relation( @@ -119,9 +119,11 @@ fun PopulatedLocalWorksite.asExternalModel( if (a.networkId == b.networkId) { if (a.createdAt < b.createdAt) 1 else -1 } else { - if (a.networkId < 0) -1 - else if (b.networkId < 0) 1 - else if (a.networkId > b.networkId) -1 else 1 + if (a.networkId < 0) { + -1 + } else if (b.networkId < 0) { + 1 + } else if (a.networkId > b.networkId) -1 else 1 } } .map(WorksiteNoteEntity::asExternalModel), @@ -143,11 +145,11 @@ fun PopulatedLocalWorksite.asExternalModel( localImages.map(WorksiteLocalImageEntity::asExternalModel), LocalChange( isLocalModified = root.isLocalModified || - hasImagesPendingDelete || - localImages.isNotEmpty(), + hasImagesPendingDelete || + localImages.isNotEmpty(), localModifiedAt = root.localModifiedAt, syncedAt = root.syncedAt, ), ) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocation.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocation.kt index 7c8244da2..f1596c3e0 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocation.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedLocation.kt @@ -26,4 +26,4 @@ fun PopulatedLocation.asExternalModel(): Location { coordinates = coordinates, multiCoordinates = multiCoordinates, ) -} \ No newline at end of file +} diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedPersonContactOrganization.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedPersonContactOrganization.kt index 20ceb01d5..6b6d9f31d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedPersonContactOrganization.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedPersonContactOrganization.kt @@ -7,6 +7,7 @@ import androidx.room.Relation data class PopulatedPersonContactOrganization( @Embedded val entity: PersonContactEntity, + // Missing cross ref will crash so be flexible @Relation( parentColumn = "id", entityColumn = "id", @@ -14,8 +15,7 @@ data class PopulatedPersonContactOrganization( value = PersonOrganizationCrossRef::class, parentColumn = "id", entityColumn = "organization_id", - ) + ), ) - // Missing cross ref will crash so be flexible val organization: IncidentOrganizationEntity?, ) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedRecentWorksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedRecentWorksite.kt index 3c4074f6c..15366932b 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedRecentWorksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedRecentWorksite.kt @@ -12,7 +12,7 @@ data class PopulatedRecentWorksite( parentColumn = "id", entityColumn = "id", ) - val worksite: WorksiteEntity + val worksite: WorksiteEntity, ) fun PopulatedRecentWorksite.asSummary(): WorksiteSummary { diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedTableDataWorksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedTableDataWorksite.kt index bd78bdc56..415356496 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedTableDataWorksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedTableDataWorksite.kt @@ -52,6 +52,10 @@ fun List.filter( it.base.isFavorite, locationAreaBounds, ) - ) it else null + ) { + it + } else { + null + } } } diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedWorksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedWorksite.kt index c4b5f9dea..13bcfa9ce 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedWorksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/PopulatedWorksite.kt @@ -143,8 +143,8 @@ fun PopulatedWorksiteMapVisual.asExternalModel(isFilteredOut: Boolean = false) = isFavorite = favoriteId != null, isHighPriority = flags.any { it.isHighPriority == true || - it.reasonT == highPriorityFlagLiteral + it.reasonT == highPriorityFlagLiteral }, isDuplicate = flags.any { it.reasonT == duplicateFlagLiteral }, isFilteredOut = isFilteredOut, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/RecentWorksiteEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/RecentWorksiteEntity.kt index 473320629..cb294db8d 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/RecentWorksiteEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/RecentWorksiteEntity.kt @@ -12,7 +12,7 @@ import kotlinx.datetime.Instant parentColumns = ["id"], childColumns = ["id"], onDelete = ForeignKey.CASCADE, - ) + ), ], indices = [ Index( @@ -23,7 +23,7 @@ import kotlinx.datetime.Instant value = ["viewed_at"], orders = [Order.DESC], ), - ] + ], ) data class RecentWorksiteEntity( @PrimaryKey diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/SyncLogEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/SyncLogEntity.kt index 0e4ddadd1..867ba5eb2 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/SyncLogEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/SyncLogEntity.kt @@ -12,8 +12,8 @@ import kotlinx.datetime.Instant Index( value = ["log_time"], orders = [Index.Order.DESC], - ) - ] + ), + ], ) data class SyncLogEntity( @PrimaryKey(true) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorkTypeStatusEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorkTypeStatusEntity.kt index 69437bfc1..65634c982 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorkTypeStatusEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorkTypeStatusEntity.kt @@ -9,7 +9,7 @@ import androidx.room.PrimaryKey "work_type_statuses", indices = [ Index(value = ["list_order"]), - ] + ], ) data class WorkTypeStatusEntity( @PrimaryKey diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/Worksite.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/Worksite.kt index 38e3d316c..0d74afd08 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/Worksite.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/Worksite.kt @@ -116,4 +116,4 @@ data class EditWorksiteEntities( val formData: Collection, val notes: Collection, val workTypes: Collection, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteChangeEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteChangeEntity.kt index 64265068e..e707d384e 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteChangeEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteChangeEntity.kt @@ -22,7 +22,7 @@ import kotlinx.datetime.Instant value = ["worksite_id", "save_attempt_at", "created_at"], orders = [Order.ASC, Order.ASC, Order.DESC], ), - ] + ], ) data class WorksiteChangeEntity( @PrimaryKey(true) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntities.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntities.kt index e202922e9..7f423d7b4 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntities.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntities.kt @@ -7,4 +7,4 @@ data class WorksiteEntities( val notes: List, val workTypes: List, val files: List = emptyList(), -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntity.kt index bb71b8bf2..ddf1eb78f 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteEntity.kt @@ -165,7 +165,8 @@ fun parseCaseNumberOrder(caseNumber: String): Long { ], indices = [ Index( - value = ["worksite_id", "work_type"], unique = true, + value = ["worksite_id", "work_type"], + unique = true, name = "unique_worksite_work_type", ), Index(value = ["worksite_id", "network_id"]), @@ -244,7 +245,8 @@ data class WorksiteFormDataEntity( ], indices = [ Index( - value = ["worksite_id", "reason_t"], unique = true, + value = ["worksite_id", "reason_t"], + unique = true, name = "unique_worksite_flag", ), Index(value = ["reason_t"]), @@ -297,7 +299,8 @@ fun WorksiteFlagEntity.asExternalModel(translator: KeyTranslator? = null) = Work ], indices = [ Index( - value = ["worksite_id", "network_id", "local_global_uuid"], unique = true, + value = ["worksite_id", "network_id", "local_global_uuid"], + unique = true, name = "unique_worksite_note", ), ], diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteLocalImageEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteLocalImageEntity.kt index 0ee69f3ef..1c4f2ef55 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteLocalImageEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteLocalImageEntity.kt @@ -19,7 +19,7 @@ import com.crisiscleanup.core.model.data.WorksiteLocalImage ], indices = [ Index(value = ["worksite_id", "local_document_id"], unique = true), - ] + ], ) data class WorksiteLocalImageEntity( @PrimaryKey(true) @@ -47,4 +47,4 @@ data class PopulatedWorksiteImageCount( @ColumnInfo("worksite_id") val id: Long, val count: Int, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteSyncStatsEntity.kt b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteSyncStatsEntity.kt index a438f8a7a..bfde7104c 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteSyncStatsEntity.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/model/WorksiteSyncStatsEntity.kt @@ -80,10 +80,16 @@ fun IncidentDataSyncStats.asWorksiteSyncStatsEntity() = WorksiteSyncStatsEntity( syncStart = syncStart, targetCount = dataCount, pagedCount = pagedCount, - successfulSync = if (syncAttempt.successfulSeconds <= 0) null - else Instant.fromEpochSeconds(syncAttempt.successfulSeconds), - attemptedSync = if (syncAttempt.attemptedSeconds <= 0) null - else Instant.fromEpochSeconds(syncAttempt.attemptedSeconds), + successfulSync = if (syncAttempt.successfulSeconds <= 0) { + null + } else { + Instant.fromEpochSeconds(syncAttempt.successfulSeconds) + }, + attemptedSync = if (syncAttempt.attemptedSeconds <= 0) { + null + } else { + Instant.fromEpochSeconds(syncAttempt.attemptedSeconds) + }, attemptedCounter = syncAttempt.attemptedCounter, appBuildVersionCode = appBuildVersionCode, -) \ No newline at end of file +) diff --git a/core/database/src/main/java/com/crisiscleanup/core/database/util/FtsUtil.kt b/core/database/src/main/java/com/crisiscleanup/core/database/util/FtsUtil.kt index 33e43453e..4e937f72a 100644 --- a/core/database/src/main/java/com/crisiscleanup/core/database/util/FtsUtil.kt +++ b/core/database/src/main/java/com/crisiscleanup/core/database/util/FtsUtil.kt @@ -19,7 +19,7 @@ val String.ftsSanitize: String val String.ftsGlobEnds: String get() { - return "*${this}*" + return "*$this*" } val String.ftsSanitizeAsToken: String @@ -83,4 +83,4 @@ internal fun Array.okapiBm25Score( } return score -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/AccountInfoDataSource.kt b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/AccountInfoDataSource.kt index dab394859..c46c53550 100644 --- a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/AccountInfoDataSource.kt +++ b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/AccountInfoDataSource.kt @@ -22,16 +22,22 @@ class AccountInfoDataSource @Inject constructor( ) { companion object { fun defaultProfilePictureUri(fullName: String): String = - if (fullName.isEmpty()) "" - else "https://avatars.dicebear.com/api/bottts/$fullName.svg" + if (fullName.isEmpty()) { + "" + } else { + "https://avatars.dicebear.com/api/bottts/$fullName.svg" + } } val accountData = dataStore.data .map { val fullName = "${it.firstName} ${it.lastName}".trim() val profilePictureUri = - if (it.profilePictureUri?.isEmpty() == true) defaultProfilePictureUri(fullName) - else it.profilePictureUri + if (it.profilePictureUri?.isEmpty() == true) { + defaultProfilePictureUri(fullName) + } else { + it.profilePictureUri + } AccountData( id = it.id, tokenExpiry = Instant.fromEpochSeconds(it.expirySeconds), diff --git a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/CasesFiltersDataSource.kt b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/CasesFiltersDataSource.kt index 0276d6c30..1f50648fc 100644 --- a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/CasesFiltersDataSource.kt +++ b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/CasesFiltersDataSource.kt @@ -18,7 +18,7 @@ class CasesFiltersDataSource @Inject constructor( if (startSeconds in 1..endSeconds) { Pair( Instant.fromEpochSeconds(startSeconds), - Instant.fromEpochSeconds(endSeconds) + Instant.fromEpochSeconds(endSeconds), ) } else { null @@ -103,4 +103,4 @@ class CasesFiltersDataSource @Inject constructor( } } } -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSource.kt b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSource.kt index 5554d296a..33f2eb4a8 100644 --- a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSource.kt +++ b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSource.kt @@ -23,7 +23,8 @@ class LocalAppPreferencesDataSource @Inject constructor( null, DarkThemeConfigProto.DARK_THEME_CONFIG_UNSPECIFIED, DarkThemeConfigProto.UNRECOGNIZED, - DarkThemeConfigProto.DARK_THEME_CONFIG_FOLLOW_SYSTEM -> + DarkThemeConfigProto.DARK_THEME_CONFIG_FOLLOW_SYSTEM, + -> DarkThemeConfig.FOLLOW_SYSTEM DarkThemeConfigProto.DARK_THEME_CONFIG_LIGHT -> @@ -130,4 +131,4 @@ class LocalAppPreferencesDataSource @Inject constructor( it.copy { tableViewSortBy = sortBy.literal } } } -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/SecureDataSource.kt b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/SecureDataSource.kt index 4eb1718ce..9ac5fe583 100644 --- a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/SecureDataSource.kt +++ b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/SecureDataSource.kt @@ -8,7 +8,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext import javax.inject.Inject class SecureDataSource @Inject constructor( - @ApplicationContext context: Context + @ApplicationContext context: Context, ) { private val sharedPrefsFile = "crisis-cleanup-secure-prefs" private val sharedPreferences: SharedPreferences @@ -42,4 +42,4 @@ class SecureDataSource @Inject constructor( val accessToken: String? get() = sharedPreferences.getString(accessTokenKey, null) -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/di/DataStoreModule.kt b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/di/DataStoreModule.kt index 14dee08c9..91de6fc89 100644 --- a/core/datastore/src/main/java/com/crisiscleanup/core/datastore/di/DataStoreModule.kt +++ b/core/datastore/src/main/java/com/crisiscleanup/core/datastore/di/DataStoreModule.kt @@ -26,7 +26,7 @@ object DataStoreModule { fun providesUserPreferencesDataStore( @ApplicationContext context: Context, @Dispatcher(IO) ioDispatcher: CoroutineDispatcher, - userPreferencesSerializer: UserPreferencesSerializer + userPreferencesSerializer: UserPreferencesSerializer, ): DataStore = DataStoreFactory.create( serializer = userPreferencesSerializer, @@ -40,7 +40,7 @@ object DataStoreModule { fun providesAccountInfoProtoDataStore( @ApplicationContext context: Context, @Dispatcher(IO) ioDispatcher: CoroutineDispatcher, - serializer: AccountInfoProtoSerializer + serializer: AccountInfoProtoSerializer, ): DataStore = DataStoreFactory.create( serializer = serializer, @@ -54,7 +54,7 @@ object DataStoreModule { fun providesCasesFiltersProtoDataStore( @ApplicationContext context: Context, @Dispatcher(IO) ioDispatcher: CoroutineDispatcher, - serializer: CasesFiltersProtoSerializer + serializer: CasesFiltersProtoSerializer, ): DataStore = DataStoreFactory.create( serializer = serializer, diff --git a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoDataSourceTest.kt b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoDataSourceTest.kt index a3a4c9d0e..991c6b0e0 100644 --- a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoDataSourceTest.kt +++ b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoDataSourceTest.kt @@ -84,4 +84,4 @@ class AccountInfoDataSourceTest { // ) // assertEquals(expected, subject.accountData.first()) // } -} \ No newline at end of file +} diff --git a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoProtoSerializerTest.kt b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoProtoSerializerTest.kt index 7c2081848..588da760a 100644 --- a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoProtoSerializerTest.kt +++ b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/AccountInfoProtoSerializerTest.kt @@ -15,7 +15,7 @@ class AccountInfoProtoSerializerTest { accountInfo { // Default value }, - serializer.defaultValue + serializer.defaultValue, ) } @@ -23,4 +23,4 @@ class AccountInfoProtoSerializerTest { fun readingInvalidAccountInfo_throwsCorruptionException() = runTest { serializer.readFrom(ByteArrayInputStream(byteArrayOf(0))) } -} \ No newline at end of file +} diff --git a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSourceTest.kt b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSourceTest.kt index 6eca2284d..310fe2c46 100644 --- a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSourceTest.kt +++ b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/LocalAppPreferencesDataSourceTest.kt @@ -26,7 +26,7 @@ class LocalAppPreferencesDataSourceTest { @Before fun setup() { subject = LocalAppPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore() + tmpFolder.testUserPreferencesDataStore(), ) } diff --git a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/UserPreferencesSerializerTest.kt b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/UserPreferencesSerializerTest.kt index c0ec961b0..e16e2ac26 100644 --- a/core/datastore/src/test/java/com/crisiscleanup/core/datastore/UserPreferencesSerializerTest.kt +++ b/core/datastore/src/test/java/com/crisiscleanup/core/datastore/UserPreferencesSerializerTest.kt @@ -15,7 +15,7 @@ class UserPreferencesSerializerTest { userPreferences { // Default value }, - userPreferencesSerializer.defaultValue + userPreferencesSerializer.defaultValue, ) } diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/LocalTranslator.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/LocalTranslator.kt index 409c8afcd..528d0e9a6 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/LocalTranslator.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/LocalTranslator.kt @@ -5,10 +5,10 @@ import com.crisiscleanup.core.common.KeyResourceTranslator import kotlinx.coroutines.flow.MutableStateFlow data class AppTranslator( - val translator: KeyResourceTranslator + val translator: KeyResourceTranslator, ) -//private val passThroughTranslator = AppTranslator( +// private val passThroughTranslator = AppTranslator( // translator = object : KeyResourceTranslator { // override val translationCount = MutableStateFlow(0) // @@ -16,7 +16,7 @@ data class AppTranslator( // // override fun translate(phraseKey: String, fallbackResId: Int) = phraseKey // } -//) +// ) val passThroughTranslator = object : KeyResourceTranslator { override val translationCount = MutableStateFlow(0) @@ -26,4 +26,4 @@ val passThroughTranslator = object : KeyResourceTranslator { override fun translate(phraseKey: String, fallbackResId: Int) = phraseKey } -val LocalAppTranslator = staticCompositionLocalOf { passThroughTranslator } \ No newline at end of file +val LocalAppTranslator = staticCompositionLocalOf { passThroughTranslator } diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/AlertDialog.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/AlertDialog.kt index 139d9a15c..372749793 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/AlertDialog.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/AlertDialog.kt @@ -42,7 +42,9 @@ fun CrisisCleanupAlertDialog( text: String = "", textContent: @Composable () -> Unit = {}, ) { - val titleComposable: @Composable () -> Unit = if (title.isBlank()) titleContent else { + val titleComposable: @Composable () -> Unit = if (title.isBlank()) { + titleContent + } else { @Composable { Text( title, @@ -52,10 +54,13 @@ fun CrisisCleanupAlertDialog( } val textComposable: @Composable () -> Unit = { CompositionLocalProvider( - LocalTextStyle provides MaterialTheme.typography.bodyLarge + LocalTextStyle provides MaterialTheme.typography.bodyLarge, ) { - if (text.isBlank()) textContent() - else Text(text) + if (text.isBlank()) { + textContent() + } else { + Text(text) + } } } diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Background.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Background.kt index ce285d65a..77b1266c9 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Background.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Background.kt @@ -25,7 +25,7 @@ import com.crisiscleanup.core.designsystem.theme.LocalBackgroundTheme @Composable fun CrisisCleanupBackground( modifier: Modifier = Modifier, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { val color = LocalBackgroundTheme.current.color val tonalElevation = LocalBackgroundTheme.current.tonalElevation @@ -62,4 +62,4 @@ fun BackgroundDynamic() { CrisisCleanupTheme { CrisisCleanupBackground(Modifier.size(100.dp), content = {}) } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Button.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Button.kt index 5a4c2b293..0422dacd2 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Button.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Button.kt @@ -240,7 +240,7 @@ fun CrisisCleanupFab( iconContent: @Composable () -> Unit = {}, ) { CompositionLocalProvider( - LocalRippleTheme provides if (enabled) LocalRippleTheme.current else NoRippleTheme + LocalRippleTheme provides if (enabled) LocalRippleTheme.current else NoRippleTheme, ) { // TODO Complex conditions below are due to some bug when shape is not a circle. // Container color would not need the condition if elevation changed as expected. @@ -270,7 +270,7 @@ fun WorkTypeAction( onClick: () -> Unit = {}, ) = CrisisCleanupOutlinedButton( // TODO Common dimensions - modifier = Modifier.testTag("workTypeAction_${text}").widthIn(100.dp), + modifier = Modifier.testTag("workTypeAction_$text").widthIn(100.dp), text = text, onClick = onClick, enabled = enabled, @@ -322,8 +322,9 @@ fun CrisisCleanupOutlinedButtonPreview() { CrisisCleanupTheme { CrisisCleanupOutlinedButton(text = "Outlined") { Icon( - imageVector = CrisisCleanupIcons.ArrowDropDown, contentDescription = null + imageVector = CrisisCleanupIcons.ArrowDropDown, + contentDescription = null, ) } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Checkbox.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Checkbox.kt index fffe1fdb8..9a6b2d85f 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Checkbox.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Checkbox.kt @@ -31,7 +31,7 @@ fun CrisisCleanupTextCheckbox( Modifier .clickable( enabled = enabled && enableToggle, - onClick = onToggle + onClick = onToggle, ) .then(modifier), verticalAlignment = Alignment.CenterVertically, @@ -56,4 +56,4 @@ fun CrisisCleanupTextCheckbox( it() } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/CollapsibleIcon.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/CollapsibleIcon.kt index 79870eb33..200bd1865 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/CollapsibleIcon.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/CollapsibleIcon.kt @@ -7,7 +7,6 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.testTag import com.crisiscleanup.core.designsystem.LocalAppTranslator - @Composable fun CollapsibleIcon( isCollapsed: Boolean, @@ -15,13 +14,16 @@ fun CollapsibleIcon( iconVector: ImageVector, ) { val translator = LocalAppTranslator.current - val translateKey = if (isCollapsed) "actions.collapse_section" - else "actions.expand_section" + val translateKey = if (isCollapsed) { + "actions.collapse_section" + } else { + "actions.expand_section" + } val description = translator(translateKey) .replace("{section}", sectionTitle) Icon( imageVector = iconVector, contentDescription = description, - modifier = Modifier.testTag("collapsibleIcon_${sectionTitle}"), + modifier = Modifier.testTag("collapsibleIcon_$sectionTitle"), ) } diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/DatePickerDialog.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/DatePickerDialog.kt index 0d5992148..f80550c1e 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/DatePickerDialog.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/DatePickerDialog.kt @@ -82,7 +82,7 @@ fun DateRangePickerDialog( val confirmEnabled = remember { derivedStateOf { datePickerState.selectedStartDateMillis != null && - datePickerState.selectedEndDateMillis != null + datePickerState.selectedEndDateMillis != null } } val translator = LocalAppTranslator.current @@ -100,7 +100,7 @@ fun DateRangePickerDialog( ) { CrisisCleanupIconButton( imageVector = CrisisCleanupIcons.Close, - onClick = { onCloseDialog(selectedMillis) } + onClick = { onCloseDialog(selectedMillis) }, ) Spacer(modifier = Modifier.weight(1f)) CrisisCleanupTextButton( diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ExplainLocationPermissionDialog.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ExplainLocationPermissionDialog.kt index 9592d4397..87dbf509f 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ExplainLocationPermissionDialog.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ExplainLocationPermissionDialog.kt @@ -27,7 +27,7 @@ fun OpenSettingsDialog( CrisisCleanupTextButton( text = dismissText, onClick = closeDialog, - modifier = Modifier.testTag("ccuAlertDialogDismissBtn") + modifier = Modifier.testTag("ccuAlertDialogDismissBtn"), ) }, confirmButton = { @@ -40,7 +40,7 @@ fun OpenSettingsDialog( ContextCompat.startActivity(context, intent, null) closeDialog() }, - modifier = Modifier.testTag("ccuAlertDialogConfirmBtn") + modifier = Modifier.testTag("ccuAlertDialogConfirmBtn"), ) }, ) @@ -63,4 +63,4 @@ fun ExplainLocationPermissionDialog( closeDialog = closeDialog, ) } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/FocusSectionSlider.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/FocusSectionSlider.kt index 081b6ea3f..72544b7ce 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/FocusSectionSlider.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/FocusSectionSlider.kt @@ -49,7 +49,6 @@ fun FocusSectionSlider( pagerState: LazyListState = rememberLazyListState(), scrollToSection: (Int) -> Unit = {}, ) { - val pagerScrollConnection = remember(pagerState) { object : NestedScrollConnection { override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity { @@ -79,7 +78,6 @@ fun FocusSectionSlider( overflow = TextOverflow.Ellipsis, style = LocalFontStyles.current.header4, ) - } else { val endFillerItemWidth = LocalConfiguration.current.screenWidthDp.dp * 0.8f Spacer(modifier = Modifier.width(endFillerItemWidth)) @@ -126,7 +124,7 @@ fun rememberSectionContentIndexLookup(sectionItemLookup: Map): Mutable sectionItem = sectionItemLookup, itemSection = itemSectionLookup, sectionItemCount = sectionItemCount, - ) + ), ) } } @@ -337,4 +335,4 @@ class FocusSectionSliderState( val onSliderScrollRest: (Int) -> Unit, val takeScrollToSection: () -> Boolean, val onContentScrollRest: (Int) -> Unit, -) \ No newline at end of file +) diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/HelpDialog.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/HelpDialog.kt index 8b6a0a219..7be0e6298 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/HelpDialog.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/HelpDialog.kt @@ -28,8 +28,8 @@ fun HelpRow( ) { Text( text, - modifier = Modifier.testTag("helpRowText_${text}"), - fontWeight = if (isBold) FontWeight.Bold else null + modifier = Modifier.testTag("helpRowText_$text"), + fontWeight = if (isBold) FontWeight.Bold else null, ) HelpAction(iconContentDescription, showHelp) } @@ -100,4 +100,4 @@ fun WithHelpDialog( hasHtml = hasHtml, ) } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconButton.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconButton.kt index 8f88e9a1c..45c40c8f5 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconButton.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconButton.kt @@ -46,8 +46,11 @@ fun CrisisCleanupElevatedIconButton( elevation = elevation, enabled = enabled, ) { - val cd = if (contentDescriptionResId == 0) contentDescription - else stringResource(contentDescriptionResId) + val cd = if (contentDescriptionResId == 0) { + contentDescription + } else { + stringResource(contentDescriptionResId) + } if (iconResId != 0) { Icon( painter = painterResource(iconResId), @@ -73,16 +76,19 @@ fun CrisisCleanupIconButton( contentDescription: String = "", onClick: () -> Unit = {}, enabled: Boolean = true, - tint: Color = LocalContentColor.current + tint: Color = LocalContentColor.current, ) { IconButton( modifier = modifier, onClick = onClick, enabled = enabled, ) { - val cd = if (contentDescriptionResId == 0) contentDescription - else stringResource(contentDescriptionResId) - val iconTint = if(enabled) tint else tint.disabledAlpha() + val cd = if (contentDescriptionResId == 0) { + contentDescription + } else { + stringResource(contentDescriptionResId) + } + val iconTint = if (enabled) tint else tint.disabledAlpha() if (iconResId != 0) { Icon( painter = painterResource(iconResId), @@ -108,4 +114,4 @@ fun CrisisCleanupIconButtonPreview() { modifier = Modifier.size(48.dp), iconResId = R.drawable.ic_cases, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconTextButton.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconTextButton.kt index f0aa9681d..690088784 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconTextButton.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/IconTextButton.kt @@ -75,4 +75,4 @@ private fun CrisisCleanupIconTextButtonPreview() { imageVector = Icons.Default.Image, label = "Presses", ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/LinkifyText.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/LinkifyText.kt index b264c3684..0064b5a54 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/LinkifyText.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/LinkifyText.kt @@ -99,4 +99,4 @@ fun LinkifyPhoneEmailText( textView, Linkify.EMAIL_ADDRESSES or Linkify.PHONE_NUMBERS, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Navigation.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Navigation.kt index ad55ca80d..a474c2801 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Navigation.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/Navigation.kt @@ -43,7 +43,7 @@ fun RowScope.CrisisCleanupNavigationBarItem( selectedIcon: @Composable () -> Unit = icon, enabled: Boolean = true, label: @Composable (() -> Unit)? = null, - alwaysShowLabel: Boolean = true + alwaysShowLabel: Boolean = true, ) { val selectedColor = CrisisCleanupNavigationDefaults.navigationSelectedItemColor() val unselectedColor = selectedColor.copy(0.5f) @@ -61,7 +61,7 @@ fun RowScope.CrisisCleanupNavigationBarItem( selectedTextColor = selectedColor, unselectedTextColor = unselectedColor, indicatorColor = CrisisCleanupNavigationDefaults.navigationIndicatorColor(), - ) + ), ) } @@ -75,14 +75,14 @@ fun RowScope.CrisisCleanupNavigationBarItem( @Composable fun CrisisCleanupNavigationBar( modifier: Modifier = Modifier, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) { NavigationBar( modifier = modifier.testTag("appNavBar"), containerColor = CrisisCleanupNavigationDefaults.navigationContainerColor(), contentColor = CrisisCleanupNavigationDefaults.navigationContentColor(), tonalElevation = 0.dp, - content = content + content = content, ) } @@ -110,7 +110,7 @@ fun CrisisCleanupNavigationRailItem( selectedIcon: @Composable () -> Unit = icon, enabled: Boolean = true, label: @Composable (() -> Unit)? = null, - alwaysShowLabel: Boolean = true + alwaysShowLabel: Boolean = true, ) { NavigationRailItem( selected = selected, @@ -126,7 +126,7 @@ fun CrisisCleanupNavigationRailItem( selectedTextColor = CrisisCleanupNavigationDefaults.navigationSelectedItemColor(), unselectedTextColor = CrisisCleanupNavigationDefaults.navigationContentColor(), indicatorColor = CrisisCleanupNavigationDefaults.navigationIndicatorColor(), - ) + ), ) } @@ -142,14 +142,14 @@ fun CrisisCleanupNavigationRailItem( fun CrisisCleanupNavigationRail( modifier: Modifier = Modifier, header: @Composable (ColumnScope.() -> Unit)? = null, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) { NavigationRail( modifier = modifier, containerColor = CrisisCleanupNavigationDefaults.navigationContainerColor(), contentColor = CrisisCleanupNavigationDefaults.navigationContentColor(), header = header, - content = content + content = content, ) } @@ -158,6 +158,7 @@ fun CrisisCleanupNavigationRail( */ object CrisisCleanupNavigationDefaults { private val containerColor = com.crisiscleanup.core.designsystem.theme.navigationContainerColor + @Composable fun navigationContainerColor() = containerColor @@ -227,4 +228,4 @@ private fun CrisisCleanupNavigationRailPreview() { label = { Text("baa") }, ) } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ProgressIndicator.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ProgressIndicator.kt index ab744a7af..4b71a5b9e 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ProgressIndicator.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/ProgressIndicator.kt @@ -59,4 +59,4 @@ fun SmallBusyIndicator( .size(size), color = color, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/RadioButton.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/RadioButton.kt index 4386ecfa1..f79d27dab 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/RadioButton.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/RadioButton.kt @@ -61,4 +61,4 @@ fun CrisisCleanupRadioButton( it() } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextArea.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextArea.kt index f9da959ee..d1e07b1fd 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextArea.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextArea.kt @@ -42,7 +42,7 @@ fun CrisisCleanupTextArea( focusManager.moveFocus(nextDirection) onNext?.invoke() }, - onDone = onDone?.let { { onDone() } } + onDone = onDone?.let { { onDone() } }, ) OutlinedTextField( text, diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextField.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextField.kt index 1526e22cc..9597ae947 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextField.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TextField.kt @@ -114,18 +114,21 @@ fun SingleLineTextField( onDone = onEnter?.let { { onEnter() } }, ) val labelText = if (labelResId == 0) label else stringResource(labelResId) - val labelContent: (@Composable (() -> Unit)?) = if (labelText.isBlank()) null - else { + val labelContent: (@Composable (() -> Unit)?) = if (labelText.isBlank()) { + null + } else { { Text(labelText) } } val trailingIconContent: (@Composable (() -> Unit)?) = - if (value.isEmpty() || trailingIcon == null) null - else { + if (value.isEmpty() || trailingIcon == null) { + null + } else { { trailingIcon() } } val placeholderContent: (@Composable (() -> Unit)?) = - if (placeholder.isBlank()) null - else { + if (placeholder.isBlank()) { + null + } else { { Text(placeholder) } } @@ -169,7 +172,7 @@ fun SingleLineTextField( focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, disabledIndicatorColor = Color.Transparent, - ) + ), ) } @@ -289,8 +292,11 @@ fun OutlinedObfuscatingTextField( imeAction: ImeAction = ImeAction.Next, ) { val visualTransformation = - if (isObfuscating) PasswordVisualTransformation() - else VisualTransformation.None + if (isObfuscating) { + PasswordVisualTransformation() + } else { + VisualTransformation.None + } val trailingIcon = @Composable { if (value.isNotEmpty()) { @@ -298,10 +304,16 @@ fun OutlinedObfuscatingTextField( onClick = { onObfuscate?.invoke() }, enabled = enabled, ) { - val icon = if (isObfuscating) CrisisCleanupIcons.Visibility - else CrisisCleanupIcons.VisibilityOff - val translateKey = if (isObfuscating) "actions.show" - else "actions.hide" + val icon = if (isObfuscating) { + CrisisCleanupIcons.Visibility + } else { + CrisisCleanupIcons.VisibilityOff + } + val translateKey = if (isObfuscating) { + "actions.show" + } else { + "actions.hide" + } val iconTestTag = if (isObfuscating) "textFieldShowIcon" else "textFieldHideIcon" val translator = LocalAppTranslator.current Icon( @@ -331,4 +343,4 @@ fun OutlinedObfuscatingTextField( imeAction = imeAction, drawOutline = true, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TopAppBar.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TopAppBar.kt index 7509dc1db..4bd46c85b 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TopAppBar.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/component/TopAppBar.kt @@ -78,7 +78,7 @@ private fun IconButton( Icon( imageVector = iconImage, contentDescription = contentDescription, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -95,7 +95,7 @@ private fun StaticDynamicIcon( modifier = Modifier.padding(staticIconPadding), imageVector = imageIcon, contentDescription = contentDescription, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } else { IconButton(onClick, imageIcon, contentDescription) @@ -143,7 +143,7 @@ fun CrisisCleanupTopAppBar( navigationIcon = navigationContent, actions = actionsContent, colors = colors, - modifier = modifier + modifier = modifier, ) } else { TopAppBar( @@ -151,7 +151,7 @@ fun CrisisCleanupTopAppBar( navigationIcon = navigationContent, actions = actionsContent, colors = colors, - modifier = modifier + modifier = modifier, ) } } @@ -184,7 +184,7 @@ fun TopAppBarBackCancel( navigationIcon = navigationContent, actions = actionsContent, colors = colors, - modifier = modifier + modifier = modifier, ) } @@ -287,7 +287,7 @@ fun TopAppBarBackCaretAction( navigationIcon = navigationContent, actions = { }, colors = colors, - modifier = modifier + modifier = modifier, ) } @@ -295,7 +295,7 @@ fun TopAppBarBackCaretAction( @Composable private fun AvatarAttentionBadge( isAlert: Boolean, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { BadgedBox( badge = { @@ -304,7 +304,7 @@ private fun AvatarAttentionBadge( Modifier .size(16.dp, 16.dp) .offset((-4).dp, 32.dp), - containerColor = if (isAlert) avatarAttentionColor else avatarStandardColor + containerColor = if (isAlert) avatarAttentionColor else avatarStandardColor, ) }, ) { @@ -340,7 +340,7 @@ fun TopAppBarDefault( navIcon, onNavigationClick, navContentDescription, - navIconPadding + navIconPadding, ) } } @@ -390,7 +390,7 @@ private fun CrisisCleanupTopCenterAppBarPreview() { navIcon = CrisisCleanupIcons.Search, navContentDescription = "Nav", actionIcon = CrisisCleanupIcons.MoreVert, - actionIconContentDescription = "Action" + actionIconContentDescription = "Action", ) } @@ -403,7 +403,7 @@ private fun CrisisCleanupTopAppBarPreview() { navIcon = CrisisCleanupIcons.Search, titleResId = android.R.string.untitled, actionIcon = CrisisCleanupIcons.MoreVert, - actionIconContentDescription = "Action" + actionIconContentDescription = "Action", ) } @@ -447,4 +447,4 @@ private fun CrisisCleanupTopAppBarImagePreview() { @Composable private fun TopAppBarBackPreview() { TopBarNavAction() -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Background.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Background.kt index 903f9bd63..7afc47190 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Background.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Background.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.unit.Dp @Immutable data class BackgroundTheme( val color: Color = Color.Unspecified, - val tonalElevation: Dp = Dp.Unspecified + val tonalElevation: Dp = Dp.Unspecified, ) /** diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Multipreviews.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Multipreviews.kt index b88d4a43a..48d1d9644 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Multipreviews.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Multipreviews.kt @@ -5,4 +5,4 @@ import androidx.compose.ui.tooling.preview.Preview @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) @Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) -annotation class DayNightPreviews \ No newline at end of file +annotation class DayNightPreviews diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/StyleModifier.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/StyleModifier.kt index 788767271..c001dab2f 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/StyleModifier.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/StyleModifier.kt @@ -42,4 +42,4 @@ fun Modifier.textMessagePadding() = padding(16.dp) val listItemDropdownMenuOffset = DpOffset(16.dp, 0.dp) -fun Modifier.centerAlignTextFieldLabelOffset() = offset(y = 3.dp) \ No newline at end of file +fun Modifier.centerAlignTextFieldLabelOffset() = offset(y = 3.dp) diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Theme.kt index d76fa414b..abe36c551 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Theme.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Theme.kt @@ -115,11 +115,11 @@ val DarkColors = darkColorScheme( @Composable fun CrisisCleanupTheme( darkTheme: Boolean = isSystemInDarkTheme(), - content: @Composable () -> Unit + content: @Composable () -> Unit, ) = CrisisCleanupTheme( darkTheme = darkTheme, disableDynamicTheming = false, - content = content + content = content, ) /** @@ -134,7 +134,7 @@ fun CrisisCleanupTheme( internal fun CrisisCleanupTheme( darkTheme: Boolean = isSystemInDarkTheme(), disableDynamicTheming: Boolean, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { // Color scheme val colorScheme = SingleColors @@ -155,7 +155,7 @@ internal fun CrisisCleanupTheme( MaterialTheme( colorScheme = colorScheme, typography = AppTypography, - content = content + content = content, ) } } diff --git a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Type.kt b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Type.kt index 84541748a..bbe206ef0 100644 --- a/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Type.kt +++ b/core/designsystem/src/main/java/com/crisiscleanup/core/designsystem/theme/Type.kt @@ -29,57 +29,57 @@ val CrisisCleanupTypographyDefault = CrisisCleanupTypography( fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 15.8.sp, - fontSize = 16.sp + fontSize = 16.sp, ), accentTextStyle = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W600, letterSpacing = 0.sp, lineHeight = 21.82.sp, - fontSize = 16.sp + fontSize = 16.sp, ), helpTextStyle = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 16.37.sp, - fontSize = 12.sp + fontSize = 12.sp, ), header1 = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 28.7.sp, - fontSize = 24.sp + fontSize = 24.sp, ), header2 = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 27.28.sp, - fontSize = 20.sp + fontSize = 20.sp, ), header3 = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 24.55.sp, - fontSize = 18.sp + fontSize = 18.sp, ), header4 = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 18.sp, - fontSize = 16.sp + fontSize = 16.sp, ), header5 = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W700, letterSpacing = 0.sp, lineHeight = 16.sp, - fontSize = 14.sp - ) + fontSize = 14.sp, + ), ) val LocalFontStyles = staticCompositionLocalOf { CrisisCleanupTypographyDefault } @@ -90,104 +90,104 @@ internal val AppTypography = Typography( fontWeight = FontWeight.Medium, letterSpacing = 0.sp, lineHeight = 20.sp, - fontSize = 14.sp + fontSize = 14.sp, ), labelMedium = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.Medium, letterSpacing = 0.10000000149011612.sp, lineHeight = 16.sp, - fontSize = 12.sp + fontSize = 12.sp, ), labelSmall = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.Medium, letterSpacing = 0.10000000149011612.sp, lineHeight = 16.sp, - fontSize = 11.sp + fontSize = 11.sp, ), bodyLarge = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 21.82.sp, - fontSize = 16.sp + fontSize = 16.sp, ), bodyMedium = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 20.sp, - fontSize = 14.sp + fontSize = 14.sp, ), bodySmall = TextStyle( fontFamily = NunitoSans, fontWeight = FontWeight.W400, letterSpacing = 0.10000000149011612.sp, lineHeight = 16.8.sp, - fontSize = 14.sp + fontSize = 14.sp, ), headlineLarge = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 40.sp, - fontSize = 32.sp + fontSize = 32.sp, ), headlineMedium = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 36.sp, - fontSize = 28.sp + fontSize = 28.sp, ), headlineSmall = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 32.sp, - fontSize = 24.sp + fontSize = 24.sp, ), displayLarge = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 64.sp, - fontSize = 57.sp + fontSize = 57.sp, ), displayMedium = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 52.sp, - fontSize = 45.sp + fontSize = 45.sp, ), displaySmall = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 44.sp, - fontSize = 36.sp + fontSize = 36.sp, ), titleLarge = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.W400, letterSpacing = 0.sp, lineHeight = 28.sp, - fontSize = 22.sp + fontSize = 22.sp, ), titleMedium = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.Medium, letterSpacing = 0.sp, lineHeight = 24.sp, - fontSize = 16.sp + fontSize = 16.sp, ), titleSmall = TextStyle( fontFamily = Roboto, fontWeight = FontWeight.Medium, letterSpacing = 0.sp, lineHeight = 20.sp, - fontSize = 14.sp + fontSize = 14.sp, ), -) \ No newline at end of file +) diff --git a/core/designsystem/src/main/res/font/nunito_sans_bold.xml b/core/designsystem/src/main/res/font/nunito_sans_bold.xml index 49aa8baa9..518b340e1 100644 --- a/core/designsystem/src/main/res/font/nunito_sans_bold.xml +++ b/core/designsystem/src/main/res/font/nunito_sans_bold.xml @@ -1,4 +1,3 @@ - #009BFF \ No newline at end of file diff --git a/core/designsystem/src/main/res/values/font_certs.xml b/core/designsystem/src/main/res/values/font_certs.xml index d2226ac01..fe71e3295 100644 --- a/core/designsystem/src/main/res/values/font_certs.xml +++ b/core/designsystem/src/main/res/values/font_certs.xml @@ -1,4 +1,3 @@ - @array/com_google_android_gms_fonts_certs_dev diff --git a/core/designsystem/src/main/res/values/preloaded_fonts.xml b/core/designsystem/src/main/res/values/preloaded_fonts.xml index 9ed9b795b..c820bcbf3 100644 --- a/core/designsystem/src/main/res/values/preloaded_fonts.xml +++ b/core/designsystem/src/main/res/values/preloaded_fonts.xml @@ -1,4 +1,3 @@ - @font/nunito_sans diff --git a/core/designsystem/src/main/res/values/styles.xml b/core/designsystem/src/main/res/values/styles.xml index 57414a340..85c1e9f77 100644 --- a/core/designsystem/src/main/res/values/styles.xml +++ b/core/designsystem/src/main/res/values/styles.xml @@ -1,4 +1,3 @@ -