Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ID-MEMENTO into feat/#33-edit-delete-view

# Conflicts:
#	app/src/main/java/org/memento/presentation/plusbottomsheet/AddToDoEisenScreen.kt
#	gradle/libs.versions.toml
  • Loading branch information
hyoeunjoo committed Jan 20, 2025
2 parents 7fcb4c9 + e73f114 commit 42f6777
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 30 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "BASE_URL", properties["base.url"].toString())
buildConfigField("String", "WebView_URL", properties["webview.url"].toString())
}

buildTypes {
debug {
buildConfigField("String", "BASE_URL", properties["base.url"].toString())
buildConfigField("String", "WebView_URL", properties["webview.url"].toString())
}

release {
Expand Down Expand Up @@ -128,6 +130,9 @@ dependencies {
implementation(libs.firebase.analytics)
implementation(libs.firebase.auth)
implementation(libs.firebase.firestore)

// Web View
implementation(libs.accompanist.webview)
}

ktlint {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/memento/presentation/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun MainScreenContent(

BottomSheetType.DEADLINE ->
AddToDoDeadLineScreen(
onClose = { currentBottomSheet = null },
onClose = { currentBottomSheet = BottomSheetType.MAIN },
onDone = { deadLine ->
selectedDeadLine = deadLine
currentBottomSheet = BottomSheetType.MAIN
Expand All @@ -99,7 +99,7 @@ fun MainScreenContent(

BottomSheetType.TAG ->
AddToDoTagScreen(
onClose = { currentBottomSheet = null },
onClose = { currentBottomSheet = BottomSheetType.MAIN },
onDone = { tagColor ->
selectedTagColor = tagColor
currentBottomSheet = BottomSheetType.MAIN
Expand All @@ -108,7 +108,7 @@ fun MainScreenContent(

BottomSheetType.EISEN ->
AddToDoEisenScreen(
onClose = { currentBottomSheet = null },
onClose = { currentBottomSheet = BottomSheetType.MAIN },
onDone = {
},
selectedType = PriorityTagType.Immediate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import org.memento.BuildConfig
import org.memento.R
import org.memento.presentation.onboarding.component.SocialLoginButton
import org.memento.presentation.util.noRippleClickable
Expand All @@ -26,6 +31,8 @@ import org.memento.ui.theme.defaultMementoTypography

@Composable
fun LoginScreen(navigationToOnboardingScreen1: () -> Unit) {
var webViewVisible by remember { mutableStateOf(false) }

Column(
modifier =
Modifier
Expand Down Expand Up @@ -66,8 +73,17 @@ fun LoginScreen(navigationToOnboardingScreen1: () -> Unit) {
color = darkModeColors.gray04,
modifier =
Modifier
.noRippleClickable { },
.noRippleClickable {
webViewVisible = true
},
)
}
}

if (webViewVisible) {
MementoWebView(
url = BuildConfig.WebView_URL,
onClose = { webViewVisible = false },
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.memento.presentation.onboarding

import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
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 com.google.accompanist.web.WebView
import com.google.accompanist.web.rememberWebViewState

@Composable
fun MementoWebView(
url: String,
onClose: () -> Unit,
) {
val webViewState = rememberWebViewState(url = url)
var webView: WebView? by remember { mutableStateOf(null) }

BackHandler(enabled = true) {
if (webView?.canGoBack() == true) {
webView?.goBack()
} else {
onClose()
}
}
Column(modifier = Modifier.fillMaxSize()) {
WebView(
state = webViewState,
modifier = Modifier.weight(1f),
onCreated = { webViewInstance ->
with(webViewInstance) {
settings.run {
javaScriptEnabled = true
domStorageEnabled = true
javaScriptCanOpenWindowsAutomatically = false
}
webViewClient =
object : WebViewClient() {
override fun onPageFinished(
view: WebView?,
url: String?,
) {
super.onPageFinished(view, url)
}
}
}
webView = webViewInstance
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -28,7 +27,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -142,44 +141,46 @@ fun AddPlanScreen() {
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
item {
TextField(
value = eventText,
onValueChange = { eventText = it },
Box(
modifier =
Modifier
.fillMaxWidth()
.background(color = darkModeColors.gray10),
textStyle =
MementoTheme.typography.body_b_18.copy(
color = darkModeColors.white,
),
placeholder = {
Modifier.fillMaxWidth()
.padding(bottom = 3.dp),
) {
BasicTextField(
value = eventText,
onValueChange = { eventText = it },
modifier =
Modifier
.fillMaxWidth()
.background(color = darkModeColors.gray10)
.padding(horizontal = 6.dp),
textStyle =
MementoTheme.typography.body_b_18.copy(
color = darkModeColors.white,
),
cursorBrush = remember { Brush.verticalGradient(colors = listOf(darkModeColors.white, darkModeColors.white)) },
singleLine = true,
)

if (eventText.isEmpty()) {
Text(
text = "Add your event",
modifier = Modifier.padding(horizontal = 6.dp),
style =
MementoTheme.typography.body_b_18.copy(
color = darkModeColors.gray07,
),
)
},
colors =
TextFieldDefaults.colors(
focusedContainerColor = darkModeColors.gray10,
unfocusedContainerColor = darkModeColors.gray10,
cursorColor = darkModeColors.white,
unfocusedIndicatorColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
),
singleLine = true,
)
}
}
}

item {
HorizontalDivider(
modifier =
Modifier
.fillMaxWidth()
.background(darkModeColors.gray08),
.background(darkModeColors.gray07),
thickness = 2.dp,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ fun AddToDoDeadLineScreen(
Image(
painter = painterResource(R.drawable.ic_back),
contentDescription = "뒤로가기 버튼",
modifier =
Modifier.noRippleClickable {
onClose()
},
)
Text(
text = "Done",
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[versions]
accompanistWebview = "0.24.13-rc"
agp = "8.7.2"

composeWheelPicker = "1.0.0-rc01"
Expand Down Expand Up @@ -40,11 +41,14 @@ ktlint = "12.1.1"
composeMaterial = "1.4.0"
playServicesMaps = "19.0.0"
composeTesting = "1.0.0-alpha01"
webkit = "1.12.1"

[libraries]
## android
accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version.ref = "accompanistWebview" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
androidx-webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" }
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
firebase-auth = { module = "com.google.firebase:firebase-auth" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
Expand Down

0 comments on commit 42f6777

Please sign in to comment.