Skip to content

Commit

Permalink
Release/v1.3.6
Browse files Browse the repository at this point in the history
Release/v1.3.6
  • Loading branch information
parkuiery authored Jun 14, 2024
2 parents d3d64bb + 50d491f commit a3a28f0
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 28 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()

versionCode = 14
versionName = "1.3.5"
versionCode = 15
versionName = "1.3.6"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -121,4 +121,6 @@ dependencies {

testImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.junit)

implementation(libs.app.update)
}
23 changes: 23 additions & 0 deletions app/src/main/java/team/aliens/dms/android/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSiz
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.core.view.WindowCompat
import com.google.accompanist.adaptive.calculateDisplayFeatures
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.AppUpdateType
import com.google.android.play.core.install.model.UpdateAvailability
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.StateFlow
import team.aliens.dms.android.core.designsystem.DmsTheme
Expand All @@ -30,6 +33,7 @@ class MainActivity : ComponentActivity() {
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
)

checkAppUpdate()
setContent {
val windowSizeClass = calculateWindowSizeClass(activity = this)
val displayFeatures = calculateDisplayFeatures(activity = this)
Expand All @@ -43,4 +47,23 @@ class MainActivity : ComponentActivity() {
}
}
}

private fun checkAppUpdate() {
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfoTask = appUpdateManager.appUpdateInfo

appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
val isUpdateAvailable =
appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE

if (isUpdateAvailable && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
AppUpdateType.IMMEDIATE,
this,
0,
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
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
Expand All @@ -46,8 +47,8 @@ fun PasswordTextField(
textStyle: TextStyle = DmsTheme.typography.body2,
hintText: String = "",
trailingIcon: Pair<Painter, Painter> = Pair(
painterResource(id = R.drawable.ic_password_invisible),
painterResource(id = R.drawable.ic_password_visible),
painterResource(id = DmsIcon.PasswordVisible),
painterResource(id = DmsIcon.PasswordInvisible),
),
supportingText: @Composable (() -> Unit)? = null,
isError: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,11 @@ private fun NoticeCard(
}

private val LocalDateTime.text: String
@Composable inline get() = "${this.year}-${this.monthValue}-${this.dayOfMonth} ${this.hour}:${this.minute}"
@Composable inline get() = stringResource(
id = R.string.format_notice_time,
this.year,
this.monthValue,
this.dayOfMonth,
this.hour,
this.minute,
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ 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
Expand All @@ -39,6 +43,7 @@ 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
Expand All @@ -52,6 +57,8 @@ internal fun ApplicationScreen(
val viewModel: ApplicationViewModel = hiltViewModel()
val uiState by viewModel.stateFlow.collectAsStateWithLifecycle()

LocalLifecycleOwner.current.lifecycle.addObserver(viewModel)

Scaffold(
modifier = modifier,
topBar = {
Expand Down Expand Up @@ -141,9 +148,9 @@ private fun ApplicationCard(
enter = slideInVertically() + fadeIn(),
exit = slideOutVertically() + fadeOut(),
) {
if (appliedTitle != null) {
if(appliedTitle!= null) {
RoundedButton(
onClick = {},
onClick = { },
fillMinSize = false,
contentPadding = PaddingValues(
horizontal = PaddingDefaults.Medium,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package team.aliens.dms.android.feature.main.application

import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
Expand All @@ -20,10 +22,15 @@ internal class ApplicationViewModel @Inject constructor(
private val remainsRepository: RemainsRepository,
) : BaseMviViewModel<ApplicationUiState, ApplicationIntent, ApplicationSideEffect>(
initialState = ApplicationUiState.initial(),
) {
init {
fetchAppliedStudyRoom()
fetchAppliedRemainsOption()
), DefaultLifecycleObserver {

override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
// TODO: onDispose를 이용하여 이벤트 넘기기
viewModelScope.launch {
fetchAppliedStudyRoom()
fetchAppliedRemainsOption()
}
}

private fun fetchAppliedStudyRoom() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,14 @@ private enum class PointCardType {

val contentColor: Color
@Composable inline get() = when (this) {
BONUS -> DmsTheme.colorScheme.error
MINUS -> DmsTheme.colorScheme.primary
BONUS -> DmsTheme.colorScheme.primary
MINUS -> DmsTheme.colorScheme.error
}

val borderColor: Color
@Composable inline get() = when (this) {
BONUS -> DmsTheme.colorScheme.error
MINUS -> DmsTheme.colorScheme.primary
BONUS -> DmsTheme.colorScheme.primary
MINUS -> DmsTheme.colorScheme.error
}

val text: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.unit.dp
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
Expand Down Expand Up @@ -88,7 +89,7 @@ internal fun NoticeDetailsScreen(
modifier = Modifier
.fillMaxWidth()
.horizontalPadding(),
text = uiState.createdAt.toString(),
text = uiState.createdAt!!.text,
style = DmsTheme.typography.caption,
color = DmsTheme.colorScheme.onSurfaceVariant,
)
Expand Down Expand Up @@ -125,3 +126,14 @@ internal fun NoticeDetailsScreen(
}
}
}

private val LocalDateTime.text: String
@Composable inline get() = stringResource(
id = R.string.format_notice_time,
this.year,
this.monthValue,
this.dayOfMonth,
this.hour,
this.minute,
)

Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import com.ramcosta.composedestinations.annotation.Destination
import org.threeten.bp.DayOfWeek
import team.aliens.dms.android.core.designsystem.ButtonDefaults
import team.aliens.dms.android.core.designsystem.ContainedButton
import team.aliens.dms.android.core.designsystem.Scaffold
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.RoundedButton
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.VerticallyFadedLazyColumn
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -73,7 +73,7 @@ internal fun RemainsApplicationScreen(
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),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -19,9 +20,10 @@ 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.DmsIcon
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.VerificationCodeInput
import team.aliens.dms.android.core.designsystem.VerificationCodeInputDefaults
import team.aliens.dms.android.core.ui.Banner
Expand All @@ -46,6 +48,12 @@ internal fun EnterSchoolVerificationCodeScreen(
val toast = LocalToast.current
val context = LocalContext.current

LaunchedEffect(uiState.schoolVerificationCode) {
if (uiState.schoolVerificationCode.length == SignUpViewModel.SCHOOL_VERIFICATION_CODE_LENGTH) {
viewModel.postIntent(SignUpIntent.ExamineSchoolVerificationCode)
}
}

viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect ->
when (sideEffect) {
SignUpSideEffect.SchoolVerificationCodeExamined -> navigator.openEnterSchoolVerificationQuestion()
Expand All @@ -66,7 +74,7 @@ internal fun EnterSchoolVerificationCodeScreen(
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),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
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
Expand Down Expand Up @@ -79,6 +80,12 @@ internal fun SignUpEnterEmailVerificationCodeScreen(
}
}

LaunchedEffect(uiState.emailVerificationCode) {
if (uiState.emailVerificationCode.length == SignUpViewModel.EMAIL_VERIFICATION_CODE_LENGTH) {
viewModel.postIntent(SignUpIntent.CheckEmailVerificationCode)
}
}

LaunchedEffect(uiState.sessionId) {
timer.start()
}
Expand Down Expand Up @@ -122,7 +129,7 @@ internal fun SignUpEnterEmailVerificationCodeScreen(
navigationIcon = {
IconButton(onClick = navigator::popUpToEnterEmail) {
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),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -77,6 +79,9 @@ internal fun SetIdScreen(
val toast = LocalToast.current
val context = LocalContext.current

val classFocusRequest = remember { FocusRequester() }
val numberFocusRequest = remember { FocusRequester() }

val (studentConfirmed, onStudentConfirmedChange) = remember { mutableStateOf(false) }

val (gradeClassNumberError, setGradeClassNumberError) = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -165,10 +170,14 @@ internal fun SetIdScreen(
horizontalArrangement = Arrangement.spacedBy(DefaultHorizontalSpace),
) {
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f),
value = uiState.grade,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_grade)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateGrade(value = it)) },
onValueChange = { grade ->
viewModel.postIntent(SignUpIntent.UpdateGrade(value = grade))
if (grade.isNotEmpty()) classFocusRequest.requestFocus()
},
supportingText = {},
isError = gradeClassNumberError,
enabled = !studentConfirmed,
Expand All @@ -178,10 +187,15 @@ internal fun SetIdScreen(
),
)
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.focusRequester(classFocusRequest),
value = uiState.classroom,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_class)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateClass(value = it)) },
onValueChange = { classRoom ->
viewModel.postIntent(SignUpIntent.UpdateClass(value = classRoom))
if (classRoom.isNotEmpty()) numberFocusRequest.requestFocus()
},
supportingText = {},
isError = gradeClassNumberError,
enabled = !studentConfirmed,
Expand All @@ -191,7 +205,9 @@ internal fun SetIdScreen(
),
)
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.focusRequester(numberFocusRequest),
value = uiState.number,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_number)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateNumber(value = it)) },
Expand Down
2 changes: 2 additions & 0 deletions feature/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@

<string name="notice_new_notice_exists">새로운 공지사항이 있습니다</string>
<string name="notice_notices_not_exists">공지사항이 없습니다</string>

<string name="format_notice_time">%d/%d/%d %d:%d</string>

<!--my page-->
<string name="my_page_sign_out">로그아웃</string>
Expand Down
Loading

0 comments on commit a3a28f0

Please sign in to comment.