Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
local.properties
/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch
/.idea/shelf/Uncommitted_changes_before_rebase__Changes_.xml
app/src/main/res/raw/
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 43 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.konan.properties.Properties
import org.jetbrains.kotlin.storage.CacheResetOnProcessCanceled.enabled

plugins {
id("com.android.application")
Expand All @@ -8,10 +9,16 @@ plugins {
id("kotlin-parcelize") // @Parcelize
}


val properties: Properties = Properties()
properties.load(project.rootProject.file("local.properties").inputStream())
val serverUrl = properties.getProperty("SERVER_URL")
val kakaoKey = properties.getProperty("KAKAO_KEY")
val nativeAppKey = properties.getProperty("NATIVE_APP_KEY")
val nativeappkey = properties.getProperty("KEY")
val testappkey = properties.getProperty("TEST_APP_KEY")
val testId = properties.getProperty("TEST_ID")


android {
namespace = "com.example.daejangjung2"
Expand All @@ -27,6 +34,13 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "SERVER_URL", serverUrl)
buildConfigField("String", "KAKAO_KEY", kakaoKey)
buildConfigField("String","NATIVE_APP_KEY", nativeAppKey)
buildConfigField("String","TEST_APP_KEY",testappkey)
buildConfigField("String", "TEST_ID",testId)
// manifestPlaceholders["NATIVE_APP_KEY"] = nativeappkey
manifestPlaceholders["NATIVE_APP_KEY"] = nativeAppKey
manifestPlaceholders["CLIENT_ID"] = testId
manifestPlaceholders["SERVER_URL"] = serverUrl
}

