diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..ee8c6bd30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*.{kt,kts}] +insert_final_newline = true +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 841b2f7fc..75096a070 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,6 @@ jobs: - name: Run test run: ./gradlew test + + - name: Check Ktlint + run: ./gradlew ktlintCheck diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a5812d11b..b038adf2a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -8,31 +8,38 @@ plugins { alias(libs.plugins.hilt) alias(libs.plugins.ksp) alias(libs.plugins.firebase.crashlytics) + alias(libs.plugins.ktlint.gradle) } android { namespace = "team.aliens.dms.android.app" - compileSdk = libs.versions.compileSdk.get().toInt() + compileSdk = ProjectProperties.COMPILE_SDK defaultConfig { - minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.targetSdk.get().toInt() + minSdk = ProjectProperties.MIN_SDK + targetSdk = ProjectProperties.TARGET_SDK - versionCode = 17 - versionName = "1.3.8" + versionCode = ProjectProperties.VERSION_CODE + versionName = ProjectProperties.VERSION_NAME testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { - isMinifyEnabled = false - + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", ) } + debug { + splits.abi.isEnable = false + aaptOptions.cruncherEnabled = false + splits.density.isEnable = false + aaptOptions.cruncherEnabled = false + } } buildFeatures { diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb4348..83fd53566 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,76 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +# keep everything in this package from being removed or renamed +-keep class team.** { *; } + +# keep everything in this package from being renamed only +-keepnames class team.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class okhttp3.** { *; } + +# keep everything in this package from being renamed only +-keepnames class okhttp3.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class kotlin.** { *; } + +# keep everything in this package from being renamed only +-keepnames class kotlin.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class okio.** { *; } + +# keep everything in this package from being renamed only +-keepnames class okio.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class java.** { *; } + +# keep everything in this package from being renamed only +-keepnames class java.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class retrofit2.** { *; } + +# keep everything in this package from being renamed only +-keepnames class retrofit2.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class org.** { *; } + +# keep everything in this package from being renamed only +-keepnames class org.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class javax.** { *; } + +# keep everything in this package from being renamed only +-keepnames class javax.** { *; } +# Add *one* of the following rules to your Proguard configuration file. +# Alternatively, you can annotate classes and class members with @androidx.annotation.Keep + +# keep everything in this package from being removed or renamed +-keep class _COROUTINE.** { *; } + +# keep everything in this package from being renamed only +-keepnames class _COROUTINE.** { *; } + +-dontwarn com.google.devtools.ksp.processing.SymbolProcessorProvider diff --git a/app/src/androidTest/java/team/aliens/dms/android/app/ExampleInstrumentedTest.kt b/app/src/androidTest/java/team/aliens/dms/android/app/ExampleInstrumentedTest.kt index c9a50f003..f060a8cb8 100644 --- a/app/src/androidTest/java/team/aliens/dms/android/app/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/team/aliens/dms/android/app/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.app -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.app.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b072d78bc..e701852d7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,12 +45,15 @@ + android:name="com.google.firebase.messaging.default_notification_icon" + android:resource="@drawable/ic_notification"/> - + + + + #3d8aff + \ No newline at end of file diff --git a/app/src/test/java/team/aliens/dms/android/app/ExampleUnitTest.kt b/app/src/test/java/team/aliens/dms/android/app/ExampleUnitTest.kt index c4249d109..0d4524129 100644 --- a/app/src/test/java/team/aliens/dms/android/app/ExampleUnitTest.kt +++ b/app/src/test/java/team/aliens/dms/android/app/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.app +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/buildSrc/src/main/kotlin/ProjectProperties.kt b/buildSrc/src/main/kotlin/ProjectProperties.kt new file mode 100644 index 000000000..45012c278 --- /dev/null +++ b/buildSrc/src/main/kotlin/ProjectProperties.kt @@ -0,0 +1,7 @@ +object ProjectProperties { + const val COMPILE_SDK = 34 + const val MIN_SDK = 23 + const val TARGET_SDK = 34 + const val VERSION_CODE = 18 + const val VERSION_NAME = "1.3.9" +} diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts index 5d33968ff..6018a5d82 100644 --- a/core/database/build.gradle.kts +++ b/core/database/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/database/src/androidTest/java/team/aliens/dms/android/core/database/ExampleInstrumentedTest.kt b/core/database/src/androidTest/java/team/aliens/dms/android/core/database/ExampleInstrumentedTest.kt index ecd7237e2..d081a5ef2 100644 --- a/core/database/src/androidTest/java/team/aliens/dms/android/core/database/ExampleInstrumentedTest.kt +++ b/core/database/src/androidTest/java/team/aliens/dms/android/core/database/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.database -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.database.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/database/src/main/java/team/aliens/dms/android/core/database/dao/NoticeDao.kt b/core/database/src/main/java/team/aliens/dms/android/core/database/dao/NoticeDao.kt index 6b433d979..6d6f14c36 100644 --- a/core/database/src/main/java/team/aliens/dms/android/core/database/dao/NoticeDao.kt +++ b/core/database/src/main/java/team/aliens/dms/android/core/database/dao/NoticeDao.kt @@ -23,7 +23,7 @@ abstract class NoticeDao { """ SELECT * FROM tbl_notices; - """ + """, ) abstract fun findAll(): List diff --git a/core/database/src/main/java/team/aliens/dms/android/core/database/entity/MealEntity.kt b/core/database/src/main/java/team/aliens/dms/android/core/database/entity/MealEntity.kt index 378028bc9..97fd313bd 100644 --- a/core/database/src/main/java/team/aliens/dms/android/core/database/entity/MealEntity.kt +++ b/core/database/src/main/java/team/aliens/dms/android/core/database/entity/MealEntity.kt @@ -7,7 +7,9 @@ import org.threeten.bp.LocalDate @Entity(tableName = "tbl_meals") data class MealEntity( - @PrimaryKey @ColumnInfo("date") val date: LocalDate, + @PrimaryKey + @ColumnInfo("date") + val date: LocalDate, @ColumnInfo(name = "breakfast") val breakfast: List, @ColumnInfo(name = "kcal_breakfast") val kcalOfBreakfast: String?, @ColumnInfo(name = "lunch") val lunch: List, diff --git a/core/database/src/main/java/team/aliens/dms/android/core/database/entity/NoticeEntity.kt b/core/database/src/main/java/team/aliens/dms/android/core/database/entity/NoticeEntity.kt index 6b5553eeb..e7e8f2e6d 100644 --- a/core/database/src/main/java/team/aliens/dms/android/core/database/entity/NoticeEntity.kt +++ b/core/database/src/main/java/team/aliens/dms/android/core/database/entity/NoticeEntity.kt @@ -8,7 +8,9 @@ import java.util.UUID @Entity(tableName = "tbl_notices") data class NoticeEntity( - @PrimaryKey @ColumnInfo(name = "id") val id: UUID, + @PrimaryKey + @ColumnInfo(name = "id") + val id: UUID, @ColumnInfo(name = "title") val title: String, @ColumnInfo(name = "content") val content: String?, @ColumnInfo(name = "created_at") val createdAt: LocalDateTime, diff --git a/core/database/src/test/java/team/aliens/dms/android/core/database/ExampleUnitTest.kt b/core/database/src/test/java/team/aliens/dms/android/core/database/ExampleUnitTest.kt index 8da690859..7815d68df 100644 --- a/core/database/src/test/java/team/aliens/dms/android/core/database/ExampleUnitTest.kt +++ b/core/database/src/test/java/team/aliens/dms/android/core/database/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.database +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/datastore/build.gradle.kts b/core/datastore/build.gradle.kts index 42cb59952..3636ddd26 100644 --- a/core/datastore/build.gradle.kts +++ b/core/datastore/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/datastore/src/androidTest/java/team/aliens/dms/android/core/datastore/ExampleInstrumentedTest.kt b/core/datastore/src/androidTest/java/team/aliens/dms/android/core/datastore/ExampleInstrumentedTest.kt index 802a9f867..7221640ac 100644 --- a/core/datastore/src/androidTest/java/team/aliens/dms/android/core/datastore/ExampleInstrumentedTest.kt +++ b/core/datastore/src/androidTest/java/team/aliens/dms/android/core/datastore/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.datastore -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.core.datastore.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/DataStore.kt b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/DataStore.kt index 04acaf6b9..408ba7869 100644 --- a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/DataStore.kt +++ b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/DataStore.kt @@ -3,4 +3,8 @@ package team.aliens.dms.android.core.datastore import android.content.Context import androidx.datastore.preferences.preferencesDataStore -internal val Context.dataStore: PreferencesDataStore by preferencesDataStore("dms-datastore") +internal val Context.jwtStore: PreferencesDataStore by preferencesDataStore("jwt-datastore") + +internal val Context.featuresStore: PreferencesDataStore by preferencesDataStore("features-datastore") + +internal val Context.deviceStore: PreferencesDataStore by preferencesDataStore("device-datastore") diff --git a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/Aliases.kt b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/PreferencesDataStore.kt similarity index 100% rename from core/datastore/src/main/java/team/aliens/dms/android/core/datastore/Aliases.kt rename to core/datastore/src/main/java/team/aliens/dms/android/core/datastore/PreferencesDataStore.kt diff --git a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/Qualifier.kt b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/Qualifier.kt new file mode 100644 index 000000000..87ffe5747 --- /dev/null +++ b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/Qualifier.kt @@ -0,0 +1,15 @@ +package team.aliens.dms.android.core.datastore + +import javax.inject.Qualifier + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class DeviceDataStore + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class FeaturesDataStore + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class JwtDataStore diff --git a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/di/DataStoreModule.kt b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/di/DataStoreModule.kt index 51c7b9069..806dd667d 100644 --- a/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/di/DataStoreModule.kt +++ b/core/datastore/src/main/java/team/aliens/dms/android/core/datastore/di/DataStoreModule.kt @@ -6,8 +6,13 @@ import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent +import team.aliens.dms.android.core.datastore.DeviceDataStore +import team.aliens.dms.android.core.datastore.FeaturesDataStore +import team.aliens.dms.android.core.datastore.JwtDataStore import team.aliens.dms.android.core.datastore.PreferencesDataStore -import team.aliens.dms.android.core.datastore.dataStore +import team.aliens.dms.android.core.datastore.deviceStore +import team.aliens.dms.android.core.datastore.featuresStore +import team.aliens.dms.android.core.datastore.jwtStore import javax.inject.Singleton @Module @@ -16,7 +21,22 @@ internal object DataStoreModule { @Provides @Singleton + @JwtDataStore fun providePreferenceDataStore( @ApplicationContext context: Context, - ): PreferencesDataStore = context.dataStore + ): PreferencesDataStore = context.jwtStore + + @Provides + @Singleton + @FeaturesDataStore + fun provideFeaturesDataStore( + @ApplicationContext context: Context, + ): PreferencesDataStore = context.featuresStore + + @Provides + @Singleton + @DeviceDataStore + fun provideDeviceDataStore( + @ApplicationContext context: Context, + ): PreferencesDataStore = context.deviceStore } diff --git a/core/datastore/src/test/java/team/aliens/dms/android/core/datastore/ExampleUnitTest.kt b/core/datastore/src/test/java/team/aliens/dms/android/core/datastore/ExampleUnitTest.kt index 4bef6d807..a40844e26 100644 --- a/core/datastore/src/test/java/team/aliens/dms/android/core/datastore/ExampleUnitTest.kt +++ b/core/datastore/src/test/java/team/aliens/dms/android/core/datastore/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.datastore +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/design-system/build.gradle.kts b/core/design-system/build.gradle.kts index 9f76bf4d3..6ca497a7e 100644 --- a/core/design-system/build.gradle.kts +++ b/core/design-system/build.gradle.kts @@ -5,6 +5,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Animations.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Animations.kt index 218969da5..e963f6993 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Animations.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Animations.kt @@ -29,7 +29,7 @@ fun slideOutFromStart(): ExitTransition { animationSpec = tween( durationMillis = slideOutDurationMillis, delayMillis = slideOutDelayMillis, - ) + ), ) } @@ -38,6 +38,6 @@ fun slideOutFromEnd(): ExitTransition { animationSpec = tween( durationMillis = slideOutDurationMillis, delayMillis = slideOutDelayMillis, - ) + ), ) } diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Buttons.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Buttons.kt index 20f5b6ec2..d2918f885 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Buttons.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Buttons.kt @@ -624,7 +624,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.outlinedGrayButtonColors() + colors = ButtonDefaults.outlinedGrayButtonColors(), ) { Text(text = "Outlined Gray Button") } @@ -633,7 +633,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.outlinedGrayButtonColors() + colors = ButtonDefaults.outlinedGrayButtonColors(), ) { Icon( painter = painterResource(id = R.drawable.ic_camera), @@ -647,7 +647,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.outlinedErrorButtonColors() + colors = ButtonDefaults.outlinedErrorButtonColors(), ) { Text(text = "Outlined Error Button") } @@ -656,7 +656,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.outlinedErrorButtonColors() + colors = ButtonDefaults.outlinedErrorButtonColors(), ) { Icon( painter = painterResource(id = R.drawable.ic_camera), @@ -697,7 +697,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.textGrayButtonColors() + colors = ButtonDefaults.textGrayButtonColors(), ) { Text(text = "Text Gray Button") } @@ -706,7 +706,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.textGrayButtonColors() + colors = ButtonDefaults.textGrayButtonColors(), ) { Icon( painter = painterResource(id = R.drawable.ic_camera), @@ -720,7 +720,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.textErrorButtonColors() + colors = ButtonDefaults.textErrorButtonColors(), ) { Text(text = "Text Error Button") } @@ -729,7 +729,7 @@ private fun ButtonPreview() { .fillMaxWidth() .padding(horizontal = 16.dp), onClick = { }, - colors = ButtonDefaults.textErrorButtonColors() + colors = ButtonDefaults.textErrorButtonColors(), ) { Icon( painter = painterResource(id = R.drawable.ic_camera), diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Checkboxes.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Checkboxes.kt index 136afc6bf..af317ccd4 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Checkboxes.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Checkboxes.kt @@ -1,7 +1,5 @@ package team.aliens.dms.android.core.designsystem -import androidx.compose.material3.Checkbox as MaterialCheckbox -import androidx.compose.material3.CheckboxDefaults as MaterialCheckboxDefaults import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -13,6 +11,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.material3.Checkbox as MaterialCheckbox +import androidx.compose.material3.CheckboxDefaults as MaterialCheckboxDefaults @Composable fun Checkbox( diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Colors.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Colors.kt index b1f4345dd..2883377e1 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Colors.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Colors.kt @@ -177,23 +177,23 @@ class Colors( ) override fun toString(): String = "Colors(" + - "primary=$primary, " + - "onPrimary=$onPrimary, " + - "primaryContainer=$primaryContainer, " + - "onPrimaryContainer=$onPrimaryContainer, " + - "error=$error, " + - "onError=$onError, " + - "errorContainer=$errorContainer, " + - "onErrorContainer=$onErrorContainer, " + - "background=$background, " + - "onBackground=$onBackground, " + - "backgroundVariant=$backgroundVariant, " + - "onBackgroundVariant=$onBackgroundVariant, " + - "surface=$surface, " + - "onSurface=$onSurface, " + - "surfaceVariant=$surfaceVariant, " + - "onSurfaceVariant=$onSurfaceVariant, " + - ")" + "primary=$primary, " + + "onPrimary=$onPrimary, " + + "primaryContainer=$primaryContainer, " + + "onPrimaryContainer=$onPrimaryContainer, " + + "error=$error, " + + "onError=$onError, " + + "errorContainer=$errorContainer, " + + "onErrorContainer=$onErrorContainer, " + + "background=$background, " + + "onBackground=$onBackground, " + + "backgroundVariant=$backgroundVariant, " + + "onBackgroundVariant=$onBackgroundVariant, " + + "surface=$surface, " + + "onSurface=$onSurface, " + + "surfaceVariant=$surfaceVariant, " + + "onSurfaceVariant=$onSurfaceVariant, " + + ")" } fun lightColors( diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Dialog.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Dialog.kt index 45bb4a6d4..c0dfdced9 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Dialog.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Dialog.kt @@ -22,7 +22,7 @@ fun AlertDialog( titleContentColor: Color = DmsTheme.colorScheme.onSurface, textContentColor: Color = DmsTheme.colorScheme.onSurface, tonalElevation: Dp = ShadowDefaults.MediumElevation, - properties: DialogProperties = DialogProperties() + properties: DialogProperties = DialogProperties(), ) = androidx.compose.material3.AlertDialog( onDismissRequest = onDismissRequest, confirmButton = confirmButton, diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/DmsIcon.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/DmsIcon.kt index 0d2cacdf3..1a561332f 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/DmsIcon.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/DmsIcon.kt @@ -39,4 +39,4 @@ object DmsIcon { val BlueNotice = R.drawable.ic_blue_notice val Edit = R.drawable.ic_edit val ProfileDefault = R.drawable.ic_profile_default -} \ No newline at end of file +} diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Picker.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Picker.kt index 41550041e..024aaeca9 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Picker.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Picker.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -39,10 +38,11 @@ fun Picker( items: List, state: PickerState = rememberPickerState(), modifier: Modifier = Modifier, - startIndex: Int = 0, + startIndex: Int = 0, visibleItemsCount: Int = 3, textModifier: Modifier = Modifier, textStyle: TextStyle = LocalTextStyle.current, + color: Color = Color.Unspecified, ) { val visibleItemsMiddle = visibleItemsCount / 2 val listScrollCount = Integer.MAX_VALUE @@ -60,8 +60,8 @@ fun Picker( val fadingEdgeGradient = remember { Brush.verticalGradient( 0f to Color.Transparent, - 0.5f to Color.Black, - 1f to Color.Transparent + 0.5f to color, + 1f to Color.Transparent, ) } @@ -80,7 +80,7 @@ fun Picker( modifier = Modifier .fillMaxWidth() .height(itemHeightDp * visibleItemsCount) - .fadingEdge(fadingEdgeGradient) + .fadingEdge(fadingEdgeGradient), ) { items(listScrollCount) { index -> Text( @@ -90,7 +90,8 @@ fun Picker( style = textStyle, modifier = Modifier .onSizeChanged { size -> itemHeightPixels.value = size.height } - .then(textModifier) + .then(textModifier), + color = color, ) } } diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/RadioButtons.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/RadioButtons.kt index 129ddadbe..daa6cbeda 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/RadioButtons.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/RadioButtons.kt @@ -1,7 +1,5 @@ package team.aliens.dms.android.core.designsystem -import androidx.compose.material3.RadioButton as MaterialRadioButton -import androidx.compose.material3.RadioButtonDefaults as MaterialRadioButtonDefaults import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -14,6 +12,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.material3.RadioButton as MaterialRadioButton +import androidx.compose.material3.RadioButtonDefaults as MaterialRadioButtonDefaults @Composable fun RadioButton( @@ -56,7 +56,6 @@ object RadioButtonDefaults { @Preview(showSystemUi = true) @Composable private fun RadioButtonPreview() { - val selectedValue = remember { mutableStateOf("") } val label = "Item" @@ -65,7 +64,7 @@ private fun RadioButtonPreview() { ) { RadioButton( selected = selectedValue.value == label, - onClick = { selectedValue.value = label } + onClick = { selectedValue.value = label }, ) Text( modifier = Modifier.fillMaxWidth(), diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Switches.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Switches.kt index 386d12bec..22446d1a6 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Switches.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Switches.kt @@ -1,7 +1,5 @@ package team.aliens.dms.android.core.designsystem -import androidx.compose.material3.Switch as MaterialSwitch -import androidx.compose.material3.SwitchDefaults as MaterialSwitchDefaults import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -16,6 +14,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.material3.Switch as MaterialSwitch +import androidx.compose.material3.SwitchDefaults as MaterialSwitchDefaults @Composable fun Switch( @@ -99,7 +99,7 @@ object SwitchDefaults { private fun SwitchPreview() { Column( horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.spacedBy(8.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), ) { val (checked, onCheckedChange) = remember { mutableStateOf(false) } Switch( diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/TextFields.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/TextFields.kt index 3f0f363c2..a781f679e 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/TextFields.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/TextFields.kt @@ -472,7 +472,6 @@ object TextFieldDefaults { shape: Shape, content: @Composable () -> Unit, ) = Column { - val trailingIconColor = colors.trailingIconColor( enabled = enabled, isError = isError, @@ -669,11 +668,9 @@ internal fun Decoration( @Preview @Composable private fun TextFieldPreview() { - val (value, onValueChange) = remember { mutableStateOf("") } val (error, onErrorChange) = remember { mutableStateOf(false) } - Column( modifier = Modifier .background(DmsTheme.colorScheme.background) diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Typography.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Typography.kt index 522f4e702..8fdf939ed 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Typography.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/Typography.kt @@ -168,18 +168,18 @@ class Typography internal constructor( override fun toString(): String { return "Typography(headline1=$headline1, " + - "headline2=$headline1, " + - "headline3=$headline3, " + - "title1=$title1, " + - "title2=$title2, " + - "title3=$title3, " + - "body1=$body1, " + - "body2=$body2, " + - "body3=$body3, " + - "caption=$caption, " + - "overline=$overline, " + - "button=$button" + - ")" + "headline2=$headline1, " + + "headline3=$headline3, " + + "title1=$title1, " + + "title2=$title2, " + + "title3=$title3, " + + "body1=$body1, " + + "body2=$body2, " + + "body3=$body3, " + + "caption=$caption, " + + "overline=$overline, " + + "button=$button" + + ")" } } diff --git a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/VerificationCodeInput.kt b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/VerificationCodeInput.kt index 5279b514a..46b2d7c44 100644 --- a/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/VerificationCodeInput.kt +++ b/core/design-system/src/main/java/team/aliens/dms/android/core/designsystem/VerificationCodeInput.kt @@ -63,7 +63,7 @@ fun VerificationCodeInput( defaultTextColor } else { filledTextColor - } + }, ) }, ) diff --git a/core/design-system/src/main/res/drawable-hdpi/ic_notification.png b/core/design-system/src/main/res/drawable-hdpi/ic_notification.png index 4c0063094..b2b1e2ddc 100644 Binary files a/core/design-system/src/main/res/drawable-hdpi/ic_notification.png and b/core/design-system/src/main/res/drawable-hdpi/ic_notification.png differ diff --git a/core/design-system/src/main/res/drawable-mdpi/ic_notification.png b/core/design-system/src/main/res/drawable-mdpi/ic_notification.png index 364ae0940..765b4293c 100644 Binary files a/core/design-system/src/main/res/drawable-mdpi/ic_notification.png and b/core/design-system/src/main/res/drawable-mdpi/ic_notification.png differ diff --git a/core/design-system/src/main/res/drawable-xhdpi/ic_notification.png b/core/design-system/src/main/res/drawable-xhdpi/ic_notification.png index f03f9acca..10abbb852 100644 Binary files a/core/design-system/src/main/res/drawable-xhdpi/ic_notification.png and b/core/design-system/src/main/res/drawable-xhdpi/ic_notification.png differ diff --git a/core/design-system/src/main/res/drawable-xxhdpi/ic_notification.png b/core/design-system/src/main/res/drawable-xxhdpi/ic_notification.png index 8d3e1011d..5617a1ab5 100644 Binary files a/core/design-system/src/main/res/drawable-xxhdpi/ic_notification.png and b/core/design-system/src/main/res/drawable-xxhdpi/ic_notification.png differ diff --git a/core/design-system/src/main/res/drawable-xxxhdpi/ic_notification.png b/core/design-system/src/main/res/drawable-xxxhdpi/ic_notification.png index d421428fb..dee91adbe 100644 Binary files a/core/design-system/src/main/res/drawable-xxxhdpi/ic_notification.png and b/core/design-system/src/main/res/drawable-xxxhdpi/ic_notification.png differ diff --git a/core/design-system/src/test/java/team/aliens/dms/android/core/designsystem/ExampleUnitTest.kt b/core/design-system/src/test/java/team/aliens/dms/android/core/designsystem/ExampleUnitTest.kt index 664283f2d..a3bdda71e 100644 --- a/core/design-system/src/test/java/team/aliens/dms/android/core/designsystem/ExampleUnitTest.kt +++ b/core/design-system/src/test/java/team/aliens/dms/android/core/designsystem/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.designsystem +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/device/build.gradle.kts b/core/device/build.gradle.kts index e687bb982..76abec2f9 100644 --- a/core/device/build.gradle.kts +++ b/core/device/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { @@ -21,7 +22,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + "proguard-rules.pro", ) } } @@ -50,4 +51,4 @@ dependencies { implementation(libs.hilt) ksp(libs.hilt.compiler) -} \ No newline at end of file +} diff --git a/core/device/src/androidTest/java/team/aliens/dms/android/core/device/ExampleInstrumentedTest.kt b/core/device/src/androidTest/java/team/aliens/dms/android/core/device/ExampleInstrumentedTest.kt index b5aab263c..c3b0ab952 100644 --- a/core/device/src/androidTest/java/team/aliens/dms/android/core/device/ExampleInstrumentedTest.kt +++ b/core/device/src/androidTest/java/team/aliens/dms/android/core/device/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.device -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.core.device.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/DeviceDataStoreDataSource.kt b/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/DeviceDataStoreDataSource.kt index 6db1676d7..55ef43b4d 100644 --- a/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/DeviceDataStoreDataSource.kt +++ b/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/DeviceDataStoreDataSource.kt @@ -7,5 +7,4 @@ abstract class DeviceDataStoreDataSource { abstract suspend fun storeDeviceToken(deviceToken: String) abstract suspend fun clearDeviceToken() - } diff --git a/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/store/DeviceStoreImpl.kt b/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/store/DeviceStoreImpl.kt index 3ab21c74c..49bc96ab1 100644 --- a/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/store/DeviceStoreImpl.kt +++ b/core/device/src/main/java/team/aliens/dms/android/core/device/datastore/store/DeviceStoreImpl.kt @@ -5,6 +5,7 @@ import androidx.datastore.preferences.core.stringPreferencesKey import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.runBlocking +import team.aliens.dms.android.core.datastore.DeviceDataStore import team.aliens.dms.android.core.datastore.PreferencesDataStore import team.aliens.dms.android.core.datastore.util.transform import team.aliens.dms.android.core.device.datastore.store.exception.CannotStoreDeviceTokenException @@ -12,10 +13,11 @@ import team.aliens.dms.android.core.device.datastore.store.exception.DeviceToken import javax.inject.Inject internal class DeviceStoreImpl @Inject constructor( - private val preferencesDataStore: PreferencesDataStore, + @DeviceDataStore private val deviceDataStore: PreferencesDataStore, ) : DeviceStore() { + override fun loadDeviceToken(): String = runBlocking { - preferencesDataStore.data.map { preferences -> + deviceDataStore.data.map { preferences -> preferences[DEVICE_TOKEN] ?: throw DeviceTokenNotFoundException() }.first() } @@ -24,7 +26,7 @@ internal class DeviceStoreImpl @Inject constructor( transform( onFailure = { throw CannotStoreDeviceTokenException() }, ) { - preferencesDataStore.edit { preferences -> + deviceDataStore.edit { preferences -> preferences[DEVICE_TOKEN] = deviceToken } } @@ -32,7 +34,7 @@ internal class DeviceStoreImpl @Inject constructor( override suspend fun clearDeviceToken() { transform { - preferencesDataStore.edit { preferences -> preferences.clear() } + deviceDataStore.edit { preferences -> preferences.clear() } } } diff --git a/core/device/src/test/java/team/aliens/dms/android/core/device/ExampleUnitTest.kt b/core/device/src/test/java/team/aliens/dms/android/core/device/ExampleUnitTest.kt index 2e898951e..9009da103 100644 --- a/core/device/src/test/java/team/aliens/dms/android/core/device/ExampleUnitTest.kt +++ b/core/device/src/test/java/team/aliens/dms/android/core/device/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.device +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/file/build.gradle.kts b/core/file/build.gradle.kts index 520f79bd7..712d065f1 100644 --- a/core/file/build.gradle.kts +++ b/core/file/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.ktlint.gradle) } android { @@ -19,7 +20,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + "proguard-rules.pro", ) } } diff --git a/core/file/src/androidTest/java/team/aliens/dms/android/core/file/ExampleInstrumentedTest.kt b/core/file/src/androidTest/java/team/aliens/dms/android/core/file/ExampleInstrumentedTest.kt index ca04ecd37..ad24f0575 100644 --- a/core/file/src/androidTest/java/team/aliens/dms/android/core/file/ExampleInstrumentedTest.kt +++ b/core/file/src/androidTest/java/team/aliens/dms/android/core/file/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.file -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.core.file.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/file/src/test/java/team/aliens/dms/android/core/file/ExampleUnitTest.kt b/core/file/src/test/java/team/aliens/dms/android/core/file/ExampleUnitTest.kt index dda5930e2..1dac1f3bd 100644 --- a/core/file/src/test/java/team/aliens/dms/android/core/file/ExampleUnitTest.kt +++ b/core/file/src/test/java/team/aliens/dms/android/core/file/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.file +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/jwt/build.gradle.kts b/core/jwt/build.gradle.kts index c64439d67..f394c3a3e 100644 --- a/core/jwt/build.gradle.kts +++ b/core/jwt/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/jwt/src/androidTest/java/team/aliens/dms/android/core/jwt/ExampleInstrumentedTest.kt b/core/jwt/src/androidTest/java/team/aliens/dms/android/core/jwt/ExampleInstrumentedTest.kt index 24248b03b..b026e1bad 100644 --- a/core/jwt/src/androidTest/java/team/aliens/dms/android/core/jwt/ExampleInstrumentedTest.kt +++ b/core/jwt/src/androidTest/java/team/aliens/dms/android/core/jwt/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.jwt -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.jwt.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Aliases.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Aliases.kt index 802564c34..88b3f4e13 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Aliases.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Aliases.kt @@ -1,7 +1,5 @@ package team.aliens.dms.android.core.jwt -import org.threeten.bp.LocalDateTime - /* typealias AccessToken = String diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/JwtProvider.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/JwtProvider.kt index eff43e080..66dc4ef23 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/JwtProvider.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/JwtProvider.kt @@ -9,7 +9,6 @@ abstract class JwtProvider { */ abstract val cachedAccessToken: AccessToken - /** * represents if the cached access token is available */ diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Token.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Token.kt index 13314badd..1ef57f023 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Token.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/Token.kt @@ -27,7 +27,6 @@ data class RefreshToken( override val expiration: LocalDateTime, ) : Token() - internal fun TokensResponse.toModel(): Tokens = Tokens( accessToken = AccessToken( value = this.accessToken, diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/JwtStoreImpl.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/JwtStoreImpl.kt index 08cc3bc28..25e9dcc20 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/JwtStoreImpl.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/JwtStoreImpl.kt @@ -6,6 +6,7 @@ import androidx.datastore.preferences.core.stringPreferencesKey import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.runBlocking +import team.aliens.dms.android.core.datastore.JwtDataStore import team.aliens.dms.android.core.datastore.PreferencesDataStore import team.aliens.dms.android.core.datastore.util.transform import team.aliens.dms.android.core.jwt.AccessToken @@ -21,11 +22,11 @@ import team.aliens.dms.android.shared.date.toLocalDateTime import javax.inject.Inject internal class JwtStoreImpl @Inject constructor( - private val preferencesDataStore: PreferencesDataStore, + @JwtDataStore private val jwtDataStore: PreferencesDataStore, ) : JwtStore() { override fun loadTokens(): Tokens = runBlocking { - preferencesDataStore.data.map { preferences -> + jwtDataStore.data.map { preferences -> val accessTokenValue = preferences[ACCESS_TOKEN] ?: throw AccessTokenNotFoundException() val accessTokenExpiration = preferences[ACCESS_TOKEN_EXPIRATION] @@ -49,8 +50,8 @@ internal class JwtStoreImpl @Inject constructor( } override suspend fun storeTokens(tokens: Tokens) { - transform(onFailure = { throw CannotStoreTokensException() },) { - preferencesDataStore.edit { preferences -> + transform(onFailure = { throw CannotStoreTokensException() }) { + jwtDataStore.edit { preferences -> val accessToken = tokens.accessToken val refreshToken = tokens.refreshToken preferences[ACCESS_TOKEN] = accessToken.value @@ -62,7 +63,7 @@ internal class JwtStoreImpl @Inject constructor( } override suspend fun clearTokens() { - transform { preferencesDataStore.edit { preferences -> preferences.clear() } } + transform { jwtDataStore.edit { preferences -> preferences.clear() } } } private companion object { diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/exception/CannotStoreTokenException.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/exception/CannotStoreTokenException.kt index 949101dc4..96fba1353 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/exception/CannotStoreTokenException.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/datastore/store/exception/CannotStoreTokenException.kt @@ -4,7 +4,7 @@ import team.aliens.dms.android.core.datastore.exception.TransformFailureExceptio sealed class CannotStoreTokenException(message: String?) : TransformFailureException(message) -class CannotStoreTokensException: CannotStoreTokenException("Cannot store tokens") +class CannotStoreTokensException : CannotStoreTokenException("Cannot store tokens") class CannotStoreAccessTokenException : CannotStoreTokenException("Cannot store access token") diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/interceptor/JwtInterceptor.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/interceptor/JwtInterceptor.kt index 1d9a52aee..3900d1a64 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/interceptor/JwtInterceptor.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/interceptor/JwtInterceptor.kt @@ -22,7 +22,7 @@ class JwtInterceptor @Inject constructor( interceptedRequest } else { interceptedRequest.newBuilder().addAccessToken().build() - } + }, ) } @@ -35,7 +35,7 @@ class JwtInterceptor @Inject constructor( val path = this@shouldBeIgnored.url.encodedPath val method = this@shouldBeIgnored.method.toHttpMethod() - path.contains(ignoreRequest.path) && method == ignoreRequest.method ||checkS3Request(url = this@shouldBeIgnored.url.toString()) + path.contains(ignoreRequest.path) && method == ignoreRequest.method || checkS3Request(url = this@shouldBeIgnored.url.toString()) } private fun checkS3Request(url: String): Boolean { diff --git a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/model/TokensResponse.kt b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/model/TokensResponse.kt index 704281483..71aab65f2 100644 --- a/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/model/TokensResponse.kt +++ b/core/jwt/src/main/java/team/aliens/dms/android/core/jwt/network/model/TokensResponse.kt @@ -1,7 +1,6 @@ package team.aliens.dms.android.core.jwt.network.model import com.google.gson.annotations.SerializedName -import org.threeten.bp.LocalDateTime data class TokensResponse( @SerializedName("access_token") val accessToken: String, diff --git a/core/jwt/src/test/java/team/aliens/dms/android/core/jwt/ExampleUnitTest.kt b/core/jwt/src/test/java/team/aliens/dms/android/core/jwt/ExampleUnitTest.kt index 77e007de4..ee75097b7 100644 --- a/core/jwt/src/test/java/team/aliens/dms/android/core/jwt/ExampleUnitTest.kt +++ b/core/jwt/src/test/java/team/aliens/dms/android/core/jwt/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.jwt +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index cc7595f7b..04cf4e52c 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/network/src/androidTest/java/team/aliens/dms/android/core/network/ExampleInstrumentedTest.kt b/core/network/src/androidTest/java/team/aliens/dms/android/core/network/ExampleInstrumentedTest.kt index 42dcaf34c..3ffdc76e6 100644 --- a/core/network/src/androidTest/java/team/aliens/dms/android/core/network/ExampleInstrumentedTest.kt +++ b/core/network/src/androidTest/java/team/aliens/dms/android/core/network/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.network -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.network.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/team/aliens/dms/android/core/network/util/NetworkRequestHandler.kt b/core/network/src/main/java/team/aliens/dms/android/core/network/util/NetworkRequestHandler.kt index 3634ccf9d..74eabaa67 100644 --- a/core/network/src/main/java/team/aliens/dms/android/core/network/util/NetworkRequestHandler.kt +++ b/core/network/src/main/java/team/aliens/dms/android/core/network/util/NetworkRequestHandler.kt @@ -27,7 +27,6 @@ suspend inline fun handleNetworkRequest( ): T = try { request() } catch (httpException: retrofit2.HttpException) { - val code = httpException.code() val message = httpException.message() diff --git a/core/network/src/test/java/team/aliens/dms/android/core/network/ExampleUnitTest.kt b/core/network/src/test/java/team/aliens/dms/android/core/network/ExampleUnitTest.kt index 571c3756f..3251e3f3f 100644 --- a/core/network/src/test/java/team/aliens/dms/android/core/network/ExampleUnitTest.kt +++ b/core/network/src/test/java/team/aliens/dms/android/core/network/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.network +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/notification/build.gradle.kts b/core/notification/build.gradle.kts index ce20a1f6b..ca3cf5140 100644 --- a/core/notification/build.gradle.kts +++ b/core/notification/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { @@ -21,7 +22,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + "proguard-rules.pro", ) } } @@ -29,7 +30,7 @@ android { buildFeatures { buildConfig = true } - + compileOptions { sourceCompatibility = Versions.java targetCompatibility = Versions.java diff --git a/core/notification/src/androidTest/java/team/aliens/dms/android/core/notification/ExampleInstrumentedTest.kt b/core/notification/src/androidTest/java/team/aliens/dms/android/core/notification/ExampleInstrumentedTest.kt index 43060cfcc..f9afe0b93 100644 --- a/core/notification/src/androidTest/java/team/aliens/dms/android/core/notification/ExampleInstrumentedTest.kt +++ b/core/notification/src/androidTest/java/team/aliens/dms/android/core/notification/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.notification -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.core.notification.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/notification/src/main/java/team/aliens/dms/android/core/notification/CheckNotificationPermission.kt b/core/notification/src/main/java/team/aliens/dms/android/core/notification/CheckNotificationPermission.kt index 8d80eefa0..152ad24c3 100644 --- a/core/notification/src/main/java/team/aliens/dms/android/core/notification/CheckNotificationPermission.kt +++ b/core/notification/src/main/java/team/aliens/dms/android/core/notification/CheckNotificationPermission.kt @@ -7,9 +7,11 @@ import android.os.Build import androidx.core.app.ActivityCompat fun notificationPermissionGranted(context: Context): Boolean { - return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && + return ( + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && ActivityCompat.checkSelfPermission( - context, - Manifest.permission.POST_NOTIFICATIONS, - ) == PackageManager.PERMISSION_GRANTED) || Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU + context, + Manifest.permission.POST_NOTIFICATIONS, + ) == PackageManager.PERMISSION_GRANTED + ) || Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU } diff --git a/app/src/main/java/team/aliens/dms/android/app/NotificationManager.kt b/core/notification/src/main/java/team/aliens/dms/android/core/notification/NotificationManager.kt similarity index 74% rename from app/src/main/java/team/aliens/dms/android/app/NotificationManager.kt rename to core/notification/src/main/java/team/aliens/dms/android/core/notification/NotificationManager.kt index b4ac4e02d..3614f5bff 100644 --- a/app/src/main/java/team/aliens/dms/android/app/NotificationManager.kt +++ b/core/notification/src/main/java/team/aliens/dms/android/core/notification/NotificationManager.kt @@ -1,16 +1,14 @@ -package team.aliens.dms.android.app +package team.aliens.dms.android.core.notification import android.annotation.SuppressLint import android.app.NotificationChannel import android.app.NotificationManager -import android.app.PendingIntent import android.content.Context -import android.content.Intent import android.os.Build import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat import team.aliens.dms.android.core.designsystem.DmsIcon -import team.aliens.dms.android.core.notification.notificationPermissionGranted private object Notifications { const val NOTIFICATION_ID = 0 @@ -19,6 +17,7 @@ private object Notifications { const val CHANNEL_DESCRIPTION = "dms notification channel" } +@SuppressLint("InlinedApi") class NotificationManager( private val context: Context, ) { @@ -31,18 +30,14 @@ class NotificationManager( NotificationManagerCompat.from(context) } - private val messageId = System.currentTimeMillis().toInt() - private val intent = Intent(context, MainActivity::class.java) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) - private val pendingIntent = PendingIntent.getActivity( - context, messageId, intent, PendingIntent.FLAG_IMMUTABLE - ) - private val notificationBuilder: NotificationCompat.Builder by lazy { NotificationCompat.Builder(context, Notifications.NOTIFICATION_CHANNEL_ID) .setSmallIcon(DmsIcon.Notification) - .setPriority(NotificationCompat.PRIORITY_HIGH) - .setContentIntent(pendingIntent) + .setColor(ContextCompat.getColor(context, R.color.primary)) + .setAutoCancel(true) + .setPriority(NotificationManager.IMPORTANCE_HIGH) + .setDefaults(NotificationCompat.DEFAULT_ALL) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) } fun setNotificationContent( @@ -67,11 +62,11 @@ class NotificationManager( private fun createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val importance = NotificationManager.IMPORTANCE_DEFAULT + val importance = NotificationManager.IMPORTANCE_HIGH val channel = NotificationChannel( Notifications.NOTIFICATION_CHANNEL_ID, Notifications.CHANNEL_NAME, - importance + importance, ).apply { this.description = Notifications.CHANNEL_DESCRIPTION } diff --git a/core/notification/src/main/res/values/colors.xml b/core/notification/src/main/res/values/colors.xml new file mode 100644 index 000000000..e108ae0c9 --- /dev/null +++ b/core/notification/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #3d8aff + \ No newline at end of file diff --git a/core/notification/src/test/java/team/aliens/dms/android/core/notification/ExampleUnitTest.kt b/core/notification/src/test/java/team/aliens/dms/android/core/notification/ExampleUnitTest.kt index 826dfaeae..203332cd0 100644 --- a/core/notification/src/test/java/team/aliens/dms/android/core/notification/ExampleUnitTest.kt +++ b/core/notification/src/test/java/team/aliens/dms/android/core/notification/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.notification +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/project/build.gradle.kts b/core/project/build.gradle.kts index 8b5c229a5..6f65a6e1e 100644 --- a/core/project/build.gradle.kts +++ b/core/project/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/project/src/androidTest/java/team/aliens/dms/android/core/project/ExampleInstrumentedTest.kt b/core/project/src/androidTest/java/team/aliens/dms/android/core/project/ExampleInstrumentedTest.kt index 1cb27a47a..b1f41050d 100644 --- a/core/project/src/androidTest/java/team/aliens/dms/android/core/project/ExampleInstrumentedTest.kt +++ b/core/project/src/androidTest/java/team/aliens/dms/android/core/project/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.project -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.core.project.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/project/src/main/java/team/aliens/dms/android/core/project/di/Qualifiers.kt b/core/project/src/main/java/team/aliens/dms/android/core/project/di/Debug.kt similarity index 100% rename from core/project/src/main/java/team/aliens/dms/android/core/project/di/Qualifiers.kt rename to core/project/src/main/java/team/aliens/dms/android/core/project/di/Debug.kt diff --git a/core/project/src/main/java/team/aliens/dms/android/core/project/logger/Logger.kt b/core/project/src/main/java/team/aliens/dms/android/core/project/logger/Logger.kt index f8b71f1ac..1d52e5a11 100644 --- a/core/project/src/main/java/team/aliens/dms/android/core/project/logger/Logger.kt +++ b/core/project/src/main/java/team/aliens/dms/android/core/project/logger/Logger.kt @@ -10,7 +10,9 @@ internal interface Logger { fun log(tag: String, type: LoggingType, message: String) fun info(tag: String, message: String) = log( - tag = tag, type = LoggingType.INFO, message = message + tag = tag, + type = LoggingType.INFO, + message = message, ) fun error(tag: String, message: String) = log( diff --git a/core/project/src/test/java/team/aliens/dms/android/core/project/ExampleUnitTest.kt b/core/project/src/test/java/team/aliens/dms/android/core/project/ExampleUnitTest.kt index dc8c3f1d4..15be96711 100644 --- a/core/project/src/test/java/team/aliens/dms/android/core/project/ExampleUnitTest.kt +++ b/core/project/src/test/java/team/aliens/dms/android/core/project/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.project +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/school/build.gradle.kts b/core/school/build.gradle.kts index fe033a689..c320e9488 100644 --- a/core/school/build.gradle.kts +++ b/core/school/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/school/src/androidTest/java/team/aliens/dms/android/core/school/ExampleInstrumentedTest.kt b/core/school/src/androidTest/java/team/aliens/dms/android/core/school/ExampleInstrumentedTest.kt index eedc45425..16ecea3b2 100644 --- a/core/school/src/androidTest/java/team/aliens/dms/android/core/school/ExampleInstrumentedTest.kt +++ b/core/school/src/androidTest/java/team/aliens/dms/android/core/school/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.school -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.core.school.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/school/src/main/java/team/aliens/dms/android/core/school/Annotations.kt b/core/school/src/main/java/team/aliens/dms/android/core/school/FeaturesFetchingUrl.kt similarity index 100% rename from core/school/src/main/java/team/aliens/dms/android/core/school/Annotations.kt rename to core/school/src/main/java/team/aliens/dms/android/core/school/FeaturesFetchingUrl.kt diff --git a/core/school/src/main/java/team/aliens/dms/android/core/school/datastore/store/FeaturesStoreImpl.kt b/core/school/src/main/java/team/aliens/dms/android/core/school/datastore/store/FeaturesStoreImpl.kt index 520ab181f..b4e0bc364 100644 --- a/core/school/src/main/java/team/aliens/dms/android/core/school/datastore/store/FeaturesStoreImpl.kt +++ b/core/school/src/main/java/team/aliens/dms/android/core/school/datastore/store/FeaturesStoreImpl.kt @@ -5,6 +5,7 @@ import androidx.datastore.preferences.core.edit import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.runBlocking +import team.aliens.dms.android.core.datastore.FeaturesDataStore import team.aliens.dms.android.core.datastore.PreferencesDataStore import team.aliens.dms.android.core.datastore.util.transform import team.aliens.dms.android.core.school.Features @@ -13,10 +14,10 @@ import team.aliens.dms.android.core.school.exception.FeaturesNotFoundException import javax.inject.Inject internal class FeaturesStoreImpl @Inject constructor( - private val preferencesDataStore: PreferencesDataStore, + @FeaturesDataStore private val featuresDataStore: PreferencesDataStore, ) : FeaturesStore() { override fun loadFeatures(): Features = runBlocking { - preferencesDataStore.data.map { preferences -> + featuresDataStore.data.map { preferences -> val mealService = preferences[MEAL_SERVICE] ?: throw FeaturesNotFoundException() val noticeService = preferences[NOTICE_SERVICE] ?: throw FeaturesNotFoundException() val pointService = preferences[POINT_SERVICE] ?: throw FeaturesNotFoundException() @@ -38,7 +39,7 @@ internal class FeaturesStoreImpl @Inject constructor( transform( onFailure = { throw CannotStoreFeaturesException() }, ) { - preferencesDataStore.edit { preferences -> + featuresDataStore.edit { preferences -> preferences[MEAL_SERVICE] = features.mealService preferences[NOTICE_SERVICE] = features.noticeService preferences[POINT_SERVICE] = features.pointService @@ -50,7 +51,7 @@ internal class FeaturesStoreImpl @Inject constructor( override suspend fun clearFeatures() { transform { - preferencesDataStore.edit { preferences -> preferences.clear() } + featuresDataStore.edit { preferences -> preferences.clear() } } } diff --git a/core/school/src/test/java/team/aliens/dms/android/core/school/ExampleUnitTest.kt b/core/school/src/test/java/team/aliens/dms/android/core/school/ExampleUnitTest.kt index ba649b1ad..9c85efe96 100644 --- a/core/school/src/test/java/team/aliens/dms/android/core/school/ExampleUnitTest.kt +++ b/core/school/src/test/java/team/aliens/dms/android/core/school/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.school +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index c7a55502f..01fb04efe 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/core/ui/src/androidTest/java/team/aliens/dms/android/core/ui/ExampleInstrumentedTest.kt b/core/ui/src/androidTest/java/team/aliens/dms/android/core/ui/ExampleInstrumentedTest.kt index c9938a5c4..c66ba1367 100644 --- a/core/ui/src/androidTest/java/team/aliens/dms/android/core/ui/ExampleInstrumentedTest.kt +++ b/core/ui/src/androidTest/java/team/aliens/dms/android/core/ui/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.ui -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.core.feature.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/FloatingNotice.kt b/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/FloatingNotice.kt index ac6422b97..2ca076fe5 100644 --- a/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/FloatingNotice.kt +++ b/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/FloatingNotice.kt @@ -17,7 +17,6 @@ import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.shadow import team.aliens.dms.android.core.ui.PaddingDefaults import team.aliens.dms.android.core.ui.horizontalPadding -import team.aliens.dms.android.core.ui.screenPadding import team.aliens.dms.android.core.ui.verticalPadding @Composable diff --git a/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/TextFields.kt b/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/TextFields.kt index 8575578a7..a84511a6c 100644 --- a/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/TextFields.kt +++ b/core/ui/src/main/java/team/aliens/dms/android/core/ui/composable/TextFields.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import team.aliens.dms.android.core.designsystem.DmsIcon import team.aliens.dms.android.core.designsystem.DmsTheme -import team.aliens.dms.android.core.designsystem.R import team.aliens.dms.android.core.designsystem.TextField import team.aliens.dms.android.core.designsystem.TextFieldColors import team.aliens.dms.android.core.designsystem.TextFieldDefaults diff --git a/core/ui/src/test/java/team/aliens/dms/android/core/ui/ExampleUnitTest.kt b/core/ui/src/test/java/team/aliens/dms/android/core/ui/ExampleUnitTest.kt index 7e86facbf..56198e6f2 100644 --- a/core/ui/src/test/java/team/aliens/dms/android/core/ui/ExampleUnitTest.kt +++ b/core/ui/src/test/java/team/aliens/dms/android/core/ui/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.ui +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/widget/build.gradle.kts b/core/widget/build.gradle.kts index d00ab220b..18063ee05 100644 --- a/core/widget/build.gradle.kts +++ b/core/widget/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.ksp) alias(libs.plugins.hilt) alias(libs.plugins.serialization) + alias(libs.plugins.ktlint.gradle) } android { @@ -22,7 +23,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + "proguard-rules.pro", ) } } @@ -71,12 +72,13 @@ dependencies { kspTest(libs.hilt.compiler) implementation(libs.androidx.glance.appwidget) + implementation(libs.androidx.glance.material3) implementation(libs.androidx.work.runtime.ktx) implementation(libs.androidx.hilt.work) ksp(libs.androidx.hilt.compiler) - implementation (libs.kotlin.stdlib) + implementation(libs.kotlin.stdlib) implementation(libs.kotlinx.serialization.json) } diff --git a/core/widget/src/androidTest/java/team/aliens/dms/android/core/widget/ExampleInstrumentedTest.kt b/core/widget/src/androidTest/java/team/aliens/dms/android/core/widget/ExampleInstrumentedTest.kt index eadac4029..915963adf 100644 --- a/core/widget/src/androidTest/java/team/aliens/dms/android/core/widget/ExampleInstrumentedTest.kt +++ b/core/widget/src/androidTest/java/team/aliens/dms/android/core/widget/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.core.widget -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.core.widget.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/Colors.kt b/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/Colors.kt deleted file mode 100644 index 79dd26b77..000000000 --- a/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/Colors.kt +++ /dev/null @@ -1,64 +0,0 @@ -package team.aliens.dms.android.core.widget.designsystem - -import androidx.compose.runtime.staticCompositionLocalOf -import androidx.glance.unit.ColorProvider -import team.aliens.dms.android.core.designsystem.ErrorDarken2 -import team.aliens.dms.android.core.designsystem.ErrorDefault -import team.aliens.dms.android.core.designsystem.ErrorLighten2 -import team.aliens.dms.android.core.designsystem.Gray1 -import team.aliens.dms.android.core.designsystem.Gray10 -import team.aliens.dms.android.core.designsystem.Gray2 -import team.aliens.dms.android.core.designsystem.Gray3 -import team.aliens.dms.android.core.designsystem.Gray5 -import team.aliens.dms.android.core.designsystem.Gray6 -import team.aliens.dms.android.core.designsystem.Gray7 -import team.aliens.dms.android.core.designsystem.Gray9 -import team.aliens.dms.android.core.designsystem.PrimaryDarken2 -import team.aliens.dms.android.core.designsystem.PrimaryDefault -import team.aliens.dms.android.core.designsystem.PrimaryLighten2 - -data class ColorProviders( - val primary: ColorProvider, - val onPrimary: ColorProvider, - val primaryContainer: ColorProvider, - val onPrimaryContainer: ColorProvider, - val error: ColorProvider, - val onError: ColorProvider, - val errorContainer: ColorProvider, - val onErrorContainer: ColorProvider, - val background: ColorProvider, - val onBackground: ColorProvider, - val backgroundVariant: ColorProvider, - val onBackgroundVariant: ColorProvider, - val surface: ColorProvider, - val onSurface: ColorProvider, - val surfaceVariant: ColorProvider, - val onSurfaceVariant: ColorProvider, - val icon: ColorProvider, - val line: ColorProvider, -) - -fun dynamicThemeColorProviders(): ColorProviders { - return ColorProviders( - primary = ColorProvider(PrimaryDefault), - onPrimary = ColorProvider(Gray1), - primaryContainer = ColorProvider(PrimaryLighten2), - onPrimaryContainer = ColorProvider(PrimaryDarken2), - error = ColorProvider(ErrorDefault), - onError = ColorProvider(Gray1), - errorContainer = ColorProvider(ErrorLighten2), - onErrorContainer = ColorProvider(ErrorDarken2), - background = ColorProvider(Gray2), - onBackground = ColorProvider(Gray10), - backgroundVariant = ColorProvider(Gray7), - onBackgroundVariant = ColorProvider(Gray3), - surface = ColorProvider(Gray1), - onSurface = ColorProvider(Gray9), - surfaceVariant = ColorProvider(Gray6), - onSurfaceVariant = ColorProvider(Gray5), - icon = ColorProvider(Gray5), - line = ColorProvider(Gray3), - ) -} - -internal val LocalColorProviders = staticCompositionLocalOf { dynamicThemeColorProviders() } diff --git a/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/DmsWidgetGlanceColorScheme.kt b/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/DmsWidgetGlanceColorScheme.kt new file mode 100644 index 000000000..ef0de1a00 --- /dev/null +++ b/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/DmsWidgetGlanceColorScheme.kt @@ -0,0 +1,68 @@ +package team.aliens.dms.android.core.widget.designsystem + +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.glance.material3.ColorProviders +import team.aliens.dms.android.core.designsystem.ErrorDarken2 +import team.aliens.dms.android.core.designsystem.ErrorDefault +import team.aliens.dms.android.core.designsystem.ErrorLighten1 +import team.aliens.dms.android.core.designsystem.ErrorLighten2 +import team.aliens.dms.android.core.designsystem.Gray1 +import team.aliens.dms.android.core.designsystem.Gray10 +import team.aliens.dms.android.core.designsystem.Gray2 +import team.aliens.dms.android.core.designsystem.Gray3 +import team.aliens.dms.android.core.designsystem.Gray4 +import team.aliens.dms.android.core.designsystem.Gray5 +import team.aliens.dms.android.core.designsystem.Gray6 +import team.aliens.dms.android.core.designsystem.Gray7 +import team.aliens.dms.android.core.designsystem.Gray8 +import team.aliens.dms.android.core.designsystem.Gray9 +import team.aliens.dms.android.core.designsystem.PrimaryDarken2 +import team.aliens.dms.android.core.designsystem.PrimaryDefault +import team.aliens.dms.android.core.designsystem.PrimaryLighten1 +import team.aliens.dms.android.core.designsystem.PrimaryLighten2 + +private val LightColorScheme = lightColorScheme( + primary = PrimaryDefault, + onPrimary = Gray1, + primaryContainer = PrimaryLighten2, + onPrimaryContainer = PrimaryDarken2, + error = ErrorDefault, + onError = Gray1, + errorContainer = ErrorLighten2, + onErrorContainer = ErrorDarken2, + background = Gray2, + onBackground = Gray10, + inverseSurface = Gray7, + inverseOnSurface = Gray3, + surface = Gray1, + onSurface = Gray9, + surfaceVariant = Gray6, + onSurfaceVariant = Gray5, +) + +private val DarkColorScheme = darkColorScheme( + primary = PrimaryDefault, + onPrimary = Gray1, + primaryContainer = PrimaryLighten1, + onPrimaryContainer = PrimaryDarken2, + error = ErrorDefault, + onError = Gray1, + errorContainer = ErrorLighten1, + onErrorContainer = ErrorDarken2, + background = Gray9, + onBackground = Gray1, + inverseSurface = Gray3, + inverseOnSurface = Gray7, + surface = Gray8, + onSurface = Gray2, + surfaceVariant = Gray4, + onSurfaceVariant = Gray5, +) + +object DmsWidgetGlanceColorScheme { + val colors = ColorProviders( + light = LightColorScheme, + dark = DarkColorScheme, + ) +} diff --git a/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/WidgetTheme.kt b/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/WidgetTheme.kt deleted file mode 100644 index 88c70d9ab..000000000 --- a/core/widget/src/main/java/team/aliens/dms/android/core/widget/designsystem/WidgetTheme.kt +++ /dev/null @@ -1,25 +0,0 @@ -package team.aliens.dms.android.core.widget.designsystem - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.ReadOnlyComposable - -object WidgetTheme { - val colors: ColorProviders - @Composable - @ReadOnlyComposable - get() = LocalColorProviders.current - -} - - -@Composable -fun WidgetTheme( - colors: ColorProviders = WidgetTheme.colors, - content: @Composable () -> Unit, -) { - CompositionLocalProvider(LocalColorProviders provides colors) { - content() - } -} - diff --git a/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealGlanceWidget.kt b/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealGlanceWidget.kt index ba30cbfb8..58473fffe 100644 --- a/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealGlanceWidget.kt +++ b/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealGlanceWidget.kt @@ -1,7 +1,10 @@ package team.aliens.dms.android.core.widget.meal +import android.app.PendingIntent import android.content.Context +import android.content.Intent import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.glance.GlanceId @@ -9,6 +12,8 @@ import androidx.glance.GlanceModifier import androidx.glance.GlanceTheme import androidx.glance.Image import androidx.glance.ImageProvider +import androidx.glance.LocalContext +import androidx.glance.action.clickable import androidx.glance.appwidget.GlanceAppWidget import androidx.glance.appwidget.lazy.LazyColumn import androidx.glance.appwidget.lazy.items @@ -29,8 +34,8 @@ import androidx.glance.state.GlanceStateDefinition import androidx.glance.text.FontWeight import androidx.glance.text.Text import androidx.glance.text.TextStyle -import team.aliens.dms.android.core.designsystem.DmsTheme -import team.aliens.dms.android.core.widget.designsystem.WidgetTheme +import team.aliens.dms.android.core.widget.R +import team.aliens.dms.android.core.widget.designsystem.DmsWidgetGlanceColorScheme class MealGlanceWidget : GlanceAppWidget() { @@ -39,51 +44,49 @@ class MealGlanceWidget : GlanceAppWidget() { override suspend fun provideGlance(context: Context, id: GlanceId) { provideContent { - MealWidget() + GlanceTheme(colors = DmsWidgetGlanceColorScheme.colors) { + MealWidget() + } } } @Composable internal fun MealWidget() { - val mealInfo = currentState() - - GlanceTheme { - when (mealInfo) { - MealInfo.Loading -> Loading() + when (val mealInfo = currentState()) { + MealInfo.Loading -> Loading() - is MealInfo.Unavailable -> Unavailable() + is MealInfo.Unavailable -> Unavailable() - is MealInfo.Available -> { - when (MealType.getCurrentMealType()) { - MealType.Breakfast -> { - MealBig( - mealState = MealState( - mealType = MealType.Breakfast, - meal = mealInfo.breakfast, - calories = mealInfo.kcalOfBreakfast, - ) - ) - } + is MealInfo.Available -> { + when (MealType.getCurrentMealType()) { + MealType.Breakfast -> { + MealBig( + mealState = MealState( + mealType = MealType.Breakfast, + meal = mealInfo.breakfast, + calories = mealInfo.kcalOfBreakfast, + ), + ) + } - MealType.Launch -> { - MealBig( - mealState = MealState( - mealType = MealType.Launch, - meal = mealInfo.lunch, - calories = mealInfo.kcalOfLunch, - ) - ) - } + MealType.Launch -> { + MealBig( + mealState = MealState( + mealType = MealType.Launch, + meal = mealInfo.lunch, + calories = mealInfo.kcalOfLunch, + ), + ) + } - MealType.Dinner -> { - MealBig( - mealState = MealState( - mealType = MealType.Dinner, - meal = mealInfo.dinner, - calories = mealInfo.kcalOfDinner, - ) - ) - } + MealType.Dinner -> { + MealBig( + mealState = MealState( + mealType = MealType.Dinner, + meal = mealInfo.dinner, + calories = mealInfo.kcalOfDinner, + ), + ) } } } @@ -92,19 +95,33 @@ class MealGlanceWidget : GlanceAppWidget() { @Composable private fun MealBig( - mealState: MealState + mealState: MealState, ) { + val context = LocalContext.current + val intent = Intent().setClassName( + context.packageName, + "team.aliens.dms.android.app.MainActivity", + ) + val pendingIntent = PendingIntent.getActivity( + context, + 0, + intent, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, + ) Row( modifier = GlanceModifier .fillMaxSize() + .clickable { + pendingIntent.send() + } .padding( horizontal = 18.dp, vertical = 16.dp, ) - .background(DmsTheme.colorScheme.background), + .background(GlanceTheme.colors.background), ) { Column( - modifier = GlanceModifier.fillMaxHeight() + modifier = GlanceModifier.fillMaxHeight(), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -117,20 +134,20 @@ class MealGlanceWidget : GlanceAppWidget() { Text( text = mealState.mealType.title, style = TextStyle( - color = WidgetTheme.colors.primary, + color = GlanceTheme.colors.primary, fontSize = 14.sp, fontWeight = FontWeight.Bold, - ) + ), ) } Spacer(GlanceModifier.defaultWeight()) Text( text = mealState.calories, style = TextStyle( - color = WidgetTheme.colors.onSurfaceVariant, + color = GlanceTheme.colors.onSurfaceVariant, fontSize = 12.sp, fontWeight = FontWeight.Normal, - ) + ), ) } LazyColumn( @@ -143,10 +160,10 @@ class MealGlanceWidget : GlanceAppWidget() { Text( text = it, style = TextStyle( - color = WidgetTheme.colors.surfaceVariant, + color = GlanceTheme.colors.surfaceVariant, fontSize = 12.sp, fontWeight = FontWeight.Normal, - ) + ), ) } } @@ -159,19 +176,18 @@ private fun Loading() { Box( modifier = GlanceModifier .fillMaxSize() - .background(DmsTheme.colorScheme.background), + .background(GlanceTheme.colors.background), contentAlignment = Alignment.Center, ) { Text( - text = "로딩중...", + text = stringResource(id = R.string.loading), style = TextStyle( - color = WidgetTheme.colors.primary, + color = GlanceTheme.colors.primary, fontSize = 14.sp, fontWeight = FontWeight.Bold, - ) + ), ) } - } @Composable @@ -179,16 +195,16 @@ private fun Unavailable() { Box( modifier = GlanceModifier .fillMaxSize() - .background(DmsTheme.colorScheme.background), + .background(GlanceTheme.colors.background), contentAlignment = Alignment.Center, ) { Text( - text = "급식을 불러오지 못했어요", + text = stringResource(id = R.string.can_not_bring_meal_info), style = TextStyle( - color = WidgetTheme.colors.primary, + color = GlanceTheme.colors.primary, fontSize = 14.sp, fontWeight = FontWeight.Bold, - ) + ), ) } } diff --git a/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealInfoStateDefinition.kt b/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealInfoStateDefinition.kt index a086aada2..969e331b5 100644 --- a/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealInfoStateDefinition.kt +++ b/core/widget/src/main/java/team/aliens/dms/android/core/widget/meal/MealInfoStateDefinition.kt @@ -34,7 +34,7 @@ object MealInfoStateDefinition : GlanceStateDefinition { override suspend fun readFrom(input: InputStream): MealInfo = try { Json.decodeFromString( MealInfo.serializer(), - input.readBytes().decodeToString() + input.readBytes().decodeToString(), ) } catch (exception: SerializationException) { throw CorruptionException("Could not read meal data: ${exception.message}") @@ -43,7 +43,7 @@ object MealInfoStateDefinition : GlanceStateDefinition { override suspend fun writeTo(t: MealInfo, output: OutputStream) { output.use { it.write( - Json.encodeToString(MealInfo.serializer(), t).encodeToByteArray() + Json.encodeToString(MealInfo.serializer(), t).encodeToByteArray(), ) } } diff --git a/core/widget/src/main/res/drawable-night/shape_widget_small.xml b/core/widget/src/main/res/drawable-night/shape_widget_small.xml new file mode 100644 index 000000000..68074280b --- /dev/null +++ b/core/widget/src/main/res/drawable-night/shape_widget_small.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/core/widget/src/main/res/drawable-night/widget_big_meal.xml b/core/widget/src/main/res/drawable-night/widget_big_meal.xml new file mode 100644 index 000000000..fe3681833 --- /dev/null +++ b/core/widget/src/main/res/drawable-night/widget_big_meal.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/core/widget/src/main/res/drawable/widget_big_meal.xml b/core/widget/src/main/res/drawable/widget_big_meal.xml index c18533ecd..732c66768 100644 --- a/core/widget/src/main/res/drawable/widget_big_meal.xml +++ b/core/widget/src/main/res/drawable/widget_big_meal.xml @@ -1,21 +1,21 @@ + android:width="288dp" + android:height="111dp" + android:viewportWidth="288" + android:viewportHeight="111"> diff --git a/core/widget/src/main/res/values/string.xml b/core/widget/src/main/res/values/string.xml index d7c4818cc..741060371 100644 --- a/core/widget/src/main/res/values/string.xml +++ b/core/widget/src/main/res/values/string.xml @@ -2,4 +2,7 @@ 급식 메뉴 오늘 급식을 빠르게 확인해보세요 + + "급식을 불러오지 못했어요" + 로딩중... \ No newline at end of file diff --git a/core/widget/src/test/java/team/aliens/dms/android/core/widget/ExampleUnitTest.kt b/core/widget/src/test/java/team/aliens/dms/android/core/widget/ExampleUnitTest.kt index 17dd4c952..91e1ffdcd 100644 --- a/core/widget/src/test/java/team/aliens/dms/android/core/widget/ExampleUnitTest.kt +++ b/core/widget/src/test/java/team/aliens/dms/android/core/widget/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.core.widget +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/data/build.gradle.kts b/data/build.gradle.kts index c8595d9e3..753f15148 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/data/src/main/java/team/aliens/dms/android/data/auth/mapper/AuthMapper.kt b/data/src/main/java/team/aliens/dms/android/data/auth/mapper/AuthMapper.kt index 0bc0100c2..07fd3f585 100644 --- a/data/src/main/java/team/aliens/dms/android/data/auth/mapper/AuthMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/auth/mapper/AuthMapper.kt @@ -7,7 +7,7 @@ import team.aliens.dms.android.core.school.Features import team.aliens.dms.android.network.auth.model.SignInResponse import team.aliens.dms.android.shared.date.toLocalDateTime -fun SignInResponse.extractTokens(): Tokens = Tokens( +internal fun SignInResponse.extractTokens(): Tokens = Tokens( accessToken = AccessToken( value = this.accessToken, expiration = this.accessTokenExpiration.toLocalDateTime(), @@ -18,7 +18,7 @@ fun SignInResponse.extractTokens(): Tokens = Tokens( ), ) -fun SignInResponse.extractFeatures(): Features = Features( +internal fun SignInResponse.extractFeatures(): Features = Features( mealService = this.features.mealService, noticeService = this.features.noticeService, pointService = this.features.pointService, diff --git a/data/src/main/java/team/aliens/dms/android/data/auth/model/EmailVerificationType.kt b/data/src/main/java/team/aliens/dms/android/data/auth/model/EmailVerificationType.kt index 26531f4a6..fcd5b758d 100644 --- a/data/src/main/java/team/aliens/dms/android/data/auth/model/EmailVerificationType.kt +++ b/data/src/main/java/team/aliens/dms/android/data/auth/model/EmailVerificationType.kt @@ -3,4 +3,4 @@ package team.aliens.dms.android.data.auth.model enum class EmailVerificationType { SIGNUP, PASSWORD, ; -} \ No newline at end of file +} diff --git a/data/src/main/java/team/aliens/dms/android/data/auth/repository/AuthRepositoryImpl.kt b/data/src/main/java/team/aliens/dms/android/data/auth/repository/AuthRepositoryImpl.kt index 9be53958e..5d21cb328 100644 --- a/data/src/main/java/team/aliens/dms/android/data/auth/repository/AuthRepositoryImpl.kt +++ b/data/src/main/java/team/aliens/dms/android/data/auth/repository/AuthRepositoryImpl.kt @@ -83,4 +83,4 @@ internal class AuthRepositoryImpl @Inject constructor( jwtProvider.clearCaches() schoolProvider.clearCaches() } -} \ No newline at end of file +} diff --git a/data/src/main/java/team/aliens/dms/android/data/file/mapper/FileMapper.kt b/data/src/main/java/team/aliens/dms/android/data/file/mapper/FileMapper.kt index 0d38713cb..75107c713 100644 --- a/data/src/main/java/team/aliens/dms/android/data/file/mapper/FileMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/file/mapper/FileMapper.kt @@ -3,7 +3,7 @@ package team.aliens.dms.android.data.file.mapper import team.aliens.dms.android.data.file.model.PresignedFileUrl import team.aliens.dms.android.network.file.model.FetchPresignedUrlResponse -internal fun FetchPresignedUrlResponse.toModel() : PresignedFileUrl = PresignedFileUrl( +internal fun FetchPresignedUrlResponse.toModel(): PresignedFileUrl = PresignedFileUrl( fileUploadUrl = this.fileUploadUrl, fileUrl = this.fileUrl, -) \ No newline at end of file +) diff --git a/data/src/main/java/team/aliens/dms/android/data/file/repository/FileRepositoryImpl.kt b/data/src/main/java/team/aliens/dms/android/data/file/repository/FileRepositoryImpl.kt index 7aa8d8f17..6a6e5c213 100644 --- a/data/src/main/java/team/aliens/dms/android/data/file/repository/FileRepositoryImpl.kt +++ b/data/src/main/java/team/aliens/dms/android/data/file/repository/FileRepositoryImpl.kt @@ -1,7 +1,6 @@ package team.aliens.dms.android.data.file.repository import team.aliens.dms.android.data.file.mapper.toModel -import team.aliens.dms.android.data.file.model.FileUrl import team.aliens.dms.android.data.file.model.PresignedFileUrl import team.aliens.dms.android.network.file.datasource.NetworkFileDataSource import java.io.File diff --git a/data/src/main/java/team/aliens/dms/android/data/meal/mapper/MealMapper.kt b/data/src/main/java/team/aliens/dms/android/data/meal/mapper/MealMapper.kt index 58befc4bb..4d8e921e2 100644 --- a/data/src/main/java/team/aliens/dms/android/data/meal/mapper/MealMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/meal/mapper/MealMapper.kt @@ -17,7 +17,7 @@ internal fun MealEntity.toModel() = Meal( internal fun List.toEntity() = this.map(Meal::toEntity) -internal fun Meal.toEntity() = MealEntity( +private fun Meal.toEntity() = MealEntity( date = this.date, breakfast = this.breakfast, kcalOfBreakfast = this.kcalOfBreakfast, @@ -29,10 +29,10 @@ internal fun Meal.toEntity() = MealEntity( internal fun FetchMealsResponse.toModel(): List = this.meals.toModel() -internal fun List.toModel(): List = +private fun List.toModel(): List = this.map(FetchMealsResponse.MealResponse::toModel) -internal fun FetchMealsResponse.MealResponse.toModel(): Meal = Meal( +private fun FetchMealsResponse.MealResponse.toModel(): Meal = Meal( date = this.date.toLocalDate(), breakfast = this.breakfast.dropLast(1), kcalOfBreakfast = this.breakfast.last(), diff --git a/data/src/main/java/team/aliens/dms/android/data/notice/mapper/NoticeMapper.kt b/data/src/main/java/team/aliens/dms/android/data/notice/mapper/NoticeMapper.kt index 2c4c29b46..6b13be2aa 100644 --- a/data/src/main/java/team/aliens/dms/android/data/notice/mapper/NoticeMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/notice/mapper/NoticeMapper.kt @@ -8,26 +8,17 @@ import team.aliens.dms.android.shared.date.toLocalDateTime internal fun List.toModel() = this.map(NoticeEntity::toModel) -internal fun Notice.toEntity() = NoticeEntity( +private fun NoticeEntity.toModel() = Notice( id = this.id, title = this.title, content = this.content, createdAt = this.createdAt, ) -internal fun NoticeEntity.toModel() = Notice( - id = this.id, - title = this.title, - content = this.content, - createdAt = this.createdAt, -) - -internal fun List.toEntity() = this.map(Notice::toEntity) - internal fun FetchNoticesResponse.toModel(): List = this.notices.map(FetchNoticesResponse.NoticeResponse::toModel) -internal fun FetchNoticesResponse.NoticeResponse.toModel(): Notice = Notice( +private fun FetchNoticesResponse.NoticeResponse.toModel(): Notice = Notice( id = this.id, title = this.title, content = null, diff --git a/data/src/main/java/team/aliens/dms/android/data/notification/repository/NotificationRepositoryImpl.kt b/data/src/main/java/team/aliens/dms/android/data/notification/repository/NotificationRepositoryImpl.kt index ada3b0bed..85daf3fd4 100644 --- a/data/src/main/java/team/aliens/dms/android/data/notification/repository/NotificationRepositoryImpl.kt +++ b/data/src/main/java/team/aliens/dms/android/data/notification/repository/NotificationRepositoryImpl.kt @@ -31,7 +31,7 @@ internal class NotificationRepositoryImpl @Inject constructor( request = SubscribeNotificationTopicRequest( deviceToken = deviceToken, topic = topic.name, - ) + ), ) override suspend fun unsubscribeNotificationTopic( @@ -41,15 +41,15 @@ internal class NotificationRepositoryImpl @Inject constructor( request = UnsubscribeNotificationTopicRequest( deviceToken = deviceToken, topic = topic.name, - ) + ), ) override suspend fun batchUpdateNotificationTopic( subscriptions: List, ) = networkNotificationDataSource.batchUpdateNotificationTopic( request = BatchUpdateNotificationTopicRequest( - topics = subscriptions.toModel() - ) + topics = subscriptions.toModel(), + ), ) override suspend fun fetchNotificationStatus(deviceToken: String): List = diff --git a/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepository.kt b/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepository.kt index a3b910829..c043d0562 100644 --- a/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepository.kt +++ b/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepository.kt @@ -2,7 +2,6 @@ package team.aliens.dms.android.data.outing.repository import org.threeten.bp.DayOfWeek import org.threeten.bp.LocalDate -import org.threeten.bp.LocalDateTime import org.threeten.bp.LocalTime import team.aliens.dms.android.data.outing.model.CurrentAppliedOutingApplication import team.aliens.dms.android.data.outing.model.OutingApplicationId diff --git a/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepositoryImpl.kt b/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepositoryImpl.kt index a82293bf4..76996a226 100644 --- a/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepositoryImpl.kt +++ b/data/src/main/java/team/aliens/dms/android/data/outing/repository/OutingRepositoryImpl.kt @@ -25,7 +25,7 @@ class OutingRepositoryImpl @Inject constructor( endTime: LocalTime, type: String, reason: String?, - companionIds: List + companionIds: List, ): OutingApplicationId = outingNetworkDataSource.applyOuting( req = ApplyOutingRequest( date = date.format(DateTimeFormatter.ISO_LOCAL_DATE), diff --git a/data/src/main/java/team/aliens/dms/android/data/point/mapper/PointMapper.kt b/data/src/main/java/team/aliens/dms/android/data/point/mapper/PointMapper.kt index d80c6e40e..9867e20cd 100644 --- a/data/src/main/java/team/aliens/dms/android/data/point/mapper/PointMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/point/mapper/PointMapper.kt @@ -11,10 +11,10 @@ internal fun FetchPointsResponse.toModel(): PointStatus = PointStatus( points = this.pointResponses.toModel(), ) -internal fun List.toModel(): List = +private fun List.toModel(): List = this.map(FetchPointsResponse.PointResponse::toModel) -internal fun FetchPointsResponse.PointResponse.toModel(): Point = Point( +private fun FetchPointsResponse.PointResponse.toModel(): Point = Point( id = this.id, date = this.date.toLocalDate(), type = PointType.valueOf(this.type), diff --git a/data/src/main/java/team/aliens/dms/android/data/remains/mapper/RemainsMapper.kt b/data/src/main/java/team/aliens/dms/android/data/remains/mapper/RemainsMapper.kt index f815ebc06..f1366055d 100644 --- a/data/src/main/java/team/aliens/dms/android/data/remains/mapper/RemainsMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/remains/mapper/RemainsMapper.kt @@ -24,7 +24,7 @@ internal fun FetchRemainsApplicationTimeResponse.toModel(): RemainsApplicationTi internal fun FetchRemainsOptionsResponse.toModel(): List = this.remainsOptionResponse.map(FetchRemainsOptionsResponse.RemainsOptionResponse::toModel) -internal fun FetchRemainsOptionsResponse.RemainsOptionResponse.toModel(): RemainsOption = +private fun FetchRemainsOptionsResponse.RemainsOptionResponse.toModel(): RemainsOption = RemainsOption( id = this.id, title = this.title, diff --git a/data/src/main/java/team/aliens/dms/android/data/school/mapper/SchoolMapper.kt b/data/src/main/java/team/aliens/dms/android/data/school/mapper/SchoolMapper.kt index 78708c6af..575a924f3 100644 --- a/data/src/main/java/team/aliens/dms/android/data/school/mapper/SchoolMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/school/mapper/SchoolMapper.kt @@ -3,7 +3,7 @@ package team.aliens.dms.android.data.school.mapper import team.aliens.dms.android.data.school.model.School import team.aliens.dms.android.network.school.model.FetchSchoolsResponse -fun FetchSchoolsResponse.toModel(): List = +internal fun FetchSchoolsResponse.toModel(): List = this.schools.map(FetchSchoolsResponse.SchoolResponse::toModel) private fun FetchSchoolsResponse.SchoolResponse.toModel(): School = School( diff --git a/data/src/main/java/team/aliens/dms/android/data/student/mapper/StudentMapper.kt b/data/src/main/java/team/aliens/dms/android/data/student/mapper/StudentMapper.kt index 5794ca99f..09a82e8dc 100644 --- a/data/src/main/java/team/aliens/dms/android/data/student/mapper/StudentMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/student/mapper/StudentMapper.kt @@ -4,7 +4,7 @@ import team.aliens.dms.android.data.student.model.MyPage import team.aliens.dms.android.network.student.model.FetchMyPageResponse import team.aliens.dms.android.shared.model.Sex -fun FetchMyPageResponse.toModel(): MyPage = MyPage( +internal fun FetchMyPageResponse.toModel(): MyPage = MyPage( schoolName = this.schoolName, studentName = this.studentName, gradeClassNumber = this.gradeClassNumber, diff --git a/data/src/main/java/team/aliens/dms/android/data/student/model/MyPage.kt b/data/src/main/java/team/aliens/dms/android/data/student/model/MyPage.kt index e6e47fedb..2464f4a1d 100644 --- a/data/src/main/java/team/aliens/dms/android/data/student/model/MyPage.kt +++ b/data/src/main/java/team/aliens/dms/android/data/student/model/MyPage.kt @@ -2,7 +2,7 @@ package team.aliens.dms.android.data.student.model import team.aliens.dms.android.shared.model.Sex -data class MyPage ( +data class MyPage( val schoolName: String, val studentName: String, val gradeClassNumber: String, diff --git a/data/src/main/java/team/aliens/dms/android/data/student/repository/StudentRepositoryImpl.kt b/data/src/main/java/team/aliens/dms/android/data/student/repository/StudentRepositoryImpl.kt index f3dc5ef39..a0f23c27c 100644 --- a/data/src/main/java/team/aliens/dms/android/data/student/repository/StudentRepositoryImpl.kt +++ b/data/src/main/java/team/aliens/dms/android/data/student/repository/StudentRepositoryImpl.kt @@ -1,6 +1,5 @@ package team.aliens.dms.android.data.student.repository -import android.util.Log import team.aliens.dms.android.core.jwt.JwtProvider import team.aliens.dms.android.core.school.SchoolProvider import team.aliens.dms.android.data.student.mapper.toModel @@ -37,8 +36,6 @@ internal class StudentRepositoryImpl @Inject constructor( password: String, profileImageUrl: String?, ) { - Log.d("TEST1",profileImageUrl.toString()) - Log.d("TEST1",password) val response: SignUpResponse = networkStudentDataSource.signUp( request = SignUpRequest( schoolVerificationCode = schoolVerificationCode, diff --git a/data/src/main/java/team/aliens/dms/android/data/studyroom/mapper/StudyRoomMapper.kt b/data/src/main/java/team/aliens/dms/android/data/studyroom/mapper/StudyRoomMapper.kt index c26c8af92..e608dfec6 100644 --- a/data/src/main/java/team/aliens/dms/android/data/studyroom/mapper/StudyRoomMapper.kt +++ b/data/src/main/java/team/aliens/dms/android/data/studyroom/mapper/StudyRoomMapper.kt @@ -12,16 +12,16 @@ import team.aliens.dms.android.network.studyroom.model.FetchStudyRoomDetailsResp import team.aliens.dms.android.network.studyroom.model.FetchStudyRoomsResponse import team.aliens.dms.android.shared.model.Sex -fun FetchStudyRoomApplicationTimeResponse.toModel(): StudyRoomApplicationTime = +internal fun FetchStudyRoomApplicationTimeResponse.toModel(): StudyRoomApplicationTime = StudyRoomApplicationTime( startAt = this.startAt, endAt = this.endAt, ) -fun FetchStudyRoomsResponse.toModel(): List = +internal fun FetchStudyRoomsResponse.toModel(): List = this.studyRoomResponses.map(FetchStudyRoomsResponse.StudyRoomResponse::toModel) -fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom( +private fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom( id = this.id, floor = this.floor, name = this.name, @@ -32,7 +32,7 @@ fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom( isMine = this.isMine, ) -fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Details( +internal fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Details( id = id, floor = floor, name = name, @@ -51,10 +51,10 @@ fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Detai seats = seats.toModel(), ) -fun List.toModel(): List = +private fun List.toModel(): List = this.map(FetchStudyRoomDetailsResponse.SeatResponse::toModel) -fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = StudyRoom.Seat( +private fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = StudyRoom.Seat( id = this.id, row = this.row, column = this.column, @@ -65,37 +65,37 @@ fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = Study student = this.student?.toModel(), ) -fun FetchStudyRoomDetailsResponse.SeatResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = +private fun FetchStudyRoomDetailsResponse.SeatResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = StudyRoom.Seat.Type( id = this.id, name = this.name, color = this.color, ) -fun FetchStudyRoomDetailsResponse.SeatResponse.StudentResponse.toModel(): StudyRoom.Seat.Student = +private fun FetchStudyRoomDetailsResponse.SeatResponse.StudentResponse.toModel(): StudyRoom.Seat.Student = StudyRoom.Seat.Student( id = this.id, name = this.name, ) -fun FetchAppliedStudyRoomResponse.toModel(): AppliedStudyRoom = AppliedStudyRoom( +internal fun FetchAppliedStudyRoomResponse.toModel(): AppliedStudyRoom = AppliedStudyRoom( floor = this.floor, name = this.name, ) -fun FetchSeatTypesResponse.toModel(): List = +internal fun FetchSeatTypesResponse.toModel(): List = this.types.map(FetchSeatTypesResponse.SeatTypeResponse::toModel) -fun FetchSeatTypesResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = StudyRoom.Seat.Type( +private fun FetchSeatTypesResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = StudyRoom.Seat.Type( id = this.id, name = this.name, color = this.color, ) -fun FetchAvailableStudyRoomTimesResponse.toModel(): List = +internal fun FetchAvailableStudyRoomTimesResponse.toModel(): List = this.availableStudyRoomTimes.map(FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse::toModel) -fun FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse.toModel(): AvailableStudyRoomTime = +private fun FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse.toModel(): AvailableStudyRoomTime = AvailableStudyRoomTime( id = this.id, startTime = this.startTime, diff --git a/data/src/main/java/team/aliens/dms/android/data/studyroom/repository/StudyRoomRepository.kt b/data/src/main/java/team/aliens/dms/android/data/studyroom/repository/StudyRoomRepository.kt index ce4950ebd..033f2c77f 100644 --- a/data/src/main/java/team/aliens/dms/android/data/studyroom/repository/StudyRoomRepository.kt +++ b/data/src/main/java/team/aliens/dms/android/data/studyroom/repository/StudyRoomRepository.kt @@ -1,9 +1,9 @@ package team.aliens.dms.android.data.studyroom.repository import team.aliens.dms.android.data.studyroom.model.AppliedStudyRoom +import team.aliens.dms.android.data.studyroom.model.AvailableStudyRoomTime import team.aliens.dms.android.data.studyroom.model.StudyRoom import team.aliens.dms.android.data.studyroom.model.StudyRoomApplicationTime -import team.aliens.dms.android.data.studyroom.model.AvailableStudyRoomTime import java.util.UUID abstract class StudyRoomRepository { diff --git a/database/build.gradle.kts b/database/build.gradle.kts index e0da82530..c8f145d53 100644 --- a/database/build.gradle.kts +++ b/database/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/database/src/main/java/team/aliens/dms/android/database/meal/datasource/DatabaseMealDataSourceImpl.kt b/database/src/main/java/team/aliens/dms/android/database/meal/datasource/DatabaseMealDataSourceImpl.kt index ba4fed51b..20c027c92 100644 --- a/database/src/main/java/team/aliens/dms/android/database/meal/datasource/DatabaseMealDataSourceImpl.kt +++ b/database/src/main/java/team/aliens/dms/android/database/meal/datasource/DatabaseMealDataSourceImpl.kt @@ -19,4 +19,4 @@ internal class DatabaseMealDataSourceImpl @Inject constructor( override suspend fun saveMeals(meals: List) { mealDao.saveAll(meals) } -} \ No newline at end of file +} diff --git a/database/src/main/java/team/aliens/dms/android/database/notice/datasource/DatabaseNoticeDataSourceImpl.kt b/database/src/main/java/team/aliens/dms/android/database/notice/datasource/DatabaseNoticeDataSourceImpl.kt index 7059cbd29..d729cd526 100644 --- a/database/src/main/java/team/aliens/dms/android/database/notice/datasource/DatabaseNoticeDataSourceImpl.kt +++ b/database/src/main/java/team/aliens/dms/android/database/notice/datasource/DatabaseNoticeDataSourceImpl.kt @@ -23,4 +23,4 @@ class DatabaseNoticeDataSourceImpl @Inject constructor( override fun saveNotices(notices: List) { noticeDao.saveAll(notices) } -} \ No newline at end of file +} diff --git a/database/src/test/java/team/aliens/dms/android/database/ExampleUnitTest.kt b/database/src/test/java/team/aliens/dms/android/database/ExampleUnitTest.kt index 53107f3c9..86761c72d 100644 --- a/database/src/test/java/team/aliens/dms/android/database/ExampleUnitTest.kt +++ b/database/src/test/java/team/aliens/dms/android/database/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.database +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/database/src/test/java/team/aliens/dms/android/database/meal/DatabaseMealDataSourceTest.kt b/database/src/test/java/team/aliens/dms/android/database/meal/DatabaseMealDataSourceTest.kt index 1aae4a1a7..9475941d3 100644 --- a/database/src/test/java/team/aliens/dms/android/database/meal/DatabaseMealDataSourceTest.kt +++ b/database/src/test/java/team/aliens/dms/android/database/meal/DatabaseMealDataSourceTest.kt @@ -1,10 +1,6 @@ package team.aliens.dms.android.database.meal -import dagger.hilt.android.testing.HiltAndroidRule import dagger.hilt.android.testing.HiltAndroidTest -import org.junit.Before -import org.junit.Rule -import org.junit.runner.RunWith @HiltAndroidTest class DatabaseMealDataSourceTest { diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 85a230cbe..e3c54ac40 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/feature/src/main/java/team/aliens/dms/android/feature/editpassword/1_ConfirmPasswordScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/editpassword/ConfirmPasswordScreen.kt similarity index 98% rename from feature/src/main/java/team/aliens/dms/android/feature/editpassword/1_ConfirmPasswordScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/editpassword/ConfirmPasswordScreen.kt index 6e7f2a738..9c7830dc2 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/editpassword/1_ConfirmPasswordScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/editpassword/ConfirmPasswordScreen.kt @@ -20,9 +20,9 @@ import androidx.compose.ui.res.stringResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.ContainedButton -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.ui.Banner import team.aliens.dms.android.core.ui.BannerDefaults import team.aliens.dms.android.core.ui.bottomPadding @@ -58,7 +58,7 @@ internal fun ConfirmPasswordScreen( message = context.getString(R.string.edit_password_error_password_mismatch), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -106,7 +106,7 @@ internal fun ConfirmPasswordScreen( }, passwordShowing = showPassword, onPasswordShowingChange = onShowPasswordChange, - hintText = stringResource(id = R.string.edit_password_please_enter_current_password) + hintText = stringResource(id = R.string.edit_password_please_enter_current_password), ) Spacer(modifier = Modifier.weight(3f)) ContainedButton( diff --git a/feature/src/main/java/team/aliens/dms/android/feature/editpassword/2_SetPasswordScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/editpassword/SetPasswordScreen.kt similarity index 97% rename from feature/src/main/java/team/aliens/dms/android/feature/editpassword/2_SetPasswordScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/editpassword/SetPasswordScreen.kt index c3a52d40d..e0d6c679b 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/editpassword/2_SetPasswordScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/editpassword/SetPasswordScreen.kt @@ -25,10 +25,10 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.AlertDialog import team.aliens.dms.android.core.designsystem.ContainedButton -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.TextButton import team.aliens.dms.android.core.ui.Banner import team.aliens.dms.android.core.ui.BannerDefaults @@ -103,7 +103,7 @@ internal fun EditPasswordSetPasswordScreen( message = context.getString(R.string.edit_password_error_password_edit_failure), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -160,7 +160,9 @@ internal fun EditPasswordSetPasswordScreen( isError = isPasswordFormatError, supportingText = if (isPasswordFormatError) { { Text(text = stringResource(id = R.string.edit_password_error_password_format_invalid)) } - } else null, + } else { + null + }, ) PasswordTextField( modifier = Modifier @@ -174,7 +176,9 @@ internal fun EditPasswordSetPasswordScreen( isError = isPasswordFormatError, supportingText = if (isPasswordFormatError) { { Text(text = stringResource(id = R.string.edit_password_error_password_format_invalid)) } - } else null, + } else { + null + }, ) Text( modifier = Modifier.fillMaxWidth(), diff --git a/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageScreen.kt index cbc3fc323..46681803e 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageScreen.kt @@ -64,23 +64,23 @@ internal fun EditProfileImageScreen( EditProfileImageIntent.UpdateProfileImage( uri = imageUrl, context = context, - ) + ), ) - } + }, ) viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { EditProfileImageSideEffect.ProfileImageSet -> toast.showSuccessToast( message = context.getString( - R.string.edit_profile_success - ) + R.string.edit_profile_success, + ), ) EditProfileImageSideEffect.ProfileImageBadRequest -> toast.showErrorToast( message = context.getString( - R.string.edit_profile_fail - ) + R.string.edit_profile_fail, + ), ) } } @@ -96,9 +96,9 @@ internal fun EditProfileImageScreen( contentDescription = stringResource(id = R.string.top_bar_back_button), ) } - } + }, ) - } + }, ) { paddingValues -> Column( modifier = Modifier @@ -114,7 +114,7 @@ internal fun EditProfileImageScreen( val mediaType = ActivityResultContracts.PickVisualMedia.ImageOnly val request = PickVisualMediaRequest(mediaType) activityResultLauncher.launch(request) - } + }, ) Spacer(modifier = Modifier.weight(1f)) ContainedButton( @@ -124,7 +124,7 @@ internal fun EditProfileImageScreen( .bottomPadding(), onClick = { viewModel.postIntent( - EditProfileImageIntent.EditProfile + EditProfileImageIntent.EditProfile, ) }, enabled = uiState.buttonEnabled, @@ -141,14 +141,14 @@ private fun SetImage( onChangeImage: () -> Unit, ) { Box( - contentAlignment = Alignment.BottomEnd + contentAlignment = Alignment.BottomEnd, ) { AsyncImage( modifier = Modifier .size(150.dp) .clip(CircleShape) .clickable( - onClick = onChangeImage + onClick = onChangeImage, ), contentScale = ContentScale.Crop, model = uiState.uri ?: DmsIcon.ProfileDefault, diff --git a/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageViewModel.kt index 46d4a4cb1..28fb94e2c 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/editprofile/EditProfileImageViewModel.kt @@ -43,7 +43,7 @@ internal class EditProfileImageViewModel @Inject constructor( file = team.aliens.dms.android.core.file.File.toFile( context = context, uri = uri, - ) + ), ) } else { postSideEffect(EditProfileImageSideEffect.ProfileImageBadRequest) @@ -67,7 +67,7 @@ internal class EditProfileImageViewModel @Inject constructor( newState = stateFlow.value.copy( profileImageUrl = fileUrl.fileUrl, buttonEnabled = true, - ) + ), ) } }.onFailure { @@ -86,7 +86,6 @@ internal class EditProfileImageViewModel @Inject constructor( postSideEffect(EditProfileImageSideEffect.ProfileImageBadRequest) } } - } data class EditProfileImageUiState( diff --git a/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdScreen.kt index c34ec514d..74d7f72f5 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdScreen.kt @@ -74,7 +74,7 @@ internal fun FindIdScreen( text = String.format( stringResource(id = R.string.find_id_send_id_to_email), uiState.email, - ) + ), ) }, onDismissRequest = { /* explicit blank */ }, @@ -115,7 +115,7 @@ internal fun FindIdScreen( } }, ) - } + }, ) { paddingValues -> Column( modifier = Modifier @@ -130,7 +130,7 @@ internal fun FindIdScreen( .topPadding(BannerDefaults.DefaultTopSpace), message = { Text(text = stringResource(id = R.string.find_id)) - } + }, ) Spacer(modifier = Modifier.weight(1f)) UserInformationInputs( @@ -161,12 +161,12 @@ private fun UserInformationInputs( var isDropdownMenuExpanded by remember { mutableStateOf(false) } Column( - verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace) + verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace), ) { Box { TextField( modifier = Modifier.clickable( - onClick = { isDropdownMenuExpanded = !isDropdownMenuExpanded } + onClick = { isDropdownMenuExpanded = !isDropdownMenuExpanded }, ), value = state.selectedSchool?.name ?: "", onValueChange = { }, @@ -180,12 +180,12 @@ private fun UserInformationInputs( DmsIcon.Down } else { DmsIcon.Up - } + }, ), contentDescription = stringResource(id = R.string.find_id_show_menu), ) } - } + }, ) DropdownMenu( modifier = Modifier @@ -198,7 +198,7 @@ private fun UserInformationInputs( text = { Text(text = school.name) }, onClick = { viewModel.postIntent( - FindIdIntent.UpdateSchoolId(value = school) + FindIdIntent.UpdateSchoolId(value = school), ) isDropdownMenuExpanded = false }, @@ -212,10 +212,10 @@ private fun UserInformationInputs( onValueChange = { name -> viewModel.postIntent(FindIdIntent.UpdateName(name)) }, - hint = { Text(text = stringResource(id = R.string.find_id_name)) } + hint = { Text(text = stringResource(id = R.string.find_id_name)) }, ) Row( - horizontalArrangement = Arrangement.spacedBy(DefaultHorizontalSpace) + horizontalArrangement = Arrangement.spacedBy(DefaultHorizontalSpace), ) { TextField( modifier = Modifier diff --git a/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdViewModel.kt index e83492ca7..e61cbc15a 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/findid/FindIdViewModel.kt @@ -1,6 +1,5 @@ package team.aliens.dms.android.feature.findid - import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers @@ -29,7 +28,7 @@ internal class FindIdViewModel @Inject constructor( override fun processIntent(intent: FindIdIntent) { when (intent) { is FindIdIntent.UpdateSchoolId -> this.updateSchoolId( - selectedSchool = intent.value + selectedSchool = intent.value, ) is FindIdIntent.UpdateName -> this.updateName(name = intent.value) @@ -42,23 +41,23 @@ internal class FindIdViewModel @Inject constructor( } private fun updateSchoolId(selectedSchool: School): Boolean = reduce( - newState = stateFlow.value.copy(selectedSchool = selectedSchool) + newState = stateFlow.value.copy(selectedSchool = selectedSchool), ).also { updateButtonEnable(checkInAvailable()) } private fun updateName(name: String): Boolean = reduce( - newState = stateFlow.value.copy(name = name) + newState = stateFlow.value.copy(name = name), ).also { updateButtonEnable(checkInAvailable()) } private fun updateGrade(grade: String): Boolean = reduce( - newState = stateFlow.value.copy(grade = grade) + newState = stateFlow.value.copy(grade = grade), ).also { updateButtonEnable(checkInAvailable()) } private fun updateClassRoom(classRoom: String): Boolean = reduce( - newState = stateFlow.value.copy(classRoom = classRoom) + newState = stateFlow.value.copy(classRoom = classRoom), ).also { updateButtonEnable(checkInAvailable()) } private fun updateNumber(number: String): Boolean = reduce( - newState = stateFlow.value.copy(number = number) + newState = stateFlow.value.copy(number = number), ).also { updateButtonEnable(checkInAvailable()) } private fun updateButtonEnable(buttonEnabled: Boolean): Boolean = @@ -114,7 +113,6 @@ internal class FindIdViewModel @Inject constructor( } } - internal data class FindIdUiState( val schoolList: List?, val email: String, @@ -123,7 +121,7 @@ internal data class FindIdUiState( val grade: String, val classRoom: String, val number: String, - val buttonEnabled: Boolean + val buttonEnabled: Boolean, ) : UiState() { companion object { fun initial() = FindIdUiState( diff --git a/feature/src/main/java/team/aliens/dms/android/feature/main/announcement/AnnouncementListScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/main/announcement/AnnouncementListScreen.kt index ca1d4eaea..becee2279 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/main/announcement/AnnouncementListScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/main/announcement/AnnouncementListScreen.kt @@ -23,11 +23,10 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import org.threeten.bp.LocalDateTime import team.aliens.dms.android.core.designsystem.ButtonDefaults -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.OutlinedButton -import team.aliens.dms.android.core.designsystem.ShadowDefaults +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.clickable import team.aliens.dms.android.core.designsystem.shadow import team.aliens.dms.android.core.ui.DefaultVerticalSpace diff --git a/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationScreen.kt index d3b27c40a..22b72beaf 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationScreen.kt @@ -18,23 +18,19 @@ import androidx.compose.material3.CardDefaults import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.res.stringResource import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.lifecycle.withResumed import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.ContainedButton import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.RoundedButton import team.aliens.dms.android.core.designsystem.Scaffold -import team.aliens.dms.android.core.designsystem.ShadowDefaults import team.aliens.dms.android.core.designsystem.shadow import team.aliens.dms.android.core.ui.DefaultVerticalSpace import team.aliens.dms.android.core.ui.PaddingDefaults @@ -43,7 +39,6 @@ import team.aliens.dms.android.core.ui.horizontalPadding import team.aliens.dms.android.core.ui.topPadding import team.aliens.dms.android.core.ui.verticalPadding import team.aliens.dms.android.feature.R -import team.aliens.dms.android.shared.date.util.today @OptIn(ExperimentalMaterial3Api::class) @Destination @@ -148,7 +143,7 @@ private fun ApplicationCard( enter = slideInVertically() + fadeIn(), exit = slideOutVertically() + fadeOut(), ) { - if(appliedTitle!= null) { + if (appliedTitle != null) { RoundedButton( onClick = { }, fillMinSize = false, diff --git a/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationViewModel.kt index 8d6da6eca..adb28c1ce 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/main/application/ApplicationViewModel.kt @@ -22,7 +22,8 @@ internal class ApplicationViewModel @Inject constructor( private val remainsRepository: RemainsRepository, ) : BaseMviViewModel( initialState = ApplicationUiState.initial(), -), DefaultLifecycleObserver { +), + DefaultLifecycleObserver { override fun onCreate(owner: LifecycleOwner) { super.onCreate(owner) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/main/home/HomeScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/main/home/HomeScreen.kt index ad284e665..6e8f5cfd6 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/main/home/HomeScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/main/home/HomeScreen.kt @@ -96,7 +96,6 @@ import team.aliens.dms.android.feature.main.home.MealCardType.BREAKFAST import team.aliens.dms.android.feature.main.home.MealCardType.DINNER import team.aliens.dms.android.feature.main.home.MealCardType.LUNCH import team.aliens.dms.android.shared.date.util.now -import java.util.UUID import kotlin.math.absoluteValue @OptIn(ExperimentalMaterial3Api::class) @@ -424,8 +423,11 @@ private fun MealCards( val context = LocalContext.current LaunchedEffect(pagerState.currentPage) { - if (firstEnter) firstEnter = false - else vibrateOnMealCardPaging(context) + if (firstEnter) { + firstEnter = false + } else { + vibrateOnMealCardPaging(context) + } } HorizontalPager( diff --git a/feature/src/main/java/team/aliens/dms/android/feature/main/mypage/MyPageScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/main/mypage/MyPageScreen.kt index 1f0fa6704..77a56296f 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/main/mypage/MyPageScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/main/mypage/MyPageScreen.kt @@ -266,7 +266,7 @@ private fun UserInformation( .clickable(onClick = onNavigateToEditProfileImage), contentScale = ContentScale.Crop, model = profileImageUrl ?: DmsIcon.ProfileDefault, - contentDescription = stringResource(id = R.string.profile_image), + contentDescription = stringResource(id = R.string.profile_image), ) Image( modifier = Modifier @@ -332,7 +332,7 @@ private fun PointCards( .weight(1f) .startPadding() .clickable( - onClick = { onNavigateToPointHistory(PointType.BONUS) } + onClick = { onNavigateToPointHistory(PointType.BONUS) }, ), type = PointCardType.BONUS, // TODO: fix @@ -343,7 +343,7 @@ private fun PointCards( .weight(1f) .endPadding() .clickable( - onClick = { onNavigateToPointHistory(PointType.MINUS) } + onClick = { onNavigateToPointHistory(PointType.MINUS) }, ), type = PointCardType.MINUS, // TODO: fix diff --git a/feature/src/main/java/team/aliens/dms/android/feature/notice/NoticeDetailsScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/notice/NoticeDetailsScreen.kt index 05541a3d1..10935ead7 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/notice/NoticeDetailsScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/notice/NoticeDetailsScreen.kt @@ -24,9 +24,9 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import org.threeten.bp.LocalDateTime -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.VerticallyFadedColumn import team.aliens.dms.android.core.ui.DefaultVerticalSpace import team.aliens.dms.android.core.ui.horizontalPadding @@ -136,4 +136,3 @@ private val LocalDateTime.text: String this.hour, this.minute, ) - diff --git a/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxScreen.kt index 82c7a6a71..0f2ccad0f 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxScreen.kt @@ -58,7 +58,7 @@ internal fun NotificationBoxScreen( viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { NotificationBoxSideEffect.CurrentNotificationsNotFound -> toast.showErrorToast( - message = context.getString(R.string.notification_box_notifications_not_current) + message = context.getString(R.string.notification_box_notifications_not_current), ) is NotificationBoxSideEffect.MoveToDetail -> { @@ -166,8 +166,8 @@ private fun NotificationListLayout( onNavigateToNoticeDetails = { viewModel.postIntent( NotificationBoxIntent.DetailNotification( - notification - ) + notification, + ), ) }, ) @@ -203,7 +203,7 @@ private fun NotificationCard( DmsTheme.colorScheme.onBackground } else { DmsTheme.colorScheme.primary - } + }, ) Spacer(modifier = Modifier.width(PaddingDefaults.Small)) Column { diff --git a/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxViewModel.kt index 8b27db822..f7f460ae6 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/notification/box/NotificationBoxViewModel.kt @@ -18,7 +18,7 @@ import javax.inject.Inject internal class NotificationBoxViewModel @Inject constructor( private val notificationRepository: NotificationRepository, ) : BaseMviViewModel( - initialState = NotificationBoxUiState.initial() + initialState = NotificationBoxUiState.initial(), ) { init { @@ -26,7 +26,7 @@ internal class NotificationBoxViewModel @Inject constructor( } override fun processIntent(intent: NotificationBoxIntent) { - when(intent) { + when (intent) { is NotificationBoxIntent.DetailNotification -> detailNotification(intent.notification) } } @@ -44,7 +44,7 @@ internal class NotificationBoxViewModel @Inject constructor( } private fun detailNotification(notification: Notification) { - when(notification.topic) { + when (notification.topic) { NotificationTopic.NOTICE -> { postSideEffect(NotificationBoxSideEffect.MoveToDetail(notification.linkId)) } @@ -70,10 +70,10 @@ internal data class NotificationBoxUiState( } internal sealed class NotificationBoxIntent : Intent() { - class DetailNotification(val notification: Notification): NotificationBoxIntent() + class DetailNotification(val notification: Notification) : NotificationBoxIntent() } internal sealed class NotificationBoxSideEffect : SideEffect() { - data object CurrentNotificationsNotFound: NotificationBoxSideEffect() - data class MoveToDetail(val detailId: UUID): NotificationBoxSideEffect() + data object CurrentNotificationsNotFound : NotificationBoxSideEffect() + data class MoveToDetail(val detailId: UUID) : NotificationBoxSideEffect() } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsScreen.kt index 2ba8da8ff..6cdcd3f5c 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsScreen.kt @@ -45,7 +45,6 @@ import team.aliens.dms.android.data.notification.model.NotificationTopicGroup import team.aliens.dms.android.feature.R import team.aliens.dms.android.feature.notification.navigation.NotificationSettingsNavigator - @OptIn(ExperimentalMaterial3Api::class) @Destination @Composable @@ -61,15 +60,15 @@ internal fun NotificationSettingsScreen( viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { NotificationSettingsSideEffect.CurrentNotificationsStatusNotFound -> toast.showErrorToast( - message = context.getString(R.string.notification_not_current) + message = context.getString(R.string.notification_not_current), ) NotificationSettingsSideEffect.SubscribeNotificationFailure -> toast.showErrorToast( - message = context.getString(R.string.notification_subscribe_fail) + message = context.getString(R.string.notification_subscribe_fail), ) NotificationSettingsSideEffect.UnSubscribeNotificationFailure -> toast.showErrorToast( - message = context.getString(R.string.notification_unsubscribe_fail) + message = context.getString(R.string.notification_unsubscribe_fail), ) } } @@ -240,7 +239,7 @@ private fun NotificationLayout( NotificationSettingsIntent.UpdateNotificationTopic( isSubscribed = isChecked, topic = topic, - ) + ), ) }, ) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsViewModel.kt index 86a71a91a..461b73256 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/notification/settings/NotificationSettingsViewModel.kt @@ -17,7 +17,7 @@ import javax.inject.Inject internal class NotificationSettingsViewModel @Inject constructor( private val notificationRepository: NotificationRepository, ) : BaseMviViewModel( - initialState = NotificationSettingsUiState.initial() + initialState = NotificationSettingsUiState.initial(), ) { override fun processIntent(intent: NotificationSettingsIntent) { diff --git a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingApplicationScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingApplicationScreen.kt index d963e62c0..d68e99122 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingApplicationScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingApplicationScreen.kt @@ -138,16 +138,16 @@ fun OutingApplicationScreen( value = LocalTime.of( startHourValuesPickerState.selectedItem.toInt(), startMinuteValuesPickerState.selectedItem.toInt(), - ) - ) + ), + ), ) viewModel.postIntent( OutingIntent.UpdateOutingEndTime( value = LocalTime.of( endHourValuesPickerState.selectedItem.toInt(), endMinuteValuesPickerState.selectedItem.toInt(), - ) - ) + ), + ), ) scope.launch { timeSheetState.hide() @@ -198,7 +198,7 @@ fun OutingApplicationScreen( .heightIn(max = 240.dp), students = uiState.students?.filter { it.name.contains(studentFilterValue) || it.gradeClassNumber.contains( - studentFilterValue + studentFilterValue, ) }, selectedStudents = uiState.selectedStudents, @@ -219,6 +219,7 @@ fun OutingApplicationScreen( .topPadding(), text = stringResource(R.string.outing_application_selected_companions), style = DmsTheme.typography.caption, + color = DmsTheme.colorScheme.onSurface, ) StudentList( modifier = Modifier @@ -274,7 +275,7 @@ fun OutingApplicationScreen( ) is OutingSideEffect.OutingApplicationSuccess -> navigator.navigateUp() - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -300,18 +301,10 @@ fun OutingApplicationScreen( .padding(padValues), verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace), ) { - if (uiState.outingApplicationTime != null) { - val startTime = uiState.outingApplicationTime!!.startTime - val endTime = uiState.outingApplicationTime!!.endTime - FloatingNotice( - modifier = Modifier.horizontalPadding(), - text = stringResource( - id = R.string.outing_format_application_time, - startTime, - endTime, - ), - ) - } + FloatingNotice( + modifier = Modifier.horizontalPadding(), + text = stringResource(id = R.string.outing_format_application_time), + ) Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(DefaultHorizontalSpace), @@ -352,6 +345,19 @@ fun OutingApplicationScreen( .endPadding(), text = { Text(text = stringResource(id = R.string.outing_start_time)) }, indicator = { OutingInputDefaults.Indicator() }, + description = { + if (uiState.outingApplicationTime != null) { + Text( + text = stringResource( + id = R.string.outing_can_go_out_time, + uiState.outingApplicationTime!!.startTime, + uiState.outingApplicationTime!!.endTime, + ), + style = DmsTheme.typography.caption, + color = DmsTheme.colorScheme.primary, + ) + } + }, ) { val startTime = remember(uiState.selectedOutingStartTime) { uiState.selectedOutingStartTime @@ -401,7 +407,7 @@ fun OutingApplicationScreen( modifier = Modifier.menuAnchor(), value = uiState.selectedOutingType ?: stringResource(id = R.string.outing_select_outing_type), - onValueChange = {/* explicit blank */ }, + onValueChange = { /* explicit blank */ }, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = outingTypeMenuExpanded) }, @@ -612,6 +618,7 @@ private fun OutingInput( modifier: Modifier = Modifier, text: (@Composable () -> Unit)? = null, indicator: (@Composable () -> Unit)? = null, + description: @Composable () -> Unit = { }, input: @Composable () -> Unit, ) { Column( @@ -627,6 +634,7 @@ private fun OutingInput( } } input() + description() } } @@ -660,6 +668,7 @@ private fun TimePickerSpinner( startIndex = startTime.hour, textStyle = DmsTheme.typography.body1, textModifier = Modifier.padding(vertical = 10.dp), + color = DmsTheme.colorScheme.onSurface, ) Text( text = ":", @@ -668,6 +677,7 @@ private fun TimePickerSpinner( .weight(1f), textAlign = TextAlign.Center, style = DmsTheme.typography.body1, + color = DmsTheme.colorScheme.onSurface, ) Picker( modifier = Modifier.weight(1f), @@ -677,12 +687,14 @@ private fun TimePickerSpinner( startIndex = startTime.minute / 10, textStyle = DmsTheme.typography.body1, textModifier = Modifier.padding(vertical = 10.dp), + color = DmsTheme.colorScheme.onSurface, ) Text( modifier = Modifier .weight(2f), text = "~", textAlign = TextAlign.Center, + color = DmsTheme.colorScheme.onSurface, ) Picker( modifier = Modifier.weight(1f), @@ -692,6 +704,7 @@ private fun TimePickerSpinner( startIndex = endTime.hour, textStyle = DmsTheme.typography.body1, textModifier = Modifier.padding(vertical = 10.dp), + color = DmsTheme.colorScheme.onSurface, ) Text( modifier = Modifier @@ -699,6 +712,7 @@ private fun TimePickerSpinner( text = ":", fontSize = 30.sp, textAlign = TextAlign.Center, + color = DmsTheme.colorScheme.onSurface, ) Picker( modifier = Modifier.weight(1f), @@ -708,6 +722,7 @@ private fun TimePickerSpinner( startIndex = endTime.minute / 10, textStyle = DmsTheme.typography.body1, textModifier = Modifier.padding(vertical = 10.dp), + color = DmsTheme.colorScheme.onSurface, ) } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingStatusScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingStatusScreen.kt index 9885827db..77ff22a43 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingStatusScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingStatusScreen.kt @@ -28,12 +28,12 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextAlign import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.AlertDialog import team.aliens.dms.android.core.designsystem.ButtonDefaults import team.aliens.dms.android.core.designsystem.ContainedButton +import team.aliens.dms.android.core.designsystem.DmsIcon import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast @@ -44,6 +44,7 @@ import team.aliens.dms.android.core.ui.DefaultHorizontalSpace import team.aliens.dms.android.core.ui.DefaultVerticalSpace import team.aliens.dms.android.core.ui.PaddingDefaults import team.aliens.dms.android.core.ui.bottomPadding +import team.aliens.dms.android.core.ui.composable.FloatingNotice import team.aliens.dms.android.core.ui.horizontalPadding import team.aliens.dms.android.core.ui.startPadding import team.aliens.dms.android.core.ui.topPadding @@ -100,7 +101,7 @@ fun OutingStatusScreen( navigationIcon = { IconButton(onClick = navigator::navigateUp) { Icon( - painter = painterResource(id = R.drawable.ic_baseline_arrow_back_24), + painter = painterResource(id = DmsIcon.Back), contentDescription = stringResource(id = R.string.top_bar_back_button), ) } @@ -118,34 +119,33 @@ fun OutingStatusScreen( modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace), ) { - Text( - modifier = Modifier - .fillMaxWidth() - .startPadding() - .verticalPadding(), - text = stringResource(id = R.string.outing_recent_application), - color = DmsTheme.colorScheme.icon, + FloatingNotice( + modifier = Modifier.horizontalPadding(), + text = stringResource(id = R.string.outing_format_application_time), ) uiState.currentAppliedOutingApplication?.let { outingApplication -> + Spacer(modifier = Modifier.height(PaddingDefaults.Large)) OutingInformationCard( title = outingApplication.type, date = outingApplication.date, time = stringResource( id = R.string.outing_format_duration_h_m, outingApplication.startTime, - outingApplication.endTime + outingApplication.endTime, ), companionNames = outingApplication.companionNames, reason = outingApplication.reason, onCancelApplication = { onChangeShouldShowCancelOutingDialog(true) }, ) - } ?: Text( + } ?: Box( modifier = Modifier - .fillMaxWidth() - .topPadding(), - textAlign = TextAlign.Center, - text = stringResource(id = R.string.outing_failed_to_fetch_current_applied_outing_application) - ) + .fillMaxSize(), + contentAlignment = Alignment.Center, + ) { + if (!uiState.isApplicationState) { + Text(text = stringResource(id = R.string.outing_not_now_outing_application_time)) + } + } } if (uiState.currentAppliedOutingApplication == null) { ContainedButton( @@ -154,6 +154,7 @@ fun OutingStatusScreen( .bottomPadding() .horizontalPadding(), onClick = navigator::openOutingApplication, + enabled = uiState.isApplicationState, ) { Text(text = stringResource(id = R.string.outing_do_application)) } @@ -172,7 +173,6 @@ private fun OutingInformationCard( reason: String?, onCancelApplication: () -> Unit, ) { - Card( modifier = modifier .horizontalPadding() diff --git a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingViewModel.kt index 221aa87bc..86c48ae39 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/outing/OutingViewModel.kt @@ -34,6 +34,7 @@ class OutingViewModel @Inject constructor( fetchOutingTypes() fetchStudents() fetchOutingDate() + fetchApplicationState() } override fun processIntent(intent: OutingIntent) { @@ -103,11 +104,16 @@ class OutingViewModel @Inject constructor( val captureOutingDate: LocalDate = stateFlow.value.outingDate if (now.hour >= 20) { reduce( - newState = stateFlow.value.copy(outingDate = captureOutingDate.plusDays(1)) + newState = stateFlow.value.copy(outingDate = captureOutingDate.plusDays(1)), ) } } + private fun fetchApplicationState() { + val isApplicationState = now.hour >= 20 || now.hour <= 11 + reduce(newState = stateFlow.value.copy(isApplicationState = isApplicationState)) + } + private fun fetchOutingTypes() = viewModelScope.launch(Dispatchers.IO) { runCatching { outingRepository.fetchOutingTypes(null) @@ -202,7 +208,7 @@ class OutingViewModel @Inject constructor( remove(student) } }, - ) + ), ) } } @@ -220,6 +226,7 @@ data class OutingUiState( val students: List?, val selectedStudents: List, val applicationId: UUID?, + val isApplicationState: Boolean, ) : UiState() { companion object { fun initial(): OutingUiState { @@ -237,6 +244,7 @@ data class OutingUiState( students = null, selectedStudents = emptyList(), applicationId = null, + isApplicationState = false, ) } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryScreen.kt index a5e8d6912..0f673d63b 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryScreen.kt @@ -208,11 +208,11 @@ private fun PointCard( ) Text( text = "${ - if (point.type == PointType.MINUS) { - point.score * -1 - } else { - point.score - } + if (point.type == PointType.MINUS) { + point.score * -1 + } else { + point.score + } }", color = when (point.type) { PointType.ALL -> throw IllegalStateException() diff --git a/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryViewModel.kt index 9a0f122dc..78855d6aa 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/point/PointHistoryViewModel.kt @@ -58,15 +58,17 @@ internal class PointHistoryViewModel @Inject constructor( private fun updatePoints(pointType: PointType): Boolean = reduce( newState = stateFlow.value.copy( - selectedPointType = pointType, totalPoints = when (pointType) { + selectedPointType = pointType, + totalPoints = when (pointType) { PointType.ALL -> scoreOfAllPoints PointType.BONUS -> scoreOfBonusPoints PointType.MINUS -> scoreOfMinusPoints - }, points = when (pointType) { + }, + points = when (pointType) { PointType.ALL -> allPoints PointType.BONUS -> bonusPoints PointType.MINUS -> minusPoints - } + }, ), ) } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationScreen.kt index fced48f6d..38260c02e 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationScreen.kt @@ -108,8 +108,8 @@ internal fun RemainsApplicationScreen( onRemainsOptionSelected = { optionId -> viewModel.postIntent( RemainsApplicationIntent.UpdateSelectedRemainsOption( - optionId - ) + optionId, + ), ) }, ) @@ -168,7 +168,7 @@ private fun RemainsOptionList( null } else { index - } + }, ) }, onClick = { onRemainsOptionSelected(option.id) }, @@ -253,7 +253,7 @@ private fun RemainsOptionCard( .size(24.dp) .rotate(rotate), painter = painterResource( - id = team.aliens.dms.android.core.designsystem.R.drawable.ic_down + id = team.aliens.dms.android.core.designsystem.R.drawable.ic_down, ), contentDescription = stringResource(id = R.string.remains_expand_remains_option_card), ) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationViewModel.kt index fd3f755ba..02aa03742 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/remains/RemainsApplicationViewModel.kt @@ -76,7 +76,7 @@ internal class RemainsApplicationViewModel @Inject constructor( ), ) this@RemainsApplicationViewModel.updateSelectedRemainsOption( - fetchedAppliedRemainsOption.id + fetchedAppliedRemainsOption.id, ) } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/1_AccountVerificationScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/AccountVerificationScreen.kt similarity index 97% rename from feature/src/main/java/team/aliens/dms/android/feature/resetpassword/1_AccountVerificationScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/resetpassword/AccountVerificationScreen.kt index e7eb6a14b..0feb53d10 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/1_AccountVerificationScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/AccountVerificationScreen.kt @@ -20,7 +20,6 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource @@ -68,7 +67,7 @@ fun AccountVerificationScreen( } } - var isAccountIdError by rememberSaveable(uiState.accountId) { mutableStateOf(false) } + val isAccountIdError by rememberSaveable(uiState.accountId) { mutableStateOf(false) } viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { @@ -82,7 +81,7 @@ fun AccountVerificationScreen( ResetPasswordSideEffect.SendEmailVerificationCodeSuccess -> navigator.openResetPasswordEnterEmailVerificationCode() - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -178,7 +177,6 @@ fun AccountVerificationScreen( }, ) } - } Spacer(modifier = Modifier.weight(3f)) ContainedButton( @@ -189,8 +187,8 @@ fun AccountVerificationScreen( onClick = { viewModel.postIntent( ResetPasswordIntent.SendEmailVerificationCode( - uiState.email - ) + uiState.email, + ), ) }, enabled = uiState.accountId.isNotEmpty() && uiState.studentName.isNotEmpty() && uiState.email.isNotEmpty(), @@ -233,4 +231,4 @@ private fun AccountAssertionCard( ) } } -} \ No newline at end of file +} diff --git a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/2_ResetPasswordEnterEmailVerificationCodeScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordEnterEmailVerificationCodeScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/resetpassword/2_ResetPasswordEnterEmailVerificationCodeScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordEnterEmailVerificationCodeScreen.kt index 5f69a5546..bb95eaa50 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/2_ResetPasswordEnterEmailVerificationCodeScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordEnterEmailVerificationCodeScreen.kt @@ -111,7 +111,7 @@ internal fun ResetPasswordEnterEmailVerificationCodeScreen( message = context.getString(R.string.sign_up_enter_email_verification_code_error_cannot_resend_verification_code), ) - else -> {//* explicit blank *//* + else -> { // * explicit blank *//* } } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordViewModel.kt index fcb563e28..ee70090e8 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/ResetPasswordViewModel.kt @@ -20,7 +20,7 @@ class ResetPasswordViewModel @Inject constructor( private val studentRepository: StudentRepository, private val authRepository: AuthRepository, ) : BaseMviViewModel( - initialState = ResetPasswordUiState.initial() + initialState = ResetPasswordUiState.initial(), ) { /*디자인에서 처음 본인인증할때 아이디만을 사용해서 "아이디 존재 여부(비밀번호 재설정)"이라는 Api로 이에 해당하는 Email를 받습니다. 그다음 아이디를 입력 받은 다음에 "이메일 검증이라는 Api를 사용하여 이메일과 아이디를 서버에 보낸뒤 이 값들이 정보와 일치하는지 검사합니다." @@ -43,7 +43,6 @@ class ResetPasswordViewModel @Inject constructor( } } - private fun resetPassword() = viewModelScope.launch(Dispatchers.IO) { val capturedState = stateFlow.value if (capturedState.newPassword != capturedState.newPasswordRepeat) { @@ -103,7 +102,6 @@ class ResetPasswordViewModel @Inject constructor( postSideEffect(ResetPasswordSideEffect.SendEmailVerificationCodeSuccess) } - private fun updateEmailVerificationCode(value: String) = run { if (value.length > ResetPasswordViewModel.EMAIL_VERIFICATION_CODE_LENGTH) { return@run false @@ -141,31 +139,31 @@ class ResetPasswordViewModel @Inject constructor( private fun updateNewPassword(value: String) = reduce( newState = stateFlow.value.copy( newPassword = value, - ) + ), ) private fun updateAccountId(value: String) = reduce( newState = stateFlow.value.copy( accountId = value, - ) + ), ) private fun updateStudentName(value: String) = reduce( newState = stateFlow.value.copy( - studentName = value - ) + studentName = value, + ), ) private fun updateEmail(value: String) = reduce( newState = stateFlow.value.copy( email = value, - ) + ), ) private fun updateNewPasswordRepeat(value: String) = reduce( newState = stateFlow.value.copy( newPasswordRepeat = value, - ) + ), ) companion object { @@ -223,4 +221,4 @@ sealed class ResetPasswordSideEffect : SideEffect() { data object EmailVerificationCodeIncorrect : ResetPasswordSideEffect() data object EmailVerificationSessionReset : ResetPasswordSideEffect() data object EmailVerificationSessionResetFailed : ResetPasswordSideEffect() -} \ No newline at end of file +} diff --git a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/3_SetPasswordScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/SetPasswordScreen.kt similarity index 96% rename from feature/src/main/java/team/aliens/dms/android/feature/resetpassword/3_SetPasswordScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/resetpassword/SetPasswordScreen.kt index 23ff00f8b..88447570e 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/3_SetPasswordScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/resetpassword/SetPasswordScreen.kt @@ -90,7 +90,7 @@ fun ResetPasswordSetPasswordScreen( ) } - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -138,13 +138,13 @@ fun ResetPasswordSetPasswordScreen( onValueChange = { viewModel.postIntent( ResetPasswordIntent.UpdateNewPassword( - value = it - ) + value = it, + ), ) }, passwordShowing = showPassword, onPasswordShowingChange = onShowPasswordChange, - hintText = stringResource(id = R.string.edit_password_please_enter_new_password) + hintText = stringResource(id = R.string.edit_password_please_enter_new_password), ) PasswordTextField( modifier = Modifier @@ -154,13 +154,13 @@ fun ResetPasswordSetPasswordScreen( onValueChange = { viewModel.postIntent( ResetPasswordIntent.UpdateNewPasswordRepeat( - value = it - ) + value = it, + ), ) }, passwordShowing = showPasswordRepeat, onPasswordShowingChange = onShowPasswordRepeatChange, - hintText = stringResource(id = R.string.edit_password_please_enter_new_password_repeat) + hintText = stringResource(id = R.string.edit_password_please_enter_new_password_repeat), ) } Spacer(modifier = Modifier.weight(3f)) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signin/SignInScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signin/SignInScreen.kt index 5aec20088..3c36ce4a8 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signin/SignInScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signin/SignInScreen.kt @@ -240,7 +240,7 @@ private fun UserInformationInputs( is BadRequestException -> R.string.sign_in_error_check_format else -> R.string.error_unknown }, - ) + ), ) } } else { diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/3_EnterEmailScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/3_EnterEmailScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailScreen.kt index abab61c5f..cdefd617c 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/3_EnterEmailScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailScreen.kt @@ -25,9 +25,9 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.AlertDialog import team.aliens.dms.android.core.designsystem.ContainedButton -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.TextButton import team.aliens.dms.android.core.designsystem.TextField import team.aliens.dms.android.core.ui.Banner @@ -106,7 +106,7 @@ internal fun EnterEmailScreen( message = context.getString(R.string.sign_up_enter_email_error_email_not_available), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/4_EnterEmailVerificationCodeScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailVerificationCodeScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/4_EnterEmailVerificationCodeScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailVerificationCodeScreen.kt index c842e94aa..8559a4ed0 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/4_EnterEmailVerificationCodeScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterEmailVerificationCodeScreen.kt @@ -28,10 +28,10 @@ import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.ButtonDefaults import team.aliens.dms.android.core.designsystem.ContainedButton import team.aliens.dms.android.core.designsystem.DmsIcon -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.TextButton import team.aliens.dms.android.core.designsystem.VerificationCodeInput import team.aliens.dms.android.core.designsystem.VerificationCodeInputDefaults @@ -116,7 +116,7 @@ internal fun SignUpEnterEmailVerificationCodeScreen( message = context.getString(R.string.sign_up_enter_email_verification_code_error_cannot_resend_verification_code), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/1_EnterSchoolVerificationCodeScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationCodeScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/1_EnterSchoolVerificationCodeScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationCodeScreen.kt index df4eb2c76..825b09103 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/1_EnterSchoolVerificationCodeScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationCodeScreen.kt @@ -61,7 +61,7 @@ internal fun EnterSchoolVerificationCodeScreen( message = context.getString(R.string.sign_up_error_school_verification_code_not_found), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/2_EnterSchoolVerificationQuestionScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationQuestionScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/2_EnterSchoolVerificationQuestionScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationQuestionScreen.kt index cff899730..d6ab62d32 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/2_EnterSchoolVerificationQuestionScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/EnterSchoolVerificationQuestionScreen.kt @@ -20,9 +20,9 @@ import androidx.compose.ui.res.stringResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.ContainedButton -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.TextField import team.aliens.dms.android.core.ui.Banner import team.aliens.dms.android.core.ui.BannerDefaults @@ -54,7 +54,7 @@ internal fun EnterSchoolVerificationQuestionScreen( message = context.getString(R.string.sign_up_enter_school_verification_question_error_question_incorrect), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/5_SetIdScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetIdScreen.kt similarity index 99% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/5_SetIdScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/SetIdScreen.kt index 4c88943c3..f28be22e8 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/5_SetIdScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetIdScreen.kt @@ -130,7 +130,7 @@ internal fun SetIdScreen( message = context.getString(R.string.sign_up_set_id_error_student_duplicated), ) - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -288,7 +288,7 @@ private fun StudentInformationCard( modifier = Modifier.startPadding(), text = stringResource( id = R.string.sign_up_set_id_format_authentication_information_student_name, - studentName + studentName, ), ) TextButton( diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/6_SetPasswordScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetPasswordScreen.kt similarity index 97% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/6_SetPasswordScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/SetPasswordScreen.kt index 52954b483..feb537f48 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/6_SetPasswordScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetPasswordScreen.kt @@ -64,7 +64,7 @@ internal fun SignUpSetPasswordScreen( val (isPasswordInvalid, onChangeIsPasswordInvalid) = remember( uiState.password, - uiState.passwordRepeat + uiState.passwordRepeat, ) { mutableStateOf(false) } @@ -106,7 +106,7 @@ internal fun SignUpSetPasswordScreen( onChangeIsPasswordInvalid(true) } - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -153,7 +153,7 @@ internal fun SignUpSetPasswordScreen( onValueChange = { viewModel.postIntent(SignUpIntent.UpdatePassword(value = it)) }, passwordShowing = showPassword, onPasswordShowingChange = onShowPasswordChange, - hintText = stringResource(id = R.string.sign_up_set_password_please_enter_password) + hintText = stringResource(id = R.string.sign_up_set_password_please_enter_password), ) PasswordTextField( modifier = Modifier @@ -163,7 +163,7 @@ internal fun SignUpSetPasswordScreen( onValueChange = { viewModel.postIntent(SignUpIntent.UpdatePasswordRepeat(value = it)) }, passwordShowing = showPasswordRepeat, onPasswordShowingChange = onShowPasswordRepeatChange, - hintText = stringResource(id = R.string.sign_up_set_password_please_enter_password_again) + hintText = stringResource(id = R.string.sign_up_set_password_please_enter_password_again), ) } Spacer(modifier = Modifier.weight(3f)) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/7_SetProfileImageScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetProfileImageScreen.kt similarity index 97% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/7_SetProfileImageScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/SetProfileImageScreen.kt index 139d31752..c74e9ce03 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/7_SetProfileImageScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/SetProfileImageScreen.kt @@ -67,21 +67,21 @@ internal fun SetProfileImageScreen( contract = ActivityResultContracts.PickVisualMedia(), onResult = { imageUrl -> viewModel.postIntent(SignUpIntent.UpdateProfileImage(uri = imageUrl, context = context)) - } + }, ) viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { SignUpSideEffect.ProfileImageSet -> navigator.openTerms() SignUpSideEffect.ProfileImageBadRequest -> toast.showErrorToast( - message = context.getString(R.string.sign_up_profile_error_load_image_error) + message = context.getString(R.string.sign_up_profile_error_load_image_error), ) else -> { /* explicit blank */ } } } - + Scaffold( topBar = { DmsTopAppBar( @@ -92,9 +92,9 @@ internal fun SetProfileImageScreen( contentDescription = stringResource(id = R.string.top_bar_back_button), ) } - } + }, ) - } + }, ) { paddingValues -> Column( modifier = Modifier @@ -123,13 +123,13 @@ internal fun SetProfileImageScreen( val mediaType = ActivityResultContracts.PickVisualMedia.ImageOnly val request = PickVisualMediaRequest(mediaType) activityResultLauncher.launch(request) - } + }, ) Spacer(modifier = Modifier.weight(2f)) Text( modifier = Modifier .clickable( - onClick = navigator::openTerms + onClick = navigator::openTerms, ) .padding( vertical = PaddingDefaults.Small, @@ -162,7 +162,7 @@ private fun SetImage( onChangeImage: () -> Unit, ) { Box( - contentAlignment = Alignment.BottomEnd + contentAlignment = Alignment.BottomEnd, ) { AsyncImage( modifier = Modifier diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/SignUpViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/SignUpViewModel.kt index d42c691cb..1bc2ddc87 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/SignUpViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/SignUpViewModel.kt @@ -54,7 +54,7 @@ class SignUpViewModel @Inject constructor( SignUpIntent.ConfirmPassword -> confirmPassword() is SignUpIntent.UpdateProfileImage -> changeProfileImage( uri = intent.uri, - context = intent.context + context = intent.context, ) is SignUpIntent.SignUp -> signUp() @@ -272,7 +272,7 @@ class SignUpViewModel @Inject constructor( file = team.aliens.dms.android.core.file.File.toFile( context = context, uri = uri, - ) + ), ) } else { postSideEffect(SignUpSideEffect.ProfileImageBadRequest) diff --git a/feature/src/main/java/team/aliens/dms/android/feature/signup/8_TermsScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/signup/TermsScreen.kt similarity index 97% rename from feature/src/main/java/team/aliens/dms/android/feature/signup/8_TermsScreen.kt rename to feature/src/main/java/team/aliens/dms/android/feature/signup/TermsScreen.kt index b3df8e198..1c14da98d 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/signup/8_TermsScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/signup/TermsScreen.kt @@ -27,10 +27,10 @@ import androidx.compose.ui.viewinterop.AndroidView import com.ramcosta.composedestinations.annotation.Destination import team.aliens.dms.android.core.designsystem.Checkbox import team.aliens.dms.android.core.designsystem.ContainedButton -import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.designsystem.DmsTheme import team.aliens.dms.android.core.designsystem.DmsTopAppBar import team.aliens.dms.android.core.designsystem.LocalToast +import team.aliens.dms.android.core.designsystem.Scaffold import team.aliens.dms.android.core.ui.DefaultHorizontalSpace import team.aliens.dms.android.core.ui.DefaultVerticalSpace import team.aliens.dms.android.core.ui.bottomPadding @@ -61,12 +61,12 @@ internal fun TermsScreen( viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect -> when (sideEffect) { SignUpSideEffect.SignUpFailure -> toast.showErrorToast( - message = context.getString(R.string.sign_up_error_id_format) + message = context.getString(R.string.sign_up_error_id_format), ) // TODO: 모달 구현 SignUpSideEffect.SignedUp -> navigator.openSignIn() - else -> {/* explicit blank */ + else -> { /* explicit blank */ } } } @@ -102,7 +102,8 @@ internal fun TermsScreen( factory = { WebView(it).apply { layoutParams = ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, ) webViewClient = WebViewClient() diff --git a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/Common.kt b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/Common.kt index 65f3c5c3d..af535891f 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/Common.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/Common.kt @@ -6,14 +6,12 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import team.aliens.dms.android.core.designsystem.DmsTheme -import team.aliens.dms.android.core.designsystem.ShadowDefaults import team.aliens.dms.android.core.designsystem.shadow import team.aliens.dms.android.core.ui.DefaultHorizontalSpace import team.aliens.dms.android.core.ui.PaddingDefaults @@ -26,7 +24,6 @@ import team.aliens.dms.android.data.studyroom.model.StudyRoom import team.aliens.dms.android.feature.R import team.aliens.dms.android.shared.model.Sex - @Composable fun StudyRoomCard( modifier: Modifier = Modifier, diff --git a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsScreen.kt b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsScreen.kt index abe55f89e..2e54ceb83 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsScreen.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsScreen.kt @@ -182,7 +182,7 @@ internal fun StudyRoomDetailsScreen( colors = when (uiState.mainButtonState) { StudyRoomDetailsMainButtonState.CANCEL_SEAT -> ButtonDefaults.containedRefuseButtonColors() else -> ButtonDefaults.containedButtonColors() - } + }, ) { Text( text = stringResource( @@ -191,7 +191,7 @@ internal fun StudyRoomDetailsScreen( null -> R.string.study_room_button_please_select_seat_before_application else -> R.string.study_room_button_apply_seat }, - ) + ), ) } } @@ -463,7 +463,7 @@ private fun Seat( seat.number.toString() } else { seat.student!!.name - } + }, ) } } @@ -487,13 +487,17 @@ fun parseColor(@Size(min = 1) colorString: String): Int = if (colorString[0] == var color = colorString.substring(1).toLong(16) if (colorString.length == 7) { // Set the alpha value color = color or -0x1000000 - } else require(colorString.length == 9) { "Unknown color" } + } else { + require(colorString.length == 9) { "Unknown color" } + } color.toInt() } else { var color = colorString.toLong(16) if (colorString.length == 7) { // Set the alpha value color = color or -0x1000000 - } else require(colorString.length == 9) { "Unknown color" } + } else { + require(colorString.length == 9) { "Unknown color" } + } color.toInt() } @@ -587,4 +591,4 @@ private fun SeatLayoutPreview() { ) Text(text = "selected: ${selectedSeat?.number}") } -} \ No newline at end of file +} diff --git a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsViewModel.kt index 07ba8333d..61401b0ff 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/details/StudyRoomDetailsViewModel.kt @@ -100,10 +100,11 @@ internal class StudyRoomDetailsViewModel @Inject constructor( ) = viewModelScope.launch(Dispatchers.IO) { reduce( newState = stateFlow.value.copy( - selectedSeat = seat, mainButtonState = when { + selectedSeat = seat, + mainButtonState = when { seat.isMine -> StudyRoomDetailsMainButtonState.CANCEL_SEAT else -> StudyRoomDetailsMainButtonState.UPDATE_SEAT - } + }, ), ) } diff --git a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/list/StudyRoomListViewModel.kt b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/list/StudyRoomListViewModel.kt index a263fa1a3..a092e2c00 100644 --- a/feature/src/main/java/team/aliens/dms/android/feature/studyroom/list/StudyRoomListViewModel.kt +++ b/feature/src/main/java/team/aliens/dms/android/feature/studyroom/list/StudyRoomListViewModel.kt @@ -28,7 +28,7 @@ internal class StudyRoomListViewModel @Inject constructor( override fun processIntent(intent: StudyRoomListIntent) { when (intent) { is StudyRoomListIntent.UpdateSelectedAvailableStudyRoomTime -> updateSelectedAvailableStudyRoomTime( - availableStudyRoomTime = intent.availableStudyRoomTime + availableStudyRoomTime = intent.availableStudyRoomTime, ) } } diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 9922573e1..47c228354 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -342,14 +342,14 @@ 외출 신청 외출 시간 선택 - 외출 신청 시간은 %s ~ %s 입니다 + 외출 신청 시간은 20:00 ~ 11:00 입니다 신청 내역 외출 신청하기 기숙사에서 생활하는 동안 밖에 다녀올 일이 있다면 외출을 신청해 보세요. 신청 취소 동행자 작성한 정보가 파기됩니다. 계속하시겠습니까? - 외출 신청 정보를 조회할 수 없습니다 + 지금은 외출 신청 시간이 아닙니다. %s ~ %s %02d:%02d ~ %02d:%02d 외출 유형이 존재하지 않습니다 @@ -360,6 +360,7 @@ 외출 일자 %04d.%02d.%02d (%s) 외출 시간 + 외출 가능 시간은 %s ~ %s까지 입니다. 복귀 시간 외출 사유를 입력해 주세요 %d명 선택 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 03de15b83..e9d4c370c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,10 +47,12 @@ junitKtx = "1.1.5" workRuntime = "2.9.0" serialization = "2.0.0" firebase-crashlytics = "2.9.9" +org-jlleitschuh-ktlint-gradle = "11.3.1" [libraries] accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" } androidx-glance-appwidget = { module = "androidx.glance:glance-appwidget", version.ref = "glanceAppwidget" } +androidx-glance-material3 = { module = "androidx.glance:glance-material3", version.ref = "glanceAppwidget" } androidx-hilt-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltWork" } androidx-hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hiltWork" } androidx-window = { module = "androidx.window:window", version.ref = "androidx-window" } @@ -116,3 +118,4 @@ googleServices = { id = "com.google.gms.google-services", version.ref = "google" jetbrainsKotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinJvm" } serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "serialization" } firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" } +ktlint-gradle = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "org-jlleitschuh-ktlint-gradle"} diff --git a/network/build.gradle.kts b/network/build.gradle.kts index ad940f834..3c9bfb94a 100644 --- a/network/build.gradle.kts +++ b/network/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/network/src/androidTest/java/team/aliens/dms/android/network/auth/datasource/NetworkAuthDataSourceTest.kt b/network/src/androidTest/java/team/aliens/dms/android/network/auth/datasource/NetworkAuthDataSourceTest.kt index d8da4607a..342780026 100644 --- a/network/src/androidTest/java/team/aliens/dms/android/network/auth/datasource/NetworkAuthDataSourceTest.kt +++ b/network/src/androidTest/java/team/aliens/dms/android/network/auth/datasource/NetworkAuthDataSourceTest.kt @@ -4,6 +4,4 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) -class NetworkAuthDataSourceTest { - -} +class NetworkAuthDataSourceTest diff --git a/network/src/main/java/team/aliens/dms/android/network/file/apiservice/FileApiService.kt b/network/src/main/java/team/aliens/dms/android/network/file/apiservice/FileApiService.kt index 3a4dd1e1f..87ee32225 100644 --- a/network/src/main/java/team/aliens/dms/android/network/file/apiservice/FileApiService.kt +++ b/network/src/main/java/team/aliens/dms/android/network/file/apiservice/FileApiService.kt @@ -3,13 +3,10 @@ package team.aliens.dms.android.network.file.apiservice import okhttp3.RequestBody import retrofit2.http.Body import retrofit2.http.GET -import retrofit2.http.POST import retrofit2.http.PUT import retrofit2.http.Query import retrofit2.http.Url import team.aliens.dms.android.network.file.model.FetchPresignedUrlResponse -import team.aliens.dms.android.network.file.model.UploadFileResponse -import java.io.File internal interface FileApiService { diff --git a/network/src/main/java/team/aliens/dms/android/network/file/datasource/NetworkFileDataSourceImpl.kt b/network/src/main/java/team/aliens/dms/android/network/file/datasource/NetworkFileDataSourceImpl.kt index 4db1d17fa..939e8329b 100644 --- a/network/src/main/java/team/aliens/dms/android/network/file/datasource/NetworkFileDataSourceImpl.kt +++ b/network/src/main/java/team/aliens/dms/android/network/file/datasource/NetworkFileDataSourceImpl.kt @@ -13,7 +13,7 @@ import java.nio.file.Files import javax.inject.Inject internal class NetworkFileDataSourceImpl @Inject constructor( - private val fileApiService: FileApiService + private val fileApiService: FileApiService, ) : NetworkFileDataSource() { override suspend fun fetchPresignedUrl(fileName: String): FetchPresignedUrlResponse = handleNetworkRequest { fileApiService.fetchPresignedUrl(fileName) } @@ -24,7 +24,7 @@ internal class NetworkFileDataSourceImpl @Inject constructor( fileApiService.uploadFile( presignedUrl = presignedUrl, file = Files.readAllBytes(file.toPath()).toRequestBody( - contentType = RequestType.Binary.toMediaTypeOrNull() + contentType = RequestType.Binary.toMediaTypeOrNull(), ), ) } diff --git a/network/src/main/java/team/aliens/dms/android/network/file/model/UploadFileResponse.kt b/network/src/main/java/team/aliens/dms/android/network/file/model/UploadFileResponse.kt index 34be0197f..968c66edb 100644 --- a/network/src/main/java/team/aliens/dms/android/network/file/model/UploadFileResponse.kt +++ b/network/src/main/java/team/aliens/dms/android/network/file/model/UploadFileResponse.kt @@ -2,6 +2,6 @@ package team.aliens.dms.android.network.file.model import com.google.gson.annotations.SerializedName -data class UploadFileResponse ( +data class UploadFileResponse( @SerializedName("file_url") val fileUrl: String, ) diff --git a/network/src/main/java/team/aliens/dms/android/network/notice/datasource/NetworkNoticeDataSourceImpl.kt b/network/src/main/java/team/aliens/dms/android/network/notice/datasource/NetworkNoticeDataSourceImpl.kt index 692ce2012..d4cf56dad 100644 --- a/network/src/main/java/team/aliens/dms/android/network/notice/datasource/NetworkNoticeDataSourceImpl.kt +++ b/network/src/main/java/team/aliens/dms/android/network/notice/datasource/NetworkNoticeDataSourceImpl.kt @@ -19,4 +19,4 @@ internal class NetworkNoticeDataSourceImpl @Inject constructor( override suspend fun fetchNoticeDetails(noticeId: UUID): FetchNoticeDetailsResponse = handleNetworkRequest { noticeApiService.fetchNoticeDetails(noticeId) } -} \ No newline at end of file +} diff --git a/network/src/main/java/team/aliens/dms/android/network/notification/apiservice/NotificationApiService.kt b/network/src/main/java/team/aliens/dms/android/network/notification/apiservice/NotificationApiService.kt index 78aace191..720a11be8 100644 --- a/network/src/main/java/team/aliens/dms/android/network/notification/apiservice/NotificationApiService.kt +++ b/network/src/main/java/team/aliens/dms/android/network/notification/apiservice/NotificationApiService.kt @@ -19,27 +19,27 @@ internal interface NotificationApiService { @POST("/notifications/tokens") suspend fun registerFcmDeviceToken( - @Body request: RegisterFcmDeviceTokenRequest + @Body request: RegisterFcmDeviceTokenRequest, ) @DELETE("/notifications/token") suspend fun cancelFcmDeviceTokenRegistration( - @Body request: CancelFcmDeviceTokenRegistrationRequest + @Body request: CancelFcmDeviceTokenRegistrationRequest, ) @POST("/notifications/topic") suspend fun subscribeNotificationTopic( - @Body request: SubscribeNotificationTopicRequest + @Body request: SubscribeNotificationTopicRequest, ) @HTTP(method = "DELETE", path = "/notifications/topic", hasBody = true) suspend fun unsubscribeNotificationTopic( - @Body request: UnsubscribeNotificationTopicRequest + @Body request: UnsubscribeNotificationTopicRequest, ) @PATCH("/notifications/topic") suspend fun batchUpdateNotificationTopic( - @Body request: BatchUpdateNotificationTopicRequest + @Body request: BatchUpdateNotificationTopicRequest, ) @GET("/notifications/topic") diff --git a/network/src/main/java/team/aliens/dms/android/network/notification/di/ApiServiceModule.kt b/network/src/main/java/team/aliens/dms/android/network/notification/di/ApiServiceModule.kt index 8eebaeccc..ba53fca4a 100644 --- a/network/src/main/java/team/aliens/dms/android/network/notification/di/ApiServiceModule.kt +++ b/network/src/main/java/team/aliens/dms/android/network/notification/di/ApiServiceModule.kt @@ -16,6 +16,6 @@ internal object ApiServiceModule { @Provides @Singleton fun provideNotificationApiService( - @GlobalRetrofitClient retrofit: Retrofit + @GlobalRetrofitClient retrofit: Retrofit, ): NotificationApiService = retrofit.create(NotificationApiService::class.java) } diff --git a/network/src/main/java/team/aliens/dms/android/network/notification/model/FetchNotificationsResponse.kt b/network/src/main/java/team/aliens/dms/android/network/notification/model/FetchNotificationsResponse.kt index 0e3aed216..380122724 100644 --- a/network/src/main/java/team/aliens/dms/android/network/notification/model/FetchNotificationsResponse.kt +++ b/network/src/main/java/team/aliens/dms/android/network/notification/model/FetchNotificationsResponse.kt @@ -1,7 +1,6 @@ package team.aliens.dms.android.network.notification.model import com.google.gson.annotations.SerializedName -import org.threeten.bp.LocalDateTime import java.util.UUID data class FetchNotificationsResponse( diff --git a/network/src/main/java/team/aliens/dms/android/network/outing/model/ApplyOutingRequest.kt b/network/src/main/java/team/aliens/dms/android/network/outing/model/ApplyOutingRequest.kt index 0e41a7250..51a56a734 100644 --- a/network/src/main/java/team/aliens/dms/android/network/outing/model/ApplyOutingRequest.kt +++ b/network/src/main/java/team/aliens/dms/android/network/outing/model/ApplyOutingRequest.kt @@ -1,8 +1,6 @@ package team.aliens.dms.android.network.outing.model import com.google.gson.annotations.SerializedName -import org.threeten.bp.LocalDate -import org.threeten.bp.LocalDateTime import java.util.UUID data class ApplyOutingRequest( diff --git a/network/src/main/java/team/aliens/dms/android/network/point/datasource/NetworkPointDataSourceImpl.kt b/network/src/main/java/team/aliens/dms/android/network/point/datasource/NetworkPointDataSourceImpl.kt index 0b0471513..28386ac12 100644 --- a/network/src/main/java/team/aliens/dms/android/network/point/datasource/NetworkPointDataSourceImpl.kt +++ b/network/src/main/java/team/aliens/dms/android/network/point/datasource/NetworkPointDataSourceImpl.kt @@ -14,4 +14,4 @@ internal class NetworkPointDataSourceImpl @Inject constructor( page: Long?, size: Long?, ): FetchPointsResponse = handleNetworkRequest { pointApiService.fetchPoints(type, page, size) } -} \ No newline at end of file +} diff --git a/network/src/main/java/team/aliens/dms/android/network/user/di/DataSourceModule.kt b/network/src/main/java/team/aliens/dms/android/network/user/di/DataSourceModule.kt index 9bc491fb7..300b6b1c6 100644 --- a/network/src/main/java/team/aliens/dms/android/network/user/di/DataSourceModule.kt +++ b/network/src/main/java/team/aliens/dms/android/network/user/di/DataSourceModule.kt @@ -15,4 +15,4 @@ internal abstract class DataSourceModule { @Binds @Singleton abstract fun bindNetworkUserDataSource(impl: NetworkUserDataSourceImpl): NetworkUserDataSource -} \ No newline at end of file +} diff --git a/shared/date/build.gradle.kts b/shared/date/build.gradle.kts index 1ec546e77..96467b5e8 100644 --- a/shared/date/build.gradle.kts +++ b/shared/date/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/shared/date/src/androidTest/java/team/aliens/dms/android/shared/date/ExampleInstrumentedTest.kt b/shared/date/src/androidTest/java/team/aliens/dms/android/shared/date/ExampleInstrumentedTest.kt index 9d2ac5e80..7576b5ba4 100644 --- a/shared/date/src/androidTest/java/team/aliens/dms/android/shared/date/ExampleInstrumentedTest.kt +++ b/shared/date/src/androidTest/java/team/aliens/dms/android/shared/date/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.shared.date -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms_android.shared.date.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/shared/date/src/main/java/team/aliens/dms/android/shared/date/util/Utils.kt b/shared/date/src/main/java/team/aliens/dms/android/shared/date/util/Utils.kt index 1bdc45411..d8533237d 100644 --- a/shared/date/src/main/java/team/aliens/dms/android/shared/date/util/Utils.kt +++ b/shared/date/src/main/java/team/aliens/dms/android/shared/date/util/Utils.kt @@ -11,4 +11,4 @@ val now: LocalDateTime inline get() = LocalDateTime.now() val timeNow: LocalTime - inline get() = LocalTime.now() + inline get() = LocalTime.now() diff --git a/shared/date/src/test/java/team/aliens/dms/android/shared/date/junit/DateUtilsTest.kt b/shared/date/src/test/java/team/aliens/dms/android/shared/date/junit/DateUtilsTest.kt index e7021e7c1..820df6fce 100644 --- a/shared/date/src/test/java/team/aliens/dms/android/shared/date/junit/DateUtilsTest.kt +++ b/shared/date/src/test/java/team/aliens/dms/android/shared/date/junit/DateUtilsTest.kt @@ -2,7 +2,6 @@ package team.aliens.dms.android.shared.date.junit import org.junit.Test import org.threeten.bp.LocalDate -import org.threeten.bp.LocalDateTime import team.aliens.dms.android.shared.date.util.now import team.aliens.dms.android.shared.date.util.today diff --git a/shared/exception/build.gradle.kts b/shared/exception/build.gradle.kts index 12b4b96ed..a5e291b0d 100644 --- a/shared/exception/build.gradle.kts +++ b/shared/exception/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/shared/exception/src/androidTest/java/team/aliens/dms/android/shared/exception/ExampleInstrumentedTest.kt b/shared/exception/src/androidTest/java/team/aliens/dms/android/shared/exception/ExampleInstrumentedTest.kt index 416582919..88a1b5dfb 100644 --- a/shared/exception/src/androidTest/java/team/aliens/dms/android/shared/exception/ExampleInstrumentedTest.kt +++ b/shared/exception/src/androidTest/java/team/aliens/dms/android/shared/exception/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.shared.exception -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.shared.exception.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/shared/exception/src/test/java/team/aliens/dms/android/shared/exception/ExampleUnitTest.kt b/shared/exception/src/test/java/team/aliens/dms/android/shared/exception/ExampleUnitTest.kt index 42caa8aac..2d6d9e575 100644 --- a/shared/exception/src/test/java/team/aliens/dms/android/shared/exception/ExampleUnitTest.kt +++ b/shared/exception/src/test/java/team/aliens/dms/android/shared/exception/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.shared.exception +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/shared/model/build.gradle.kts b/shared/model/build.gradle.kts index 0ee37d73d..19fd6644a 100644 --- a/shared/model/build.gradle.kts +++ b/shared/model/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.ktlint.gradle) } android { diff --git a/shared/model/src/androidTest/java/team/aliens/dms/android/shared/model/ExampleInstrumentedTest.kt b/shared/model/src/androidTest/java/team/aliens/dms/android/shared/model/ExampleInstrumentedTest.kt index 00c4ebfb3..dd7f78916 100644 --- a/shared/model/src/androidTest/java/team/aliens/dms/android/shared/model/ExampleInstrumentedTest.kt +++ b/shared/model/src/androidTest/java/team/aliens/dms/android/shared/model/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package team.aliens.dms.android.shared.model -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("team.aliens.dms.android.shared.model.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/shared/model/src/test/java/team/aliens/dms/android/shared/model/ExampleUnitTest.kt b/shared/model/src/test/java/team/aliens/dms/android/shared/model/ExampleUnitTest.kt index fad073765..07b0ce93d 100644 --- a/shared/model/src/test/java/team/aliens/dms/android/shared/model/ExampleUnitTest.kt +++ b/shared/model/src/test/java/team/aliens/dms/android/shared/model/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package team.aliens.dms.android.shared.model +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/shared/validator/build.gradle.kts b/shared/validator/build.gradle.kts index 272d4d4ce..f1e2f9aa7 100644 --- a/shared/validator/build.gradle.kts +++ b/shared/validator/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("java-library") alias(libs.plugins.jetbrainsKotlinJvm) + alias(libs.plugins.ktlint.gradle) } java { @@ -10,4 +11,4 @@ java { dependencies { implementation(libs.junit) } -} \ No newline at end of file +}