Skip to content

Commit

Permalink
[MERGE] #238 -> develop
Browse files Browse the repository at this point in the history
[FEAT/#238] λ§ˆμ΄νŽ˜μ΄μ§€ / 링크 μ—°κ²°
  • Loading branch information
leeeyubin authored Sep 11, 2024
2 parents 2c6d288 + 494b8e6 commit 36d16b8
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 55 deletions.
14 changes: 0 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name="com.terning.feature.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.TerningAndroid"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true"
Expand Down
16 changes: 16 additions & 0 deletions feature/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity
android:name="com.terning.feature.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.TerningAndroid"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terning.feature.mypage.mypage

import android.content.Context
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -25,6 +27,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand All @@ -46,6 +49,11 @@ import com.terning.core.state.UiState
import com.terning.feature.R
import com.terning.feature.mypage.component.MyPageProfile
import com.terning.feature.mypage.mypage.component.MyPageItem
import com.terning.feature.mypage.mypage.util.MyPageDefaults.NOTICE_URL
import com.terning.feature.mypage.mypage.util.MyPageDefaults.OPINION_URL
import com.terning.feature.mypage.mypage.util.MyPageDefaults.PERSONAL_URL
import com.terning.feature.mypage.mypage.util.MyPageDefaults.SERVICE_URL
import com.terning.feature.mypage.mypage.util.MyPageDefaults.VERSION

@Composable
fun MyPageRoute(
Expand Down Expand Up @@ -73,7 +81,7 @@ fun MyPageRoute(
}
}

LaunchedEffect(true) {
LaunchedEffect(key1 = true) {
viewModel.getProfile()
}

Expand All @@ -87,6 +95,12 @@ fun MyPageRoute(
)

is MyPageSideEffect.ShowToast -> context.toast(sideEffect.message)
is MyPageSideEffect.NavigateToNoticeWebView -> navigateToNoticeWebView(context)
is MyPageSideEffect.NavigateToOpinionWebView -> navigateToOpinionWebView(context)
is MyPageSideEffect.NavigateToServiceWebView -> navigateToServiceWebView(context)
is MyPageSideEffect.NavigateToPersonalWebView -> navigateToPersonalWebView(
context
)
}
}
}
Expand Down Expand Up @@ -123,13 +137,13 @@ fun MyPageRoute(
is UiState.Success -> {
MyPageScreen(
paddingValues = paddingValues,
onEditClick = { viewModel.navigateToProfileEdit() },
onEditClick = viewModel::navigateToProfileEdit,
onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) },
onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) },
onNoticeClick = { viewModel.fetchShowNotice(true) },
onOpinionClick = { viewModel.fetchShowOpinion(true) },
onServiceClick = {},
onPersonalClick = {},
onServiceClick = { viewModel.fetchShowService(true) },
onPersonalClick = { viewModel.fetchShowPersonal(true) },
name = state.name,
profileImage = state.profileImage
)
Expand All @@ -145,15 +159,14 @@ fun MyPageRoute(
}
}

if (state.showNotice) {
viewModel.navigateToNoticeWebView(context)
viewModel.fetchShowNotice(false)
}
if (state.showNotice) viewModel.fetchShowNotice(false)

if (state.showOpinion) viewModel.fetchShowOpinion(false)

if (state.showService) viewModel.fetchShowService(false)

if (state.showPersonal) viewModel.fetchShowPersonal(false)

if (state.showOpinion) {
viewModel.navigateToOpinionWebView(context)
viewModel.fetchShowOpinion(false)
}
}

@Composable
Expand Down Expand Up @@ -385,7 +398,21 @@ fun ServiceInfo(
}
}

private const val VERSION = "1.0.2"
private fun navigateToNoticeWebView(context: Context) {
CustomTabsIntent.Builder().build().launchUrl(context, NOTICE_URL.toUri())
}

private fun navigateToOpinionWebView(context: Context) {
CustomTabsIntent.Builder().build().launchUrl(context, OPINION_URL.toUri())
}

private fun navigateToServiceWebView(context: Context) {
CustomTabsIntent.Builder().build().launchUrl(context, SERVICE_URL.toUri())
}

private fun navigateToPersonalWebView(context: Context) {
CustomTabsIntent.Builder().build().launchUrl(context, PERSONAL_URL.toUri())
}

@Preview(showBackground = true)
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ import androidx.annotation.StringRes

