Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties

plugins {
alias(libs.plugins.spot.android.application)
alias(libs.plugins.kotlin.android)
Expand All @@ -9,9 +11,12 @@ android {

// signingConfigs {
// getByName("debug") {
// keyAlias = "androiddebugkey"
// keyPassword = "android"
// storeFile = file("debug.keystore")
// val props = gradleLocalProperties(rootDir, providers)
//
// storeFile = file(props.getProperty("DEBUG_STORE_FILE"))
// storePassword = props.getProperty("DEBUG_STORE_PASSWORD")
// keyAlias = props.getProperty("DEBUG_KEY_ALIAS")
// keyPassword = props.getProperty("DEBUG_KEY_PASSWORD")
// }
// }

Expand All @@ -38,8 +43,6 @@ dependencies {
implementation(projects.feature.study)
implementation(projects.feature.signup)

implementation(projects.domain.home)

implementation(projects.core.ui)
implementation(projects.core.network)
implementation(projects.core.model)
Expand All @@ -53,4 +56,13 @@ dependencies {
implementation(projects.data.study)
implementation(projects.data.alert)
implementation(projects.data.board)
implementation(projects.data.user)
implementation(projects.data.login)

implementation(libs.kakao.common)
implementation(libs.kakao.login)
implementation(libs.kakao.auth)

implementation(libs.naver.oauth)
// implementation(libs.naver.jdk)
}
14 changes: 14 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,19 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<!-- 리다이렉트 URI: "kakao${NATIVE_APP_KEY}://oauth" -->
<data android:host="oauth"
android:scheme="kakao7878cb24cec56458df067991de5e7786" />
</intent-filter>
</activity>
</application>
</manifest>
8 changes: 8 additions & 0 deletions app/src/main/java/com/umcspot/spot/SpotApplication.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
package com.umcspot.spot

import android.app.Application
import android.util.Log
import com.umcspot.spot.buildconfig.BuildConfig
import com.kakao.sdk.common.KakaoSdk
import com.kakao.sdk.common.util.Utility
import com.navercorp.nid.NidOAuth
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class SpotApplication : Application() {
override fun onCreate() {
super.onCreate()

KakaoSdk.init(this, BuildConfig.KAKAO_NATIVE_KEY)
NidOAuth.initialize(this, BuildConfig.NAVER_CLIENT_ID, BuildConfig.NAVER_CLIENT_SECRET, BuildConfig.APP_NAME)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,51 @@ import org.gradle.api.Project
internal fun Project.configureBuildConfig(
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
val properties = gradleLocalProperties(rootDir, providers)

val baseUrl = properties.getProperty("BASE_URL") ?: ""
val kakaoNativeKey = properties.getProperty("KAKAO_NATIVE_KEY") ?: ""
val naverClientId = properties.getProperty("NAVER_CLIENT_ID") ?: ""
val naverClientSecret = properties.getProperty("NAVER_CLIENT_SECRET") ?: ""
val appName = properties.getProperty("APP_NAME") ?: "SPOT"


commonExtension.apply {
defaultConfig {
val properties = gradleLocalProperties(rootDir, providers)

buildConfigField(
"String",
"BASE_URL",
"\"${properties.getProperty("base.url") ?: "https://default-url.com/"}\""
"\"$baseUrl\""
)

buildConfigField(
"String",
"KAKAO_NATIVE_KEY",
"\"${properties.getProperty("kakao.native.key") ?: ""}\""
"\"$kakaoNativeKey\""
)

buildConfigField(
"String",
"NAVER_CLIENT_ID",
"\"$naverClientId\""
)

buildConfigField(
"String",
"NAVER_CLIENT_SECRET",
"\"$naverClientSecret\""
)

buildConfigField(
"String",
"APP_NAME",
"\"$appName\""
)
}

buildFeatures {
buildConfig = true
}
}
}
}
2 changes: 2 additions & 0 deletions core/buildconfig/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
android {
namespace = "com.umcspot.spot.buildconfig"
}


dependencies {
implementation(projects.core.common)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@file:OptIn(kotlinx.serialization.InternalSerializationApi::class)
package com.umcspot.spot.datastore


import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.umcspot.spot.datastore.di
package com.umcspot.spot.datastore

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.core.DataStoreFactory
import androidx.datastore.dataStoreFile
import com.umcspot.spot.datastore.SpotSecureDataStoreSerializer
import com.umcspot.spot.datastore.SpotTokenData
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -16,17 +14,16 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
object DataStoreModule {

@Provides
@Singleton
fun providesDataStore(
fun provideSpotTokenDataStore(
@ApplicationContext context: Context,
spotSecureDataStoreSerializer: SpotSecureDataStoreSerializer
): DataStore<SpotTokenData> =
DataStoreFactory.create(
serializer = spotSecureDataStoreSerializer
) {
context.dataStoreFile(DATASTORE_PREFERENCES)
}

private const val DATASTORE_PREFERENCES = "com.umcspot.spot.datastore"
}
serializer: SpotSecureDataStoreSerializer
): DataStore<SpotTokenData> {
return DataStoreFactory.create(
serializer = serializer,
produceFile = { context.dataStoreFile("spot_tokens.secure") }
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.umcspot.spot.designsystem.theme.*
* @param borderColor 테두리 색
*/
@Composable
fun GaugeBar(
fun GageBar(
value: Float,
modifier: Modifier = Modifier,
height: Dp = 12.dp,
Expand Down Expand Up @@ -77,7 +77,7 @@ fun GaugeBar(
@Composable
fun Preview_GaugeBar_15() {
Column(modifier = Modifier.padding(16.dp)) {
GaugeBar(
GageBar(
value = 0.15f, // 퍼센트 조절 가능
height = 12.dp,
trackColor = SpotTheme.colors.G100,
Expand All @@ -90,7 +90,7 @@ fun Preview_GaugeBar_15() {
@Composable
fun Preview_GaugeBar_75() {
Column(modifier = Modifier.padding(16.dp)) {
GaugeBar(
GageBar(
value = 0.75f, // 퍼센트 조절 가능
height = 12.dp,
trackColor = SpotTheme.colors.G100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,60 @@ package com.umcspot.spot.designsystem.component.study.section

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.umcspot.spot.designsystem.R
import com.umcspot.spot.designsystem.component.button.MultiButton
import com.umcspot.spot.model.StudyTheme
import com.umcspot.spot.ui.extension.screenHeightDp
import com.umcspot.spot.ui.extension.screenWidthDp
import com.umcspot.spot.designsystem.R
import com.umcspot.spot.designsystem.component.button.MultiButton
import kotlinx.collections.immutable.ImmutableList

@Composable
fun ActivityThemeSection(
activityTheme: StudyTheme?,
onSelect: (StudyTheme) -> Unit
selectedTheme: StudyTheme?,
onSelect: (StudyTheme) -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier = Modifier.fillMaxWidth()
) {
FlowRow(
horizontalArrangement = Arrangement.spacedBy(screenWidthDp(14.dp)),
verticalArrangement = Arrangement.spacedBy(screenHeightDp(16.dp))
) {
StudyTheme.entries.forEach { theme ->
val iconRes = when (theme) {
StudyTheme.LANGUAGE -> painterResource(R.drawable.language)
StudyTheme.LICENSE -> painterResource(R.drawable.license)
StudyTheme.EMPLOYMENT -> painterResource(R.drawable.employment)
StudyTheme.DISCUSSION -> painterResource(R.drawable.discussion)
StudyTheme.NEWS -> painterResource(R.drawable.news)
StudyTheme.SELFSTUDY -> painterResource(R.drawable.self_study)
StudyTheme.PROJECT -> painterResource(R.drawable.project)
StudyTheme.CONTEST -> painterResource(R.drawable.contest)
StudyTheme.MAJOR -> painterResource(R.drawable.major)
StudyTheme.ETC -> painterResource(R.drawable.resource_else)
}

MultiButton(
text = theme.title,
painter = iconRes,
checked = activityTheme == theme,
onClick = { onSelect(theme) },
)
}
}
}
BaseActivityThemeSection(
modifier = modifier,
isThemeSelected = { it == selectedTheme },
isThemeEnabled = { true },
onSelect = onSelect
)
}

@Composable
fun ActivityThemeSection(
selectedThemes: ImmutableList<StudyTheme>,
onSelect: (StudyTheme) -> Unit,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
maxSelection: Int = 3
) {
val isMaxSelected = selectedThemes.size >= maxSelection

BaseActivityThemeSection(
modifier = modifier,
isThemeSelected = { selectedThemes.contains(it) },

isThemeEnabled = { theme -> !isMaxSelected || selectedThemes.contains(theme) },
onSelect = onSelect
)
}

@Composable
private fun BaseActivityThemeSection(
modifier: Modifier,
isThemeSelected: (StudyTheme) -> Boolean,
isThemeEnabled: (StudyTheme) -> Boolean,
onSelect: (StudyTheme) -> Unit
) {
val themesInRows = StudyTheme.entries.chunked(2)
val isMaxSelected = selectedThemes.size >= 3

Column(
modifier = modifier,
Expand All @@ -72,31 +67,34 @@ fun ActivityThemeSection(
horizontalArrangement = Arrangement.spacedBy(screenWidthDp(14.dp))
) {
themesInRow.forEach { theme ->
val iconRes = getIconForTheme(theme)
val isChecked = selectedThemes.contains(theme)

MultiButton(
modifier = Modifier.weight(1f),
text = theme.title,
painter = iconRes,
checked = isChecked,
enabled = !isMaxSelected || isChecked,
painter = getIconForTheme(theme),
checked = isThemeSelected(theme),
enabled = isThemeEnabled(theme),
onClick = { onSelect(theme) },
)
}

if (themesInRow.size < 2) {
Spacer(modifier = Modifier.weight(1f))
}
}
}
}
}

@Composable
private fun getIconForTheme(theme: StudyTheme) = when (theme) {
StudyTheme.LANGUAGE -> painterResource(R.drawable.language)
StudyTheme.LICENSE -> painterResource(R.drawable.license)
StudyTheme.EMPLOYMENT -> painterResource(R.drawable.employment)
StudyTheme.DISCUSSION -> painterResource(R.drawable.discussion)
StudyTheme.NEWS -> painterResource(R.drawable.news)
StudyTheme.SELFSTUDY -> painterResource(R.drawable.self_study)
StudyTheme.CERTIFICATION -> painterResource(R.drawable.license)
StudyTheme.CAREER -> painterResource(R.drawable.employment)
StudyTheme.DEBATE -> painterResource(R.drawable.discussion)
StudyTheme.CURRENT_AFFAIRS -> painterResource(R.drawable.news)
StudyTheme.SELF_STUDY -> painterResource(R.drawable.self_study)
StudyTheme.PROJECT -> painterResource(R.drawable.project)
StudyTheme.CONTEST -> painterResource(R.drawable.contest)
StudyTheme.MAJOR -> painterResource(R.drawable.major)
StudyTheme.ETC -> painterResource(R.drawable.resource_else)
StudyTheme.COMPETITION -> painterResource(R.drawable.contest)
StudyTheme.MAJOR_CAREER -> painterResource(R.drawable.major)
StudyTheme.OTHER -> painterResource(R.drawable.resource_else)
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ fun StateCardActive(
borderWidth: Dp = 1.dp,
modifier: Modifier = Modifier
) = ShapeBox(

shape = shape,
color = color,
borderWidth = borderWidth,
Expand Down
Loading