From fb81ed860e209aefcb8551ebccbb7116cfbb38d2 Mon Sep 17 00:00:00 2001 From: dadachi Date: Fri, 27 Mar 2026 09:07:22 +0900 Subject: [PATCH] Add Spotless + ktlint for Kotlin code formatting Configure Spotless with ktlint to enforce consistent code style across the project, excluding libs.versions.toml. Add spotlessCheck and Android Lint to CI workflow. Add JVM crash logs to .gitignore. Disable ktlint rules incompatible with existing codebase conventions (package-name, wildcard-imports, max-line-length, property-naming, filename) and Compose-unfriendly rules (matching nowinandroid .editorconfig). Co-Authored-By: Claude Opus 4.6 (1M context) --- .editorconfig | 22 +++++- .github/workflows/run_tests.yml | 10 ++- .gitignore | 4 + app/build.gradle.kts | 14 ++-- .../nativeapptemplatefree/MainActivity.kt | 12 +-- .../nativeapptemplatefree/NatConstants.kt | 2 +- .../NativeAppTemplateApplication.kt | 2 +- .../data/item_tag/ItemTagApi.kt | 12 +-- .../data/item_tag/ItemTagRepository.kt | 2 +- .../data/item_tag/ItemTagRepositoryImpl.kt | 46 +++++------ .../data/login/AccountPasswordApi.kt | 4 +- .../data/login/AccountPasswordRepository.kt | 2 +- .../login/AccountPasswordRepositoryImpl.kt | 11 ++- .../data/login/LoginApi.kt | 10 +-- .../data/login/LoginRepository.kt | 9 +-- .../data/login/LoginRepositoryImpl.kt | 37 +++++---- .../data/login/SignUpApi.kt | 13 ++-- .../data/login/SignUpRepository.kt | 3 +- .../data/login/SignUpRepositoryImpl.kt | 37 +++++---- .../data/shop/ShopApi.kt | 2 +- .../data/shop/ShopRepository.kt | 4 +- .../data/shop/ShopRepositoryImpl.kt | 43 +++++------ .../datastore/NatPreferencesDataSource.kt | 14 ++-- .../designsystem/component/Navigation.kt | 2 - .../designsystem/theme/Color.kt | 1 - .../designsystem/theme/CustomColorScheme.kt | 2 +- .../designsystem/theme/Theme.kt | 7 +- .../di/modules/CoroutineScopesModule.kt | 12 +-- .../di/modules/DataStoreModule.kt | 2 - .../di/modules/NetModule.kt | 4 +- .../navigation/NatNavHost.kt | 22 +++--- .../network/AuthInterceptor.kt | 5 +- .../network/NatDispatchers.kt | 4 +- .../network/RequestHelper.kt | 2 +- .../ui/app_root/AcceptPrivacyView.kt | 23 +++--- .../ui/app_root/AcceptPrivacyViewModel.kt | 2 +- .../ui/app_root/AcceptTermsView.kt | 23 +++--- .../ui/app_root/AcceptTermsViewModel.kt | 2 +- .../ui/app_root/ForgotPasswordView.kt | 20 ++--- .../ui/app_root/ForgotPasswordViewModel.kt | 8 +- .../ui/app_root/NatApp.kt | 2 +- .../ui/app_root/NatAppState.kt | 9 ++- .../ui/app_root/NeedAppUpdatesView.kt | 16 ++-- .../ui/app_root/OnboardingView.kt | 16 ++-- .../ui/app_root/OnboardingViewModel.kt | 3 +- .../ResendConfirmationInstructionsView.kt | 20 ++--- ...ResendConfirmationInstructionsViewModel.kt | 8 +- .../ui/app_root/SignInEmailAndPasswordView.kt | 52 +++++++------ .../SignInEmailAndPasswordViewModel.kt | 8 +- .../ui/app_root/SignUpOrSignInView.kt | 31 ++++---- .../ui/app_root/SignUpView.kt | 44 ++++++----- .../ui/app_root/SignUpViewModel.kt | 10 +-- .../app_root/navigation/AppRootNavigation.kt | 16 ++-- .../ui/common/ActionIcon.kt | 10 +-- .../ui/common/ActionText.kt | 6 +- .../ui/common/ErrorView.kt | 10 +-- .../ui/common/LoadingView.kt | 1 + .../ui/common/MainButtonView.kt | 2 +- .../ui/common/NatAlertDialog.kt | 13 ++-- .../ui/common/NonScaledSp.kt | 2 +- .../ui/common/SwipeableItemWithActions.kt | 16 ++-- .../ui/scan/CompleteScanResultView.kt | 20 ++--- .../ui/scan/DoScanView.kt | 18 ++--- .../ui/scan/DoScanViewModel.kt | 6 +- .../nativeapptemplatefree/ui/scan/ScanView.kt | 52 ++++++------- .../ui/scan/ScanViewModel.kt | 3 +- .../ui/scan/ShowTagInfoScanResultView.kt | 51 ++++++------- .../ui/scan/navigation/ScanNavigation.kt | 4 +- .../ui/settings/DarkModeSettingsDialog.kt | 2 +- .../ui/settings/PasswordEditView.kt | 57 +++++++------- .../ui/settings/PasswordEditViewModel.kt | 6 +- .../ui/settings/SettingsView.kt | 50 ++++++------ .../ui/settings/ShopkeeperEditView.kt | 43 ++++++----- .../ui/settings/ShopkeeperEditViewModel.kt | 14 ++-- .../settings/navigation/SettingsNavigation.kt | 5 +- .../ui/shop_detail/ShopDetailCardView.kt | 5 +- .../ui/shop_detail/ShopDetailView.kt | 38 +++++----- .../ui/shop_detail/ShopDetailViewModel.kt | 2 +- .../NumberTagsWebpageListView.kt | 10 +-- .../NumberTagsWebpageListViewModel.kt | 3 +- .../ui/shop_settings/ShopBasicSettingsView.kt | 24 +++--- .../ShopBasicSettingsViewModel.kt | 10 +-- .../ui/shop_settings/ShopSettingsView.kt | 44 +++++------ .../ui/shop_settings/ShopSettingsViewModel.kt | 2 +- .../item_tag_detail/ItemTagDetailView.kt | 52 ++++++------- .../item_tag_detail/ItemTagDetailViewModel.kt | 1 - .../item_tag_detail/ItemTagEditView.kt | 24 +++--- .../item_tag_detail/ItemTagEditViewModel.kt | 8 +- .../item_tag_detail/ItemTagWriteView.kt | 24 +++--- .../item_tag_detail/ItemTagWriteViewModel.kt | 5 +- .../item_tag_list/ItemTagCreateView.kt | 26 +++---- .../item_tag_list/ItemTagCreateViewModel.kt | 6 +- .../item_tag_list/ItemTagListCardView.kt | 2 +- .../item_tag_list/ItemTagListView.kt | 28 +++---- .../item_tag_list/ItemTagListViewModel.kt | 4 +- .../navigation/shopSettingsNavigation.kt | 9 ++- .../ui/shops/ShopCreateView.kt | 24 +++--- .../ui/shops/ShopCreateViewModel.kt | 4 +- .../ui/shops/ShopListCardView.kt | 6 +- .../ui/shops/ShopListView.kt | 53 ++++++------- .../ui/shops/ShopListViewModel.kt | 6 +- .../ui/shops/navigation/ShopsNavigation.kt | 2 + .../ConnectivityManagerNetworkMonitor.kt | 76 +++++++++---------- .../utils/DateTimeFormatterUtility.kt | 2 +- .../utils/DateUtility.kt | 2 +- .../utils/NetworkMonitor.kt | 2 +- .../utils/ProfileVerifierLogger.kt | 30 ++++---- .../nativeapptemplatefree/utils/Utility.kt | 12 +-- .../datastore/NatPreferencesDataSourceTest.kt | 2 +- .../UserPreferencesSerializerTest.kt | 2 +- .../datastoreTest/TestDataStoreModule.kt | 14 ++-- .../demo/DemoAssetManager.kt | 2 +- .../demo/DemoAssetManagerImpl.kt | 3 +- .../item_tag/DemoItemTagRepositoryTest.kt | 12 +-- .../login/DemoAccountPasswordRepository.kt | 3 +- .../DemoAccountPasswordRepositoryTest.kt | 6 +- .../demo/login/DemoLoginRepository.kt | 4 +- .../demo/login/DemoLoginRepositoryTest.kt | 8 +- .../demo/login/DemoSignUpRepositoryTest.kt | 10 +-- .../demo/shop/DemoShopRepositoryTest.kt | 6 +- .../testing/di/TestDispatcherModule.kt | 6 +- .../testing/di/TestDispatchersModule.kt | 20 ++--- .../TestAccountPasswordRepository.kt | 4 +- .../repository/TestItemTagRepository.kt | 1 - .../testing/repository/TestLoginRepository.kt | 22 +++--- .../testing/repository/TestShopRepository.kt | 4 +- .../repository/TestSignUpRepository.kt | 8 +- .../testing/util/MainDispatcherRule.kt | 6 +- .../ui/app_root/OnboardingViewModelTest.kt | 2 +- .../SignInEmailAndPasswordViewModelTest.kt | 16 ++-- .../ui/app_root/SignUpViewModelTest.kt | 2 +- .../ui/scan/ScanViewModelTest.kt | 38 +++++----- .../settings/DarkModeSettingsViewModelTest.kt | 2 +- .../ui/settings/PasswordEditViewModelTest.kt | 2 +- .../settings/ShopkeeperEditViewModelTest.kt | 14 ++-- .../ui/shop_detail/ShopDetailViewModelTest.kt | 14 ++-- .../NumberTagsWebpageListViewModelTest.kt | 2 +- .../ShopBasicSettingsViewModelTest.kt | 2 +- .../ShopSettingsViewModelTest.kt | 2 +- .../ItemTagDetailViewModelTest.kt | 4 +- .../ItemTagEditViewModelTest.kt | 6 +- .../ItemTagWriteViewModelTest.kt | 4 +- .../ItemTagCreateViewModelTest.kt | 11 ++- .../item_tag_list/ItemTagListViewModelTest.kt | 14 ++-- .../ui/shops/ShopCreateViewModelTest.kt | 2 +- .../ui/shops/ShopListViewModelTest.kt | 1 - build.gradle.kts | 37 +++++++++ datastore-proto/build.gradle.kts | 34 ++++----- gradle/libs.versions.toml | 3 + .../nativeapptemplatefree/model/Attributes.kt | 4 +- .../model/CompleteScanResultType.kt | 9 ++- .../nativeapptemplatefree/model/Data.kt | 2 +- .../nativeapptemplatefree/model/ItemTag.kt | 4 +- .../model/ItemTagBody.kt | 5 +- .../model/ItemTagBodyDetail.kt | 4 +- .../model/ItemTagData.kt | 6 +- .../model/ItemTagInfoFromNdefMessage.kt | 2 +- .../model/ItemTagState.kt | 3 +- .../model/ItemTagType.kt | 5 +- .../nativeapptemplatefree/model/ItemTags.kt | 4 +- .../model/LoggedInShopkeeper.kt | 4 +- .../nativeapptemplatefree/model/Meta.kt | 6 +- .../model/NativeAppTemplateApiError.kt | 4 +- .../model/Permissions.kt | 4 +- .../model/Relationships.kt | 3 +- .../nativeapptemplatefree/model/ScanState.kt | 3 +- .../model/SendConfirmation.kt | 6 +- .../model/SendResetPassword.kt | 6 +- .../nativeapptemplatefree/model/Shop.kt | 6 +- .../nativeapptemplatefree/model/ShopBody.kt | 5 +- .../model/ShopBodyDetail.kt | 2 +- .../model/ShopUpdateBody.kt | 5 +- .../model/ShopUpdateBodyDetail.kt | 2 +- .../nativeapptemplatefree/model/Shopkeeper.kt | 4 +- .../model/Shopkeepers.kt | 4 +- .../nativeapptemplatefree/model/Shops.kt | 4 +- .../model/ShowTagInfoScanResultType.kt | 7 +- .../nativeapptemplatefree/model/SignUp.kt | 2 +- .../model/SignUpForUpdate.kt | 2 +- .../nativeapptemplatefree/model/Status.kt | 6 +- .../nativeapptemplatefree/model/TimeZones.kt | 2 +- .../model/UpdatePasswordBody.kt | 5 +- .../model/UpdatePasswordBodyDetail.kt | 2 +- .../nativeapptemplatefree/model/UserData.kt | 8 +- settings.gradle.kts | 1 + 185 files changed, 1097 insertions(+), 1037 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5f457ca..4b69008 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,4 +8,24 @@ ij_formatter_off_tag = @formatter:off ij_formatter_on_tag = @formatter:on ij_formatter_tags_enabled = false ij_smart_tabs = false -ij_wrap_on_typing = false \ No newline at end of file +ij_wrap_on_typing = false + +[*.{kt,kts}] +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true +ktlint_function_naming_ignore_when_annotated_with = Composable, Test +ktlint_standard_backing-property-naming = disabled +ktlint_standard_binary-expression-wrapping = disabled +ktlint_standard_chain-method-continuation = disabled +ktlint_standard_class-signature = disabled +ktlint_standard_condition-wrapping = disabled +ktlint_standard_function-expression-body = disabled +ktlint_standard_function-literal = disabled +ktlint_standard_function-type-modifier-spacing = disabled +ktlint_standard_multiline-loop = disabled +ktlint_standard_function-signature = disabled +ktlint_standard_package-name = disabled +ktlint_standard_no-wildcard-imports = disabled +ktlint_standard_property-naming = disabled +ktlint_standard_max-line-length = disabled +ktlint_standard_filename = disabled \ No newline at end of file diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 61aa0a3..e2dcfde 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -15,7 +15,13 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 - - name: Unit Tests + - name: Check lint (spotless) run: | chmod +x gradlew - ./gradlew test --stacktrace + ./gradlew spotlessCheck + + - name: Android Lint + run: ./gradlew :app:lintDebug + + - name: Unit Tests + run: ./gradlew test --stacktrace diff --git a/.gitignore b/.gitignore index 6156213..2f48d81 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,10 @@ app/release/* # https://github.com/JetBrains/kotlin/blob/ca34e5d2fd255ed0501bae4fae3d3691dc40d375/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt#L458 /.kotlin +# JVM crash logs +hs_err_pid*.log +replay_pid*.log + # Claude # Personal Claude Code settings .claude/settings.local.json diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ca9475e..5949925 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,9 +26,9 @@ android { debug { extra["alwaysUpdateBuildId"] = false isDebuggable = true - buildConfigField("String", "DOMAIN","\"api.nativeapptemplate.com\"") - buildConfigField("String", "PORT","\"\"") - buildConfigField("String", "SCHEME","\"https\"") + buildConfigField("String", "DOMAIN", "\"api.nativeapptemplate.com\"") + buildConfigField("String", "PORT", "\"\"") + buildConfigField("String", "SCHEME", "\"https\"") // buildConfigField("String", "DOMAIN","\"192.168.1.21\"") // buildConfigField("String", "PORT","\"3000\"") // buildConfigField("String", "SCHEME","\"http\"") @@ -37,9 +37,9 @@ android { release { isMinifyEnabled = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - buildConfigField("String", "DOMAIN","\"api.nativeapptemplate.com\"") - buildConfigField("String", "PORT","\"\"") - buildConfigField("String", "SCHEME","\"https\"") + buildConfigField("String", "DOMAIN", "\"api.nativeapptemplate.com\"") + buildConfigField("String", "PORT", "\"\"") + buildConfigField("String", "SCHEME", "\"https\"") } } @@ -124,5 +124,3 @@ dependencies { testImplementation(libs.kotlinx.coroutines.test) testImplementation(libs.robolectric) } - - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/MainActivity.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/MainActivity.kt index 1b69d9b..a37bcb0 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/MainActivity.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/MainActivity.kt @@ -128,9 +128,9 @@ class MainActivity : ComponentActivity() { val rawMessages = if (SDK_INT >= 33) { // TIRAMISU intent.getParcelableArrayExtra( NfcAdapter.EXTRA_NDEF_MESSAGES, - NdefMessage::class.java + NdefMessage::class.java, ) - }else{ + } else { @Suppress("DEPRECATION") intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES) } @@ -140,7 +140,7 @@ class MainActivity : ComponentActivity() { val itemTagInfoFromNdefMessage = Utility.extractItemTagInfoFrom( context = this, - ndefMessage = ndefMessage + ndefMessage = ndefMessage, ) updateItemTagInfoFromNdefMessage(itemTagInfoFromNdefMessage) @@ -162,9 +162,9 @@ class MainActivity : ComponentActivity() { val rawMessages = if (SDK_INT >= 33) { // TIRAMISU intent.getParcelableArrayExtra( NfcAdapter.EXTRA_NDEF_MESSAGES, - NdefMessage::class.java + NdefMessage::class.java, ) - }else{ + } else { @Suppress("DEPRECATION") intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES) } @@ -174,7 +174,7 @@ class MainActivity : ComponentActivity() { val itemTagInfoFromNdefMessage = Utility.extractItemTagInfoFrom( context = this, - ndefMessage = ndefMessage + ndefMessage = ndefMessage, ) updateItemTagInfoFromNdefMessage(itemTagInfoFromNdefMessage) diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NatConstants.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NatConstants.kt index bf27901..c5762b0 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NatConstants.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NatConstants.kt @@ -27,4 +27,4 @@ object NatConstants { return result } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NativeAppTemplateApplication.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NativeAppTemplateApplication.kt index 5eeb9b2..e006ae9 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NativeAppTemplateApplication.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NativeAppTemplateApplication.kt @@ -14,4 +14,4 @@ class NativeAppTemplateApplication : Application() { super.onCreate() profileVerifierLogger() } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagApi.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagApi.kt index 60c5f47..76f5e48 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagApi.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagApi.kt @@ -9,33 +9,33 @@ interface ItemTagApi { @GET("{account_id}/api/v1/shopkeeper/shops/{shop_id}/item_tags") suspend fun getItemTags( @Path("account_id") accountId: String, - @Path("shop_id") shopId: String + @Path("shop_id") shopId: String, ): ApiResponse @GET("{account_id}/api/v1/shopkeeper/item_tags/{id}") suspend fun getItemTag( @Path("account_id") accountId: String, - @Path("id") id: String + @Path("id") id: String, ): ApiResponse @POST("{account_id}/api/v1/shopkeeper/shops/{shop_id}/item_tags") suspend fun createItemTag( @Path("account_id") accountId: String, @Path("shop_id") shopId: String, - @Body data: ItemTagBody + @Body data: ItemTagBody, ): ApiResponse @PATCH("{account_id}/api/v1/shopkeeper/item_tags/{id}") suspend fun updateItemTag( @Path("account_id") accountId: String, @Path("id") id: String, - @Body data: ItemTagBody + @Body data: ItemTagBody, ): ApiResponse @DELETE("{account_id}/api/v1/shopkeeper/item_tags/{id}") suspend fun deleteItemTag( @Path("account_id") accountId: String, - @Path("id") id: String + @Path("id") id: String, ): ApiResponse @PATCH("{account_id}/api/v1/shopkeeper/item_tags/{id}/complete") @@ -52,7 +52,7 @@ interface ItemTagApi { companion object { fun create(retroFit: Retrofit): ItemTagApi = retroFit.create( - ItemTagApi::class.java + ItemTagApi::class.java, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepository.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepository.kt index 69dc849..d33b1b0 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepository.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepository.kt @@ -19,7 +19,7 @@ interface ItemTagRepository { fun updateItemTag( id: String, - itemTagBody: ItemTagBody + itemTagBody: ItemTagBody, ): Flow fun deleteItemTag( diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepositoryImpl.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepositoryImpl.kt index 37a3669..05f23bb 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepositoryImpl.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepositoryImpl.kt @@ -36,15 +36,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -55,7 +55,7 @@ class ItemTagRepositoryImpl @Inject constructor( ) = flow { val response = api.getItemTag( mtcPreferencesDataSource.userData.first().accountId, - id + id, ) response.suspendOnSuccess { @@ -66,15 +66,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -101,15 +101,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -124,7 +124,7 @@ class ItemTagRepositoryImpl @Inject constructor( val response = api.updateItemTag( mtcPreferencesDataSource.userData.first().accountId, id, - itemTagBody + itemTagBody, ) response.suspendOnSuccess { @@ -136,15 +136,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -163,15 +163,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -190,15 +190,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -217,15 +217,15 @@ class ItemTagRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordApi.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordApi.kt index d729c62..52ec719 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordApi.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordApi.kt @@ -10,12 +10,12 @@ interface AccountPasswordApi { @PATCH("{account_id}/api/v1/shopkeeper/account/password") suspend fun updateAccountPassword( @Path("account_id") accountId: String, - @Body data: UpdatePasswordBody + @Body data: UpdatePasswordBody, ): ApiResponse companion object { fun create(retroFit: Retrofit): AccountPasswordApi = retroFit.create( - AccountPasswordApi::class.java + AccountPasswordApi::class.java, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepository.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepository.kt index 3a2711c..fd6cb19 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepository.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepository.kt @@ -5,6 +5,6 @@ import kotlinx.coroutines.flow.Flow interface AccountPasswordRepository { fun updateAccountPassword( - updatePasswordBody: UpdatePasswordBody + updatePasswordBody: UpdatePasswordBody, ): Flow } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepositoryImpl.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepositoryImpl.kt index f15f065..1e9a7ea 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepositoryImpl.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/AccountPasswordRepositoryImpl.kt @@ -24,29 +24,28 @@ class AccountPasswordRepositoryImpl @Inject constructor( ) = flow { val response = api.updateAccountPassword( natPreferencesDataSource.userData.first().accountId, - updatePasswordBody + updatePasswordBody, ) response.suspendOnSuccess { - emit(true) + emit(true) }.suspendOnFailure { val nativeAppTemplateApiError: NativeAppTemplateApiError? try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } - }.flowOn(ioDispatcher) } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginApi.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginApi.kt index 6efe38f..2a64879 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginApi.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginApi.kt @@ -11,7 +11,7 @@ import retrofit2.http.* interface LoginApi { @POST("shopkeeper_auth/sign_in") suspend fun login( - @Body data: Login + @Body data: Login, ): ApiResponse @DELETE("shopkeeper_auth/sign_out") @@ -19,22 +19,22 @@ interface LoginApi { @GET("{account_id}/api/v1/shopkeeper/permissions") suspend fun getPermissions( - @Path("account_id") accountId: String + @Path("account_id") accountId: String, ): ApiResponse @PATCH("{account_id}/api/v1/shopkeeper/me/update_confirmed_privacy_version") suspend fun updateConfirmedPrivacyVersion( - @Path("account_id") accountId: String + @Path("account_id") accountId: String, ): ApiResponse @PATCH("{account_id}/api/v1/shopkeeper/me/update_confirmed_terms_version") suspend fun updateConfirmedTermsVersion( - @Path("account_id") accountId: String + @Path("account_id") accountId: String, ): ApiResponse companion object { fun create(retroFit: Retrofit): LoginApi = retroFit.create( - LoginApi::class.java + LoginApi::class.java, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepository.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepository.kt index 19724dd..b7e901f 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepository.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepository.kt @@ -9,18 +9,16 @@ interface LoginRepository { val userData: Flow fun login( - login: Login + login: Login, ): Flow fun logout(): Flow fun getPermissions(): Flow - fun updateConfirmedPrivacyVersion( - ): Flow + fun updateConfirmedPrivacyVersion(): Flow - fun updateConfirmedTermsVersion( - ): Flow + fun updateConfirmedTermsVersion(): Flow suspend fun setShouldFetchItemTagForShowTagInfoScan(shouldFetchItemTagForShowTagInfoScan: Boolean) @@ -88,4 +86,3 @@ interface LoginRepository { fun showTagInfoScanResult(): Flow } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepositoryImpl.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepositoryImpl.kt index aceecf8..58121a3 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepositoryImpl.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/LoginRepositoryImpl.kt @@ -29,7 +29,7 @@ class LoginRepositoryImpl @Inject constructor( ) : LoginRepository { override fun login( - login: Login + login: Login, ) = flow { var loggedInShopkeeper: LoggedInShopkeeper @@ -44,15 +44,15 @@ class LoginRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -73,10 +73,9 @@ class LoginRepositoryImpl @Inject constructor( } }.flowOn(ioDispatcher) - override fun getPermissions( - ) = flow { + override fun getPermissions() = flow { val response = api.getPermissions( - userData.first().accountId + userData.first().accountId, ) response.suspendOnSuccess { @@ -87,22 +86,21 @@ class LoginRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } }.flowOn(ioDispatcher) - override fun updateConfirmedPrivacyVersion( - ) = flow { + override fun updateConfirmedPrivacyVersion() = flow { val response = api.updateConfirmedPrivacyVersion( natPreferencesDataSource.userData.first().accountId, ) @@ -115,22 +113,21 @@ class LoginRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } }.flowOn(ioDispatcher) - override fun updateConfirmedTermsVersion( - ) = flow { + override fun updateConfirmedTermsVersion() = flow { val response = api.updateConfirmedTermsVersion( natPreferencesDataSource.userData.first().accountId, ) @@ -143,15 +140,15 @@ class LoginRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpApi.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpApi.kt index 0ba85ab..2e6668e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpApi.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpApi.kt @@ -13,31 +13,30 @@ import retrofit2.http.* interface SignUpApi { @POST("shopkeeper_auth") suspend fun signUp( - @Body data: SignUp + @Body data: SignUp, ): ApiResponse @PATCH("shopkeeper_auth") suspend fun updateAccount( - @Body data: SignUpForUpdate + @Body data: SignUpForUpdate, ): ApiResponse @DELETE("shopkeeper_auth") - suspend fun deleteAccount( - ): ApiResponse + suspend fun deleteAccount(): ApiResponse @POST("shopkeeper_auth/password") suspend fun sendResetPasswordInstruction( - @Body data: SendResetPassword + @Body data: SendResetPassword, ): ApiResponse @POST("shopkeeper_auth/confirmation") suspend fun sendConfirmationInstruction( - @Body data: SendConfirmation + @Body data: SendConfirmation, ): ApiResponse companion object { fun create(retroFit: Retrofit): SignUpApi = retroFit.create( - SignUpApi::class.java + SignUpApi::class.java, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepository.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepository.kt index d37b4ec..35e89ab 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepository.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepository.kt @@ -13,8 +13,7 @@ interface SignUpRepository { signUpForUpdate: SignUpForUpdate, ): Flow - fun deleteAccount( - ): Flow + fun deleteAccount(): Flow fun sendResetPasswordInstruction( sendResetPassword: SendResetPassword, diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepositoryImpl.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepositoryImpl.kt index e9c4b8c..33c9d87 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepositoryImpl.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/login/SignUpRepositoryImpl.kt @@ -26,26 +26,26 @@ class SignUpRepositoryImpl @Inject constructor( signUp: SignUp, ) = flow { val response = api.signUp( - signUp + signUp, ) response.suspendOnSuccess { - emit(data) + emit(data) }.suspendOnFailure { val nativeAppTemplateApiError: NativeAppTemplateApiError? try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -66,22 +66,21 @@ class SignUpRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } }.flowOn(ioDispatcher) - override fun deleteAccount( - ) = flow { + override fun deleteAccount() = flow { val response = api.deleteAccount() response.suspendOnSuccess { @@ -92,15 +91,15 @@ class SignUpRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -119,15 +118,15 @@ class SignUpRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -146,15 +145,15 @@ class SignUpRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopApi.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopApi.kt index 518a681..8598bf3 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopApi.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopApi.kt @@ -44,7 +44,7 @@ interface ShopApi { companion object { fun create(retroFit: Retrofit): ShopApi = retroFit.create( - ShopApi::class.java + ShopApi::class.java, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepository.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepository.kt index cdf0206..31d63e7 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepository.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepository.kt @@ -7,11 +7,11 @@ interface ShopRepository { fun getShops(): Flow fun getShop( - id: String + id: String, ): Flow fun createShop( - shopBody: ShopBody + shopBody: ShopBody, ): Flow fun updateShop( diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepositoryImpl.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepositoryImpl.kt index ce41606..36e825b 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepositoryImpl.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/shop/ShopRepositoryImpl.kt @@ -20,8 +20,7 @@ class ShopRepositoryImpl @Inject constructor( @Dispatcher(NatDispatchers.IO) private val ioDispatcher: CoroutineDispatcher, ) : ShopRepository { - override fun getShops( - ) = flow { + override fun getShops() = flow { val response = api.getShops( natPreferencesDataSource.userData.first().accountId, ) @@ -34,15 +33,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -53,7 +52,7 @@ class ShopRepositoryImpl @Inject constructor( ) = flow { val response = api.getShop( natPreferencesDataSource.userData.first().accountId, - id + id, ) response.suspendOnSuccess { emit(data) @@ -63,15 +62,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -84,7 +83,7 @@ class ShopRepositoryImpl @Inject constructor( val response = api.createShop( natPreferencesDataSource.userData.first().accountId, - shopBody + shopBody, ) response.suspendOnSuccess { @@ -96,15 +95,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -131,15 +130,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -158,15 +157,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } @@ -185,15 +184,15 @@ class ShopRepositoryImpl @Inject constructor( try { nativeAppTemplateApiError = response.deserializeErrorBody() } catch (exception: Exception) { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } if (nativeAppTemplateApiError != null) { - val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" + val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]" throw Exception(message) } else { - val message= "Not processable error(${message()})." + val message = "Not processable error(${message()})." throw Exception(message) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSource.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSource.kt index ca7819f..52ef36b 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSource.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSource.kt @@ -50,7 +50,7 @@ class NatPreferencesDataSource @Inject constructor( DarkThemeConfigProto.DARK_THEME_CONFIG_UNSPECIFIED, DarkThemeConfigProto.UNRECOGNIZED, DarkThemeConfigProto.DARK_THEME_CONFIG_FOLLOW_SYSTEM, - -> + -> DarkThemeConfig.FOLLOW_SYSTEM DarkThemeConfigProto.DARK_THEME_CONFIG_LIGHT -> DarkThemeConfig.LIGHT @@ -455,11 +455,11 @@ class NatPreferencesDataSource @Inject constructor( private fun showTagInfoScanResultFrom(scanResultProto: ScanResultProto): ShowTagInfoScanResult { val itemTagInfoFromNdefMessage = itemTagInfoFromNdefMessageFrom( - scanResultProto.itemTagInfoFromNdefMessage + scanResultProto.itemTagInfoFromNdefMessage, ) val itemTagData = itemTagDataFrom( - scanResultProto.itemTagData + scanResultProto.itemTagData, ) return ShowTagInfoScanResult( @@ -472,11 +472,11 @@ class NatPreferencesDataSource @Inject constructor( private fun completeScanResultFrom(scanResultProto: ScanResultProto): CompleteScanResult { val itemTagInfoFromNdefMessage = itemTagInfoFromNdefMessageFrom( - scanResultProto.itemTagInfoFromNdefMessage + scanResultProto.itemTagInfoFromNdefMessage, ) val itemTagData = itemTagDataFrom( - scanResultProto.itemTagData + scanResultProto.itemTagData, ) return CompleteScanResult( @@ -488,7 +488,7 @@ class NatPreferencesDataSource @Inject constructor( } private fun itemTagInfoFromNdefMessageFrom( - itemTagInfoFromNdefMessageProto: ItemTagInfoFromNdefMessageProto + itemTagInfoFromNdefMessageProto: ItemTagInfoFromNdefMessageProto, ): ItemTagInfoFromNdefMessage { return ItemTagInfoFromNdefMessage( id = itemTagInfoFromNdefMessageProto.id, @@ -515,4 +515,4 @@ class NatPreferencesDataSource @Inject constructor( alreadyCompleted = itemTagDataProto.alreadyCompleted, ) } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/component/Navigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/component/Navigation.kt index be42547..a3135b5 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/component/Navigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/component/Navigation.kt @@ -18,10 +18,8 @@ package com.nativeapptemplate.nativeapptemplatefree.designsystem.component import androidx.compose.foundation.layout.RowScope import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.People import androidx.compose.material.icons.outlined.Settings import androidx.compose.material.icons.outlined.Storefront -import androidx.compose.material.icons.rounded.People import androidx.compose.material.icons.rounded.Settings import androidx.compose.material.icons.rounded.Storefront import androidx.compose.material3.Icon diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Color.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Color.kt index 54182c4..a1ea02b 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Color.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Color.kt @@ -45,4 +45,3 @@ internal val Yellow20 = Color(0xFFB44D12) internal val Yellow30 = Color(0xFFCB6E17) internal val Yellow40 = Color(0xFFDE911D) internal val Yellow90 = Color(0xFFFFF3C4) - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/CustomColorScheme.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/CustomColorScheme.kt index e0797dd..70d83a1 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/CustomColorScheme.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/CustomColorScheme.kt @@ -26,4 +26,4 @@ val DarkCustomColorScheme = CustomColorScheme( onSuccessContainer = Teal90, ) -val LocalCustomColorScheme = staticCompositionLocalOf { CustomColorScheme() } \ No newline at end of file +val LocalCustomColorScheme = staticCompositionLocalOf { CustomColorScheme() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Theme.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Theme.kt index 63ea020..4fb2da8 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Theme.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Theme.kt @@ -80,8 +80,11 @@ fun NatTheme( val tintTheme = TintTheme() val customColorsPalette = - if (darkTheme) DarkCustomColorScheme - else LightCustomColorScheme + if (darkTheme) { + DarkCustomColorScheme + } else { + LightCustomColorScheme + } // Composition locals CompositionLocalProvider( diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/CoroutineScopesModule.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/CoroutineScopesModule.kt index 86beaa1..9f5fb05 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/CoroutineScopesModule.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/CoroutineScopesModule.kt @@ -35,10 +35,10 @@ annotation class ApplicationScope @Module @InstallIn(SingletonComponent::class) internal object CoroutineScopesModule { - @Provides - @Singleton - @ApplicationScope - fun providesCoroutineScope( - @Dispatcher(NatDispatchers.Default) dispatcher: CoroutineDispatcher, - ): CoroutineScope = CoroutineScope(SupervisorJob() + dispatcher) + @Provides + @Singleton + @ApplicationScope + fun providesCoroutineScope( + @Dispatcher(NatDispatchers.Default) dispatcher: CoroutineDispatcher, + ): CoroutineScope = CoroutineScope(SupervisorJob() + dispatcher) } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/DataStoreModule.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/DataStoreModule.kt index 2c175c4..1e09851 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/DataStoreModule.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/DataStoreModule.kt @@ -24,8 +24,6 @@ import com.nativeapptemplate.nativeapptemplatefree.UserPreferences import com.nativeapptemplate.nativeapptemplatefree.datastore.UserPreferencesSerializer import com.nativeapptemplate.nativeapptemplatefree.network.Dispatcher import com.nativeapptemplate.nativeapptemplatefree.network.NatDispatchers.IO - - import dagger.Module import dagger.Provides import dagger.hilt.InstallIn diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt index eefc0e0..9ee5b03 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt @@ -24,7 +24,6 @@ import retrofit2.Retrofit import java.util.concurrent.TimeUnit import javax.inject.Singleton - /** * Dagger module for network ops */ @@ -53,7 +52,7 @@ class NetModule { @Provides fun provideOkHttp( loggingInterceptor: HttpLoggingInterceptor, - authInterceptor: AuthInterceptor + authInterceptor: AuthInterceptor, ): OkHttpClient = OkHttpClient.Builder() .connectTimeout(30, TimeUnit.SECONDS) @@ -64,7 +63,6 @@ class NetModule { .addInterceptor(loggingInterceptor) .build() - private val json = Json { prettyPrint = true ignoreUnknownKeys = true diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/navigation/NatNavHost.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/navigation/NatNavHost.kt index 41e345d..5af2db0 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/navigation/NatNavHost.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/navigation/NatNavHost.kt @@ -7,11 +7,6 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.compose.NavHost -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToPasswordEdit -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToShopkeeperEdit -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.passwordEditView -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.settingsView -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.shopkeeperEditView import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.NatAppState import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.navigation.acceptPrivacyView import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.navigation.acceptTermsView @@ -35,7 +30,12 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.scan.navigation.doScanView import com.nativeapptemplate.nativeapptemplatefree.ui.scan.navigation.navigateToDoScan import com.nativeapptemplate.nativeapptemplatefree.ui.scan.navigation.scanBaseView import com.nativeapptemplate.nativeapptemplatefree.ui.scan.navigation.scanView +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToPasswordEdit +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToShopkeeperEdit +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.passwordEditView import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.settingBaseView +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.settingsView +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.shopkeeperEditView import com.nativeapptemplate.nativeapptemplatefree.ui.shop_detail.navigation.navigateToShopDetail import com.nativeapptemplate.nativeapptemplatefree.ui.shop_detail.navigation.shopDetailView import com.nativeapptemplate.nativeapptemplatefree.ui.shop_settings.navigation.itemTagCreateView @@ -81,7 +81,7 @@ fun NatNavHost( val shouldUpdateTerms by appState.shouldUpdateTerms.collectAsStateWithLifecycle() val shouldNavigateToScanView by appState.shouldNavigateToScanView.collectAsStateWithLifecycle() - LaunchedEffect( + LaunchedEffect( isLoggedIn, shouldUpdateApp, shouldUpdatePrivacy, @@ -141,10 +141,10 @@ fun NatNavHost( ) needAppUpdatesView() - acceptPrivacyView ( + acceptPrivacyView( onShowSnackbar = onShowSnackbar, ) - acceptTermsView ( + acceptTermsView( onShowSnackbar = onShowSnackbar, ) @@ -185,7 +185,7 @@ fun NatNavHost( onItemClick = { itemTagId -> navController.navigateToItemTagDetail(itemTagId) }, onAddItemTagClick = { shopId -> navController.navigateToItemTagCreate(shopId) }, onShowSnackbar = onShowSnackbar, - onBackClick =navController::popBackStack, + onBackClick = navController::popBackStack, ) itemTagCreateView( onShowSnackbar = onShowSnackbar, @@ -224,11 +224,11 @@ fun NatNavHost( ) shopkeeperEditView( onShowSnackbar = onShowSnackbar, - onBackClick =navController::popBackStack, + onBackClick = navController::popBackStack, ) passwordEditView( onShowSnackbar = onShowSnackbar, - onBackClick =navController::popBackStack, + onBackClick = navController::popBackStack, ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/AuthInterceptor.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/AuthInterceptor.kt index e413d4d..68f286e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/AuthInterceptor.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/AuthInterceptor.kt @@ -14,15 +14,14 @@ import kotlin.coroutines.cancellation.CancellationException class AuthInterceptor @Inject constructor( private val natPreferencesDataSource: NatPreferencesDataSource, ) : Interceptor { - private suspend fun requestHelper( - ): RequestHelper { + private suspend fun requestHelper(): RequestHelper { val userData = natPreferencesDataSource.userData.first() return RequestHelper( apiAuthToken = userData.token, client = userData.client, expiry = userData.expiry, - uid = userData.uid + uid = userData.uid, ) } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/NatDispatchers.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/NatDispatchers.kt index 4c1bdd0..c4c6e39 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/NatDispatchers.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/NatDispatchers.kt @@ -24,6 +24,6 @@ import kotlin.annotation.AnnotationRetention.RUNTIME annotation class Dispatcher(val natDispatcher: NatDispatchers) enum class NatDispatchers { - Default, - IO, + Default, + IO, } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/RequestHelper.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/RequestHelper.kt index 701a5d6..d666d24 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/RequestHelper.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/network/RequestHelper.kt @@ -7,7 +7,7 @@ data class RequestHelper @JvmOverloads constructor( private val apiAuthToken: String = "", private val client: String = "", private val expiry: String = "", - private val uid: String = "" + private val uid: String = "", ) { fun getHeaders(): ArrayMap { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyView.kt index d97a0a2..2a52070 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyView.kt @@ -56,7 +56,7 @@ fun AcceptPrivacyView( if (uiState.isUpdated) { val context = LocalContext.current NatAlertDialog( - dialogTitle= stringResource(R.string.confirmed_privacy_version_updated), + dialogTitle = stringResource(R.string.confirmed_privacy_version_updated), onDismissRequest = { context.restartApp() }, ) } @@ -102,7 +102,7 @@ fun AcceptPrivacyContentView( .padding(padding) .padding(horizontal = 24.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(24.dp) + verticalArrangement = Arrangement.spacedBy(24.dp), ) { val annotatedString = buildAnnotatedString { withStyle(style = SpanStyle(color = MaterialTheme.colorScheme.onSurfaceVariant)) { @@ -113,8 +113,8 @@ fun AcceptPrivacyContentView( withLink( LinkAnnotation.Url( NatConstants.PRIVACY_POLICY_URL, - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.privacy_policy)) } @@ -132,8 +132,8 @@ fun AcceptPrivacyContentView( MainButtonView( title = stringResource(R.string.accept), onClick = { viewModel.updateConfirmedPrivacyVersion() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -141,8 +141,7 @@ fun AcceptPrivacyContentView( @OptIn(ExperimentalMaterial3Api::class) @Composable -private fun TopAppBar( -) { +private fun TopAppBar() { CenterAlignedTopAppBar( colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.primaryContainer, @@ -154,12 +153,10 @@ private fun TopAppBar( } @Composable -private fun AcceptPrivacyLoadingView( -) { +private fun AcceptPrivacyLoadingView() { Scaffold( topBar = { - TopAppBar( - ) + TopAppBar() }, modifier = Modifier.fillMaxSize(), ) { padding -> @@ -168,7 +165,7 @@ private fun AcceptPrivacyLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyViewModel.kt index 86f1f44..6fce95a 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptPrivacyViewModel.kt @@ -23,7 +23,7 @@ data class AcceptPrivacyUiState( @HiltViewModel class AcceptPrivacyViewModel @Inject constructor( - private val loginRepository: LoginRepository + private val loginRepository: LoginRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(AcceptPrivacyUiState()) val uiState: StateFlow = _uiState.asStateFlow() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsView.kt index 3446c44..88f25f3 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsView.kt @@ -56,7 +56,7 @@ fun AcceptTermsView( if (uiState.isUpdated) { val context = LocalContext.current NatAlertDialog( - dialogTitle= stringResource(R.string.confirmed_terms_version_updated), + dialogTitle = stringResource(R.string.confirmed_terms_version_updated), onDismissRequest = { context.restartApp() }, ) } @@ -102,7 +102,7 @@ fun AcceptTermsContentView( .padding(padding) .padding(horizontal = 24.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(24.dp) + verticalArrangement = Arrangement.spacedBy(24.dp), ) { val annotatedString = buildAnnotatedString { withStyle(style = SpanStyle(color = MaterialTheme.colorScheme.onSurfaceVariant)) { @@ -113,8 +113,8 @@ fun AcceptTermsContentView( withLink( LinkAnnotation.Url( NatConstants.TERMS_OF_USE_URL, - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.terms_of_use)) } @@ -132,8 +132,8 @@ fun AcceptTermsContentView( MainButtonView( title = stringResource(R.string.accept), onClick = { viewModel.updateConfirmedTermsVersion() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -141,8 +141,7 @@ fun AcceptTermsContentView( @OptIn(ExperimentalMaterial3Api::class) @Composable -private fun TopAppBar( -) { +private fun TopAppBar() { CenterAlignedTopAppBar( colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.primaryContainer, @@ -154,12 +153,10 @@ private fun TopAppBar( } @Composable -private fun AcceptTermsLoadingView( -) { +private fun AcceptTermsLoadingView() { Scaffold( topBar = { - TopAppBar( - ) + TopAppBar() }, modifier = Modifier.fillMaxSize(), ) { padding -> @@ -168,7 +165,7 @@ private fun AcceptTermsLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsViewModel.kt index ed85355..2a78ec4 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/AcceptTermsViewModel.kt @@ -23,7 +23,7 @@ data class AcceptTermsUiState( @HiltViewModel class AcceptTermsViewModel @Inject constructor( - private val loginRepository: LoginRepository + private val loginRepository: LoginRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(AcceptTermsUiState()) val uiState: StateFlow = _uiState.asStateFlow() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordView.kt index fa61806..7ee1da9 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordView.kt @@ -59,7 +59,7 @@ fun ForgotPasswordView( if (uiState.isSent) { NatAlertDialog( - dialogTitle= stringResource(R.string.sent_reset_password_instruction), + dialogTitle = stringResource(R.string.sent_reset_password_instruction), onDismissRequest = { onBackClick() }, ) } @@ -67,7 +67,7 @@ fun ForgotPasswordView( ForgotPasswordView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -110,14 +110,14 @@ fun ForgotPasswordContentView( onClick = { viewModel.sendMeResetPasswordInstructions() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) Text( stringResource(R.string.button_send_me_reset_password_instructions), modifier = Modifier - .padding(start = 12.dp) + .padding(start = 12.dp), ) } }, @@ -128,12 +128,12 @@ fun ForgotPasswordContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(24.dp) + verticalArrangement = Arrangement.spacedBy(24.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.email) + text = stringResource(R.string.email), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_EMAIL) }, @@ -144,13 +144,13 @@ fun ForgotPasswordContentView( Text( text = stringResource(id = R.string.email_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataEmail()) { Text( text = stringResource(id = R.string.email_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, @@ -201,7 +201,7 @@ private fun ForgotPasswordLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordViewModel.kt index ad461ae..caffd7a 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ForgotPasswordViewModel.kt @@ -26,7 +26,7 @@ data class ForgotPasswordUiState( @HiltViewModel class ForgotPasswordViewModel @Inject constructor( - private val signUpRepository: SignUpRepository + private val signUpRepository: SignUpRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(ForgotPasswordUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -42,7 +42,7 @@ class ForgotPasswordViewModel @Inject constructor( viewModelScope.launch { val sendResetPassword = SendResetPassword( email = uiState.value.email.trim(), - redirectUrl = SendResetPassword.redirectUrlString(NatConstants.baseUrlString()) + redirectUrl = SendResetPassword.redirectUrlString(NatConstants.baseUrlString()), ) val booleanFlow = signUpRepository.sendResetPasswordInstruction(sendResetPassword) @@ -67,11 +67,11 @@ class ForgotPasswordViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { return hasInvalidDataEmail() } - fun hasInvalidDataEmail() : Boolean { + fun hasInvalidDataEmail(): Boolean { if (uiState.value.email.isBlank()) return true return !uiState.value.email.validateEmail() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatApp.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatApp.kt index 2d9d8c4..9f50a87 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatApp.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatApp.kt @@ -190,4 +190,4 @@ private fun NatBottomBar( private fun NavDestination?.isRouteInHierarchy(route: KClass<*>) = this?.hierarchy?.any { it.hasRoute(route) - } ?: false \ No newline at end of file + } ?: false diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatAppState.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatAppState.kt index 2bc790b..2541d1f 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatAppState.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NatAppState.kt @@ -11,20 +11,20 @@ import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import androidx.tracing.trace -import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToSettings import com.nativeapptemplate.nativeapptemplatefree.data.login.LoginRepository import com.nativeapptemplate.nativeapptemplatefree.navigation.TopLevelDestination import com.nativeapptemplate.nativeapptemplatefree.navigation.TopLevelDestination.SCAN_TAB import com.nativeapptemplate.nativeapptemplatefree.navigation.TopLevelDestination.SETTINGS_TAB import com.nativeapptemplate.nativeapptemplatefree.navigation.TopLevelDestination.SHOPS_TAB import com.nativeapptemplate.nativeapptemplatefree.ui.scan.navigation.navigateToScan +import com.nativeapptemplate.nativeapptemplatefree.ui.settings.navigation.navigateToSettings import com.nativeapptemplate.nativeapptemplatefree.ui.shops.navigation.navigateToShopList import com.nativeapptemplate.nativeapptemplatefree.utils.NetworkMonitor import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch @@ -66,12 +66,13 @@ class NatAppState( loginRepository.isLoggedIn(), loginRepository.shouldUpdateApp(), loginRepository.shouldUpdatePrivacy(), - loginRepository.shouldUpdateTerms() + loginRepository.shouldUpdateTerms(), ) { theIsLoggedIn, theShouldUpdateApp, theShouldUpdatePrivacy, - theShouldUpdateTerms -> + theShouldUpdateTerms, + -> theIsLoggedIn && !theShouldUpdateApp && !theShouldUpdatePrivacy && !theShouldUpdateTerms }.stateIn( scope = coroutineScope, diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NeedAppUpdatesView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NeedAppUpdatesView.kt index b5d3755..6088a15 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NeedAppUpdatesView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/NeedAppUpdatesView.kt @@ -31,8 +31,7 @@ import com.nativeapptemplate.nativeapptemplatefree.designsystem.theme.NatTheme import com.nativeapptemplate.nativeapptemplatefree.utils.Utility @Composable -fun NeedAppUpdatesView( -) { +fun NeedAppUpdatesView() { val context = LocalContext.current Scaffold( @@ -43,26 +42,26 @@ fun NeedAppUpdatesView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(24.dp), modifier = Modifier .verticalScroll(rememberScrollState()) - .padding(16.dp) + .padding(16.dp), ) { Icon( Icons.Outlined.Update, contentDescription = null, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { Text( stringResource(R.string.update_app), @@ -83,7 +82,7 @@ fun NeedAppUpdatesView( ) { Text( stringResource(R.string.update_app), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) } } @@ -95,7 +94,6 @@ fun NeedAppUpdatesView( @Composable private fun LoadingStatePreview() { NatTheme { - NeedAppUpdatesView( - ) + NeedAppUpdatesView() } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingView.kt index ff5fbd4..a3bd452 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingView.kt @@ -62,27 +62,27 @@ internal fun OnboardingView( HorizontalPager( state = pagerState, modifier = Modifier - .fillMaxSize() + .fillMaxSize(), ) { page -> Box( modifier = Modifier .fillMaxSize() .padding(12.dp) - .padding(top = 12.dp) + .padding(top = 12.dp), ) { Image( painter = painterResource(OnboardingViewModel.onboardingImageId(page)), contentDescription = null, contentScale = ContentScale.Fit, modifier = Modifier - .align(Alignment.TopCenter) + .align(Alignment.TopCenter), ) Card( shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), modifier = Modifier - .align(Alignment.BottomCenter) + .align(Alignment.BottomCenter), ) { Text( stringResource(OnboardingViewModel.onboardingDescription(page)), @@ -91,7 +91,7 @@ internal fun OnboardingView( lineHeight = lineHeightLarge.sp.nonScaledSp, modifier = Modifier .padding(24.dp) - .padding(bottom = 16.dp) + .padding(bottom = 16.dp), ) } } @@ -102,7 +102,7 @@ internal fun OnboardingView( .fillMaxWidth() .align(Alignment.BottomCenter) .padding(bottom = 8.dp), - horizontalArrangement = Arrangement.Center + horizontalArrangement = Arrangement.Center, ) { repeat(pagerState.pageCount) { iteration -> val color = if (pagerState.currentPage == iteration) Color.DarkGray else Color.LightGray @@ -111,7 +111,7 @@ internal fun OnboardingView( .padding(2.dp) .clip(CircleShape) .background(color) - .size(16.dp) + .size(16.dp), ) } } @@ -138,7 +138,7 @@ private fun TopAppBar( ) { Text( "Start", - style = MaterialTheme.typography.displaySmall + style = MaterialTheme.typography.displaySmall, ) } }, diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModel.kt index d3fa445..51c46ee 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModel.kt @@ -6,8 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @HiltViewModel -class OnboardingViewModel @Inject constructor( -) : ViewModel() { +class OnboardingViewModel @Inject constructor() : ViewModel() { companion object { fun onboardingDescription(index: Int): Int { val description = when (index) { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsView.kt index 7f06937..ca75f3f 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsView.kt @@ -59,7 +59,7 @@ fun ResendConfirmationInstructionsView( if (uiState.isSent) { NatAlertDialog( - dialogTitle= stringResource(R.string.sent_confirmation_instruction), + dialogTitle = stringResource(R.string.sent_confirmation_instruction), onDismissRequest = { onBackClick() }, ) } @@ -67,7 +67,7 @@ fun ResendConfirmationInstructionsView( ResendConfirmationInstructionsView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -110,14 +110,14 @@ fun ResendConfirmationInstructionsContentView( onClick = { viewModel.sendMeResetPasswordInstructions() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) Text( stringResource(R.string.button_send_me_confirmation_instructions), modifier = Modifier - .padding(start = 12.dp) + .padding(start = 12.dp), ) } }, @@ -128,12 +128,12 @@ fun ResendConfirmationInstructionsContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(24.dp) + verticalArrangement = Arrangement.spacedBy(24.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.email) + text = stringResource(R.string.email), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_EMAIL) }, @@ -144,13 +144,13 @@ fun ResendConfirmationInstructionsContentView( Text( text = stringResource(id = R.string.email_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataEmail()) { Text( text = stringResource(id = R.string.email_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, @@ -201,7 +201,7 @@ private fun ResendConfirmationInstructionsLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsViewModel.kt index be52f44..8e7acb5 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/ResendConfirmationInstructionsViewModel.kt @@ -26,7 +26,7 @@ data class ResendConfirmationInstructionsUiState( @HiltViewModel class ResendConfirmationInstructionsViewModel @Inject constructor( - private val signUpRepository: SignUpRepository + private val signUpRepository: SignUpRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(ResendConfirmationInstructionsUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -42,7 +42,7 @@ class ResendConfirmationInstructionsViewModel @Inject constructor( viewModelScope.launch { val sendConfirmation = SendConfirmation( email = uiState.value.email.trim(), - redirectUrl = SendConfirmation.redirectUrlString(NatConstants.baseUrlString()) + redirectUrl = SendConfirmation.redirectUrlString(NatConstants.baseUrlString()), ) val booleanFlow = signUpRepository.sendConfirmationInstruction(sendConfirmation) @@ -67,11 +67,11 @@ class ResendConfirmationInstructionsViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { return hasInvalidDataEmail() } - fun hasInvalidDataEmail() : Boolean { + fun hasInvalidDataEmail(): Boolean { if (uiState.value.email.isBlank()) return true return !uiState.value.email.validateEmail() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordView.kt index 3ce05e5..6238f43 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordView.kt @@ -60,7 +60,7 @@ fun SignInEmailAndPasswordView( onShowForgotPasswordClick, onShowResendConfirmationInstructionsClick, onShowSnackbar, - onBackClick + onBackClick, ) } @@ -79,7 +79,7 @@ fun SignInEmailAndPasswordView( onShowForgotPasswordClick, onShowResendConfirmationInstructionsClick, onShowSnackbar, - onBackClick + onBackClick, ) } @@ -101,7 +101,7 @@ private fun ContentView( onShowForgotPasswordClick, onShowResendConfirmationInstructionsClick, onShowSnackbar, - onBackClick + onBackClick, ) } } @@ -125,9 +125,11 @@ fun SignInEmailAndPasswordContentView( } Scaffold( - topBar = { TopAppBar( - onBackClick = onBackClick - ) }, + topBar = { + TopAppBar( + onBackClick = onBackClick, + ) + }, modifier = Modifier.fillMaxSize(), ) { padding -> Column( @@ -141,7 +143,7 @@ fun SignInEmailAndPasswordContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.email) + text = stringResource(R.string.email), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_EMAIL) }, @@ -152,13 +154,13 @@ fun SignInEmailAndPasswordContentView( Text( text = stringResource(id = R.string.email_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataEmail()) { Text( text = stringResource(id = R.string.email_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, @@ -170,7 +172,7 @@ fun SignInEmailAndPasswordContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.label_password) + text = stringResource(R.string.label_password), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_PASSWORD) }, @@ -181,27 +183,29 @@ fun SignInEmailAndPasswordContentView( Text( text = stringResource(id = R.string.new_password_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataPassword()) { Text( text = stringResource(id = R.string.password_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { - val image = if (passwordVisible) + val image = if (passwordVisible) { Icons.Filled.Visibility - else Icons.Filled.VisibilityOff + } else { + Icons.Filled.VisibilityOff + } val description = if (passwordVisible) "Hide password" else "Show password" - IconButton(onClick = {passwordVisible = !passwordVisible}){ - Icon(imageVector = image, description) + IconButton(onClick = { passwordVisible = !passwordVisible }) { + Icon(imageVector = image, description) } }, modifier = Modifier @@ -212,23 +216,23 @@ fun SignInEmailAndPasswordContentView( title = stringResource(R.string.button_sign_in), onClick = { viewModel.login() }, enabled = !viewModel.hasInvalidData(), - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) MainButtonView( title = stringResource(R.string.forgot_password), onClick = { onShowForgotPasswordClick() }, - modifier = Modifier + modifier = Modifier .padding(horizontal = 12.dp, vertical = 24.dp) - .padding(top = 64.dp) + .padding(top = 64.dp), ) MainButtonView( title = stringResource(R.string.didnt_receive_confirmation_instructions), onClick = { onShowResendConfirmationInstructionsClick() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -251,7 +255,6 @@ private fun TopAppBar( }) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } - }, modifier = Modifier.fillMaxWidth(), ) @@ -270,10 +273,9 @@ private fun SignInEmailAndPasswordLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModel.kt index 6cf6efc..c1e6586 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModel.kt @@ -31,7 +31,7 @@ data class SignInEmailAndPasswordUiState( @HiltViewModel class SignInEmailAndPasswordViewModel @Inject constructor( - private val loginRepository: LoginRepository + private val loginRepository: LoginRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(SignInEmailAndPasswordUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -83,20 +83,20 @@ class SignInEmailAndPasswordViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if (hasInvalidDataEmail()) return true if (hasInvalidDataPassword()) return true return false } - fun hasInvalidDataEmail() : Boolean { + fun hasInvalidDataEmail(): Boolean { if (uiState.value.email.isBlank()) return true return !uiState.value.email.validateEmail() } - fun hasInvalidDataPassword() : Boolean { + fun hasInvalidDataPassword(): Boolean { if (uiState.value.password.isBlank()) return true if (uiState.value.password.length < NatConstants.MINIMUM_PASSWORD_LENGTH) return true diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpOrSignInView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpOrSignInView.kt index c52bc5a..8d3d870 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpOrSignInView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpOrSignInView.kt @@ -46,9 +46,11 @@ internal fun SignUpOrSignInView( onBackClick: () -> Unit, ) { Scaffold( - topBar = { TopAppBar( - onBackClick = onBackClick - ) }, + topBar = { + TopAppBar( + onBackClick = onBackClick, + ) + }, modifier = Modifier.fillMaxSize(), ) { padding -> Column( @@ -57,14 +59,14 @@ internal fun SignUpOrSignInView( modifier = Modifier .verticalScroll(rememberScrollState()) .padding(padding) - .padding(24.dp) + .padding(24.dp), ) { Text( stringResource(R.string.app_name), style = MaterialTheme.typography.displaySmall, modifier = Modifier .fillMaxWidth() - .padding(horizontal = 24.dp) + .padding(horizontal = 24.dp), ) Image( @@ -73,7 +75,7 @@ internal fun SignUpOrSignInView( contentScale = ContentScale.FillWidth, modifier = Modifier .fillMaxWidth() - .padding(vertical = 24.dp) + .padding(vertical = 24.dp), ) val agreement = buildAnnotatedString { @@ -84,8 +86,8 @@ internal fun SignUpOrSignInView( withLink( LinkAnnotation.Url( NatConstants.TERMS_OF_USE_URL, - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.terms_of_use)) } @@ -97,8 +99,8 @@ internal fun SignUpOrSignInView( withLink( LinkAnnotation.Url( NatConstants.PRIVACY_POLICY_URL, - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.privacy_policy)) } @@ -116,8 +118,8 @@ internal fun SignUpOrSignInView( MainButtonView( title = stringResource(R.string.sign_up_for_an_account), onClick = { onSignUpClick() }, - modifier = Modifier - .padding(horizontal = 24.dp) + modifier = Modifier + .padding(horizontal = 24.dp), ) Text( @@ -126,12 +128,12 @@ internal fun SignUpOrSignInView( ) TextButton( - onClick = {onSignInClick() }, + onClick = { onSignInClick() }, ) { Text( stringResource(R.string.sign_in_to_your_account), color = MaterialTheme.colorScheme.primary, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } } @@ -166,7 +168,6 @@ private fun TopAppBar( }) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } - }, modifier = Modifier.fillMaxWidth(), ) diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpView.kt index 23a7787..dbe370e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpView.kt @@ -21,12 +21,12 @@ import androidx.compose.material3.Button import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarDuration @@ -73,7 +73,7 @@ fun SignUpView( if (uiState.isCreated) { NatAlertDialog( - dialogTitle= stringResource(R.string.signed_up_but_unconfirmed), + dialogTitle = stringResource(R.string.signed_up_but_unconfirmed), onDismissRequest = { onBackClick() }, ) } @@ -81,7 +81,7 @@ fun SignUpView( SignUpView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -129,14 +129,14 @@ fun SignUpContentView( onClick = { viewModel.createShopkeeper() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) Text( stringResource(R.string.sign_up), modifier = Modifier - .padding(start = 12.dp) + .padding(start = 12.dp), ) } }, @@ -147,12 +147,12 @@ fun SignUpContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(24.dp) + verticalArrangement = Arrangement.spacedBy(24.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.full_name) + text = stringResource(R.string.full_name), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_FULLNAME) }, @@ -162,7 +162,7 @@ fun SignUpContentView( Text( text = stringResource(id = R.string.full_name_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.name.isBlank()) Color.Red else Color.Transparent + color = if (uiState.name.isBlank()) Color.Red else Color.Transparent, ) }, modifier = Modifier @@ -172,7 +172,7 @@ fun SignUpContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.email) + text = stringResource(R.string.email), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_EMAIL) }, @@ -183,13 +183,13 @@ fun SignUpContentView( Text( text = stringResource(id = R.string.email_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataEmail()) { Text( text = stringResource(id = R.string.email_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, @@ -232,7 +232,7 @@ fun SignUpContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.password) + text = stringResource(R.string.password), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_PASSWORD) }, @@ -243,20 +243,20 @@ fun SignUpContentView( Text( text = "${NatConstants.MINIMUM_PASSWORD_LENGTH} characters minimum.", style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) if (uiState.password.isBlank()) { Text( text = stringResource(id = R.string.new_password_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataPassword()) { Text( text = stringResource(id = R.string.password_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } } @@ -264,14 +264,16 @@ fun SignUpContentView( visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { - val image = if (passwordVisible) + val image = if (passwordVisible) { Icons.Filled.Visibility - else Icons.Filled.VisibilityOff + } else { + Icons.Filled.VisibilityOff + } val description = if (passwordVisible) "Hide password" else "Show password" - IconButton(onClick = {passwordVisible = !passwordVisible}){ - Icon(imageVector = image, description) + IconButton(onClick = { passwordVisible = !passwordVisible }) { + Icon(imageVector = image, description) } }, modifier = Modifier @@ -320,7 +322,7 @@ private fun SignUpLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModel.kt index a6ec197..203b815 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModel.kt @@ -30,7 +30,7 @@ data class SignUpUiState( @HiltViewModel class SignUpViewModel @Inject constructor( - private val signUpRepository: SignUpRepository + private val signUpRepository: SignUpRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(SignUpUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -49,7 +49,7 @@ class SignUpViewModel @Inject constructor( email = uiState.value.email.trim(), password = uiState.value.password.trim(), timeZone = uiState.value.timeZone, - currentPlatform = "android" + currentPlatform = "android", ) val loggedInShopkeeperFlow = signUpRepository.signUp(signUp) @@ -74,7 +74,7 @@ class SignUpViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if (uiState.value.name.isBlank()) return true if (hasInvalidDataEmail()) return true @@ -84,13 +84,13 @@ class SignUpViewModel @Inject constructor( return false } - fun hasInvalidDataEmail() : Boolean { + fun hasInvalidDataEmail(): Boolean { if (uiState.value.email.isBlank()) return true return !uiState.value.email.validateEmail() } - fun hasInvalidDataPassword() : Boolean { + fun hasInvalidDataPassword(): Boolean { if (uiState.value.password.isBlank()) return true if (uiState.value.password.length < NatConstants.MINIMUM_PASSWORD_LENGTH) return true diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/navigation/AppRootNavigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/navigation/AppRootNavigation.kt index 7439c04..a0853e5 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/navigation/AppRootNavigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/navigation/AppRootNavigation.kt @@ -17,19 +17,27 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.SignUpView import kotlinx.serialization.Serializable @Serializable data object OnboardingRoute + @Serializable data object SignUpOrSignInRoute + @Serializable data object SignUpRoute + @Serializable data object SignInEmailAndPasswordRoute + @Serializable data object ForgotPasswordRoute + @Serializable data object ResendConfirmationInstructionsRoute + @Serializable data object NeedAppUpdatesRoute + @Serializable data object AcceptPrivacyRoute + @Serializable data object AcceptTermsRoute fun NavController.navigateToOnboarding(navOptions: NavOptions? = null) = navigate(route = OnboardingRoute, navOptions) fun NavGraphBuilder.onboardingView( - onStartClick: () -> Unit + onStartClick: () -> Unit, ) { composable { OnboardingView(onStartClick) @@ -114,11 +122,9 @@ fun NavGraphBuilder.resendConfirmationInstructionsView( fun NavController.navigateToNeedAppUpdates() = navigate(NeedAppUpdatesRoute) -fun NavGraphBuilder.needAppUpdatesView( -) { +fun NavGraphBuilder.needAppUpdatesView() { composable { - NeedAppUpdatesView( - ) + NeedAppUpdatesView() } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionIcon.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionIcon.kt index 38669e8..08c9a3f 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionIcon.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionIcon.kt @@ -8,7 +8,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector -//https://github.com/philipplackner/ComposeSwipeToReveal +// https://github.com/philipplackner/ComposeSwipeToReveal @Composable fun ActionIcon( onClick: () -> Unit, @@ -16,17 +16,17 @@ fun ActionIcon( icon: ImageVector, modifier: Modifier = Modifier, contentDescription: String? = null, - tint: Color = Color.White + tint: Color = Color.White, ) { IconButton( onClick = onClick, modifier = modifier - .background(backgroundColor) + .background(backgroundColor), ) { Icon( imageVector = icon, contentDescription = contentDescription, - tint = tint + tint = tint, ) } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionText.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionText.kt index d26a074..c3fc420 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionText.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ActionText.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.nativeapptemplate.nativeapptemplatefree.ui.common.NonScaledSp.nonScaledSp -//https://github.com/philipplackner/ComposeSwipeToReveal +// https://github.com/philipplackner/ComposeSwipeToReveal @Composable fun ActionText( onClick: () -> Unit, @@ -24,7 +24,7 @@ fun ActionText( IconButton( onClick = onClick, modifier = modifier - .background(backgroundColor) + .background(backgroundColor), ) { Text( text = text, @@ -36,4 +36,4 @@ fun ActionText( fontWeight = FontWeight.Bold, ) } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ErrorView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ErrorView.kt index d3b74df..2eee8ff 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ErrorView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/ErrorView.kt @@ -26,19 +26,19 @@ fun ErrorView( Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(24.dp), - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { Icon( Icons.Outlined.CrisisAlert, contentDescription = null, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { Text( titleText, @@ -51,8 +51,8 @@ fun ErrorView( MainButtonView( title = buttonTitle, onClick = { onClick() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/LoadingView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/LoadingView.kt index c9d7604..a152226 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/LoadingView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/LoadingView.kt @@ -24,6 +24,7 @@ fun LoadingView() { ) } } + @Preview @Composable private fun LoadingStatePreview() { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/MainButtonView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/MainButtonView.kt index f9a5bc7..0c659d8 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/MainButtonView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/MainButtonView.kt @@ -35,7 +35,7 @@ fun MainButtonView( colors = ButtonDefaults.outlinedButtonColors(contentColor = color), enabled = enabled, modifier = modifier - .padding(horizontal = 12.dp) + .padding(horizontal = 12.dp), ) { Column( horizontalAlignment = Alignment.CenterHorizontally, diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NatAlertDialog.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NatAlertDialog.kt index 5cba837..a05d256 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NatAlertDialog.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NatAlertDialog.kt @@ -25,11 +25,12 @@ fun NatAlertDialog( AlertDialog( icon = { icon?.let { - Icon(icon, + Icon( + icon, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier - .size(48.dp) + .size(48.dp), ) } }, @@ -53,11 +54,11 @@ fun NatAlertDialog( TextButton( onClick = { it() - } + }, ) { Text( confirmButtonTitle ?: "OK", - color = confirmButtonTitleColor ?: Color.Red + color = confirmButtonTitleColor ?: Color.Red, ) } } @@ -67,11 +68,11 @@ fun NatAlertDialog( TextButton( onClick = { it() - } + }, ) { Text("Dismiss") } } - } + }, ) } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NonScaledSp.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NonScaledSp.kt index 838f26f..0ec9fca 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NonScaledSp.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/NonScaledSp.kt @@ -9,4 +9,4 @@ object NonScaledSp { val TextUnit.nonScaledSp @Composable get() = (this.value / LocalDensity.current.fontScale).sp -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/SwipeableItemWithActions.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/SwipeableItemWithActions.kt index de260a3..8523d17 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/SwipeableItemWithActions.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/common/SwipeableItemWithActions.kt @@ -26,7 +26,7 @@ import androidx.compose.ui.unit.IntOffset import kotlinx.coroutines.launch import kotlin.math.roundToInt -//https://github.com/philipplackner/ComposeSwipeToReveal +// https://github.com/philipplackner/ComposeSwipeToReveal @Composable fun SwipeableItemWithActions( isRevealed: Boolean, @@ -34,7 +34,7 @@ fun SwipeableItemWithActions( modifier: Modifier = Modifier, onExpanded: () -> Unit = {}, onCollapsed: () -> Unit = {}, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { var contextMenuWidth by remember { mutableFloatStateOf(0f) @@ -45,7 +45,7 @@ fun SwipeableItemWithActions( val scope = rememberCoroutineScope() LaunchedEffect(key1 = isRevealed, contextMenuWidth) { - if(isRevealed) { + if (isRevealed) { offset.animateTo(contextMenuWidth) } else { offset.animateTo(0f) @@ -55,14 +55,14 @@ fun SwipeableItemWithActions( Box( modifier = modifier .fillMaxWidth() - .height(IntrinsicSize.Min) + .height(IntrinsicSize.Min), ) { Row( modifier = Modifier .onSizeChanged { contextMenuWidth = it.width.toFloat() }, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { actions() } @@ -95,11 +95,11 @@ fun SwipeableItemWithActions( } } } - } + }, ) - } + }, ) { content() } } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/CompleteScanResultView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/CompleteScanResultView.kt index b5ebe28..9a169dd 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/CompleteScanResultView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/CompleteScanResultView.kt @@ -42,7 +42,8 @@ private fun ContentView( ) { when (completeScanResult.completeScanResultType) { CompleteScanResultType.Completed, - CompleteScanResultType.Reset -> SucceededView(completeScanResult) + CompleteScanResultType.Reset, + -> SucceededView(completeScanResult) CompleteScanResultType.Failed -> FailedView(completeScanResult) CompleteScanResultType.Idled -> IdledView() } @@ -57,7 +58,7 @@ private fun SucceededView( colors = CardDefaults.cardColors(containerColor = LocalCustomColorScheme.current.successContainer), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { val fontSizeMedium = 16 val fontSizeLarge = 20 @@ -67,7 +68,7 @@ private fun SucceededView( Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -144,7 +145,7 @@ private fun SucceededView( fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = LocalCustomColorScheme.current.onSuccessContainer, - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) Text( "complete scanned", @@ -166,12 +167,12 @@ private fun FailedView( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.errorContainer), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -206,19 +207,18 @@ private fun FailedView( } @Composable -private fun IdledView( -) { +private fun IdledView() { Card( shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors(containerColor = LocalCustomColorScheme.current.successContainer), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanView.kt index 76f3684..d9afe81 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanView.kt @@ -87,7 +87,7 @@ internal fun DoScanView( itemTagInfoFromNdefMessage = Utility.extractItemTagInfoFrom( context = context, ndefMessage = ndefMessage, - isTest = viewModel.isTest + isTest = viewModel.isTest, ) if (itemTagInfoFromNdefMessage.success) { @@ -179,7 +179,7 @@ private fun DoScanContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -202,7 +202,7 @@ private fun DoScanContentView( ), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -212,7 +212,7 @@ private fun DoScanContentView( alignment = Alignment.CenterVertically, ), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Text( stringResource(R.string.ready_for_scanning), @@ -220,7 +220,7 @@ private fun DoScanContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) Text( @@ -229,7 +229,7 @@ private fun DoScanContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) if (uiState.isScanned) { @@ -237,7 +237,7 @@ private fun DoScanContentView( Icons.Outlined.Done, contentDescription = null, tint = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) } else { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.nfc_reader)) @@ -250,8 +250,8 @@ private fun DoScanContentView( MainButtonView( title = stringResource(R.string.cancel), onClick = { onBackClick() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanViewModel.kt index 886e2fc..6e9c6d6 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/DoScanViewModel.kt @@ -29,7 +29,7 @@ data class DoScanUiState( class DoScanViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val loginRepository: LoginRepository, - ) : ViewModel() { +) : ViewModel() { val isTest = savedStateHandle.toRoute().isTest private val _uiState = MutableStateFlow(DoScanUiState()) @@ -91,8 +91,7 @@ class DoScanViewModel @Inject constructor( } } - fun updateScanViewSelectedTabIndex( - ) { + fun updateScanViewSelectedTabIndex() { val scanViewSelectedTabIndex = if (isTest) 1 else 0 _uiState.update { it.copy(isLoading = true) } @@ -127,4 +126,3 @@ class DoScanViewModel @Inject constructor( } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanView.kt index 80b2b23..b4d7fce 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanView.kt @@ -56,7 +56,7 @@ enum class ScanPage( @StringRes val titleResId: Int, ) { COMPLETE_SCAN(R.string.complete_scan), - SHOW_TAG_INFO_SCAN(R.string.show_tag_info_scan) + SHOW_TAG_INFO_SCAN(R.string.show_tag_info_scan), } @OptIn(ExperimentalMaterial3Api::class) @@ -100,7 +100,7 @@ internal fun ScanView( onDismissRequest = { viewModel.updateIsAlreadyCompleted(false) }, - sheetState = sheetState + sheetState = sheetState, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -110,7 +110,7 @@ internal fun ScanView( alignment = Alignment.CenterVertically, ), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Text(stringResource(R.string.are_you_sure)) @@ -119,10 +119,10 @@ internal fun ScanView( onClick = { viewModel.resetItemTag(uiState.completeScanResult.itemTagInfoFromNdefMessage) }, - color = MaterialTheme.colorScheme.onErrorContainer, - titleColor = MaterialTheme.colorScheme.onErrorContainer, - modifier = Modifier - .padding(horizontal = 24.dp) + color = MaterialTheme.colorScheme.onErrorContainer, + titleColor = MaterialTheme.colorScheme.onErrorContainer, + modifier = Modifier + .padding(horizontal = 24.dp), ) } } @@ -200,7 +200,7 @@ private fun ScanContentView( // Tab Row TabRow( - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, ) { pages.forEachIndexed { index, page -> val title = stringResource(id = page.titleResId) @@ -216,7 +216,7 @@ private fun ScanContentView( lineHeight = lineHeightMedium.sp.nonScaledSp, ) }, - unselectedContentColor = MaterialTheme.colorScheme.secondary + unselectedContentColor = MaterialTheme.colorScheme.secondary, ) } } @@ -225,7 +225,7 @@ private fun ScanContentView( HorizontalPager( modifier = Modifier.background(MaterialTheme.colorScheme.background), state = pagerState, - verticalAlignment = Alignment.Top + verticalAlignment = Alignment.Top, ) { index -> when (pages[index]) { ScanPage.COMPLETE_SCAN -> { @@ -244,7 +244,7 @@ private fun ScanContentView( Column( verticalArrangement = Arrangement.spacedBy(24.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -273,10 +273,10 @@ private fun ScanContentView( viewModel.updateMessage(deviceDoesNotSupportTagScanningMessage) } }, - color = MaterialTheme.colorScheme.onPrimary, - titleColor = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier - .padding(horizontal = 24.dp) + color = MaterialTheme.colorScheme.onPrimary, + titleColor = MaterialTheme.colorScheme.onPrimary, + modifier = Modifier + .padding(horizontal = 24.dp), ) Text( @@ -308,7 +308,7 @@ private fun ScanContentView( Column( verticalArrangement = Arrangement.spacedBy(24.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -337,10 +337,10 @@ private fun ScanContentView( viewModel.updateMessage(deviceDoesNotSupportTagScanningMessage) } }, - color = MaterialTheme.colorScheme.inverseOnSurface, - titleColor = MaterialTheme.colorScheme.inverseOnSurface, - modifier = Modifier - .padding(horizontal = 24.dp) + color = MaterialTheme.colorScheme.inverseOnSurface, + titleColor = MaterialTheme.colorScheme.inverseOnSurface, + modifier = Modifier + .padding(horizontal = 24.dp), ) Text( @@ -374,18 +374,17 @@ private fun ScanErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } } @Composable -private fun ScanLoadingView( -) { +private fun ScanLoadingView() { Scaffold( modifier = Modifier.fillMaxSize(), ) { padding -> @@ -394,12 +393,9 @@ private fun ScanLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } } } - - - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModel.kt index db25d0d..f04a83c 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModel.kt @@ -169,7 +169,7 @@ class ScanViewModel @Inject constructor( _uiState.update { it.copy( - isLoading = false + isLoading = false, ) } } @@ -277,4 +277,3 @@ class ScanViewModel @Inject constructor( _uiState.update { it.copy(message = "") } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ShowTagInfoScanResultView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ShowTagInfoScanResultView.kt index 6450720..9e94d88 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ShowTagInfoScanResultView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ShowTagInfoScanResultView.kt @@ -82,12 +82,12 @@ private fun SucceededView( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.inverseSurface), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -115,7 +115,7 @@ private fun SucceededView( Text( showTagInfoScanResult.itemTagData.queueNumber, color = itemTagTypeColor, - style = MaterialTheme.typography.displaySmall + style = MaterialTheme.typography.displaySmall, ) } @@ -155,11 +155,11 @@ private fun SucceededView( space = 8.dp, alignment = Alignment.CenterHorizontally, ), - verticalAlignment = Alignment.Bottom + verticalAlignment = Alignment.Bottom, ) { Icon( Icons.Outlined.Storefront, - contentDescription = null + contentDescription = null, ) Text( @@ -173,20 +173,20 @@ private fun SucceededView( InfoRow( Icons.Outlined.Info, - "tag type" + "tag type", ) { Text( itemTagType.title, fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = itemTagTypeColor, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } InfoRow( Icons.Outlined.Flag, - "tag status" + "tag status", ) { when (itemTagData.state) { ItemTagState.Completed -> CompletedTag() @@ -197,14 +197,14 @@ private fun SucceededView( if (itemTagData.scanState == ScanState.Scanned && itemTagData.customerReadAt.isNotBlank()) { InfoRow( Icons.Outlined.People, - "scanned by a customer" + "scanned by a customer", ) { Text( itemTagData.customerReadAt.cardTimeString(), fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = MaterialTheme.colorScheme.inverseOnSurface, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } } @@ -212,41 +212,41 @@ private fun SucceededView( if (itemTagData.state == ItemTagState.Completed && itemTagData.completedAt.isNotBlank()) { InfoRow( Icons.Outlined.FlagCircle, - "completed" + "completed", ) { Text( itemTagData.completedAt.cardTimeString(), fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = MaterialTheme.colorScheme.inverseOnSurface, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } } InfoRow( Icons.Outlined.Rectangle, - "NFC tag" + "NFC tag", ) { Text( displayReadOnly, fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = MaterialTheme.colorScheme.inverseOnSurface, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } InfoRow( Icons.Outlined.AccessTime, - "created" + "created", ) { Text( itemTagData.createdAt.cardDateString(), fontSize = fontSizeLarge.sp.nonScaledSp, lineHeight = lineHeightLarge.sp.nonScaledSp, color = MaterialTheme.colorScheme.inverseOnSurface, - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) } } @@ -263,12 +263,12 @@ private fun FailedView( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.errorContainer), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -303,19 +303,18 @@ private fun FailedView( } @Composable -private fun IdledView( -) { +private fun IdledView() { Card( shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.inverseSurface), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -355,16 +354,16 @@ private fun InfoRow( space = 8.dp, alignment = Alignment.CenterHorizontally, ), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Icon( imageVector = icon, - contentDescription = null + contentDescription = null, ) Row( modifier = Modifier - .width(128.dp) + .width(128.dp), ) { content() } @@ -374,7 +373,7 @@ private fun InfoRow( fontSize = fontSizeMedium.sp.nonScaledSp, lineHeight = lineHeightMedium.sp.nonScaledSp, modifier = Modifier - .padding(start = 8.dp) + .padding(start = 8.dp), ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/navigation/ScanNavigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/navigation/ScanNavigation.kt index 494c921..794dd9e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/navigation/ScanNavigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/navigation/ScanNavigation.kt @@ -14,7 +14,9 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.scan.ScanView import kotlinx.serialization.Serializable @Serializable data object ScanBaseRoute + @Serializable data object ScanRoute + @Serializable data class DoScanRoute(val isTest: Boolean) fun NavGraphBuilder.scanBaseView( @@ -53,7 +55,7 @@ fun NavGraphBuilder.doScanView( usePlatformDefaultWidth = false, dismissOnBackPress = false, dismissOnClickOutside = false, - ) + ), ) { DoScanView( onBackClick = onBackClick, diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsDialog.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsDialog.kt index 10a3da9..f8efb94 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsDialog.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsDialog.kt @@ -29,8 +29,8 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.DialogProperties import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.nativeapptemplate.nativeapptemplatefree.designsystem.theme.NatTheme import com.nativeapptemplate.nativeapptemplatefree.R +import com.nativeapptemplate.nativeapptemplatefree.designsystem.theme.NatTheme import com.nativeapptemplate.nativeapptemplatefree.model.DarkThemeConfig @Composable diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditView.kt index 2804c6c..94b9e5b 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditView.kt @@ -73,7 +73,7 @@ fun PasswordEditView( PasswordEditView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -109,7 +109,6 @@ fun PasswordEditContentView( var passwordVisible by rememberSaveable { mutableStateOf(false) } var passwordConfirmationVisible by rememberSaveable { mutableStateOf(false) } - Scaffold( topBar = { TopAppBar(onBackClick) @@ -121,9 +120,9 @@ fun PasswordEditContentView( onClick = { viewModel.updatePassword() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) } }, @@ -134,12 +133,12 @@ fun PasswordEditContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.current_password) + text = stringResource(R.string.current_password), ) }, placeholder = { Text(stringResource(R.string.current_password)) }, @@ -156,21 +155,23 @@ fun PasswordEditContentView( Text( text = stringResource(id = R.string.current_password_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.currentPassword.isBlank()) Color.Red else Color.Transparent + color = if (uiState.currentPassword.isBlank()) Color.Red else Color.Transparent, ) } }, visualTransformation = if (currentPasswordVisible) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { - val image = if (currentPasswordVisible) + val image = if (currentPasswordVisible) { Icons.Filled.Visibility - else Icons.Filled.VisibilityOff + } else { + Icons.Filled.VisibilityOff + } val description = if (currentPasswordVisible) "Hide password" else "Show password" - IconButton(onClick = {currentPasswordVisible = !currentPasswordVisible}){ - Icon(imageVector = image, description) + IconButton(onClick = { currentPasswordVisible = !currentPasswordVisible }) { + Icon(imageVector = image, description) } }, modifier = Modifier @@ -180,7 +181,7 @@ fun PasswordEditContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.new_password) + text = stringResource(R.string.new_password), ) }, placeholder = { Text(stringResource(R.string.new_password)) }, @@ -191,20 +192,20 @@ fun PasswordEditContentView( Text( text = "${NatConstants.MINIMUM_PASSWORD_LENGTH} characters minimum.", style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) if (uiState.password.isBlank()) { Text( text = stringResource(id = R.string.password_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataPassword()) { Text( text = stringResource(id = R.string.password_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } } @@ -212,14 +213,16 @@ fun PasswordEditContentView( visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { - val image = if (passwordVisible) + val image = if (passwordVisible) { Icons.Filled.Visibility - else Icons.Filled.VisibilityOff + } else { + Icons.Filled.VisibilityOff + } val description = if (passwordVisible) "Hide password" else "Show password" - IconButton(onClick = {passwordVisible = !passwordVisible}){ - Icon(imageVector = image, description) + IconButton(onClick = { passwordVisible = !passwordVisible }) { + Icon(imageVector = image, description) } }, modifier = Modifier @@ -229,7 +232,7 @@ fun PasswordEditContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.confirm_new_password) + text = stringResource(R.string.confirm_new_password), ) }, placeholder = { Text(stringResource(R.string.confirm_new_password)) }, @@ -239,20 +242,22 @@ fun PasswordEditContentView( Text( text = stringResource(id = R.string.confirm_new_password_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.passwordConfirmation.isBlank()) Color.Red else Color.Transparent + color = if (uiState.passwordConfirmation.isBlank()) Color.Red else Color.Transparent, ) }, visualTransformation = if (passwordConfirmationVisible) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { - val image = if (passwordConfirmationVisible) + val image = if (passwordConfirmationVisible) { Icons.Filled.Visibility - else Icons.Filled.VisibilityOff + } else { + Icons.Filled.VisibilityOff + } val description = if (passwordConfirmationVisible) "Hide password" else "Show password" - IconButton(onClick = {passwordConfirmationVisible = !passwordConfirmationVisible}){ - Icon(imageVector = image, description) + IconButton(onClick = { passwordConfirmationVisible = !passwordConfirmationVisible }) { + Icon(imageVector = image, description) } }, modifier = Modifier @@ -301,7 +306,7 @@ private fun PasswordEditLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModel.kt index efc5652..4b953d2 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModel.kt @@ -28,7 +28,7 @@ data class PasswordEditUiState( @HiltViewModel class PasswordEditViewModel @Inject constructor( - private val accountPasswordRepository: AccountPasswordRepository + private val accountPasswordRepository: AccountPasswordRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(PasswordEditUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -72,7 +72,7 @@ class PasswordEditViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if ( uiState.value.currentPassword.isBlank() || uiState.value.password.isBlank() || @@ -86,7 +86,7 @@ class PasswordEditViewModel @Inject constructor( return false } - fun hasInvalidDataPassword() : Boolean { + fun hasInvalidDataPassword(): Boolean { if (uiState.value.password.isBlank()) return true if (uiState.value.password.length < NatConstants.MINIMUM_PASSWORD_LENGTH) return true diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/SettingsView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/SettingsView.kt index 9800afb..66ec222 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/SettingsView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/SettingsView.kt @@ -148,10 +148,10 @@ private fun SettingsContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { ListItem( @@ -169,7 +169,7 @@ private fun SettingsContentView( headlineContent = { Text( stringResource(R.string.profile), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, leadingContent = { @@ -192,7 +192,7 @@ private fun SettingsContentView( headlineContent = { Text( stringResource(R.string.label_password), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, leadingContent = { @@ -214,7 +214,7 @@ private fun SettingsContentView( headlineContent = { Text( "", - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, ) @@ -245,7 +245,7 @@ private fun SettingsContentView( headlineContent = { Text( "", - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, ) @@ -256,7 +256,7 @@ private fun SettingsContentView( headlineContent = { Text( stringResource(R.string.information), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, ) @@ -283,8 +283,8 @@ private fun SettingsContentView( context.startActivity( Intent( Intent.ACTION_VIEW, - Uri.parse(NatConstants.SUPPORT_WEBSITE_URL) - ) + Uri.parse(NatConstants.SUPPORT_WEBSITE_URL), + ), ) }, ) @@ -311,8 +311,8 @@ private fun SettingsContentView( context.startActivity( Intent( Intent.ACTION_VIEW, - Uri.parse(NatConstants.HOW_TO_USE_URL) - ) + Uri.parse(NatConstants.HOW_TO_USE_URL), + ), ) }, ) @@ -362,8 +362,8 @@ private fun SettingsContentView( context.startActivity( Intent( Intent.ACTION_VIEW, - Uri.parse(NatConstants.DISCUSSIONS_URL) - ) + Uri.parse(NatConstants.DISCUSSIONS_URL), + ), ) }, ) @@ -439,8 +439,8 @@ private fun SettingsContentView( context.startActivity( Intent( Intent.ACTION_VIEW, - Uri.parse(NatConstants.PRIVACY_POLICY_URL) - ) + Uri.parse(NatConstants.PRIVACY_POLICY_URL), + ), ) }, ) @@ -460,8 +460,8 @@ private fun SettingsContentView( context.startActivity( Intent( Intent.ACTION_VIEW, - Uri.parse(NatConstants.TERMS_OF_USE_URL) - ) + Uri.parse(NatConstants.TERMS_OF_USE_URL), + ), ) }, ) @@ -472,7 +472,7 @@ private fun SettingsContentView( Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier - .padding(top = 48.dp) + .padding(top = 48.dp), ) { Text("Logged in as ${userData.name}") @@ -480,7 +480,7 @@ private fun SettingsContentView( title = stringResource(R.string.button_sign_out), onClick = { viewModel.logout() }, modifier = Modifier - .padding(top = 12.dp) + .padding(top = 12.dp), ) } } @@ -515,8 +515,7 @@ private fun SettingsErrorView( ) { Scaffold( topBar = { - TopAppBar( - ) + TopAppBar() }, modifier = Modifier.fillMaxSize(), ) { padding -> @@ -525,18 +524,17 @@ private fun SettingsErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } } @Composable -private fun SettingsLoadingView( -) { +private fun SettingsLoadingView() { Scaffold( topBar = { TopAppBar() }, modifier = Modifier.fillMaxSize(), @@ -546,7 +544,7 @@ private fun SettingsLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditView.kt index a8eb62f..d36f4cb 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditView.kt @@ -22,12 +22,12 @@ import androidx.compose.material3.Button import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarDuration @@ -89,7 +89,7 @@ fun ShopkeeperEditView( ShopkeeperEditView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -149,9 +149,9 @@ fun ShopkeeperEditContentView( onClick = { viewModel.updateShopkeeper() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) } }, @@ -162,12 +162,12 @@ fun ShopkeeperEditContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.full_name) + text = stringResource(R.string.full_name), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_FULLNAME) }, @@ -177,7 +177,7 @@ fun ShopkeeperEditContentView( Text( text = stringResource(id = R.string.full_name_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.name.isBlank()) Color.Red else Color.Transparent + color = if (uiState.name.isBlank()) Color.Red else Color.Transparent, ) }, modifier = Modifier @@ -187,7 +187,7 @@ fun ShopkeeperEditContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.email) + text = stringResource(R.string.email), ) }, placeholder = { Text(NatConstants.PLACEHOLDER_EMAIL) }, @@ -198,13 +198,13 @@ fun ShopkeeperEditContentView( Text( text = stringResource(id = R.string.email_is_required), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } else if (viewModel.hasInvalidDataEmail()) { Text( text = stringResource(id = R.string.email_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = Color.Red + color = Color.Red, ) } }, @@ -247,8 +247,8 @@ fun ShopkeeperEditContentView( MainButtonView( title = stringResource(R.string.delete_my_account), onClick = { isShowingDeleteConfirmationDialog = true }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -286,11 +286,12 @@ fun DeleteShopkeeperAlertDialog( ) { AlertDialog( icon = { - Icon(icon, + Icon( + icon, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier - .size(48.dp) + .size(48.dp), ) }, title = { @@ -303,11 +304,11 @@ fun DeleteShopkeeperAlertDialog( TextButton( onClick = { onConfirmation() - } + }, ) { Text( confirmButtonTitle, - color = Color.Red + color = Color.Red, ) } }, @@ -315,11 +316,11 @@ fun DeleteShopkeeperAlertDialog( TextButton( onClick = { onDismissRequest() - } + }, ) { Text("Dismiss") } - } + }, ) } @@ -341,10 +342,10 @@ private fun ShopkeeperEditErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -367,7 +368,7 @@ private fun ShopkeeperEditLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModel.kt index 886ae3e..b3b05c3 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModel.kt @@ -38,7 +38,7 @@ data class ShopkeeperEditUiState( @HiltViewModel class ShopkeeperEditViewModel @Inject constructor( private val loginRepository: LoginRepository, - private val signUpRepository: SignUpRepository + private val signUpRepository: SignUpRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(ShopkeeperEditUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -87,7 +87,7 @@ class ShopkeeperEditViewModel @Inject constructor( } } } - + fun updateShopkeeper() { _uiState.update { it.copy( @@ -182,7 +182,7 @@ class ShopkeeperEditViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if (uiState.value.name.isBlank()) return true if (hasInvalidDataEmail()) return true @@ -190,11 +190,11 @@ class ShopkeeperEditViewModel @Inject constructor( val userData = uiState.value.userData return userData.name == uiState.value.name && - userData.email == uiState.value.email && - userData.timeZone == uiState.value.timeZone + userData.email == uiState.value.email && + userData.timeZone == uiState.value.timeZone } - fun hasInvalidDataEmail() : Boolean { + fun hasInvalidDataEmail(): Boolean { if (uiState.value.email.isBlank()) return true return !uiState.value.email.validateEmail() @@ -220,6 +220,6 @@ class ShopkeeperEditViewModel @Inject constructor( fun snackbarMessageShown() { _uiState.update { it.copy(message = "") } - _uiState.update {it.copy(success = false) } + _uiState.update { it.copy(success = false) } } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/navigation/SettingsNavigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/navigation/SettingsNavigation.kt index ad3a281..686cfa0 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/navigation/SettingsNavigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/navigation/SettingsNavigation.kt @@ -12,8 +12,11 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.settings.ShopkeeperEditVie import kotlinx.serialization.Serializable @Serializable data object SettingBaseRoute + @Serializable data object SettingsRoute + @Serializable data object ShopkeeperEditRoute + @Serializable data object PasswordEditRoute fun NavGraphBuilder.settingBaseView( @@ -66,4 +69,4 @@ fun NavGraphBuilder.passwordEditView( onBackClick = onBackClick, ) } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailCardView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailCardView.kt index b71d7d0..a0bfaae 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailCardView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailCardView.kt @@ -43,9 +43,8 @@ fun ShopDetailCardView( Spacer(modifier = Modifier.weight(1f)) Column( - horizontalAlignment = Alignment.End + horizontalAlignment = Alignment.End, ) { - data.getScanState()?.let { scanState -> if (scanState == ScanState.Scanned) { CustomerScannedTag() @@ -63,7 +62,7 @@ fun ShopDetailCardView( Spacer(modifier = Modifier.weight(1f)) Column( - horizontalAlignment = Alignment.End + horizontalAlignment = Alignment.End, ) { data.getItemTagState()?.let { itemTagState -> when (itemTagState) { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailView.kt index 0604c3c..ef9cd9e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailView.kt @@ -153,10 +153,10 @@ private fun ShopDetailContentView( isRefreshing = uiState.isLoading, onRefresh = viewModel::reload, ) - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { if (!uiState.didShowReadInstructionsTip) { @@ -171,7 +171,7 @@ private fun ShopDetailContentView( item { Surface(Modifier.fillParentMaxWidth()) { Header( - uiState = uiState + uiState = uiState, ) } } @@ -198,7 +198,7 @@ private fun ShopDetailContentView( text = "Complete", modifier = Modifier .fillMaxHeight() - .width(64.dp) + .width(64.dp), ) } else { ActionText( @@ -207,7 +207,7 @@ private fun ShopDetailContentView( }, backgroundColor = Color.Red, text = "Reset", - modifier = Modifier.fillMaxHeight() + modifier = Modifier.fillMaxHeight(), ) } }, @@ -252,8 +252,8 @@ private fun Header( withLink( LinkAnnotation.Url( uiState.shop.displayShopServerUrlString(NatConstants.baseUrlString()), - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.server_number_tags_webpage)) } @@ -279,8 +279,8 @@ private fun Header( withLink( LinkAnnotation.Url( NatConstants.HOW_TO_USE_URL, - TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) - ) + TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + ), ) { append(stringResource(R.string.learn_more)) } @@ -312,25 +312,27 @@ fun ReadInstructionsTip( onClick = { onDismiss() }, - label = { Text( - text, - style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.tertiary, - ) }, + label = { + Text( + text, + style = MaterialTheme.typography.titleLarge, + color = MaterialTheme.colorScheme.tertiary, + ) + }, selected = false, avatar = { Icon( Icons.Outlined.Info, contentDescription = null, tint = MaterialTheme.colorScheme.tertiary, - modifier = Modifier.size(InputChipDefaults.AvatarSize) + modifier = Modifier.size(InputChipDefaults.AvatarSize), ) }, trailingIcon = { Icon( Icons.Default.Close, contentDescription = null, - Modifier.size(InputChipDefaults.AvatarSize) + Modifier.size(InputChipDefaults.AvatarSize), ) }, ) @@ -397,7 +399,7 @@ private fun ShopDetailErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView(onClick = viewModel::reload) } @@ -425,7 +427,7 @@ private fun ShopDetailLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModel.kt index 39b11b1..6bd9d06 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModel.kt @@ -40,7 +40,7 @@ class ShopDetailViewModel @Inject constructor( private val loginRepository: LoginRepository, private val shopRepository: ShopRepository, private val itemTagRepository: ItemTagRepository, - ) : ViewModel() { +) : ViewModel() { private val shopId = savedStateHandle.toRoute().id private val _uiState = MutableStateFlow(ShopDetailUiState()) val uiState: StateFlow = _uiState.asStateFlow() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListView.kt index 86777a9..ef907ec 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListView.kt @@ -115,10 +115,10 @@ private fun NumberTagsWebpageListContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { Text( @@ -187,7 +187,7 @@ private fun NumberTagsWebpageListErrorView( Scaffold( topBar = { TopAppBar( - onBackClick + onBackClick, ) }, modifier = Modifier.fillMaxSize(), @@ -197,7 +197,7 @@ private fun NumberTagsWebpageListErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView(onClick = viewModel::reload) } @@ -221,7 +221,7 @@ private fun NumberTagsWebpageListLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModel.kt index 7e226b3..9bced6c 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModel.kt @@ -32,7 +32,7 @@ class NumberTagsWebpageListViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val shopRepository: ShopRepository, - ) : ViewModel() { +) : ViewModel() { private val shopId = savedStateHandle.toRoute().id private val _uiState = MutableStateFlow(NumberTagsWebpageListUiState()) @@ -79,4 +79,3 @@ class NumberTagsWebpageListViewModel @Inject constructor( _uiState.update { it.copy(message = "") } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsView.kt index 0f4e771..a51228b 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsView.kt @@ -19,12 +19,12 @@ import androidx.compose.material3.Button import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarDuration @@ -80,7 +80,7 @@ fun ShopBasicSettingsView( ShopBasicSettingsView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -129,9 +129,9 @@ fun ShopBasicSettingsContentView( onClick = { viewModel.updateShop() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) } }, @@ -142,12 +142,12 @@ fun ShopBasicSettingsContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.shop_name) + text = stringResource(R.string.shop_name), ) }, placeholder = { Text(stringResource(R.string.shop_name)) }, @@ -157,7 +157,7 @@ fun ShopBasicSettingsContentView( Text( text = stringResource(id = R.string.shop_name_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.name.isBlank()) Color.Red else Color.Transparent + color = if (uiState.name.isBlank()) Color.Red else Color.Transparent, ) }, modifier = Modifier @@ -167,14 +167,14 @@ fun ShopBasicSettingsContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.label_description) + text = stringResource(R.string.label_description), ) }, value = uiState.description, onValueChange = { viewModel.updateDescription(it) }, modifier = Modifier .fillMaxWidth() - .height(128.dp) + .height(128.dp), ) ExposedDropdownMenuBox( @@ -251,10 +251,10 @@ private fun ShopBasicSettingsErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -277,7 +277,7 @@ private fun ShopBasicSettingsLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModel.kt index 7be5d16..6093725 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModel.kt @@ -37,7 +37,7 @@ data class ShopBasicSettingsUiState( @HiltViewModel class ShopBasicSettingsViewModel @Inject constructor( savedStateHandle: SavedStateHandle, - private val shopRepository: ShopRepository + private val shopRepository: ShopRepository, ) : ViewModel() { private val shopId = savedStateHandle.toRoute().id @@ -84,7 +84,7 @@ class ShopBasicSettingsViewModel @Inject constructor( } } } - + fun updateShop() { _uiState.update { it.copy( @@ -125,14 +125,14 @@ class ShopBasicSettingsViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if (uiState.value.name.isBlank()) return true val shopData = uiState.value.shop.getData()!! return shopData.getName() == uiState.value.name && - shopData.getDescription() == uiState.value.description && - shopData.getTimeZone() == uiState.value.timeZone + shopData.getDescription() == uiState.value.description && + shopData.getTimeZone() == uiState.value.timeZone } fun updateName(newName: String) { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsView.kt index e72c793..7e3707f 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsView.kt @@ -75,7 +75,7 @@ internal fun ShopSettingsView( if (uiState.isShopReset) { NatAlertDialog( - dialogTitle= stringResource(R.string.message_shop_reset), + dialogTitle = stringResource(R.string.message_shop_reset), onDismissRequest = { onBackClick() }, @@ -167,7 +167,7 @@ private fun ShopSettingsContentView( if (isShowingResetConfirmationDialog) { NatAlertDialog( - dialogTitle= stringResource(R.string.are_you_sure), + dialogTitle = stringResource(R.string.are_you_sure), confirmButtonTitle = stringResource(R.string.title_reset_number_tags), onDismissRequest = { isShowingResetConfirmationDialog = false }, onConfirmation = { viewModel.resetShop(uiState.shop.getData()?.id!!) }, @@ -177,7 +177,7 @@ private fun ShopSettingsContentView( if (isShowingDeleteConfirmationDialog) { NatAlertDialog( - dialogTitle= stringResource(R.string.are_you_sure), + dialogTitle = stringResource(R.string.are_you_sure), confirmButtonTitle = stringResource(R.string.title_delete_shop), onDismissRequest = { isShowingDeleteConfirmationDialog = false }, onConfirmation = { viewModel.deleteShop(uiState.shop.getData()?.id!!) }, @@ -197,10 +197,10 @@ private fun ShopSettingsContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { Text( @@ -209,7 +209,7 @@ private fun ShopSettingsContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(bottom = 48.dp) + .padding(bottom = 48.dp), ) } @@ -220,7 +220,7 @@ private fun ShopSettingsContentView( headlineContent = { Text( stringResource(R.string.label_shop_settings_basic_settings), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, leadingContent = { @@ -231,7 +231,7 @@ private fun ShopSettingsContentView( ) }, modifier = Modifier - .clickable { onShowBasicSettingsClick(uiState.shop.getData()?.id!!) } + .clickable { onShowBasicSettingsClick(uiState.shop.getData()?.id!!) }, ) HorizontalDivider() @@ -242,7 +242,7 @@ private fun ShopSettingsContentView( headlineContent = { Text( "", - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, ) @@ -255,7 +255,7 @@ private fun ShopSettingsContentView( headlineContent = { Text( stringResource(R.string.label_shop_settings_manage_number_tags), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, leadingContent = { @@ -266,7 +266,7 @@ private fun ShopSettingsContentView( ) }, modifier = Modifier - .clickable { onShowItemTagListClick(uiState.shop.getData()?.id!!) } + .clickable { onShowItemTagListClick(uiState.shop.getData()?.id!!) }, ) HorizontalDivider() @@ -277,7 +277,7 @@ private fun ShopSettingsContentView( headlineContent = { Text( "", - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, ) @@ -290,7 +290,7 @@ private fun ShopSettingsContentView( headlineContent = { Text( stringResource(R.string.label_shop_settings_number_tags_webpage), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, leadingContent = { @@ -312,14 +312,14 @@ private fun ShopSettingsContentView( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier - .padding(top = 48.dp) + .padding(top = 48.dp), ) { MainButtonView( title = stringResource(R.string.title_reset_number_tags), - onClick = { isShowingResetConfirmationDialog = true }, + onClick = { isShowingResetConfirmationDialog = true }, modifier = Modifier .padding(horizontal = 12.dp) - .padding(top = 24.dp) + .padding(top = 24.dp), ) Text( @@ -327,7 +327,7 @@ private fun ShopSettingsContentView( color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center, modifier = Modifier - .fillMaxWidth() + .fillMaxWidth(), ) } } @@ -336,8 +336,8 @@ private fun ShopSettingsContentView( MainButtonView( title = stringResource(R.string.title_delete_shop), onClick = { isShowingDeleteConfirmationDialog = true }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -385,10 +385,10 @@ private fun ShopSettingsErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -411,7 +411,7 @@ private fun ShopSettingsLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModel.kt index 4a08c25..86b9da1 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModel.kt @@ -33,7 +33,7 @@ class ShopSettingsViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val loginRepository: LoginRepository, private val shopRepository: ShopRepository, - ) : ViewModel() { +) : ViewModel() { private val shopId = savedStateHandle.toRoute().id private val _uiState = MutableStateFlow(ShopSettingsUiState()) diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailView.kt index ec37692..5a4ee50 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailView.kt @@ -94,7 +94,7 @@ internal fun ItemTagDetailView( if (uiState.isDeleted) { NatAlertDialog( - dialogTitle= stringResource(R.string.message_item_tag_deleted), + dialogTitle = stringResource(R.string.message_item_tag_deleted), onDismissRequest = { onBackClick() }, ) } @@ -173,7 +173,7 @@ private fun ItemTagDetailContentView( if (isShowingDeleteConfirmationDialog) { NatAlertDialog( - dialogTitle= stringResource(R.string.are_you_sure), + dialogTitle = stringResource(R.string.are_you_sure), confirmButtonTitle = stringResource(R.string.title_delete_item_tag), onDismissRequest = { isShowingDeleteConfirmationDialog = false }, onConfirmation = { viewModel.deleteItemTag() }, @@ -196,7 +196,7 @@ private fun ItemTagDetailContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { Column( modifier = Modifier @@ -217,7 +217,7 @@ private fun ItemTagDetailContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) Text( @@ -227,7 +227,7 @@ private fun ItemTagDetailContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) Card( @@ -235,12 +235,12 @@ private fun ItemTagDetailContentView( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.tertiary), modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -294,12 +294,12 @@ private fun ItemTagDetailContentView( shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.error), modifier = Modifier - .padding(top = 24.dp) + .padding(top = 24.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(24.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -326,10 +326,10 @@ private fun ItemTagDetailContentView( viewModel.updateMessage(deviceDoesNotSupportTagScanningMessage) } }, - color = MaterialTheme.colorScheme.onError, - titleColor = MaterialTheme.colorScheme.onError, - modifier = Modifier - .padding(horizontal = 24.dp) + color = MaterialTheme.colorScheme.onError, + titleColor = MaterialTheme.colorScheme.onError, + modifier = Modifier + .padding(horizontal = 24.dp), ) } } @@ -338,12 +338,12 @@ private fun ItemTagDetailContentView( shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primary), modifier = Modifier - .padding(top = 48.dp) + .padding(top = 48.dp), ) { Column( verticalArrangement = Arrangement.spacedBy(24.dp), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -370,10 +370,10 @@ private fun ItemTagDetailContentView( viewModel.updateMessage(deviceDoesNotSupportTagScanningMessage) } }, - color = MaterialTheme.colorScheme.onPrimary, - titleColor = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier - .padding(horizontal = 24.dp) + color = MaterialTheme.colorScheme.onPrimary, + titleColor = MaterialTheme.colorScheme.onPrimary, + modifier = Modifier + .padding(horizontal = 24.dp), ) val captureController = rememberCaptureController() @@ -395,7 +395,7 @@ private fun ItemTagDetailContentView( context.shareImage( uiState.itemTag.getQueueNumber(), bitmap, - uiState.itemTag.getQueueNumber() + uiState.itemTag.getQueueNumber(), ) // Do something with `bitmap`. } catch (error: Throwable) { @@ -403,7 +403,7 @@ private fun ItemTagDetailContentView( viewModel.updateMessage(error.localizedMessage ?: "") } } - } + }, ) { QrCode(viewModel, uiState, Modifier.capturable(captureController)) } @@ -433,9 +433,9 @@ fun QrCode( modifier = Modifier .fillMaxSize() .clip( - RectangleShape + RectangleShape, ) - .background(Color.White) + .background(Color.White), ) { Text( uiState.itemTag.getQueueNumber(), @@ -518,10 +518,10 @@ private fun ItemTagDetailErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -550,7 +550,7 @@ private fun ItemTagDetailLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModel.kt index 4122ab8..2581c96 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModel.kt @@ -124,4 +124,3 @@ class ItemTagDetailViewModel @Inject constructor( _uiState.update { it.copy(message = "") } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditView.kt index c7aa420..40ee545 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditView.kt @@ -72,7 +72,7 @@ fun ItemTagEditView( ItemTagEditView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -117,9 +117,9 @@ fun ItemTagEditContentView( onClick = { viewModel.updateItemTag() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = null) } }, @@ -130,12 +130,12 @@ fun ItemTagEditContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.tag_number) + text = stringResource(R.string.tag_number), ) }, placeholder = { Text("A001") }, @@ -146,17 +146,17 @@ fun ItemTagEditContentView( Text( text = "Tag Number must be a 2-${uiState.maximumQueueNumberLength} alphanumeric characters.", style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Text( text = stringResource(R.string.zero_padding), style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Text( text = stringResource(id = R.string.tag_number_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = if (viewModel.hasInvalidDataQueueNumber()) Color.Red else Color.Transparent + color = if (viewModel.hasInvalidDataQueueNumber()) Color.Red else Color.Transparent, ) } }, @@ -185,7 +185,7 @@ private fun TopAppBar( }) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } - }, + }, modifier = Modifier.fillMaxWidth(), ) } @@ -208,10 +208,10 @@ private fun ItemTagEditErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -234,7 +234,7 @@ private fun ItemTagEditLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModel.kt index d4483e3..e76363e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModel.kt @@ -38,7 +38,7 @@ data class ItemTagEditUiState( class ItemTagEditViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val loginRepository: LoginRepository, - private val itemTagRepository: ItemTagRepository + private val itemTagRepository: ItemTagRepository, ) : ViewModel() { private val itemTagId = savedStateHandle.toRoute().id @@ -123,14 +123,14 @@ class ItemTagEditViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { if (hasInvalidDataQueueNumber()) return true val itemTag = uiState.value.itemTag return itemTag.getQueueNumber() == uiState.value.queueNumber } - fun hasInvalidDataQueueNumber() : Boolean { + fun hasInvalidDataQueueNumber(): Boolean { val queueNumber = uiState.value.queueNumber if (queueNumber.isBlank()) return true @@ -154,7 +154,7 @@ class ItemTagEditViewModel @Inject constructor( fun snackbarMessageShown() { _uiState.update { it.copy(message = "") } - _uiState.update {it.copy(isUpdated = false) } + _uiState.update { it.copy(isUpdated = false) } _uiState.update { it.copy(success = false) } } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteView.kt index 863e3d7..2ab137a 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteView.kt @@ -83,8 +83,8 @@ internal fun ItemTagWriteView( NdefMessage( arrayOf( mRecord, - NdefRecord.createApplicationRecord(BuildConfig.APPLICATION_ID) - ) + NdefRecord.createApplicationRecord(BuildConfig.APPLICATION_ID), + ), ) } else { NdefMessage(mRecord) @@ -133,7 +133,7 @@ internal fun ItemTagWriteView( activity, nfcCallback, NfcAdapter.FLAG_READER_NFC_A, - null + null, ) onDispose { @@ -182,7 +182,7 @@ private fun ItemTagWriteContentView( modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .padding(padding) + .padding(padding), ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -205,7 +205,7 @@ private fun ItemTagWriteContentView( ), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -215,7 +215,7 @@ private fun ItemTagWriteContentView( alignment = Alignment.CenterVertically, ), modifier = Modifier - .padding(24.dp) + .padding(24.dp), ) { Text( stringResource(R.string.ready_for_scanning), @@ -223,7 +223,7 @@ private fun ItemTagWriteContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) Text( @@ -232,7 +232,7 @@ private fun ItemTagWriteContentView( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(top = 12.dp) + .padding(top = 12.dp), ) if (uiState.isUpdated) { @@ -240,14 +240,14 @@ private fun ItemTagWriteContentView( Icons.Outlined.Done, contentDescription = null, tint = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) } else if (uiState.isFailed) { Icon( Icons.Outlined.CrisisAlert, contentDescription = null, tint = Color.Red, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) } else { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.nfc_reader)) @@ -260,8 +260,8 @@ private fun ItemTagWriteContentView( MainButtonView( title = stringResource(R.string.cancel), onClick = { onBackClick() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModel.kt index 31963d1..dfa1c39 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModel.kt @@ -23,7 +23,7 @@ data class ItemTagWriteUiState( class ItemTagWriteViewModel @Inject constructor( savedStateHandle: SavedStateHandle, - ) : ViewModel() { +) : ViewModel() { private val itemTagId = savedStateHandle.toRoute().id val isLock = savedStateHandle.toRoute().isLock val itemTagType = savedStateHandle.toRoute().itemTagType @@ -33,7 +33,7 @@ class ItemTagWriteViewModel @Inject constructor( val scanUri = Utility.scanUri( itemTagId = itemTagId, - itemTagType = itemTagType + itemTagType = itemTagType, ) fun updateIsUpdated(newIsUpdated: Boolean) { @@ -54,4 +54,3 @@ class ItemTagWriteViewModel @Inject constructor( } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateView.kt index fec8624..a429d20 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateView.kt @@ -65,7 +65,7 @@ fun ItemTagCreateView( if (uiState.isCreated) { NatAlertDialog( - dialogTitle= stringResource(R.string.message_item_tag_created), + dialogTitle = stringResource(R.string.message_item_tag_created), onDismissRequest = { onBackClick() }, ) } @@ -73,7 +73,7 @@ fun ItemTagCreateView( ItemTagCreateView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -118,9 +118,9 @@ fun ItemTagCreateContentView( onClick = { viewModel.createItemTag() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = stringResource(R.string.label_add_tag)) } }, @@ -131,12 +131,12 @@ fun ItemTagCreateContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.tag_number) + text = stringResource(R.string.tag_number), ) }, placeholder = { Text("A001") }, @@ -147,17 +147,17 @@ fun ItemTagCreateContentView( Text( text = "Tag Number must be a 2-${uiState.maximumQueueNumberLength} alphanumeric characters.", style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Text( text = stringResource(R.string.zero_padding), style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Text( text = stringResource(id = R.string.tag_number_is_invalid), style = MaterialTheme.typography.bodyLarge, - color = if (viewModel.hasInvalidDataQueueNumber()) Color.Red else Color.Transparent + color = if (viewModel.hasInvalidDataQueueNumber()) Color.Red else Color.Transparent, ) } }, @@ -186,7 +186,7 @@ private fun TopAppBar( }) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } - }, + }, modifier = Modifier.fillMaxWidth(), ) } @@ -209,10 +209,10 @@ private fun ItemTagCreateErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -235,7 +235,7 @@ private fun ItemTagCreateLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModel.kt index 5ca88d3..31033ca 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModel.kt @@ -35,7 +35,7 @@ data class ItemTagCreateUiState( class ItemTagCreateViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val loginRepository: LoginRepository, - private val itemTagRepository: ItemTagRepository + private val itemTagRepository: ItemTagRepository, ) : ViewModel() { private val shopId = savedStateHandle.toRoute().shopId @@ -116,11 +116,11 @@ class ItemTagCreateViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { return hasInvalidDataQueueNumber() } - fun hasInvalidDataQueueNumber() : Boolean { + fun hasInvalidDataQueueNumber(): Boolean { val queueNumber = uiState.value.queueNumber if (queueNumber.isBlank()) return true diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListCardView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListCardView.kt index 96b83c8..9bca5e8 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListCardView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListCardView.kt @@ -17,7 +17,7 @@ fun ItemTagListCardView( headlineContent = { Text( data.getQueueNumber(), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) }, modifier = Modifier diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListView.kt index 1956afa..c8083f9 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListView.kt @@ -106,7 +106,7 @@ private fun ContentView( onBackClick: () -> Unit, ) { if (uiState.isLoading) { - ItemTagListLoadingView( onBackClick) + ItemTagListLoadingView(onBackClick) } else if (uiState.success) { ItemTagListContentView( viewModel = viewModel, @@ -170,10 +170,10 @@ private fun ItemTagListContentView( isRefreshing = uiState.isLoading, onRefresh = viewModel::reload, ) - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { Text( @@ -181,7 +181,7 @@ private fun ItemTagListContentView( style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, modifier = Modifier - .fillMaxWidth() + .fillMaxWidth(), ) } itemsIndexed( @@ -202,7 +202,7 @@ private fun ItemTagListContentView( }, backgroundColor = Color.Red, icon = Icons.Default.Delete, - modifier = Modifier.fillMaxHeight() + modifier = Modifier.fillMaxHeight(), ) }, ) { @@ -257,30 +257,30 @@ private fun NoResultsView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(24.dp), - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { Icon( Icons.Outlined.Rectangle, contentDescription = null, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) Text( stringResource(R.string.add_tag_description), modifier = Modifier - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) MainButtonView( title = stringResource(R.string.label_add_tag), onClick = { onAddItemTagClick(viewModel.shopId) }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } } @@ -304,10 +304,10 @@ private fun ItemTagListErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -330,7 +330,7 @@ private fun ItemTagListLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModel.kt index 15ce2e1..66952fa 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModel.kt @@ -72,7 +72,8 @@ class ItemTagListViewModel @Inject constructor( val itemTagsFlow: Flow = itemTagRepository.getItemTags(shopId) combine( - shopFlow, itemTagsFlow + shopFlow, + itemTagsFlow, ) { shop, itemTags -> _uiState.update { it.copy( @@ -130,4 +131,3 @@ class ItemTagListViewModel @Inject constructor( _uiState.update { it.copy(message = "") } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/navigation/shopSettingsNavigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/navigation/shopSettingsNavigation.kt index 01874a3..fd1a30e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/navigation/shopSettingsNavigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/navigation/shopSettingsNavigation.kt @@ -17,12 +17,19 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.shop_settings.item_tag_lis import kotlinx.serialization.Serializable @Serializable data class ShopSettingsRoute(val id: String) + @Serializable data class ShopBasicSettingsRoute(val id: String) + @Serializable data class NumberTagsWebpageListRoute(val id: String) + @Serializable data class ItemTagListRoute(val shopId: String) + @Serializable data class ItemTagCreateRoute(val shopId: String) + @Serializable data class ItemTagDetailRoute(val id: String) + @Serializable data class ItemTagEditRoute(val id: String) + @Serializable data class ItemTagWriteRoute(val id: String, val isLock: Boolean, val itemTagType: String) fun NavController.navigateToShopSettings(shopId: String, navOptions: NavOptionsBuilder.() -> Unit = {}) { @@ -168,7 +175,7 @@ fun NavController.navigateToItemTagWrite( itemTagId: String, isLock: Boolean, itemTagType: String, - navOptions: NavOptionsBuilder.() -> Unit = {} + navOptions: NavOptionsBuilder.() -> Unit = {}, ) { navigate(route = ItemTagWriteRoute(itemTagId, isLock, itemTagType)) { navOptions() diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateView.kt index 21d86a1..d87f0ad 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateView.kt @@ -20,12 +20,12 @@ import androidx.compose.material3.Button import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ExposedDropdownMenuAnchorType.Companion.PrimaryEditable import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarDuration @@ -66,7 +66,7 @@ fun ShopCreateView( if (uiState.isCreated) { NatAlertDialog( - dialogTitle= stringResource(R.string.message_shop_created), + dialogTitle = stringResource(R.string.message_shop_created), onDismissRequest = { onBackClick() }, ) } @@ -74,7 +74,7 @@ fun ShopCreateView( ShopCreateView( viewModel, uiState, - onBackClick + onBackClick, ) } @@ -121,9 +121,9 @@ fun ShopCreateContentView( onClick = { viewModel.createShop() }, modifier = Modifier.defaultMinSize(minWidth = 64.dp, minHeight = 64.dp), enabled = !viewModel.hasInvalidData(), - shape = CircleShape + shape = CircleShape, - ){ + ) { Icon(Icons.Filled.Done, contentDescription = stringResource(R.string.add_shop)) } }, @@ -134,12 +134,12 @@ fun ShopCreateContentView( .padding(padding) .padding(horizontal = 16.dp, vertical = 16.dp) .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { OutlinedTextField( label = { Text( - text = stringResource(R.string.shop_name) + text = stringResource(R.string.shop_name), ) }, placeholder = { Text(stringResource(R.string.shop_name)) }, @@ -149,7 +149,7 @@ fun ShopCreateContentView( Text( text = stringResource(id = R.string.shop_name_is_required), style = MaterialTheme.typography.bodyLarge, - color = if (uiState.name.isBlank()) Color.Red else Color.Transparent + color = if (uiState.name.isBlank()) Color.Red else Color.Transparent, ) }, modifier = Modifier @@ -159,14 +159,14 @@ fun ShopCreateContentView( OutlinedTextField( label = { Text( - text = stringResource(R.string.label_description) + text = stringResource(R.string.label_description), ) }, value = uiState.description, onValueChange = { viewModel.updateDescription(it) }, modifier = Modifier .fillMaxWidth() - .height(128.dp) + .height(128.dp), ) ExposedDropdownMenuBox( @@ -221,7 +221,7 @@ private fun TopAppBar( }) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } - }, + }, modifier = Modifier.fillMaxWidth(), ) } @@ -243,7 +243,7 @@ private fun ShopCreateLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModel.kt index 2514923..fc887eb 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModel.kt @@ -29,7 +29,7 @@ data class ShopCreateUiState( @HiltViewModel class ShopCreateViewModel @Inject constructor( - private val shopRepository: ShopRepository + private val shopRepository: ShopRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(ShopCreateUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -70,7 +70,7 @@ class ShopCreateViewModel @Inject constructor( } } - fun hasInvalidData() : Boolean { + fun hasInvalidData(): Boolean { return uiState.value.name.isBlank() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListCardView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListCardView.kt index 7202b2b..90a1158 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListCardView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListCardView.kt @@ -57,7 +57,7 @@ fun ShopListCardView( data.getDescription(), color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier - .padding(top = 12.dp) + .padding(top = 12.dp), ) } } @@ -83,14 +83,14 @@ private fun CountRow( style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Right, modifier = Modifier - .width(32.dp) + .width(32.dp), ) Text( text = countLabel, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier - .padding(start = 8.dp) + .padding(start = 8.dp), ) } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListView.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListView.kt index 74398f6..469660e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListView.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListView.kt @@ -10,8 +10,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Close @@ -142,7 +142,7 @@ private fun ShopListContentView( Icon(Icons.Filled.Add, stringResource(id = R.string.add_shop)) } } - } + }, ) { padding -> val pullToRefreshState = rememberPullToRefreshState() @@ -150,7 +150,7 @@ private fun ShopListContentView( NoResultsView( leftInShopSlots = leftInShopSlots, padding = padding, - onAddShopClick = onAddShopClick + onAddShopClick = onAddShopClick, ) } else { Box( @@ -162,10 +162,10 @@ private fun ShopListContentView( isRefreshing = uiState.isLoading, onRefresh = viewModel::reload, ) - .padding(padding) + .padding(padding), ) { LazyColumn( - Modifier.padding(24.dp) + Modifier.padding(24.dp), ) { item { if (!uiState.didShowTapShopBelowTip) { @@ -179,7 +179,7 @@ private fun ShopListContentView( items( items = uiState.shops.getDatumWithRelationships(), - key = { it.id!! } + key = { it.id!! }, ) { shop -> ShopListCardView( data = shop, @@ -240,25 +240,27 @@ fun TapShopBelowTip( onClick = { onDismiss() }, - label = { Text( - text, - style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.tertiary, - ) }, + label = { + Text( + text, + style = MaterialTheme.typography.titleLarge, + color = MaterialTheme.colorScheme.tertiary, + ) + }, selected = false, avatar = { Icon( Icons.Outlined.Info, contentDescription = null, tint = MaterialTheme.colorScheme.tertiary, - modifier = Modifier.size(InputChipDefaults.AvatarSize) + modifier = Modifier.size(InputChipDefaults.AvatarSize), ) }, trailingIcon = { Icon( Icons.Default.Close, contentDescription = null, - Modifier.size(InputChipDefaults.AvatarSize) + Modifier.size(InputChipDefaults.AvatarSize), ) }, ) @@ -277,10 +279,10 @@ private fun ShopListErrorView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { ErrorView( - onClick = { viewModel.reload() } + onClick = { viewModel.reload() }, ) } } @@ -297,43 +299,43 @@ private fun NoResultsView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(24.dp), - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { if (leftInShopSlots > 0) { Icon( Icons.Outlined.Storefront, contentDescription = null, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) Text( stringResource(R.string.add_shop_description), modifier = Modifier - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) MainButtonView( title = stringResource(R.string.add_shop), onClick = { onAddShopClick() }, - modifier = Modifier - .padding(horizontal = 12.dp, vertical = 24.dp) + modifier = Modifier + .padding(horizontal = 12.dp, vertical = 24.dp), ) } else { Icon( Icons.Outlined.NoLuggage, contentDescription = null, - modifier = Modifier.size(128.dp) + modifier = Modifier.size(128.dp), ) Column( verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { Row( horizontalArrangement = Arrangement.spacedBy(4.dp), @@ -355,8 +357,7 @@ private fun NoResultsView( } @Composable -private fun ShopListLoadingView( -) { +private fun ShopListLoadingView() { Scaffold( topBar = { TopAppBar() }, modifier = Modifier.fillMaxSize(), @@ -366,7 +367,7 @@ private fun ShopListLoadingView( .fillMaxWidth() .fillMaxHeight() .padding(padding), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { LoadingView() } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModel.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModel.kt index da95f1e..c14d13e 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModel.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModel.kt @@ -34,7 +34,7 @@ data class ShopListUiState( @HiltViewModel class ShopListViewModel @Inject constructor( private val loginRepository: LoginRepository, - private val shopRepository: ShopRepository + private val shopRepository: ShopRepository, ) : ViewModel() { private val _uiState = MutableStateFlow(ShopListUiState()) val uiState: StateFlow = _uiState.asStateFlow() @@ -72,7 +72,8 @@ class ShopListViewModel @Inject constructor( shopsFlow, didShowTapShopBelowTipFlow, ) { shops, - didShowTapShopBelowTip -> + didShowTapShopBelowTip, + -> _uiState.update { it.copy( shops = shops, @@ -104,4 +105,3 @@ class ShopListViewModel @Inject constructor( _uiState.update { it.copy(message = "") } } } - diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/navigation/ShopsNavigation.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/navigation/ShopsNavigation.kt index b6c96df..4a5ba00 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/navigation/ShopsNavigation.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/navigation/ShopsNavigation.kt @@ -11,7 +11,9 @@ import com.nativeapptemplate.nativeapptemplatefree.ui.shops.ShopListView import kotlinx.serialization.Serializable @Serializable data object ShopBaseRoute + @Serializable data object ShopsRoute + @Serializable data object ShopCreateRoute fun NavGraphBuilder.shopBaseView( diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ConnectivityManagerNetworkMonitor.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ConnectivityManagerNetworkMonitor.kt index 442ec7c..36e665d 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ConnectivityManagerNetworkMonitor.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ConnectivityManagerNetworkMonitor.kt @@ -32,52 +32,52 @@ import kotlinx.coroutines.flow.conflate import javax.inject.Inject internal class ConnectivityManagerNetworkMonitor @Inject constructor( - @ApplicationContext private val context: Context, + @ApplicationContext private val context: Context, ) : NetworkMonitor { - override val isOnline: Flow = callbackFlow { - val connectivityManager = context.getSystemService() - if (connectivityManager == null) { - channel.trySend(false) - channel.close() - return@callbackFlow - } + override val isOnline: Flow = callbackFlow { + val connectivityManager = context.getSystemService() + if (connectivityManager == null) { + channel.trySend(false) + channel.close() + return@callbackFlow + } - /** - * The callback's methods are invoked on changes to *any* network matching the [NetworkRequest], - * not just the active network. So we can simply track the presence (or absence) of such [Network]. - */ - val callback = object : NetworkCallback() { + /** + * The callback's methods are invoked on changes to *any* network matching the [NetworkRequest], + * not just the active network. So we can simply track the presence (or absence) of such [Network]. + */ + val callback = object : NetworkCallback() { - private val networks = mutableSetOf() + private val networks = mutableSetOf() - override fun onAvailable(network: Network) { - networks += network - channel.trySend(true) - } + override fun onAvailable(network: Network) { + networks += network + channel.trySend(true) + } - override fun onLost(network: Network) { - networks -= network - channel.trySend(networks.isNotEmpty()) - } - } + override fun onLost(network: Network) { + networks -= network + channel.trySend(networks.isNotEmpty()) + } + } - val request = Builder() - .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) - .build() - connectivityManager.registerNetworkCallback(request, callback) + val request = Builder() + .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) + .build() + connectivityManager.registerNetworkCallback(request, callback) - /** - * Sends the latest connectivity status to the underlying channel. - */ - channel.trySend(connectivityManager.isCurrentlyConnected()) + /** + * Sends the latest connectivity status to the underlying channel. + */ + channel.trySend(connectivityManager.isCurrentlyConnected()) - awaitClose { - connectivityManager.unregisterNetworkCallback(callback) - } + awaitClose { + connectivityManager.unregisterNetworkCallback(callback) } - .conflate() + } + .conflate() - private fun ConnectivityManager.isCurrentlyConnected() = activeNetwork - ?.let(::getNetworkCapabilities) - ?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) ?: false + private fun ConnectivityManager.isCurrentlyConnected() = activeNetwork + ?.let(::getNetworkCapabilities) + ?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) ?: false } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateTimeFormatterUtility.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateTimeFormatterUtility.kt index d77f77e..e554169 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateTimeFormatterUtility.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateTimeFormatterUtility.kt @@ -13,4 +13,4 @@ object DateTimeFormatterUtility { fun cardTimeFormatter(): DateTimeFormatter { return DateTimeFormatter.ofPattern(CARD_TIME_STRING) } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateUtility.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateUtility.kt index 73e1536..80dad25 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateUtility.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateUtility.kt @@ -39,4 +39,4 @@ object DateUtility { val date = ZonedDateTime.parse(this).withZoneSameInstant(zoneId) return date.cardTimeAgoInWordsDateString() } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/NetworkMonitor.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/NetworkMonitor.kt index 340845a..47739e3 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/NetworkMonitor.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/NetworkMonitor.kt @@ -22,5 +22,5 @@ import kotlinx.coroutines.flow.Flow * Utility for reporting app connectivity status */ interface NetworkMonitor { - val isOnline: Flow + val isOnline: Flow } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ProfileVerifierLogger.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ProfileVerifierLogger.kt index c3a937d..b7a73bb 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ProfileVerifierLogger.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/ProfileVerifierLogger.kt @@ -51,20 +51,20 @@ import javax.inject.Inject class ProfileVerifierLogger @Inject constructor( @ApplicationScope private val scope: CoroutineScope, ) { - companion object { - private const val TAG = "ProfileInstaller" - } + companion object { + private const val TAG = "ProfileInstaller" + } - operator fun invoke() = scope.launch { - val status = ProfileVerifier.getCompilationStatusAsync().await() - Log.d(TAG, "Status code: ${status.profileInstallResultCode}") - Log.d( - TAG, - when { - status.isCompiledWithProfile -> "App compiled with profile" - status.hasProfileEnqueuedForCompilation() -> "Profile enqueued for compilation" - else -> "Profile not compiled nor enqueued" - }, - ) - } + operator fun invoke() = scope.launch { + val status = ProfileVerifier.getCompilationStatusAsync().await() + Log.d(TAG, "Status code: ${status.profileInstallResultCode}") + Log.d( + TAG, + when { + status.isCompiledWithProfile -> "App compiled with profile" + status.hasProfileEnqueuedForCompilation() -> "Profile enqueued for compilation" + else -> "Profile not compiled nor enqueued" + }, + ) + } } diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/Utility.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/Utility.kt index ba8bb00..119fda9 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/Utility.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/Utility.kt @@ -40,10 +40,10 @@ object Utility { return text.matches("^[a-zA-Z0-9]*$".toRegex()) } - fun scanUri ( + fun scanUri( itemTagId: String, itemTagType: String, - ) : Uri { + ): Uri { val baseUri = Uri.parse(NatConstants.baseUrlString()) val uriBuilder = baseUri.buildUpon() val path = if (itemTagType == "server") NatConstants.SCAN_PATH else NatConstants.SCAN_PATH_CUSTOMER @@ -57,7 +57,7 @@ object Utility { fun extractItemTagInfoFrom( context: Context, ndefMessage: NdefMessage, - isTest: Boolean = false + isTest: Boolean = false, ): ItemTagInfoFromNdefMessage { val itemTagInfo = ItemTagInfoFromNdefMessage() itemTagInfo.message = context.getString(R.string.message_written_on_tag_is_wrong) @@ -152,15 +152,15 @@ object Utility { val appName = ctx.getString(R.string.app_name) val systemVersion = Build.VERSION.RELEASE val device = Build.MODEL - val appVersion= BuildConfig.VERSION_NAME + val appVersion = BuildConfig.VERSION_NAME val language = Locale.getDefault().language val body = "\n\n\n-----\n$appName $appVersion\n$device ($systemVersion)\n$language" val emailIntent = Intent(Intent.ACTION_SENDTO) val uriText = "mailto:" + Uri.encode(NatConstants.SUPPORT_MAIL) + - "?subject=" + Uri.encode("$appName for Android support") + - "&body=" + Uri.encode(body) + "?subject=" + Uri.encode("$appName for Android support") + + "&body=" + Uri.encode(body) emailIntent.setData(Uri.parse(uriText)) ctx.startActivity(emailIntent) diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSourceTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSourceTest.kt index 9eea402..7359f70 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSourceTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/NatPreferencesDataSourceTest.kt @@ -68,7 +68,7 @@ private val testInputLoggedInShopkeeperData = client = LOGGED_IN_SHOPKEEPER_CLIENT, uid = LOGGED_IN_SHOPKEEPER_UID, expiry = LOGGED_IN_SHOPKEEPER_EXPIRY, - ) + ), ) private val testInputLoggedInShopkeeper = LoggedInShopkeeper( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/UserPreferencesSerializerTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/UserPreferencesSerializerTest.kt index ca64543..ee870c3 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/UserPreferencesSerializerTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastore/UserPreferencesSerializerTest.kt @@ -44,4 +44,4 @@ class UserPreferencesSerializerTest { fun readingInvalidUserPreferences_throwsCorruptionException() = runTest { userPreferencesSerializer.readFrom(ByteArrayInputStream(byteArrayOf(0))) } -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt index f315066..d9ed0bb 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt @@ -28,13 +28,13 @@ import javax.inject.Singleton @Module @TestInstallIn( - components = [SingletonComponent::class], - replaces = [DataStoreModule::class], + components = [SingletonComponent::class], + replaces = [DataStoreModule::class], ) internal object TestDataStoreModule { - @Provides - @Singleton - fun providesUserPreferencesDataStore( - serializer: UserPreferencesSerializer, - ): DataStore = InMemoryDataStore(serializer.defaultValue) + @Provides + @Singleton + fun providesUserPreferencesDataStore( + serializer: UserPreferencesSerializer, + ): DataStore = InMemoryDataStore(serializer.defaultValue) } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManager.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManager.kt index 2d2ce2a..38ecd8f 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManager.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManager.kt @@ -4,5 +4,5 @@ import android.content.Context import java.io.InputStream fun interface DemoAssetManager { - fun open(context : Context, fileName: String): InputStream + fun open(context: Context, fileName: String): InputStream } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManagerImpl.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManagerImpl.kt index b4f7f88..68ae486 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManagerImpl.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/DemoAssetManagerImpl.kt @@ -19,7 +19,6 @@ package com.nativeapptemplate.nativeapptemplatefree.demo import android.content.Context import java.io.InputStream - internal object DemoAssetManagerImpl : DemoAssetManager { - override fun open(context : Context, fileName: String): InputStream = context.assets.open(fileName) + override fun open(context: Context, fileName: String): InputStream = context.assets.open(fileName) } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt index ec586d5..62406dd 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt @@ -22,7 +22,7 @@ class DemoItemTagRepositoryTest { private lateinit var subject: DemoItemTagRepository private val testDispatcher = StandardTestDispatcher() - private val itemTagData = Data( + private val itemTagData = Data( id = "9712F2DF-DFC7-A3AA-66BC-191203654A1A", type = "item_tag", attributes = Attributes( @@ -34,7 +34,7 @@ class DemoItemTagRepositoryTest { shopName = "8th & Townsend", customerReadAt = "2025-01-02T12:00:01.000Z", completedAt = "2025-01-02T12:00:03.000Z", - alreadyCompleted = false + alreadyCompleted = false, ), ) @@ -71,9 +71,9 @@ class DemoItemTagRepositoryTest { itemTagData.getShopId()!!, ItemTagBody( itemTagBodyDetail = ItemTagBodyDetail( - queueNumber = itemTagData.getQueueNumber() - ) - ) + queueNumber = itemTagData.getQueueNumber(), + ), + ), ).first(), ) } @@ -86,7 +86,7 @@ class DemoItemTagRepositoryTest { id = itemTagData.id!!, itemTagBody = ItemTagBody( itemTagBodyDetail = ItemTagBodyDetail( - queueNumber = itemTagData.getQueueNumber() + queueNumber = itemTagData.getQueueNumber(), ), ), ).first(), diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepository.kt index 5c37395..4365aa8 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepository.kt @@ -6,8 +6,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import javax.inject.Inject -class DemoAccountPasswordRepository @Inject constructor( -) : AccountPasswordRepository { +class DemoAccountPasswordRepository @Inject constructor() : AccountPasswordRepository { override fun updateAccountPassword(updatePasswordBody: UpdatePasswordBody): Flow = MutableStateFlow(true) } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepositoryTest.kt index 3066c34..299e755 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoAccountPasswordRepositoryTest.kt @@ -27,9 +27,9 @@ class DemoAccountPasswordRepositoryTest { currentPassword = "password", password = "updatingPassword", passwordConfirmation = "updatingPassword", - ) - ) - ).first() + ), + ), + ).first(), ) } } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepository.kt index d0e3556..58f4e24 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepository.kt @@ -121,9 +121,9 @@ class DemoLoginRepository @Inject constructor( override fun isShopDeleted(): Flow = MutableStateFlow(true) - override fun didShowTapShopBelowTip(): Flow =MutableStateFlow(true) + override fun didShowTapShopBelowTip(): Flow = MutableStateFlow(true) - override fun didShowReadInstructionsTip(): Flow =MutableStateFlow(true) + override fun didShowReadInstructionsTip(): Flow = MutableStateFlow(true) override fun getMaximumQueueNumberLength(): Flow = MutableStateFlow(5) diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepositoryTest.kt index 150da34..87d6837 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoLoginRepositoryTest.kt @@ -44,7 +44,7 @@ class DemoLoginRepositoryTest { name = "update shops", tag = "update_shops", createdAt = "2024-07-01T15:30:35.000Z", - updatedAt = "2024-07-01T15:30:35.000Z" + updatedAt = "2024-07-01T15:30:35.000Z", ), ), Data( @@ -54,7 +54,7 @@ class DemoLoginRepositoryTest { name = "update organizations", tag = "update_organizations", createdAt = "2024-07-01T15:30:35.000Z", - updatedAt = "2024-07-01T15:30:35.000Z" + updatedAt = "2024-07-01T15:30:35.000Z", ), ), Data( @@ -64,7 +64,7 @@ class DemoLoginRepositoryTest { name = "invitation", tag = "invitation", createdAt = "2024-07-01T15:30:35.000Z", - updatedAt = "2024-07-01T15:30:35.000Z" + updatedAt = "2024-07-01T15:30:35.000Z", ), ), ), @@ -73,7 +73,7 @@ class DemoLoginRepositoryTest { shouldUpdatePrivacy = false, shouldUpdateTerms = false, shopLimitCount = 99, - ) + ), ) @Before diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoSignUpRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoSignUpRepositoryTest.kt index c872c83..c0a3b99 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoSignUpRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/login/DemoSignUpRepositoryTest.kt @@ -57,7 +57,7 @@ class DemoSignUpRepositoryTest { email = "john@example.com", password = "password", timeZone = "Tokyo", - currentPlatform = "android" + currentPlatform = "android", ), ).first(), ) @@ -89,8 +89,8 @@ class DemoSignUpRepositoryTest { SendResetPassword( email = "john@example.com", redirectUrl = SendResetPassword.redirectUrlString(NatConstants.baseUrlString()), - ) - ).first() + ), + ).first(), ) } @@ -101,8 +101,8 @@ class DemoSignUpRepositoryTest { SendConfirmation( email = "john@example.com", redirectUrl = SendConfirmation.redirectUrlString(NatConstants.baseUrlString()), - ) - ).first() + ), + ).first(), ) } } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/shop/DemoShopRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/shop/DemoShopRepositoryTest.kt index 664d553..ded09d8 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/shop/DemoShopRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/shop/DemoShopRepositoryTest.kt @@ -33,7 +33,7 @@ class DemoShopRepositoryTest { ), meta = Meta( limitCount = 96, - createdShopsCount = 3 + createdShopsCount = 3, ), ) @@ -72,8 +72,8 @@ class DemoShopRepositoryTest { name = "Shop1", description = "This is a Shop1", timeZone = "Tokyo", - ) - ) + ), + ), ).first(), ) } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt index 72b6075..faed07f 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt @@ -27,7 +27,7 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) internal object TestDispatcherModule { - @Provides - @Singleton - fun providesTestDispatcher(): TestDispatcher = UnconfinedTestDispatcher() + @Provides + @Singleton + fun providesTestDispatcher(): TestDispatcher = UnconfinedTestDispatcher() } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt index a1b9c25..ede90f5 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt @@ -28,17 +28,17 @@ import kotlinx.coroutines.test.TestDispatcher @Module @TestInstallIn( - components = [SingletonComponent::class], - replaces = [DispatchersModule::class], + components = [SingletonComponent::class], + replaces = [DispatchersModule::class], ) internal object TestDispatchersModule { - @Provides - @Dispatcher(NatDispatchers.IO) - fun providesIODispatcher(testDispatcher: TestDispatcher): CoroutineDispatcher = testDispatcher + @Provides + @Dispatcher(NatDispatchers.IO) + fun providesIODispatcher(testDispatcher: TestDispatcher): CoroutineDispatcher = testDispatcher - @Provides - @Dispatcher(NatDispatchers.Default) - fun providesDefaultDispatcher( - testDispatcher: TestDispatcher, - ): CoroutineDispatcher = testDispatcher + @Provides + @Dispatcher(NatDispatchers.Default) + fun providesDefaultDispatcher( + testDispatcher: TestDispatcher, + ): CoroutineDispatcher = testDispatcher } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestAccountPasswordRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestAccountPasswordRepository.kt index d1d56c8..57ad562 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestAccountPasswordRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestAccountPasswordRepository.kt @@ -7,6 +7,6 @@ import kotlinx.coroutines.flow.MutableStateFlow class TestAccountPasswordRepository : AccountPasswordRepository { override fun updateAccountPassword( - updatePasswordBody: UpdatePasswordBody + updatePasswordBody: UpdatePasswordBody, ): Flow = MutableStateFlow(true) -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestItemTagRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestItemTagRepository.kt index 5d12a0c..a0ef63e 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestItemTagRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestItemTagRepository.kt @@ -16,7 +16,6 @@ class TestItemTagRepository : ItemTagRepository { private val itemTagFlow: MutableSharedFlow = MutableSharedFlow(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST) - override fun getItemTags(shopId: String): Flow = itemTagsFlow override fun getItemTag(id: String): Flow = itemTagFlow diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestLoginRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestLoginRepository.kt index 26f88f0..dd31343 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestLoginRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestLoginRepository.kt @@ -15,8 +15,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map -val emptyUserData = UserData( -) +val emptyUserData = UserData() class TestLoginRepository : LoginRepository { private val loggedInShopkeeperFlow: MutableSharedFlow = @@ -36,13 +35,13 @@ class TestLoginRepository : LoginRepository { override fun login(login: Login): Flow = loggedInShopkeeperFlow - override fun logout(): Flow = MutableStateFlow(true) + override fun logout(): Flow = MutableStateFlow(true) override fun getPermissions(): Flow = permissionsFlow - override fun updateConfirmedPrivacyVersion(): Flow = MutableStateFlow(true) + override fun updateConfirmedPrivacyVersion(): Flow = MutableStateFlow(true) - override fun updateConfirmedTermsVersion(): Flow = MutableStateFlow(true) + override fun updateConfirmedTermsVersion(): Flow = MutableStateFlow(true) override suspend fun setShouldFetchItemTagForShowTagInfoScan(shouldFetchItemTagForShowTagInfoScan: Boolean) { currentUserData.let { current -> @@ -91,7 +90,7 @@ class TestLoginRepository : LoginRepository { uid = loggedInShopkeeper.getUID()!!, expiry = loggedInShopkeeper.getExpiry()!!, isLoggedIn = true, - ) + ), ) } } @@ -104,7 +103,7 @@ class TestLoginRepository : LoginRepository { name = loggedInShopkeeper.getName()!!, timeZone = loggedInShopkeeper.getTimeZone()!!, uid = loggedInShopkeeper.getUID()!!, - ) + ), ) } } @@ -112,11 +111,11 @@ class TestLoginRepository : LoginRepository { currentUserData.let { current -> _userData.tryEmit( current.copy( - androidAppVersion = permissions.getAndroidAppVersion()!!, - shouldUpdatePrivacy = permissions.getShouldUpdatePrivacy()!!, + androidAppVersion = permissions.getAndroidAppVersion()!!, + shouldUpdatePrivacy = permissions.getShouldUpdatePrivacy()!!, shouldUpdateTerms = permissions.getShouldUpdateTerms()!!, shopLimitCount = permissions.getShopLimitCount()!!, - ) + ), ) } } @@ -168,7 +167,6 @@ class TestLoginRepository : LoginRepository { override fun isShopDeleted(): Flow = MutableStateFlow(false) - override fun didShowTapShopBelowTip(): Flow = MutableStateFlow(true) override fun didShowReadInstructionsTip(): Flow = userData.map { it.didShowReadInstructionsTip } @@ -201,4 +199,4 @@ class TestLoginRepository : LoginRepository { fun sendPermissions(permissions: Permissions) { permissionsFlow.tryEmit(permissions) } -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestShopRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestShopRepository.kt index c4e2495..50574ed 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestShopRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestShopRepository.kt @@ -25,9 +25,9 @@ class TestShopRepository : ShopRepository { override fun updateShop(id: String, shopUpdateBody: ShopUpdateBody): Flow = shopFlow - override fun deleteShop(id: String): Flow = MutableStateFlow(true) + override fun deleteShop(id: String): Flow = MutableStateFlow(true) - override fun resetShop(id: String): Flow = MutableStateFlow(true) + override fun resetShop(id: String): Flow = MutableStateFlow(true) /** * A test-only API. diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestSignUpRepository.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestSignUpRepository.kt index 5c11d19..1fd1f88 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestSignUpRepository.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/repository/TestSignUpRepository.kt @@ -18,17 +18,17 @@ class TestSignUpRepository : SignUpRepository { override fun signUp(signUp: SignUp): Flow = loggedInShopkeeperFlow override fun updateAccount( - signUpForUpdate: SignUpForUpdate + signUpForUpdate: SignUpForUpdate, ): Flow = loggedInShopkeeperFlow override fun deleteAccount(): Flow = MutableStateFlow(true) override fun sendResetPasswordInstruction( - sendResetPassword: SendResetPassword + sendResetPassword: SendResetPassword, ): Flow = MutableStateFlow(true) override fun sendConfirmationInstruction( - sendConfirmation: SendConfirmation + sendConfirmation: SendConfirmation, ): Flow = MutableStateFlow(true) /** @@ -37,4 +37,4 @@ class TestSignUpRepository : SignUpRepository { fun sendLoggedInShopkeeper(loggedInShopkeeper: LoggedInShopkeeper) { loggedInShopkeeperFlow.tryEmit(loggedInShopkeeper) } -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/util/MainDispatcherRule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/util/MainDispatcherRule.kt index 99812b0..7eff28f 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/util/MainDispatcherRule.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/util/MainDispatcherRule.kt @@ -30,9 +30,9 @@ import org.junit.runner.Description * for the duration of the test. */ class MainDispatcherRule( - private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(), + private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(), ) : TestWatcher() { - override fun starting(description: Description) = Dispatchers.setMain(testDispatcher) + override fun starting(description: Description) = Dispatchers.setMain(testDispatcher) - override fun finished(description: Description) = Dispatchers.resetMain() + override fun finished(description: Description) = Dispatchers.resetMain() } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModelTest.kt index 839f352..60b7af9 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/OnboardingViewModelTest.kt @@ -15,4 +15,4 @@ class OnboardingViewModelTest { fun onboardingImageId_isValid() = runTest { assertEquals(OnboardingViewModel.onboardingImageId(0), R.drawable.ic_overview1) } -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModelTest.kt index 326879e..78919d8 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignInEmailAndPasswordViewModelTest.kt @@ -140,7 +140,7 @@ private val testInputLoggedInShopkeeperData = client = LOGGED_IN_SHOPKEEPER_CLIENT, uid = LOGGED_IN_SHOPKEEPER_UID, expiry = LOGGED_IN_SHOPKEEPER_EXPIRY, - ) + ), ) private val testInputLoggedInShopkeeper = LoggedInShopkeeper( @@ -172,8 +172,8 @@ private val testInputPermissionsData = listOf( name = PERMISSION_1_NAME, tag = PERMISSION_1_TAG, createdAt = PERMISSION_CREATED_AT, - updatedAt = PERMISSION_UPDATED_AT - ) + updatedAt = PERMISSION_UPDATED_AT, + ), ), Data( id = PERMISSION_2_ID, @@ -182,8 +182,8 @@ private val testInputPermissionsData = listOf( name = PERMISSION_2_NAME, tag = PERMISSION_2_TAG, createdAt = PERMISSION_CREATED_AT, - updatedAt = PERMISSION_UPDATED_AT - ) + updatedAt = PERMISSION_UPDATED_AT, + ), ), Data( id = PERMISSION_3_ID, @@ -192,8 +192,8 @@ private val testInputPermissionsData = listOf( name = PERMISSION_3_NAME, tag = PERMISSION_3_TAG, createdAt = PERMISSION_CREATED_AT, - updatedAt = PERMISSION_UPDATED_AT - ) + updatedAt = PERMISSION_UPDATED_AT, + ), ), ) @@ -204,7 +204,7 @@ private val testInputPermissions = Permissions( shouldUpdatePrivacy = PERMISSION_SHOULD_UPDATE_PRIVACY, shouldUpdateTerms = PERMISSION_SHOULD_UPDATE_TERMS, shopLimitCount = PERMISSION_SHOP_LIMIT_COUNT, - ) + ), ) private const val testInputPassword = "password" diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModelTest.kt index 73b9839..ccd9dc2 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SignUpViewModelTest.kt @@ -143,7 +143,7 @@ private val testInputLoggedInShopkeeperData = client = LOGGED_IN_SHOPKEEPER_CLIENT, uid = LOGGED_IN_SHOPKEEPER_UID, expiry = LOGGED_IN_SHOPKEEPER_EXPIRY, - ) + ), ) private val testInputLoggedInShopkeeper = LoggedInShopkeeper( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModelTest.kt index fd809d3..98fc3f8 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/scan/ScanViewModelTest.kt @@ -73,17 +73,17 @@ class ScanViewModelTest { val showTagInfoScanResult = uiStateValue.showTagInfoScanResult assertEquals( showTagInfoScanResult.itemTagInfoFromNdefMessage, - testInputItemTagInfoFromNdefMessage + testInputItemTagInfoFromNdefMessage, ) assertEquals( showTagInfoScanResult.itemTagData, - ItemTagData(testInputItemTag) + ItemTagData(testInputItemTag), ) assertEquals( showTagInfoScanResult.showTagInfoScanResultType, - ShowTagInfoScanResultType.Succeeded + ShowTagInfoScanResultType.Succeeded, ) } @@ -101,22 +101,22 @@ class ScanViewModelTest { val completeScanResult = uiStateValue.completeScanResult assertEquals( completeScanResult.itemTagInfoFromNdefMessage, - testInputItemTagInfoFromNdefMessage + testInputItemTagInfoFromNdefMessage, ) assertEquals( completeScanResult.itemTagData, - ItemTagData(testInputItemTag) + ItemTagData(testInputItemTag), ) assertEquals( completeScanResult.completeScanResultType, - CompleteScanResultType.Completed + CompleteScanResultType.Completed, ) assertEquals( uiStateValue.isAlreadyCompleted, - false + false, ) } @@ -132,8 +132,8 @@ class ScanViewModelTest { type = ITEM_TAG_TYPE, attributes = testInputItemTag.datum!!.attributes!!.copy( alreadyCompleted = true, - ) - ) + ), + ), ) itemTagRepository.sendItemTag(newTestInputItemTag) @@ -145,22 +145,22 @@ class ScanViewModelTest { val completeScanResult = uiStateValue.completeScanResult assertEquals( completeScanResult.itemTagInfoFromNdefMessage, - testInputItemTagInfoFromNdefMessage + testInputItemTagInfoFromNdefMessage, ) assertEquals( completeScanResult.itemTagData, - ItemTagData(newTestInputItemTag) + ItemTagData(newTestInputItemTag), ) assertEquals( completeScanResult.completeScanResultType, - CompleteScanResultType.Completed + CompleteScanResultType.Completed, ) assertEquals( uiStateValue.isAlreadyCompleted, - true + true, ) } @@ -178,22 +178,22 @@ class ScanViewModelTest { val completeScanResult = uiStateValue.completeScanResult assertEquals( completeScanResult.itemTagInfoFromNdefMessage, - testInputItemTagInfoFromNdefMessage + testInputItemTagInfoFromNdefMessage, ) assertEquals( completeScanResult.itemTagData, - ItemTagData(testInputItemTag) + ItemTagData(testInputItemTag), ) assertEquals( completeScanResult.completeScanResultType, - CompleteScanResultType.Reset + CompleteScanResultType.Reset, ) assertEquals( uiStateValue.isAlreadyCompleted, - false + false, ) } @@ -287,8 +287,8 @@ private val testInputItemTagData = shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ) private val testInputItemTag = ItemTag( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsViewModelTest.kt index 7f63f31..cb67c58 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/DarkModeSettingsViewModelTest.kt @@ -63,4 +63,4 @@ class DarkModeSettingsViewModelTest { viewModel.darkModeSettingsUiState.value, ) } -} \ No newline at end of file +} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModelTest.kt index fa50abf..f7b4b66 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/PasswordEditViewModelTest.kt @@ -88,4 +88,4 @@ class PasswordEditViewModelTest { } private const val testInputCurrentPassword = "password" -private const val testInputNewPassword = "newPassword" \ No newline at end of file +private const val testInputNewPassword = "newPassword" diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModelTest.kt index a6dee5a..3514c64 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/settings/ShopkeeperEditViewModelTest.kt @@ -77,9 +77,9 @@ class ShopkeeperEditViewModelTest { type = LOGGED_IN_SHOPKEEPER_TYPE, attributes = testInputLoggedInShopkeeper.datum!!.attributes!!.copy( name = testInputNewName, - timeZone = testInputNewTimeZone - ) - ) + timeZone = testInputNewTimeZone, + ), + ), ) loginRepository.sendUserData(userData) @@ -123,9 +123,9 @@ class ShopkeeperEditViewModelTest { attributes = testInputLoggedInShopkeeper.datum!!.attributes!!.copy( name = testInputNewName, email = testInputNewEmail, - timeZone = testInputNewTimeZone - ) - ) + timeZone = testInputNewTimeZone, + ), + ), ) loginRepository.sendUserData(userData) @@ -250,7 +250,7 @@ private val testInputLoggedInShopkeeperData = client = LOGGED_IN_SHOPKEEPER_CLIENT, uid = LOGGED_IN_SHOPKEEPER_UID, expiry = LOGGED_IN_SHOPKEEPER_EXPIRY, - ) + ), ) private val testInputLoggedInShopkeeper = LoggedInShopkeeper( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModelTest.kt index dcab73e..f5d2f94 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_detail/ShopDetailViewModelTest.kt @@ -162,7 +162,7 @@ private var testInputShopsData = description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, completedItemTagsCount = 3, - ) + ), ) private var testInputShop = Shop( @@ -196,8 +196,8 @@ private val testInputItemTagsData = listOf( shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), Data( id = ITEM_TAG_2_ID, @@ -211,8 +211,8 @@ private val testInputItemTagsData = listOf( shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), Data( id = ITEM_TAG_3_ID, @@ -226,8 +226,8 @@ private val testInputItemTagsData = listOf( shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), ) diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModelTest.kt index b1a3a6d..2e0080d 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/NumberTagsWebpageListViewModelTest.kt @@ -87,7 +87,7 @@ private val testInputShopsData = name = SHOP_NAME, description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, - ) + ), ) private val testInputShop = Shop( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModelTest.kt index 671e70f..fd8f5a2 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopBasicSettingsViewModelTest.kt @@ -131,7 +131,7 @@ private val testInputShopsData = name = SHOP_NAME, description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, - ) + ), ) private val testInputShop = Shop( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModelTest.kt index 3e4baae..bd86001 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/ShopSettingsViewModelTest.kt @@ -88,7 +88,7 @@ private val testInputShopsData = name = SHOP_NAME, description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, - ) + ), ) private val testInputShop = Shop( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModelTest.kt index 4c26789..c8c17a3 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagDetailViewModelTest.kt @@ -138,8 +138,8 @@ private val testInputItemTagData = shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ) private val testInputItemTag = ItemTag( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModelTest.kt index affd308..aa8876a 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagEditViewModelTest.kt @@ -80,7 +80,7 @@ class ItemTagEditViewModelTest { val maximumQueueNumberLength = 5 val userData = emptyUserData.copy( - maximumQueueNumberLength = maximumQueueNumberLength + maximumQueueNumberLength = maximumQueueNumberLength, ) loginRepository.sendUserData(userData) @@ -155,8 +155,8 @@ private val testInputItemTagData = shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ) private val testInputItemTag = ItemTag( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModelTest.kt index 1702b62..546c7f5 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_detail/ItemTagWriteViewModelTest.kt @@ -39,7 +39,7 @@ class ItemTagWriteViewModelTest { route = ItemTagWriteRoute( id = testInputItemTagId, isLock = testInputIsLock, - itemTagType = testInputItemTagType + itemTagType = testInputItemTagType, ), ), ) @@ -50,7 +50,7 @@ class ItemTagWriteViewModelTest { backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.uiState.collect() } assertEquals( viewModel.scanUri, - Utility.scanUri(itemTagId = testInputItemTagId, itemTagType = testInputItemTagType) + Utility.scanUri(itemTagId = testInputItemTagId, itemTagType = testInputItemTagType), ) } diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModelTest.kt index 46c8ed0..d69844d 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagCreateViewModelTest.kt @@ -65,7 +65,7 @@ class ItemTagCreateViewModelTest { val maximumQueueNumberLength = 5 val userData = emptyUserData.copy( - maximumQueueNumberLength = maximumQueueNumberLength + maximumQueueNumberLength = maximumQueueNumberLength, ) loginRepository.sendUserData(userData) @@ -84,7 +84,7 @@ class ItemTagCreateViewModelTest { val maximumQueueNumberLength = 5 val userData = emptyUserData.copy( - maximumQueueNumberLength = maximumQueueNumberLength + maximumQueueNumberLength = maximumQueueNumberLength, ) loginRepository.sendUserData(userData) @@ -148,7 +148,7 @@ private var testInputShopsData = description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, completedItemTagsCount = 3, - ) + ), ) private var testInputShop = Shop( @@ -178,11 +178,10 @@ private val testInputItemTagsData = shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ) - private val testInputItemTag = ItemTag( datum = testInputItemTagsData, ) diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModelTest.kt index fdb4d3b..b56593f 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shop_settings/item_tag_list/ItemTagListViewModelTest.kt @@ -122,7 +122,7 @@ private var testInputShopsData = description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, completedItemTagsCount = 3, - ) + ), ) private var testInputShop = Shop( @@ -156,8 +156,8 @@ private val testInputItemTagsData = listOf( shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), Data( id = ITEM_TAG_2_ID, @@ -170,8 +170,8 @@ private val testInputItemTagsData = listOf( createdAt = ITEM_TAG_CREATED_AT, shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), Data( id = ITEM_TAG_3_ID, @@ -185,8 +185,8 @@ private val testInputItemTagsData = listOf( shopName = SHOP_NAME, customerReadAt = ITEM_TAG_CUSTOMER_READ_AT, completedAt = ITEM_TAG_COMPLETED_AT, - alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED - ) + alreadyCompleted = ITEM_TAG_ALREADY_COMPLETED, + ), ), ) diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModelTest.kt index 608925d..bd93e03 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopCreateViewModelTest.kt @@ -96,7 +96,7 @@ private val testInputShopsData = name = SHOP_NAME, description = SHOP_DESCRIPTION, timeZone = SHOP_TIME_ZONE, - ) + ), ) private val testInputShop = Shop( diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModelTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModelTest.kt index f569d2f..91e8e77 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModelTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/shops/ShopListViewModelTest.kt @@ -12,7 +12,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Assert.* - import org.junit.Before import org.junit.Rule import org.junit.Test diff --git a/build.gradle.kts b/build.gradle.kts index 355e186..01baa4d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,4 +24,41 @@ plugins { alias(libs.plugins.kotlin.parcelize) apply false alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.ksp) apply false + alias(libs.plugins.spotless) apply true +} + +val ktlintEditorConfig = + mapOf( + "android" to "true", + "ktlint_function_naming_ignore_when_annotated_with" to "Composable, Test", + "ktlint_standard_backing-property-naming" to "disabled", + "ktlint_standard_binary-expression-wrapping" to "disabled", + "ktlint_standard_chain-method-continuation" to "disabled", + "ktlint_standard_class-signature" to "disabled", + "ktlint_standard_condition-wrapping" to "disabled", + "ktlint_standard_function-expression-body" to "disabled", + "ktlint_standard_function-literal" to "disabled", + "ktlint_standard_function-type-modifier-spacing" to "disabled", + "ktlint_standard_multiline-loop" to "disabled", + "ktlint_standard_function-signature" to "disabled", + "ktlint_standard_package-name" to "disabled", + "ktlint_standard_no-wildcard-imports" to "disabled", + "ktlint_standard_property-naming" to "disabled", + "ktlint_standard_max-line-length" to "disabled", + "ktlint_standard_filename" to "disabled", + ) + +spotless { + kotlin { + target("**/*.kt") + targetExclude("**/build/**") + ktlint(libs.versions.ktlint.get()) + .editorConfigOverride(ktlintEditorConfig) + } + kotlinGradle { + target("**/*.kts") + targetExclude("**/build/**", "gradle/libs.versions.toml") + ktlint(libs.versions.ktlint.get()) + .editorConfigOverride(ktlintEditorConfig) + } } diff --git a/datastore-proto/build.gradle.kts b/datastore-proto/build.gradle.kts index 7757e11..a3b11a9 100644 --- a/datastore-proto/build.gradle.kts +++ b/datastore-proto/build.gradle.kts @@ -1,30 +1,30 @@ plugins { - alias(libs.plugins.kotlin.jvm) - alias(libs.plugins.protobuf) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.protobuf) } kotlin { - jvmToolchain(17) + jvmToolchain(17) } protobuf { - protoc { - artifact = libs.protobuf.protoc.get().toString() - } - generateProtoTasks { - all().configureEach { - builtins { - named("java") { - option("lite") - } - register("kotlin") { - option("lite") - } - } + protoc { + artifact = libs.protobuf.protoc.get().toString() + } + generateProtoTasks { + all().configureEach { + builtins { + named("java") { + option("lite") + } + register("kotlin") { + option("lite") } + } } + } } dependencies { - api(libs.protobuf.kotlin.lite) + api(libs.protobuf.kotlin.lite) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a724738..e41d7b4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,6 +14,7 @@ androidxTracing = "1.3.0-alpha02" capturable = "3.0.1" composeQrCode = "1.0.1" dependencyAnalysis = "2.8.0" +ktlint = "1.4.0" gmsPlugin = "4.4.4" googleOssPlugin = "0.10.9" hilt = "2.59" @@ -31,6 +32,7 @@ retrofitKotlinxSerializationJson = "1.0.0" robolectric = "4.16" sandwich = "2.1.1" sandwichRetrofitSerialization = "2.1.1" +spotless = "7.0.4" [libraries] androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivity" } @@ -89,3 +91,4 @@ kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt index a1f33ae..88e58a6 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -95,5 +95,5 @@ data class Attributes( val uid: String? = null, - val expiry: String? = null + val expiry: String? = null, ) : Parcelable diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/CompleteScanResultType.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/CompleteScanResultType.kt index b2b74a7..f039529 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/CompleteScanResultType.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/CompleteScanResultType.kt @@ -1,13 +1,14 @@ package com.nativeapptemplate.nativeapptemplatefree.model enum class CompleteScanResultType(val param: String, val title: String) { - Idled("idled","Idling"), + Idled("idled", "Idling"), - Completed("completed","Completed!"), + Completed("completed", "Completed!"), - Reset("reset","Reset!"), + Reset("reset", "Reset!"), - Failed("failed","Failed"); + Failed("failed", "Failed"), + ; companion object { val titles: List = entries.map { it.title } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt index 3ea51fa..d8462e3 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt @@ -1,8 +1,8 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable -import kotlinx.serialization.Serializable import kotlinx.parcelize.Parcelize +import kotlinx.serialization.Serializable @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt index 605389c..28d4d33 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,7 +11,7 @@ data class ItemTag( @SerialName("data") var datum: Data? = null, val meta: Meta? = null, - val included: List? = null + val included: List? = null, ) : Parcelable { fun getData(): Data? { if (included.isNullOrEmpty()) { diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBody.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBody.kt index 9096ffc..118e848 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBody.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBody.kt @@ -1,14 +1,13 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize data class ItemTagBody( @SerialName("item_tag") - var itemTagBodyDetail: ItemTagBodyDetail + var itemTagBodyDetail: ItemTagBodyDetail, ) : Parcelable - diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt index f11d39c..df9c698 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt @@ -1,13 +1,13 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize data class ItemTagBodyDetail( @SerialName("queue_number") - val queueNumber: String + val queueNumber: String, ) : Parcelable diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagData.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagData.kt index 39408e6..055ac58 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagData.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagData.kt @@ -6,9 +6,9 @@ data class ItemTagData( var queueNumber: String = "", var state: ItemTagState = ItemTagState.Idled, var scanState: ScanState = ScanState.Unscanned, - var createdAt: String = "", - var customerReadAt: String= "", - var completedAt: String= "", + var createdAt: String = "", + var customerReadAt: String = "", + var completedAt: String = "", var shopName: String = "", var alreadyCompleted: Boolean = false, ) { diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagInfoFromNdefMessage.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagInfoFromNdefMessage.kt index 013c8c8..1a11137 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagInfoFromNdefMessage.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagInfoFromNdefMessage.kt @@ -6,6 +6,6 @@ data class ItemTagInfoFromNdefMessage( var success: Boolean = false, var message: String = "", - var isReadOnly : Boolean = false, + var isReadOnly: Boolean = false, var scannedAt: String = "", ) diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagState.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagState.kt index a1a0b42..b5f746e 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagState.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagState.kt @@ -3,7 +3,8 @@ package com.nativeapptemplate.nativeapptemplatefree.model enum class ItemTagState(val param: String, val title: String) { Idled("idled", "Idling"), - Completed("completed", "Completed"); + Completed("completed", "Completed"), + ; companion object { fun fromParam(param: String?): ItemTagState? = param?.let { paramMap[it] } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagType.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagType.kt index 01359ba..e4c1738 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagType.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagType.kt @@ -1,9 +1,10 @@ package com.nativeapptemplate.nativeapptemplatefree.model enum class ItemTagType(val param: String, val title: String) { - Server("server","Server"), + Server("server", "Server"), - Customer("customer","Customer"); + Customer("customer", "Customer"), + ; companion object { val titles: List = entries.map { it.title } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTags.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTags.kt index 8e10a0b..f986338 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTags.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTags.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize /** * Model for list response of Bookmark, Content, Progressions @@ -14,7 +14,7 @@ data class ItemTags( @SerialName("data") val datum: List = emptyList(), val included: List? = null, - val meta: Meta? = null + val meta: Meta? = null, ) : Parcelable { fun getDatumWithRelationships(): List = datum.map { it.updateRelationships(included) diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/LoggedInShopkeeper.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/LoggedInShopkeeper.kt index 3babaae..5775020 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/LoggedInShopkeeper.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/LoggedInShopkeeper.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -13,7 +13,7 @@ data class LoggedInShopkeeper( val included: List? = null, - val meta: Meta? = null + val meta: Meta? = null, ) : Parcelable { fun getId(): String? = getData()?.id diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Meta.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Meta.kt index e1a921c..4d0d18b 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Meta.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Meta.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -17,7 +17,7 @@ data class Meta( @SerialName("android_app_version") var androidAppVersion: Int = 0, - @SerialName("should_update_privacy") + @SerialName("should_update_privacy") val shouldUpdatePrivacy: Boolean? = null, @SerialName("should_update_terms") @@ -29,5 +29,5 @@ data class Meta( @SerialName("shop_limit_count") var shopLimitCount: Int = 0, - var count: Int = 0 + var count: Int = 0, ) : Parcelable diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/NativeAppTemplateApiError.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/NativeAppTemplateApiError.kt index b4d4ecd..1dacedc 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/NativeAppTemplateApiError.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/NativeAppTemplateApiError.kt @@ -8,5 +8,5 @@ data class NativeAppTemplateApiError( val code: Int, @SerialName("error_message") - val message: String -) \ No newline at end of file + val message: String, +) diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Permissions.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Permissions.kt index f1f34f6..4a5db74 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Permissions.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Permissions.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -13,7 +13,7 @@ data class Permissions( val included: List? = null, - val meta: Meta? = null + val meta: Meta? = null, ) : Parcelable { fun getAndroidAppVersion(): Int? = meta?.androidAppVersion diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt index 668dc07..6a53ce1 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt @@ -1,9 +1,8 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable -import kotlinx.serialization.Serializable import kotlinx.parcelize.Parcelize -import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ScanState.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ScanState.kt index 48fa0f2..88fb2d1 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ScanState.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ScanState.kt @@ -1,7 +1,8 @@ package com.nativeapptemplate.nativeapptemplatefree.model enum class ScanState(val param: String, val title: String) { Unscanned("unscanned", "Unscanned"), - Scanned("scanned", "Scanned"); + Scanned("scanned", "Scanned"), + ; companion object { fun fromParam(param: String?): ScanState? = param?.let { paramMap[it] } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendConfirmation.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendConfirmation.kt index 550952e..b73f07f 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendConfirmation.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendConfirmation.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,9 +11,9 @@ data class SendConfirmation( val email: String, @SerialName("redirect_url") - val redirectUrl: String + val redirectUrl: String, ) : Parcelable { companion object { - fun redirectUrlString(baseUrlString: String): String = "${baseUrlString}/shopkeeper_auth/confirmation_result" + fun redirectUrlString(baseUrlString: String): String = "$baseUrlString/shopkeeper_auth/confirmation_result" } } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendResetPassword.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendResetPassword.kt index 7f840cd..c88a4d3 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendResetPassword.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SendResetPassword.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,9 +11,9 @@ data class SendResetPassword( val email: String, @SerialName("redirect_url") - val redirectUrl: String + val redirectUrl: String, ) : Parcelable { companion object { - fun redirectUrlString(baseUrlString: String): String = "${baseUrlString}/shopkeeper_auth/reset_password/edit" + fun redirectUrlString(baseUrlString: String): String = "$baseUrlString/shopkeeper_auth/reset_password/edit" } } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shop.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shop.kt index 6863a3e..6b42bff 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shop.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shop.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,7 +11,7 @@ data class Shop( @SerialName("data") var datum: Data? = null, val meta: Meta? = null, - val included: List? = null + val included: List? = null, ) : Parcelable { fun getData(): Data? { if (included.isNullOrEmpty()) { @@ -28,5 +28,5 @@ data class Shop( fun getCompletedItemTagsCount(): Int = getData()?.getCompletedItemTagsCount() ?: 0 - fun displayShopServerUrlString(baseUrlString: String): String = "${baseUrlString}/${getData()?.getDisplayShopServerPath()}" + fun displayShopServerUrlString(baseUrlString: String): String = "$baseUrlString/${getData()?.getDisplayShopServerPath()}" } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBody.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBody.kt index 5e76426..8a135b9 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBody.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBody.kt @@ -1,14 +1,13 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize data class ShopBody( @SerialName("shop") - val shopBodyDetail: ShopBodyDetail + val shopBodyDetail: ShopBodyDetail, ) : Parcelable - diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBodyDetail.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBodyDetail.kt index b3807a6..a798f41 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBodyDetail.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopBodyDetail.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBody.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBody.kt index ce06f69..4c664e3 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBody.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBody.kt @@ -1,14 +1,13 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize data class ShopUpdateBody( @SerialName("shop") - val shopUpdateBodyDetail: ShopUpdateBodyDetail + val shopUpdateBodyDetail: ShopUpdateBodyDetail, ) : Parcelable - diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBodyDetail.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBodyDetail.kt index 1c71b02..027c0a3 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBodyDetail.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShopUpdateBodyDetail.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt index bcc53ce..7c46a9b 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,7 +11,7 @@ data class Shopkeeper( @SerialName("data") var datum: Data? = null, val meta: Meta? = null, - val included: List? = null + val included: List? = null, ) : Parcelable { fun getData(): Data? { if (included.isNullOrEmpty()) { diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt index 6f93612..990f7a2 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,5 +11,5 @@ data class Shopkeepers( @SerialName("data") val datum: List = emptyList(), val included: List? = null, - val meta: Meta? = null + val meta: Meta? = null, ) : Parcelable diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shops.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shops.kt index 8f841eb..f8ebfbe 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shops.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shops.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize @@ -11,7 +11,7 @@ data class Shops( @SerialName("data") val datum: List = emptyList(), val included: List? = null, - val meta: Meta? = null + val meta: Meta? = null, ) : Parcelable { fun getCreatedShopsCount(): Int = meta?.createdShopsCount ?: 0 diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShowTagInfoScanResultType.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShowTagInfoScanResultType.kt index e9e0d55..dfa77cb 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShowTagInfoScanResultType.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ShowTagInfoScanResultType.kt @@ -1,11 +1,12 @@ package com.nativeapptemplate.nativeapptemplatefree.model enum class ShowTagInfoScanResultType(val param: String, val title: String) { - Idled("idled","Idling"), + Idled("idled", "Idling"), - Succeeded("succeeded","Succeeded"), + Succeeded("succeeded", "Succeeded"), - Failed("failed","Failed"); + Failed("failed", "Failed"), + ; companion object { val titles: List = entries.map { it.title } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUp.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUp.kt index 628d836..ba9a85d 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUp.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUp.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUpForUpdate.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUpForUpdate.kt index 3a442b9..6a0a163 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUpForUpdate.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/SignUpForUpdate.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Status.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Status.kt index fe3ea3a..4c4b233 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Status.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Status.kt @@ -1,11 +1,11 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable -import kotlinx.serialization.Serializable import kotlinx.parcelize.Parcelize +import kotlinx.serialization.Serializable @Serializable @Parcelize data class Status( - val status: Int? = null -) : Parcelable \ No newline at end of file + val status: Int? = null, +) : Parcelable diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/TimeZones.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/TimeZones.kt index 16994f5..6a9d69c 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/TimeZones.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/TimeZones.kt @@ -165,7 +165,7 @@ object TimeZones { "Chatham Is." to "(GMT+12:45) Chatham Is.", "Nuku'alofa" to "(GMT+13:00) Nuku'alofa", "Samoa" to "(GMT+13:00) Samoa", - "Tokelau Is." to "(GMT+13:00) Tokelau Is." + "Tokelau Is." to "(GMT+13:00) Tokelau Is.", ) /** diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBody.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBody.kt index 396cb4e..420b1a2 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBody.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBody.kt @@ -1,14 +1,13 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize data class UpdatePasswordBody( @SerialName("shopkeeper") - val updatePasswordBodyDetail: UpdatePasswordBodyDetail + val updatePasswordBodyDetail: UpdatePasswordBodyDetail, ) : Parcelable - diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBodyDetail.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBodyDetail.kt index bbce9d3..996097f 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBodyDetail.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UpdatePasswordBodyDetail.kt @@ -1,9 +1,9 @@ package com.nativeapptemplate.nativeapptemplatefree.model import android.os.Parcelable +import kotlinx.parcelize.Parcelize import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.parcelize.Parcelize @Serializable @Parcelize diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UserData.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UserData.kt index a8b5f0d..5904dc6 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UserData.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/UserData.kt @@ -22,7 +22,7 @@ package com.nativeapptemplate.nativeapptemplatefree.model data class UserData( val id: String = "", val accountId: String = "", - val personalAccountId : String = "", + val personalAccountId: String = "", val accountOwnerId: String = "", val accountName: String = "", val email: String = "", @@ -40,8 +40,8 @@ data class UserData( val didShowReadInstructionsTip: Boolean = false, var androidAppVersion: Int = -1, - var shouldUpdatePrivacy: Boolean= false, - var shouldUpdateTerms: Boolean= false, + var shouldUpdatePrivacy: Boolean = false, + var shouldUpdateTerms: Boolean = false, var maximumQueueNumberLength: Int = -1, var shopLimitCount: Int = -1, @@ -53,4 +53,4 @@ data class UserData( var shouldCompleteItemTagForCompleteScan: Boolean = false, val didShowTapShopBelowTip: Boolean = false, -) \ No newline at end of file +) diff --git a/settings.gradle.kts b/settings.gradle.kts index 90a2fd7..56e49f1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,5 @@ @file:Suppress("UnstableApiUsage") + enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement {