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

Feature/#71 login #74

Merged
merged 9 commits into from
Dec 28, 2023
4 changes: 4 additions & 0 deletions app-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ android {
}

dependencies {
implementation(projects.core.designsystem)
implementation(projects.feature.navigator)

implementation(projects.remote.openmajor)
Expand All @@ -28,10 +29,12 @@ dependencies {
implementation(projects.remote.signup)
implementation(projects.remote.notice)
implementation(projects.remote.user)
implementation(projects.remote.login)

implementation(projects.local.openmajor)
implementation(projects.local.timetable)
implementation(projects.local.user)
implementation(projects.local.login)

implementation(projects.data.openmajor)
implementation(projects.data.timetable)
Expand All @@ -41,6 +44,7 @@ dependencies {
implementation(projects.data.user)
implementation(projects.data.notice)
implementation(projects.data.signup)
implementation(projects.data.login)

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.crashlytics)
Expand Down
5 changes: 3 additions & 2 deletions app-compose/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_logo"
android:supportsRtl="true"
android:theme="@style/Theme.Suwiki"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup"
tools:targetApi="s" />

Expand Down
Binary file added app-compose/src/main/ic_logo-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package com.suwiki.core.android

import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import com.suwiki.core.model.exception.UnknownException

fun throwUnknownException(
fun recordException(
e: Throwable,
) {
Firebase.crashlytics.recordException(e)
throw e.message?.let { UnknownException(it) } ?: UnknownException()
}
Binary file added core/designsystem/src/main/ic_logo-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
package com.suwiki.core.designsystem.component.bottomsheet

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.suwiki.core.designsystem.component.align.SuwikiAlignContainer
import com.suwiki.core.designsystem.theme.Gray95
import com.suwiki.core.designsystem.theme.SuwikiTheme
import com.suwiki.core.designsystem.theme.White

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SuwikiBottomSheet(
sheetState: SheetState = rememberModalBottomSheetState(),
isSheetOpen: Boolean,
onDismissRequest: () -> Unit = {},
bottomSheetItem: List<@Composable () -> Unit>,
content: @Composable ColumnScope.() -> Unit,
) {
if (isSheetOpen) {
ModalBottomSheet(
sheetState = sheetState,
shape = RoundedCornerShape(topStart = 28.dp, topEnd = 28.dp),
onDismissRequest = onDismissRequest,
containerColor = White,
dragHandle = null,
) {
Spacer(modifier = Modifier.height(36.dp))
bottomSheetItem.forEach { item ->
item()
}
content()
}
}
}
Expand All @@ -60,10 +60,10 @@ fun SuwikiBottomSheetItem(
)
}

@OptIn(ExperimentalMaterial3Api::class)
@Preview
@Composable
fun SuwikiBottomSheetPreview() {
var isChecked by remember { mutableStateOf(false) }
var isSheetOpen by rememberSaveable { mutableStateOf(false) }

// ํ…Œ์ŠคํŠธ์šฉ ๋ฒ„ํŠผ
Expand All @@ -75,16 +75,7 @@ fun SuwikiBottomSheetPreview() {
SuwikiBottomSheet(
isSheetOpen = isSheetOpen,
onDismissRequest = { isSheetOpen = !isSheetOpen },
bottomSheetItem = listOf(
{ SuwikiBottomSheetItem(title = "ํƒ€์ดํ‹€") },
{
SuwikiAlignContainer(
text = "๋ฉ”๋‰ด",
isChecked = isChecked,
onClick = { isChecked = !isChecked },
)
},
),
content = {},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ fun SuwikiDialog(
headerText: String,
bodyText: String,
confirmButtonText: String,
dismissButtonText: String,
dismissButtonText: String? = null,
onDismissRequest: () -> Unit,
onClickConfirm: () -> Unit,
onClickDismiss: () -> Unit,
onClickDismiss: () -> Unit = {},
) {
Dialog(
onDismissRequest = onDismissRequest,
Expand All @@ -60,12 +60,14 @@ fun SuwikiDialog(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
) {
Text(
modifier = Modifier.suwikiClickable(rippleEnabled = false, onClick = onClickDismiss),
text = dismissButtonText,
style = SuwikiTheme.typography.body4,
color = Gray95,
)
if (dismissButtonText != null) {
Text(
modifier = Modifier.suwikiClickable(rippleEnabled = false, onClick = onClickDismiss),
text = dismissButtonText,
style = SuwikiTheme.typography.body4,
color = Gray95,
)
}

Spacer(modifier = Modifier.width(30.dp))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.suwiki.core.designsystem.component.loading

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.suwiki.core.designsystem.theme.Primary
import com.suwiki.core.ui.extension.suwikiClickable

@Composable
fun LoadingScreen(modifier: Modifier = Modifier) {
Box(
modifier = modifier.fillMaxSize().suwikiClickable(rippleEnabled = false, onClick = {}),
contentAlignment = Alignment.Center,
) {
CircularProgressIndicator(
modifier = Modifier.size(36.dp),
strokeWidth = 4.dp,
color = Primary,
trackColor = Color.Transparent,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -24,9 +26,14 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.painterResource
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 com.suwiki.core.designsystem.R
import com.suwiki.core.designsystem.component.button.TextFieldClearButton
import com.suwiki.core.designsystem.theme.Black
import com.suwiki.core.designsystem.theme.Error
Expand All @@ -36,9 +43,10 @@ import com.suwiki.core.designsystem.theme.GrayF6
import com.suwiki.core.designsystem.theme.Primary
import com.suwiki.core.designsystem.theme.SuwikiTheme
import com.suwiki.core.designsystem.theme.White
import com.suwiki.core.ui.extension.suwikiClickable

@Composable
fun SuwikiTextFieldRegular(
fun SuwikiRegularTextField(
modifier: Modifier = Modifier,
label: String? = "",
placeholder: String = "",
Expand All @@ -51,6 +59,9 @@ fun SuwikiTextFieldRegular(
minLines: Int = 1,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
showEyeIcon: Boolean = false,
onClickEyeIcon: () -> Unit = {},
showValue: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) {
val isFocused by interactionSource.collectIsFocusedAsState()
Expand Down Expand Up @@ -78,6 +89,7 @@ fun SuwikiTextFieldRegular(
textStyle = SuwikiTheme.typography.header4.copy(color = Black),
interactionSource = interactionSource,
cursorBrush = SolidColor(Primary),
visualTransformation = if (showValue) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
decorationBox = { innerText ->
Expand Down Expand Up @@ -116,9 +128,25 @@ fun SuwikiTextFieldRegular(
}

if (value.isNotEmpty()) {
TextFieldClearButton(
onClick = onClickClearButton,
)
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
if (showEyeIcon) {
Icon(
modifier = modifier
.size(24.dp)
.clip(CircleShape)
.suwikiClickable(onClick = onClickEyeIcon),
painter = painterResource(id = if (showValue) R.drawable.ic_eye_off else R.drawable.ic_eye_on),
tint = Gray95,
contentDescription = "",
)
}

TextFieldClearButton(
onClick = onClickClearButton,
)
}
}
}

Expand All @@ -145,7 +173,7 @@ fun SuwikiTextFieldRegular(

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun SuwikiTextFieldRegularPreview() {
fun SuwikiRegularTextFieldPreview() {
SuwikiTheme {
var normalValue by remember {
mutableStateOf("")
Expand All @@ -159,7 +187,7 @@ fun SuwikiTextFieldRegularPreview() {
modifier = Modifier.background(White),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
SuwikiTextFieldRegular(
SuwikiRegularTextField(
label = "๋ผ๋ฒจ",
placeholder = "ํ”Œ๋ ˆ์ด์Šค ํ™€๋”",
value = normalValue,
Expand All @@ -168,7 +196,7 @@ fun SuwikiTextFieldRegularPreview() {
helperText = "๋„์›€๋ง ๋ฉ”์„ธ์ง€",
)

SuwikiTextFieldRegular(
SuwikiRegularTextField(
label = "๋ผ๋ฒจ",
placeholder = "ํ”Œ๋ ˆ์ด์Šค ํ™€๋”",
value = errorValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.suwiki.core.designsystem.theme.Primary
import com.suwiki.core.designsystem.theme.SuwikiTheme

@Composable
fun SuwikiTextFieldReview(
fun SuwikiReviewInputBox(
modifier: Modifier = Modifier,
hint: String = "",
value: String = "",
Expand Down Expand Up @@ -74,7 +74,7 @@ fun SuwikiTextFieldReview(

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun SuwikiTextFieldReviewPreview() {
fun SuwikiReviewInputBoxPreview() {
SuwikiTheme {
var normalValue by remember {
mutableStateOf("")
Expand All @@ -84,13 +84,13 @@ fun SuwikiTextFieldReviewPreview() {
modifier = Modifier.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
SuwikiTextFieldReview(
SuwikiReviewInputBox(
hint = "๊ฐ•์˜ํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”",
value = normalValue,
onValueChange = { normalValue = it },
)

SuwikiTextFieldReview(
SuwikiReviewInputBox(
hint = "๊ฐ•์˜ํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”",
value = normalValue,
isError = true,
Expand Down
Loading