-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # backend/src/main/java/com/festago/auth/application/AuthService.java
- Loading branch information
Showing
68 changed files
with
1,314 additions
and
296 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
44 changes: 2 additions & 42 deletions
44
android/festago/app/src/main/java/com/festago/festago/FestagoApplication.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 |
---|---|---|
@@ -1,58 +1,18 @@ | ||
package com.festago.festago | ||
|
||
import android.app.Application | ||
import com.festago.festago.analytics.FirebaseAnalyticsHelper | ||
import com.festago.festago.di.AnalysisContainer | ||
import com.festago.festago.di.AuthServiceContainer | ||
import com.festago.festago.di.LocalDataSourceContainer | ||
import com.festago.festago.di.NormalServiceContainer | ||
import com.festago.festago.di.RepositoryContainer | ||
import com.festago.festago.di.TokenContainer | ||
import com.kakao.sdk.common.KakaoSdk | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class FestagoApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
initKakaoSdk() | ||
initRepositoryContainer() | ||
initFirebaseContainer() | ||
} | ||
|
||
private fun initKakaoSdk() { | ||
KakaoSdk.init(this, BuildConfig.KAKAO_NATIVE_APP_KEY) | ||
} | ||
|
||
private fun initRepositoryContainer() { | ||
normalServiceContainer = NormalServiceContainer(BuildConfig.BASE_URL) | ||
|
||
tokenContainer = TokenContainer( | ||
normalServiceContainer = normalServiceContainer, | ||
localDataSourceContainer = LocalDataSourceContainer(applicationContext), | ||
) | ||
|
||
authServiceContainer = AuthServiceContainer( | ||
baseUrl = BuildConfig.BASE_URL, | ||
tokenContainer = tokenContainer, | ||
) | ||
|
||
repositoryContainer = RepositoryContainer( | ||
authServiceContainer = authServiceContainer, | ||
normalServiceContainer = normalServiceContainer, | ||
tokenContainer = tokenContainer, | ||
) | ||
} | ||
|
||
private fun initFirebaseContainer() { | ||
FirebaseAnalyticsHelper.init(applicationContext) | ||
analysisContainer = AnalysisContainer() | ||
} | ||
|
||
companion object DependencyContainer { | ||
lateinit var normalServiceContainer: NormalServiceContainer | ||
lateinit var authServiceContainer: AuthServiceContainer | ||
lateinit var repositoryContainer: RepositoryContainer | ||
lateinit var analysisContainer: AnalysisContainer | ||
lateinit var tokenContainer: TokenContainer | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
android/festago/app/src/main/java/com/festago/festago/data/di/ViewModelScopeModule.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,30 @@ | ||
package com.festago.festago.data.di | ||
|
||
import com.festago.festago.data.repository.ReservationTicketDefaultRepository | ||
import com.festago.festago.data.repository.StudentVerificationDefaultRepository | ||
import com.festago.festago.data.repository.UserDefaultRepository | ||
import com.festago.festago.repository.ReservationTicketRepository | ||
import com.festago.festago.repository.StudentVerificationRepository | ||
import com.festago.festago.repository.UserRepository | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ViewModelComponent | ||
import dagger.hilt.android.scopes.ViewModelScoped | ||
|
||
@InstallIn(ViewModelComponent::class) | ||
@Module | ||
interface ViewModelScopeModule { | ||
|
||
@Binds | ||
@ViewModelScoped | ||
fun bindsReservationTicketDefaultRepository(reservationTicketRepository: ReservationTicketDefaultRepository): ReservationTicketRepository | ||
|
||
@Binds | ||
@ViewModelScoped | ||
fun bindsStudentVerificationDefaultRepository(studentVerificationRepository: StudentVerificationDefaultRepository): StudentVerificationRepository | ||
|
||
@Binds | ||
@ViewModelScoped | ||
fun binsUserDefaultRepository(userRepository: UserDefaultRepository): UserRepository | ||
} |
19 changes: 19 additions & 0 deletions
19
...d/festago/app/src/main/java/com/festago/festago/data/di/singletonscope/AnalyticsModule.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,19 @@ | ||
package com.festago.festago.data.di.singletonscope | ||
|
||
import com.festago.festago.analytics.AnalyticsHelper | ||
import com.festago.festago.analytics.FirebaseAnalyticsHelper | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
interface AnalyticsModule { | ||
@Binds | ||
@Singleton | ||
fun bindsFirebaseAnalyticsHelper( | ||
analyticsHelper: FirebaseAnalyticsHelper | ||
): AnalyticsHelper | ||
} |
65 changes: 65 additions & 0 deletions
65
android/festago/app/src/main/java/com/festago/festago/data/di/singletonscope/ApiModule.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,65 @@ | ||
package com.festago.festago.data.di.singletonscope | ||
|
||
import com.festago.festago.BuildConfig | ||
import com.festago.festago.data.retrofit.AuthInterceptor | ||
import com.festago.festago.data.retrofit.TokenManager | ||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.serialization.json.Json | ||
import okhttp3.MediaType.Companion.toMediaType | ||
import okhttp3.OkHttpClient | ||
import retrofit2.Retrofit | ||
import javax.inject.Qualifier | ||
import javax.inject.Singleton | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class NormalRetrofitQualifier | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class AuthRetrofitQualifier | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class BaseUrlQualifier | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
object ApiModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideOkHttpClient(tokenManager: TokenManager): OkHttpClient = OkHttpClient | ||
.Builder() | ||
.addInterceptor(AuthInterceptor(tokenManager)) | ||
.build() | ||
|
||
@Provides | ||
@Singleton | ||
@NormalRetrofitQualifier | ||
fun providesNormalRetrofit(@BaseUrlQualifier baseUrl: String): Retrofit = Retrofit.Builder() | ||
.baseUrl(baseUrl) | ||
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType())) | ||
.build() | ||
|
||
@Provides | ||
@Singleton | ||
@AuthRetrofitQualifier | ||
fun providesAuthRetrofit( | ||
@BaseUrlQualifier baseUrl: String, | ||
okHttpClient: OkHttpClient | ||
): Retrofit = Retrofit.Builder() | ||
.baseUrl(baseUrl) | ||
.client(okHttpClient) | ||
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType())) | ||
.build() | ||
|
||
@Provides | ||
@Singleton | ||
@BaseUrlQualifier | ||
fun providesBaseUrl(): String = BuildConfig.BASE_URL | ||
} |
17 changes: 17 additions & 0 deletions
17
.../festago/app/src/main/java/com/festago/festago/data/di/singletonscope/DataSourceModule.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 com.festago.festago.data.di.singletonscope | ||
|
||
import com.festago.festago.data.datasource.TokenDataSource | ||
import com.festago.festago.data.datasource.TokenLocalDataSource | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
interface DataSourceModule { | ||
@Binds | ||
@Singleton | ||
fun bindsLocalTokenDataSource(tokenDataSource: TokenLocalDataSource): TokenDataSource | ||
} |
40 changes: 40 additions & 0 deletions
40
.../festago/app/src/main/java/com/festago/festago/data/di/singletonscope/RepositoryModule.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,40 @@ | ||
package com.festago.festago.data.di.singletonscope | ||
|
||
import com.festago.festago.data.repository.AuthDefaultRepository | ||
import com.festago.festago.data.repository.FestivalDefaultRepository | ||
import com.festago.festago.data.repository.SchoolDefaultRepository | ||
import com.festago.festago.data.repository.TicketDefaultRepository | ||
import com.festago.festago.data.repository.TokenDefaultRepository | ||
import com.festago.festago.repository.AuthRepository | ||
import com.festago.festago.repository.FestivalRepository | ||
import com.festago.festago.repository.SchoolRepository | ||
import com.festago.festago.repository.TicketRepository | ||
import com.festago.festago.repository.TokenRepository | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
interface RepositoryModule { | ||
|
||
@Binds | ||
fun bindsTokenDefaultRepository(tokenRepository: TokenDefaultRepository): TokenRepository | ||
|
||
@Binds | ||
fun bindsAuthDefaultRepository(authRepository: AuthDefaultRepository): AuthRepository | ||
|
||
@Binds | ||
@Singleton | ||
fun bindsFestivalDefaultRepository(festivalRepository: FestivalDefaultRepository): FestivalRepository | ||
|
||
@Binds | ||
@Singleton | ||
fun bindsSchoolDefaultRepository(schoolRepository: SchoolDefaultRepository): SchoolRepository | ||
|
||
@Binds | ||
@Singleton | ||
fun bindsTicketDefaultRepository(ticketRepository: TicketDefaultRepository): TicketRepository | ||
} |
Oops, something went wrong.