buildTypes {
Expand Down Expand Up @@ -64,6 +78,8 @@ android {

}



dependencies {

implementation("androidx.core:core-ktx:1.10.1")
Expand Down Expand Up @@ -100,6 +116,12 @@ dependencies {
implementation("com.squareup.okhttp3:logging-interceptor:3.14.9")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")

//카카오로그인
implementation("com.kakao.sdk:v2-user:2.20.6")




// 직렬화 / 역직렬화 라이브러리
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
// dataStore
Expand All @@ -109,7 +131,6 @@ dependencies {
// Timber
implementation("com.jakewharton.timber:timber:4.7.1")

implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.squareup.retrofit2:converter-gson:2.6.0")
implementation("com.google.android.gms:play-services-location:21.0.1")
Expand All @@ -126,4 +147,25 @@ dependencies {
annotationProcessor("com.github.bumptech.glide:compiler:4.11.0")
implementation("androidx.cardview:cardview:1.0.0")

//웹소켓
implementation ("com.squareup.okhttp3:okhttp:4.9.0")

val nav_version = "2.8.0"
// Jetpack Compose integration
implementation("androidx.navigation:navigation-compose:$nav_version")

// Views/Fragments integration
implementation("androidx.navigation:navigation-fragment:$nav_version")
implementation("androidx.navigation:navigation-ui:$nav_version")

// Feature module support for Fragments
implementation("androidx.navigation:navigation-dynamic-features-fragment:$nav_version")

// Testing Navigation
androidTestImplementation("androidx.navigation:navigation-testing:$nav_version")

implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")

implementation("com.kakao.sdk:v2-user:2.0.1")
}
69 changes: 67 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,40 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />


<application
android:name=".app.DaejangjungApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@drawable/logo"
android:supportsRtl="true"
android:theme="@style/Base.Theme.Daejangjung2"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<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${NATIVE_APP_KEY}" />
</intent-filter>
</activity>


<activity
android:name=".feature.splash.SplashActivity"
android:exported="true"
Expand All @@ -41,6 +62,50 @@
android:exported="false"
android:theme="@style/Base.Theme.Daejangjung2">
</activity>

<activity
android:name=".feature.auth.login.LoginFirstActivity"
android:exported="false">
</activity>

<activity
android:name=".feature.auth.login.LoginSecondActivity"
android:exported="false">
</activity>

<activity
android:name=".feature.auth.login.LoginThirdActivity"
android:exported="false">
</activity>

<activity
android:name=".feature.auth.login.LoginFourthActivity"
android:exported="false">
</activity>

<activity
android:name=".feature.auth.login.LoginSecondActivity2"
android:exported="false">
</activity>

<activity android:name=".feature.auth.signup.SignupFirstActivity"
android:exported="false">
</activity>

<activity android:name=".feature.auth.signup.SignupSecondActivity"
android:exported="false">
</activity>

<activity android:name=".feature.auth.signup.SignupThirdActivity"
android:exported="false">
</activity>

<activity android:name=".feature.auth.signup.SignupFourthActivity"
android:exported="false">
</activity>



</application>

</manifest>
40 changes: 39 additions & 1 deletion app/src/main/java/com/example/daejangjung2/app/DIContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@ import android.app.Application
import android.content.Context
import com.example.daejangjung2.data.datasource.local.LocalAuthDataSource
import com.example.daejangjung2.data.datasource.network.NetworkAuthDataSource
import com.example.daejangjung2.data.datasource.network.NetworkCommunityDataSource
import com.example.daejangjung2.data.datasource.network.NetworkMapDataSource
import com.example.daejangjung2.data.datasource.network.NetworkPostCallAllDataSource
import com.example.daejangjung2.data.datasource.network.NetworkPostCallLocationDataSource
import com.example.daejangjung2.data.repository.DefaultAuthRepository
import com.example.daejangjung2.data.repository.DefaultCommunityRepository
import com.example.daejangjung2.data.repository.DefaultMapRepository
import com.example.daejangjung2.data.repository.DefaultPostCallAllRepository
import com.example.daejangjung2.data.retrofit.AuthRetrofit
import com.example.daejangjung2.data.retrofit.AuthService
import com.example.daejangjung2.data.retrofit.CommunityService
import com.example.daejangjung2.data.retrofit.DefaultRetrofit
import com.example.daejangjung2.data.retrofit.MapService
import com.example.daejangjung2.data.retrofit.PostCallAllService
import com.example.daejangjung2.data.retrofit.PostCallLocationService
import com.example.daejangjung2.domain.repository.AuthRepository
import com.example.daejangjung2.domain.repository.CommunityRepository
import com.example.daejangjung2.domain.repository.MapRepository
import com.example.daejangjung2.domain.repository.PostCallAllRepository
import retrofit2.create

class DIContainer(
application: Application,
Expand All @@ -25,6 +41,28 @@ class DIContainer(
val authRepository: AuthRepository =
DefaultAuthRepository(localAuthDataSource, networkAuthDataSource)

val isLogin = authRepository.isLogin
// 공통 accessToken 적용 retrofit
private val default = DefaultRetrofit.createInstance(authRepository)

private val mapService = default.create(MapService::class.java)
private val networkMapDataSource = NetworkMapDataSource(mapService)
val mapRepository: MapRepository = DefaultMapRepository(networkMapDataSource)

// 커뮤니티
private val communityService = default.create(CommunityService::class.java)
private val networkCommunityDataSource = NetworkCommunityDataSource(communityService)
val communityRepository: CommunityRepository = DefaultCommunityRepository(networkCommunityDataSource)

// 모든 포스트 부르기
private val postcallallService = default.create(PostCallAllService::class.java)
private val networkpostcallallDataSource = NetworkPostCallAllDataSource(postcallallService)
// 지역별 포스트 부르기
private val postcalllocationService = default.create(PostCallLocationService::class.java)
private val networkpostcalllocationDataSource = NetworkPostCallLocationDataSource(postcalllocationService)
val postcallallRepository: PostCallAllRepository = DefaultPostCallAllRepository(networkpostcallallDataSource, networkpostcalllocationDataSource)


val postcalllocationRepository: PostCallAllRepository = DefaultPostCallAllRepository(networkpostcallallDataSource, networkpostcalllocationDataSource)

val isLogin = authRepository.isLogin
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.provider.Settings
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatDelegate
import com.example.daejangjung2.BuildConfig
import com.example.daejangjung2.common.util.log
//import com.example.daejangjung2.common.util.log
import com.kakao.sdk.common.KakaoSdk
import com.kakao.sdk.common.util.Utility
import com.kakao.vectormap.KakaoMapSdk
import timber.log.Timber

Expand All @@ -24,14 +27,20 @@ class DaejangjungApplication: Application() {
// 디버그 모드로 빌드한 경우에만 팀버가 동작하도록
if (BuildConfig.DEBUG_MODE) {
Timber.plant(Timber.DebugTree())
log(message = "deviceId: $deviceId")
// log(message = "deviceId: $deviceId")
}

KakaoMapSdk.init(this, BuildConfig.KAKAO_KEY);
var keyHash = Utility.getKeyHash(this)
Log.d("Hash", keyHash)

KakaoSdk.init(this, BuildConfig.NATIVE_APP_KEY)
KakaoMapSdk.init(this, BuildConfig.KAKAO_KEY)

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) // 다크모드 일단은 방지
}



companion object {
private lateinit var _instance: DaejangjungApplication

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ abstract class BindingActivity<T : ViewDataBinding>(@LayoutRes private val layou
.collect { event(it) }
}
}

abstract class BindingActivity<T : ViewDataBinding> : AppCompatActivity() {
protected lateinit var localBinding: T
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.daejangjung2.common.util


import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import androidx.core.app.ActivityCompat

object LocationUtils {
fun isLocationPermissionGranted(context: Context): Boolean {
return ActivityCompat.checkSelfPermission(
context, Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(
context, Manifest.permission.ACCESS_COARSE_LOCATION
) == PackageManager.PERMISSION_GRANTED
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.daejangjung2.data.datasource.local

import android.content.SharedPreferences
import com.example.daejangjung2.data.model.response.Token
import kotlinx.coroutines.runBlocking

class LocalAuthDataSource(private val sharedPref: SharedPreferences) {
fun getToken(): Token {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example.daejangjung2.data.datasource.network

import com.example.daejangjung2.data.model.request.KakaoLoginRequest
import com.example.daejangjung2.data.model.response.KakaoLoginResponse
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

// ApiService.kt
interface ApiService {
@GET("/api/kakao/auth/login/oauth2")
fun loginWithKakao(@Query("accessToken") accessToken: String): Call<KakaoLoginResponse>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.daejangjung2.data.datasource.network

import com.example.daejangjung2.data.model.request.LoginRequest
import com.example.daejangjung2.data.model.request.RefreshTokenRequest
import com.example.daejangjung2.data.model.response.Token
import com.example.daejangjung2.data.retrofit.AuthService
import com.example.daejangjung2.domain.model.ApiResponse
Expand All @@ -11,4 +12,8 @@ class NetworkAuthDataSource(
suspend fun login(loginRequest: LoginRequest): ApiResponse<Token>{
return service.login(loginRequest);
}

suspend fun refresh(assessToken: RefreshTokenRequest): Token{
return service.refresh(assessToken)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example.daejangjung2.data.datasource.network

import com.example.daejangjung2.data.model.request.CreateRequest
import com.example.daejangjung2.data.model.response.CreateResponse
import com.example.daejangjung2.data.retrofit.CommunityService
import com.example.daejangjung2.domain.model.ApiResponse
import com.example.daejangjung2.domain.model.DefaultResponse

class NetworkCommunityDataSource(
private val service: CommunityService
) {
suspend fun create(createRequest: CreateRequest): ApiResponse<DefaultResponse<CreateResponse>>{
return service.create(createRequest)
}
}
Loading