diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/component/BtWebView.kt b/presentation/src/main/java/com/nexters/boolti/presentation/component/BtWebView.kt
index c2e963ad..41326bfa 100644
--- a/presentation/src/main/java/com/nexters/boolti/presentation/component/BtWebView.kt
+++ b/presentation/src/main/java/com/nexters/boolti/presentation/component/BtWebView.kt
@@ -22,6 +22,9 @@ class BtWebView @JvmOverloads constructor(
val progress = _progress.asStateFlow()
init {
+ isFocusable = true
+ isFocusableInTouchMode = true
+
setupSettings()
setupWebViewClient()
}
diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/screen/showregistration/ShowRegistrationScreen.kt b/presentation/src/main/java/com/nexters/boolti/presentation/screen/showregistration/ShowRegistrationScreen.kt
index cd7d9ead..751ab3b4 100644
--- a/presentation/src/main/java/com/nexters/boolti/presentation/screen/showregistration/ShowRegistrationScreen.kt
+++ b/presentation/src/main/java/com/nexters/boolti/presentation/screen/showregistration/ShowRegistrationScreen.kt
@@ -1,10 +1,13 @@
package com.nexters.boolti.presentation.screen.showregistration
import android.annotation.SuppressLint
+import android.app.ActionBar.LayoutParams
import android.net.Uri
import android.webkit.CookieManager
import android.webkit.ValueCallback
import android.webkit.WebStorage
+import android.webkit.WebView
+import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedVisibility
@@ -12,7 +15,9 @@ import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
@@ -29,6 +34,7 @@ import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.navigation.compose.hiltViewModel
import com.nexters.boolti.presentation.BuildConfig
import com.nexters.boolti.presentation.R
+import com.nexters.boolti.presentation.component.BTDialog
import com.nexters.boolti.presentation.component.BtBackAppBar
import com.nexters.boolti.presentation.component.BtCircularProgressIndicator
import com.nexters.boolti.presentation.component.BtWebView
@@ -53,7 +59,10 @@ fun ShowRegistrationScreen(
val domain = BuildConfig.DOMAIN
val url = "https://${domain}/show/add"
+ var showExitDialog by mutableStateOf(false)
+
val scope = rememberCoroutineScope()
+ var webView: WebView? by remember { mutableStateOf(null) }
var webviewProgress by remember { mutableIntStateOf(0) }
val loading by remember { derivedStateOf { webviewProgress < 100 } }
@@ -73,12 +82,16 @@ fun ShowRegistrationScreen(
}
}
+ BackHandler {
+ if (webView?.canGoBack() == true) webView?.goBack() else showExitDialog = true
+ }
+
Scaffold(
modifier = modifier,
topBar = {
BtBackAppBar(
title = stringResource(R.string.my_register_show),
- onClickBack = onClickBack,
+ onClickBack = { showExitDialog = true },
)
},
) { innerPadding ->
@@ -90,6 +103,11 @@ fun ShowRegistrationScreen(
AndroidView(
factory = { context ->
BtWebView(context).apply {
+ layoutParams = LayoutParams(
+ LayoutParams.MATCH_PARENT,
+ LayoutParams.MATCH_PARENT,
+ )
+
setWebChromeClient(
launchActivity = { launcher.launch(arrayOf("image/*")) },
setFilePathCallback = { callback -> filePathCallback = callback },
@@ -99,7 +117,7 @@ fun ShowRegistrationScreen(
scope.launch {
progress.collect { webviewProgress = it }
}
- }
+ }.also { webView = it }
},
update = { webView -> webView.loadUrl(url) },
)
@@ -111,6 +129,21 @@ fun ShowRegistrationScreen(
) {
BtCircularProgressIndicator()
}
+
+ if (showExitDialog) {
+ BTDialog(
+ positiveButtonLabel = stringResource(R.string.btn_exit),
+ onClickPositiveButton = onClickBack,
+ onClickNegativeButton = { showExitDialog = false },
+ onDismiss = { showExitDialog = false },
+ ) {
+ Text(
+ text = stringResource(R.string.exit_register_msg),
+ style = MaterialTheme.typography.titleLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ }
}
}
}
diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml
index 75f44107..3dccb7ce 100644
--- a/presentation/src/main/res/values/strings.xml
+++ b/presentation/src/main/res/values/strings.xml
@@ -264,6 +264,7 @@
입장 확인
정말 로그아웃 하시겠어요?
공연 등록
+ 공연 등록을 종료하시겠어요?
프로필 보기
계정 설정
내 공연