sealed class MyPageSideEffect {
data object NavigateToProfileEdit : MyPageSideEffect()
data object NavigateToNoticeWebView : MyPageSideEffect()
data object NavigateToOpinionWebView : MyPageSideEffect()
data object NavigateToServiceWebView : MyPageSideEffect()
data object NavigateToPersonalWebView : MyPageSideEffect()
data class ShowToast(@StringRes val message: Int) : MyPageSideEffect()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ data class MyPageState(
val isGetSuccess: UiState<Boolean> = UiState.Loading,
val name: String = "",
val profileImage: String = "",
val authType : String ="",
val authType: String = "",
val showNotice: Boolean = false,
val showOpinion: Boolean = false,
val showLogoutBottomSheet : Boolean = false,
val showQuitBottomSheet : Boolean = false,
val showService: Boolean = false,
val showPersonal: Boolean = false,
val showLogoutBottomSheet: Boolean = false,
val showQuitBottomSheet: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import android.content.Context
import android.content.Intent
import android.os.Handler
import android.os.Looper
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.jakewharton.processphoenix.ProcessPhoenix
Expand Down Expand Up @@ -112,39 +110,42 @@ class MyPageViewModel @Inject constructor(
}

fun fetchShowNotice(show: Boolean) {
_state.value = _state.value.copy(showNotice = show)
viewModelScope.launch {
_sideEffects.emit(MyPageSideEffect.NavigateToNoticeWebView)
_state.value = _state.value.copy(showNotice = show)
}
}

fun fetchShowOpinion(show: Boolean) {
_state.value = _state.value.copy(showOpinion = show)
viewModelScope.launch {
_sideEffects.emit(MyPageSideEffect.NavigateToOpinionWebView)
_state.value = _state.value.copy(showOpinion = show)
}
}

fun fetchShowLogoutBottomSheet(show: Boolean) {
_state.value = _state.value.copy(showLogoutBottomSheet = show)
fun fetchShowService(show: Boolean) {
viewModelScope.launch {
_sideEffects.emit(MyPageSideEffect.NavigateToServiceWebView)
_state.value = _state.value.copy(showService = show)
}
}

fun fetchShowQuitBottomSheet(show: Boolean) {
_state.value = _state.value.copy(showQuitBottomSheet = show)
fun fetchShowPersonal(show: Boolean) {
viewModelScope.launch {
_sideEffects.emit(MyPageSideEffect.NavigateToPersonalWebView)
_state.value = _state.value.copy(showPersonal = show)
}
}

fun navigateToNoticeWebView(context: Context) {
val url = NOTICE_URL.toUri()
val customTabsIntent = CustomTabsIntent.Builder().build()
customTabsIntent.launchUrl(context, url)
fun fetchShowLogoutBottomSheet(show: Boolean) {
_state.value = _state.value.copy(showLogoutBottomSheet = show)
}

fun navigateToOpinionWebView(context: Context) {
val url = OPINION_URL.toUri()
val customTabsIntent = CustomTabsIntent.Builder().build()
customTabsIntent.launchUrl(context, url)
fun fetchShowQuitBottomSheet(show: Boolean) {
_state.value = _state.value.copy(showQuitBottomSheet = show)
}

fun navigateToProfileEdit() =
viewModelScope.launch { _sideEffects.emit(MyPageSideEffect.NavigateToProfileEdit) }

companion object {
private const val NOTICE_URL =
"https://abundant-quiver-13f.notion.site/69109213e7db4873be6b9600f2f5163a"
private const val OPINION_URL = "https://forms.gle/AaLpVptfg6cATYWa7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.component.image.TerningImage
import com.terning.core.designsystem.theme.Grey350
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
Expand Down Expand Up @@ -51,7 +52,8 @@ fun MyPageItem(
Text(
text = version,
modifier = modifier.padding(end = 16.dp),
style = TerningTheme.typography.button4
style = TerningTheme.typography.button4,
color = Grey350
)
else TerningImage(painter = R.drawable.ic_my_page_go_detail)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.terning.feature.mypage.mypage.util

object MyPageDefaults {
const val VERSION = "1.1.0"
const val NOTICE_URL =
"https://abundant-quiver-13f.notion.site/Android-49b3cc2390ee4dc389e25a5097736944"
const val OPINION_URL = "https://forms.gle/AaLpVptfg6cATYWa7"
const val SERVICE_URL =
"https://abundant-quiver-13f.notion.site/69109213e7db4873be6b9600f2f5163a?pvs=4"
const val PERSONAL_URL =
"https://abundant-quiver-13f.notion.site/130cf1915fe7471e9aaf29cab306be3b?pvs=4"
}
2 changes: 1 addition & 1 deletion feature/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">터닝(terning)</string>
<string name="app_name">terning</string>

<string name="server_success">μ„œλ²„ν†΅μ‹ μ— μ„±κ³΅ν–ˆμ–΄μš”</string>
<string name="server_failure">μ„œλ²„ν†΅μ‹ μ— μ‹€νŒ¨ν–ˆμ–΄μš”</string>
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
compileSdk = "34"
minSdk = "28"
targetSdk = "34"
versionName = "1.0.2"
versionCode = "10002"
versionName = "1.1.0"
versionCode = "10100"
kotlinCompilerExtensionVersion = "1.5.0"
jvmTarget = "1.8"

Expand Down

0 comments on commit 36d16b8

Please sign in to comment.