Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release snutt 3.8.5 #388

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
Expand Down Expand Up @@ -77,9 +77,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
needs: cancel-workflow
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Run ktlintDebug
run: ./gradlew ktlintMainSourceSetCheck
- name: Upload ktlint report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: ktlint-result
Expand All @@ -44,9 +44,9 @@ jobs:
needs: static-check
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manual_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography

Expand All @@ -46,6 +47,8 @@ fun EditText(
value: String,
onValueChange: (String) -> Unit,
hint: String? = null,
hintTextColor: Color = SNUTTColors.EditTextHint,
hintTextStyle: TextStyle = SNUTTTypography.body1.copy(fontSize = 15.sp),
underlineEnabled: Boolean = true,
underlineColor: Color = SNUTTColors.Gray200,
underlineColorFocused: Color = SNUTTColors.Black900,
Expand Down Expand Up @@ -86,11 +89,11 @@ fun EditText(
modifier = Modifier.weight(1f),
) {
it()
if (value.isEmpty() && isFocused.not()) { // FIXME: lectureDetail 에서는 focus 되어 있어도 empty이면 hint 가 나와야 한다.
if (value.isEmpty()) {
hint?.let {
Text(
text = it,
style = textStyle.copy(color = SNUTTColors.Gray200),
style = hintTextStyle.copy(color = hintTextColor),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package com.wafflestudio.snutt2.components.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography

@Composable
fun EditTextFieldValue(
modifier: Modifier = Modifier,
leadingIcon: @Composable (() -> Unit) = {},
trailingIcon: @Composable (() -> Unit) = {},
keyboardOptions: KeyboardOptions = KeyboardOptions(),
keyboardActions: KeyboardActions = KeyboardActions(),
singleLine: Boolean = false,
enabled: Boolean = true,
visualTransformation: VisualTransformation = VisualTransformation.None,
value: TextFieldValue,
onValueChange: (TextFieldValue) -> Unit,
hint: String? = null,
hintTextColor: Color = SNUTTColors.EditTextHint,
hintTextStyle: TextStyle = SNUTTTypography.body1.copy(fontSize = 15.sp),
underlineEnabled: Boolean = true,
underlineColor: Color = SNUTTColors.Gray200,
underlineColorFocused: Color = SNUTTColors.Black900,
underlineWidth: Dp = 1.dp,
clearFocusFlag: Boolean = false,
textStyle: TextStyle = SNUTTTypography.subtitle1.copy(color = SNUTTColors.Black900),
) {
val focusManager = LocalFocusManager.current
LaunchedEffect(clearFocusFlag) {
if (clearFocusFlag) focusManager.clearFocus()
}

var isFocused by remember { mutableStateOf(false) }
val customTextSelectionColors = TextSelectionColors(
handleColor = SNUTTColors.Black900,
backgroundColor = SNUTTColors.Black300,
)
CompositionLocalProvider(
LocalTextSelectionColors provides customTextSelectionColors,
) {
BasicTextField(
modifier = modifier
.onFocusChanged { isFocused = it.isFocused },
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
value = value,
textStyle = textStyle,
enabled = enabled,
onValueChange = onValueChange,
singleLine = singleLine,
visualTransformation = visualTransformation,
cursorBrush = SolidColor(SNUTTColors.Black900),
decorationBox = {
Column {
Row(modifier = Modifier.fillMaxWidth()) {
leadingIcon()
Box(
modifier = Modifier.weight(1f),
) {
it()
if (value.text.isEmpty()) {
hint?.let {
Text(
text = it,
style = hintTextStyle.copy(color = hintTextColor),
)
}
}
}
trailingIcon()
}

if (underlineEnabled) {
Box(
modifier = Modifier
.padding(top = 8.dp)
.background(if (isFocused) underlineColorFocused else underlineColor)
.fillMaxWidth()
.height(underlineWidth),
)
}
}
},
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.wafflestudio.snutt2.components.compose

import androidx.compose.animation.AnimatedContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography

@Composable
fun IOSStyleTopBar(
modifier: Modifier = Modifier,
title: String,
backButtonText: String,
onBack: () -> Unit,
) {
Box(
modifier = modifier
.fillMaxWidth()
.background(color = SNUTTColors.White900)
.height(40.dp)
.drawWithCache {
onDrawWithContent {
drawLine(
color = SNUTTColors.EditTextHint,
start = Offset(0f, this.size.height), end = Offset(this.size.width, this.size.height),
strokeWidth = 0.5.dp.toPx(),
)
drawContent()
}
}
.padding(horizontal = 5.dp),
contentAlignment = Alignment.CenterStart,
) {
Row(
modifier = Modifier.clicks(1000L) { onBack() },
verticalAlignment = Alignment.CenterVertically,
) {
ArrowBackIcon(
colorFilter = ColorFilter.tint(SNUTTColors.Black900),
)
AnimatedContent(backButtonText, label = "") {
Text(
text = it,
style = SNUTTTypography.button,
)
}
}
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(
text = title,
style = SNUTTTypography.h3,
)
}
}
}

@Preview
@Composable
fun IOSStyleTopBarPreview() {
IOSStyleTopBar(
title = "비밀번호 재설정",
backButtonText = "로그인",
) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ fun CustomDialog(
}
}
}
} ?: positiveButtonText?.let {
Row(modifier = Modifier.padding(vertical = 20.dp, horizontal = 30.dp)) {
Box(modifier = Modifier.weight(1f))
Box(modifier = Modifier.clicks { onConfirm() }) {
Text(text = positiveButtonText, style = SNUTTTypography.body1)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wafflestudio.snutt2.components.compose
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -22,8 +23,8 @@ fun WebViewStyleButton(
Box(
modifier = modifier
.clicks { if (enabled) onClick() }
.background(if (enabled) enabledColor else disabledColor)
.height(60.dp),
.background(shape = RoundedCornerShape(6.dp), color = if (enabled) enabledColor else disabledColor)
.height(47.dp),
contentAlignment = Alignment.Center,
) {
content()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.MotionEvent
import android.view.View
import androidx.core.content.res.ResourcesCompat
import com.wafflestudio.snutt2.R
import com.wafflestudio.snutt2.data.SNUTTStorage
import com.wafflestudio.snutt2.lib.contains
import com.wafflestudio.snutt2.lib.getFittingTrimParam
import com.wafflestudio.snutt2.lib.network.dto.core.ClassTimeDto
Expand All @@ -18,12 +19,12 @@ import com.wafflestudio.snutt2.lib.rx.sp
import com.wafflestudio.snutt2.lib.toDayString
import com.wafflestudio.snutt2.model.BuiltInTheme
import com.wafflestudio.snutt2.model.TableTrimParam
import com.wafflestudio.snutt2.ui.isSystemDarkMode
import io.reactivex.rxjava3.core.Observable
import kotlin.math.max
import kotlin.math.min

class TimetableView : View {

private val hourLabelWidth = 24.5f.dp(context)
private val dayLabelHeight = 28.5f.dp(context)
private val cellPadding = 4.dp(context)
Expand Down Expand Up @@ -132,7 +133,29 @@ class TimetableView : View {
}

private fun init() {
setBackgroundColor(Color.rgb(255, 255, 255))
val sharedPreferences = context.getSharedPreferences(SNUTTStorage.DOMAIN_SCOPE_CURRENT_VERSION, Context.MODE_PRIVATE)
val themeMode = sharedPreferences.getString("theme_mode", null) ?: ""
val isDarkMode = when (themeMode) {
"\"DARK\"" -> true
"\"LIGHT\"" -> false
else -> isSystemDarkMode(context)
}

setBackgroundColor(
if (isDarkMode) Color.rgb(43, 43, 43) else Color.rgb(255, 255, 255),
)
linePaint.apply {
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(235, 235, 235)
}
subLinePaint.apply {
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(243, 243, 243)
}
hourLabelTextPaint.apply {
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0)
}
dayLabelTextPaint.apply {
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0)
}
}

override fun onDraw(canvas: Canvas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface UserRepository {

suspend fun verifyPwResetCode(id: String, code: String)

suspend fun resetPassword(id: String, password: String)
suspend fun resetPassword(id: String, password: String, code: String)

suspend fun sendCodeToEmail(email: String)

Expand Down
Loading
Loading