Skip to content

Commit

Permalink
[PRODUCTION] Version 1.4(33)
Browse files Browse the repository at this point in the history
[PRODUCTION] Version 1.4(33)
  • Loading branch information
kkk5474096 authored Nov 2, 2023
2 parents 9c02b47 + 32270e8 commit 7caea29
Show file tree
Hide file tree
Showing 216 changed files with 4,260 additions and 4,205 deletions.
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission android:name="com.google.android.play.billingclient.version" />
Expand Down Expand Up @@ -86,7 +87,7 @@
android:screenOrientation="portrait" />

<activity
android:name=".presentation.onboarding.StartAppActivity"
android:name=".presentation.onboarding.activity.GetAlarmActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
Expand Down Expand Up @@ -142,7 +143,7 @@
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.main.recommend.search.RecommendSearchActivity"
android:name=".presentation.search.SearchActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.el.yello.presentation.main.MainActivity
import com.example.data.model.request.auth.toDeviceToken
import com.example.data.remote.service.AuthService
import com.example.domain.YelloDataStore
import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.messaging.FirebaseMessagingService
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -52,7 +51,9 @@ class YelloMessagingService : FirebaseMessagingService() {
responseMessage.path = intent.getStringExtra("path")
responseMessage.badge = intent.getStringExtra("badge")?.toInt()

sendNotificationAlarm(responseMessage)
if (responseMessage.title != EMPTY) {
sendNotificationAlarm(responseMessage)
}
}
}

Expand Down Expand Up @@ -97,4 +98,8 @@ class YelloMessagingService : FirebaseMessagingService() {
var path: String? = null,
var badge: Int? = null
)

companion object {
const val EMPTY = "null"
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/el/yello/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import com.example.data.datasource.OnboardingDataSource
import com.example.data.datasource.PayDataSource
import com.example.data.datasource.ProfileDataSource
import com.example.data.datasource.RecommendDataSource
import com.example.data.datasource.SearchDataSource
import com.example.data.datasource.VoteDataSource
import com.example.data.datasource.YelloDataSource
import com.example.data.datasource.remote.AuthDataSourceImpl
import com.example.data.datasource.remote.OnboardingDataSourceImpl
import com.example.data.datasource.remote.PayDataSourceImpl
import com.example.data.datasource.remote.ProfileDataSourceImpl
import com.example.data.datasource.remote.RecommendDataSourceImpl
import com.example.data.datasource.remote.SearchDataSourceImpl
import com.example.data.datasource.remote.VoteDataSourceImpl
import com.example.data.datasource.remote.YelloDataSourceImpl
import dagger.Module
Expand Down Expand Up @@ -48,6 +50,11 @@ object DataSourceModule {
fun provideRecommendDataSource(recommendDataSourceImpl: RecommendDataSourceImpl): RecommendDataSource =
recommendDataSourceImpl

@Provides
@Singleton
fun provideSearchDataSource(searchDataSourceImpl: SearchDataSourceImpl): SearchDataSource =
searchDataSourceImpl

@Provides
@Singleton
fun providePayDataSource(payDataSourceImpl: PayDataSourceImpl): PayDataSource =
Expand Down
83 changes: 83 additions & 0 deletions app/src/main/java/com/el/yello/di/DataStoreModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.el.yello.di

import android.content.Context
import android.content.SharedPreferences
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
import com.el.yello.BuildConfig
import com.example.data.local.qualifier.App
import com.example.data.local.qualifier.User
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import java.security.GeneralSecurityException
import java.security.KeyStore
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object DataStoreModule {
private const val APP_PREFERENCES_NAME = "APP_DATA"

@Provides
@Singleton
@User
fun provideUserPreferences(
@ApplicationContext context: Context
): SharedPreferences = if (BuildConfig.DEBUG) {
context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE)
} else {
try {
createEncryptedSharedPreferences(context.packageName, context)
} catch (e: GeneralSecurityException) {
deleteMasterKeyEntry()
deleteExistingPref(context.packageName, context)
createEncryptedSharedPreferences(context.packageName, context)
}
}

@Provides
@Singleton
@App
fun provideAppPreferences(
@ApplicationContext context: Context
): SharedPreferences = if (BuildConfig.DEBUG) {
context.getSharedPreferences(APP_PREFERENCES_NAME, Context.MODE_PRIVATE)
} else {
try {
createEncryptedSharedPreferences(APP_PREFERENCES_NAME, context)
} catch (e: GeneralSecurityException) {
deleteMasterKeyEntry()
deleteExistingPref(APP_PREFERENCES_NAME, context)
createEncryptedSharedPreferences(APP_PREFERENCES_NAME, context)
}
}

private fun deleteExistingPref(fileName: String, context: Context) {
context.deleteSharedPreferences(fileName)
}

private fun deleteMasterKeyEntry() {
KeyStore.getInstance("AndroidKeyStore").apply {
load(null)
deleteEntry(MasterKey.DEFAULT_MASTER_KEY_ALIAS)
}
}

private fun createEncryptedSharedPreferences(
fileName: String,
context: Context
): SharedPreferences {
return EncryptedSharedPreferences.create(
context,
fileName,
MasterKey.Builder(context, MasterKey.DEFAULT_MASTER_KEY_ALIAS)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build(),
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/el/yello/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import com.example.data.repository.OnboardingRepositoryImpl
import com.example.data.repository.PayRepositoryImpl
import com.example.data.repository.ProfileRepositoryImpl
import com.example.data.repository.RecommendRepositoryImpl
import com.example.data.repository.SearchRepositoryImpl
import com.example.data.repository.VoteRepositoryImpl
import com.example.data.repository.YelloRepositoryImpl
import com.example.domain.repository.AuthRepository
import com.example.domain.repository.OnboardingRepository
import com.example.domain.repository.PayRepository
import com.example.domain.repository.ProfileRepository
import com.example.domain.repository.RecommendRepository
import com.example.domain.repository.SearchRepository
import com.example.domain.repository.VoteRepository
import com.example.domain.repository.YelloRepository
import dagger.Module
Expand Down Expand Up @@ -48,6 +50,11 @@ object RepositoryModule {
fun provideRecommendRepository(recommendRepositoryImpl: RecommendRepositoryImpl): RecommendRepository =
recommendRepositoryImpl

@Provides
@Singleton
fun provideSearchRepository(searchRepositoryImpl: SearchRepositoryImpl): SearchRepository =
searchRepositoryImpl

@Provides
@Singleton
fun provideAuthRepository(authRepositoryImpl: AuthRepositoryImpl): AuthRepository =
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/el/yello/di/ServiceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.example.data.remote.service.OnboardingService
import com.example.data.remote.service.PayService
import com.example.data.remote.service.ProfileService
import com.example.data.remote.service.RecommendService
import com.example.data.remote.service.SearchService
import com.example.data.remote.service.VoteService
import com.example.data.remote.service.YelloService
import dagger.Module
Expand Down Expand Up @@ -43,6 +44,11 @@ object ServiceModule {
fun provideRecommendService(retrofit: Retrofit): RecommendService =
retrofit.create(RecommendService::class.java)

@Provides
@Singleton
fun provideSearchService(retrofit: Retrofit): SearchService =
retrofit.create(SearchService::class.java)

@Provides
@Singleton
fun provideLookService(retrofit: Retrofit): LookService =
Expand Down
Loading

0 comments on commit 7caea29

Please sign in to comment.