-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
2,061 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...on/src/androidMain/kotlin/team/aliens/dms/kmp/core/common/timer/CountDownTimer.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package team.aliens.dms.kmp.core.common.timer | ||
|
||
import android.os.CountDownTimer | ||
|
||
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") | ||
actual class CountDownTimer { | ||
private var timer: CountDownTimer? = null | ||
|
||
actual fun start( | ||
durationMillis: Long, | ||
intervalMillis: Long, | ||
listener: CountDownTimerListener, | ||
) { | ||
timer = object : CountDownTimer(durationMillis, intervalMillis) { | ||
override fun onTick(millisUntilFinished: Long) { | ||
listener.onTick(millisUntilFinished) | ||
} | ||
|
||
override fun onFinish() { | ||
listener.onFinish() | ||
} | ||
}.start() | ||
} | ||
|
||
actual fun stop() { | ||
timer?.cancel() | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
core/common/src/commonMain/kotlin/team/aliens/dms/kmp/core/common/timer/CountDownTimer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package team.aliens.dms.kmp.core.common.timer | ||
|
||
interface CountDownTimerListener { | ||
fun onTick(timeLeft: Long) | ||
fun onFinish() | ||
} | ||
|
||
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") | ||
expect class CountDownTimer() { | ||
fun start( | ||
durationMillis: Long, | ||
intervalMillis: Long, | ||
listener: CountDownTimerListener, | ||
) | ||
|
||
fun stop() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
core/common/src/commonMain/kotlin/team/aliens/dms/kmp/core/common/utils/Regex.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package team.aliens.dms.kmp.core.common.utils | ||
|
||
object Regex { | ||
const val PASSWORD = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@\$!%*#?&])[A-Za-z\\d@\$!%*#?&]{8,20}\$" | ||
} |
5 changes: 5 additions & 0 deletions
5
core/common/src/commonMain/kotlin/team/aliens/dms/kmp/core/common/utils/ResourceKeys.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package team.aliens.dms.kmp.core.common.utils | ||
|
||
object ResourceKeys { | ||
const val SIGN_UP = "signUp" | ||
} |
35 changes: 35 additions & 0 deletions
35
core/common/src/iosMain/kotlin/team/aliens/dms/kmp/core/common/timer/CountDownTimer.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package team.aliens.dms.kmp.core.common.timer | ||
|
||
import platform.Foundation.NSTimer | ||
import kotlin.native.concurrent.freeze | ||
|
||
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") | ||
actual class CountDownTimer { | ||
private var timer: NSTimer? = null | ||
private var timeLeft: Long = 0 | ||
|
||
actual fun start( | ||
durationMillis: Long, | ||
intervalMillis: Long, | ||
listener: CountDownTimerListener, | ||
) { | ||
timeLeft = durationMillis | ||
listener.freeze() | ||
val intervalSeconds = intervalMillis / 1000.0 | ||
|
||
timer = NSTimer.scheduledTimerWithTimeInterval(intervalSeconds, true) { | ||
timeLeft -= intervalMillis | ||
if (timeLeft > 0) { | ||
listener.onTick(timeLeft) | ||
} else { | ||
listener.onFinish() | ||
stop() | ||
} | ||
} | ||
} | ||
|
||
actual fun stop() { | ||
timer?.invalidate() | ||
timer = null | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
core/common/src/jvmMain/kotlin/team/aliens/dms/kmp/core/common/timer/CountDownTimer.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package team.aliens.dms.kmp.core.common.timer | ||
|
||
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") | ||
actual class CountDownTimer { | ||
actual fun start( | ||
durationMillis: Long, | ||
intervalMillis: Long, | ||
listener: CountDownTimerListener, | ||
) { | ||
} | ||
|
||
actual fun stop() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...rc/androidMain/kotlin/team/aliens/dms/kmp/core/designsystem/webview/DmsWebView.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package team.aliens.dms.kmp.core.designsystem.webview | ||
|
||
import android.graphics.Bitmap | ||
import android.webkit.WebResourceError | ||
import android.webkit.WebResourceRequest | ||
import android.webkit.WebView | ||
import android.webkit.WebViewClient | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.CircularProgressIndicator | ||
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.platform.LocalContext | ||
import androidx.compose.ui.viewinterop.AndroidView | ||
import team.aliens.dms.kmp.core.designsystem.foundation.DmsTheme | ||
import team.aliens.dms.kmp.core.designsystem.status.ErrorStatus | ||
import team.aliens.dms.kmp.core.designsystem.webview.exception.WebViewErrorException | ||
|
||
@Composable | ||
actual fun DmsWebView( | ||
modifier: Modifier, | ||
url: String, | ||
) { | ||
val context = LocalContext.current | ||
var isLoading by remember { mutableStateOf(true) } | ||
var isError by remember { mutableStateOf(false) } | ||
|
||
Box( | ||
modifier = modifier, | ||
contentAlignment = Alignment.Center, | ||
) { | ||
AndroidView( | ||
factory = { | ||
WebView(context).apply { | ||
webViewClient = object : WebViewClient() { | ||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { | ||
super.onPageStarted(view, url, favicon) | ||
isLoading = true | ||
} | ||
|
||
override fun onPageFinished(view: WebView?, url: String?) { | ||
super.onPageFinished(view, url) | ||
isLoading = false | ||
} | ||
|
||
override fun onReceivedError( | ||
view: WebView?, | ||
request: WebResourceRequest?, | ||
error: WebResourceError?, | ||
) { | ||
super.onReceivedError(view, request, error) | ||
isLoading = false | ||
try { | ||
throw WebViewErrorException("WebView error: ${error?.description}") | ||
} catch (e: Exception) { | ||
e.printStackTrace() | ||
isError = true | ||
} | ||
} | ||
|
||
override fun shouldOverrideUrlLoading( | ||
view: WebView?, | ||
request: WebResourceRequest?, | ||
): Boolean { | ||
return false | ||
} | ||
} | ||
settings.javaScriptEnabled = true | ||
} | ||
}, | ||
update = { it.loadUrl(url) }, | ||
) | ||
|
||
if (isLoading) { | ||
CircularProgressIndicator() | ||
} | ||
|
||
if (isError) { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(DmsTheme.colors.onBackground), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
ErrorStatus(title = "화면을 불러오지 못했어요.") | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...n/kotlin/team/aliens/dms/kmp/core/designsystem/webview/exception/WebViewErrorException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package team.aliens.dms.kmp.core.designsystem.webview.exception | ||
|
||
class WebViewErrorException(message: String) : Exception(message) |
13 changes: 13 additions & 0 deletions
13
core/design-system/src/commonMain/composeResources/drawable/ic_alarm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="20dp" | ||
android:height="20dp" | ||
android:viewportWidth="20" | ||
android:viewportHeight="20"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h20v20h-20z"/> | ||
<path | ||
android:pathData="M10.542,10.455V7.539C10.542,7.391 10.49,7.264 10.387,7.159C10.285,7.053 10.157,7 10.005,7C9.852,7 9.723,7.051 9.617,7.154C9.511,7.256 9.459,7.383 9.459,7.535V10.658C9.459,10.746 9.477,10.83 9.513,10.91C9.549,10.989 9.602,11.063 9.671,11.132L11.851,13.313C11.967,13.428 12.094,13.483 12.234,13.479C12.374,13.475 12.505,13.412 12.625,13.292C12.746,13.171 12.806,13.042 12.806,12.905C12.806,12.767 12.746,12.638 12.625,12.518L10.542,10.455ZM10,17.583C9.087,17.583 8.231,17.411 7.432,17.065C6.634,16.72 5.938,16.25 5.344,15.656C4.75,15.062 4.28,14.366 3.935,13.568C3.59,12.769 3.417,11.913 3.417,11C3.417,10.087 3.59,9.231 3.935,8.432C4.28,7.634 4.75,6.938 5.344,6.344C5.938,5.75 6.634,5.28 7.432,4.935C8.231,4.589 9.087,4.417 10,4.417C10.914,4.417 11.77,4.589 12.568,4.935C13.366,5.28 14.062,5.75 14.656,6.344C15.25,6.938 15.72,7.634 16.065,8.432C16.411,9.231 16.583,10.087 16.583,11C16.583,11.913 16.411,12.769 16.065,13.568C15.72,14.366 15.25,15.062 14.656,15.656C14.062,16.25 13.366,16.72 12.568,17.065C11.77,17.411 10.914,17.583 10,17.583ZM2.242,6.442C2.121,6.322 2.061,6.193 2.061,6.055C2.061,5.918 2.121,5.789 2.242,5.668L4.689,3.221C4.805,3.106 4.932,3.047 5.072,3.044C5.212,3.041 5.343,3.1 5.463,3.221C5.584,3.342 5.644,3.471 5.644,3.608C5.644,3.746 5.584,3.875 5.463,3.995L2.995,6.463C2.88,6.579 2.756,6.634 2.623,6.63C2.49,6.626 2.363,6.563 2.242,6.442ZM17.779,6.442C17.658,6.563 17.529,6.623 17.392,6.623C17.255,6.623 17.126,6.563 17.005,6.442L14.558,3.995C14.443,3.88 14.384,3.752 14.381,3.612C14.378,3.472 14.437,3.342 14.558,3.221C14.679,3.1 14.808,3.04 14.945,3.04C15.082,3.04 15.211,3.1 15.332,3.221L17.779,5.689C17.894,5.805 17.953,5.929 17.956,6.062C17.959,6.195 17.9,6.322 17.779,6.442Z" | ||
android:fillColor="#B3B7BB"/> | ||
</group> | ||
</vector> |
13 changes: 13 additions & 0 deletions
13
core/design-system/src/commonMain/composeResources/drawable/ic_check.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h24v24h-24z"/> | ||
<path | ||
android:pathData="M9.55,15.516L18.188,6.877C18.337,6.728 18.511,6.652 18.71,6.649C18.91,6.646 19.087,6.722 19.242,6.877C19.397,7.032 19.475,7.21 19.475,7.412C19.475,7.613 19.397,7.791 19.242,7.946L10.182,17.021C10.002,17.202 9.791,17.292 9.55,17.292C9.309,17.292 9.098,17.202 8.917,17.021L4.742,12.846C4.593,12.697 4.52,12.521 4.522,12.316C4.524,12.112 4.602,11.932 4.758,11.777C4.913,11.622 5.091,11.544 5.292,11.544C5.493,11.544 5.672,11.622 5.827,11.777L9.55,15.516Z" | ||
android:fillColor="#919297"/> | ||
</group> | ||
</vector> |
Oops, something went wrong.