Skip to content

Commit

Permalink
[PC-92] Resolve Conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Dec 26, 2024
2 parents 6d361ed + c36817a commit ed034e6
Show file tree
Hide file tree
Showing 15 changed files with 372 additions and 23 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .github/workflows/android_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up local.properties
run: |
echo "KAKAO_APP_KEY=${{ secrets.KAKAO_APP_KEY }}" >> local.properties
- name: Build with Gradle
run: ./gradlew assembleDebug --build-cache --stacktrace

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set up local.properties
run: |
echo "KAKAO_APP_KEY=${{ secrets.KAKAO_APP_KEY }}" >> local.properties
- name: Build with Gradle
run: ./gradlew assembleDebug --build-cache --stacktrace

Expand Down
9 changes: 9 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Properties

plugins {
id("piece.android.application")
id("piece.android.compose")
Expand All @@ -12,6 +14,11 @@ android {
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

val localProperties = Properties()
localProperties.load(project.rootProject.file("local.properties").bufferedReader())
manifestPlaceholders["KAKAO_APP_KEY"] = localProperties["KAKAO_APP_KEY"] as String
buildConfigField("String", "KAKAO_APP_KEY", "\"${localProperties["KAKAO_APP_KEY"]}\"")
}

packaging { resources { excludes += "/META-INF/*" } }
Expand All @@ -36,6 +43,8 @@ dependencies {
implementation(libs.mavericks)
implementation(libs.mavericks.hilt)

implementation(libs.kakao.user)

implementation(projects.feature.auth)
implementation(projects.feature.etc)
implementation(projects.feature.matching)
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".PieceApplication"
android:allowBackup="true"
Expand All @@ -24,6 +26,18 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<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" />

<data android:host="oauth"
android:scheme="kakao${KAKAO_APP_KEY}" />
</intent-filter>
</activity>
</application>
</manifest>
7 changes: 6 additions & 1 deletion app/src/main/java/com/puzzle/piece/PieceApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ package com.puzzle.piece

import android.app.Application
import com.airbnb.mvrx.Mavericks
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class PieceApplication : Application() {
override fun onCreate() {
super.onCreate()
Mavericks.initialize(this)
initMavericks()
initKakao()
}

private fun initMavericks() = Mavericks.initialize(this)
private fun initKakao() = KakaoSdk.init(this, BuildConfig.KAKAO_APP_KEY)
}
12 changes: 9 additions & 3 deletions app/src/main/java/com/puzzle/piece/ui/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import com.puzzle.navigation.AuthGraph
import com.puzzle.navigation.EtcRoute
import com.puzzle.navigation.MatchingGraph
import com.puzzle.navigation.MatchingGraphDest.MatchingDetailRoute
import com.puzzle.navigation.MyPageRoute
import com.puzzle.navigation.Route
import com.puzzle.piece.navigation.AppNavHost
Expand All @@ -35,7 +36,7 @@ fun App(

Scaffold(
bottomBar = {
if (currentDestination?.isHideBottomNavigationRoute() == false) {
if (currentDestination?.shouldHideBottomNavigation() == false) {
AppBottomBar(
currentDestination = currentDestination,
navigateToTopLevelDestination = navigateToTopLevelDestination,
Expand Down Expand Up @@ -82,12 +83,17 @@ private fun AppBottomBar(
}
}

private val HIDDEN_BOTTOM_NAV_ROUTES = setOf(
AuthGraph::class.qualifiedName,
MatchingDetailRoute::class.qualifiedName
)

/**
* 현재 목적지가 바텀 네비게이션이 보여지지 않는 화면인지 확인하는 메서드
*/
private fun NavDestination?.isHideBottomNavigationRoute(): Boolean =
private fun NavDestination?.shouldHideBottomNavigation(): Boolean =
this?.hierarchy?.any { destination ->
destination.route == AuthGraph::class.qualifiedName
destination.route in HIDDEN_BOTTOM_NAV_ROUTES
} ?: false

/**
Expand Down
4 changes: 4 additions & 0 deletions feature/auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ plugins {
android {
namespace = "com.puzzle.auth"
}

dependencies {
implementation(libs.kakao.user)
}
24 changes: 20 additions & 4 deletions feature/auth/src/main/java/com/puzzle/auth/AuthScreen.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package com.puzzle.auth

import android.util.Log
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import com.kakao.sdk.user.UserApiClient
import com.puzzle.navigation.AuthGraph
import com.puzzle.navigation.MatchingGraph
import com.puzzle.navigation.NavigationEvent

@Composable
fun AuthRoute(viewModel: AuthViewModel = hiltViewModel()) {
val context = LocalContext.current

Box(
Column(
modifier = Modifier
.fillMaxSize()
.clickable {
Expand All @@ -27,8 +30,21 @@ fun AuthRoute(viewModel: AuthViewModel = hiltViewModel()) {
)
)
},
contentAlignment = Alignment.Center,
) {
Text(
text = "카카오 로그인",
fontSize = 30.sp,
modifier = Modifier.clickable {
UserApiClient.instance.loginWithKakaoAccount(context) { token, error ->
if (error != null) {
Log.e("test", "로그인 실패", error)
} else if (token != null) {
Log.i("test", "로그인 성공 ${token.accessToken}")
}
}
}
)

Text(
text = "AuthRoute",
fontSize = 30.sp,
Expand Down
Loading

0 comments on commit ed034e6

Please sign in to comment.