-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from Nexters/feature/fcm-push
푸시 알림 구현
- Loading branch information
Showing
48 changed files
with
637 additions
and
27 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
8 changes: 7 additions & 1 deletion
8
app/src/main/java/com/goalpanzi/mission_mate/MainApplication.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,7 +1,13 @@ | ||
package com.goalpanzi.mission_mate | ||
|
||
import android.app.Application | ||
import com.google.firebase.FirebaseApp | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class MainApplication : Application() | ||
class MainApplication : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
FirebaseApp.initializeApp(this) | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
...ta/common/src/main/java/com/goalpanzi/mission_mate/core/data/common/DeviceInfoProvider.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,15 @@ | ||
package com.goalpanzi.mission_mate.core.data.common | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import android.provider.Settings | ||
import javax.inject.Inject | ||
|
||
class DeviceInfoProvider @Inject constructor( | ||
private val context: Context | ||
) { | ||
@SuppressLint("HardwareIds") | ||
fun getDeviceSSAID(): String { | ||
return Settings.Secure.getString(context.contentResolver,Settings.Secure.ANDROID_ID) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/main/java/com/goalpanzi/mission_mate/core/data/common/di/DeviceInfoProviderModule.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,22 @@ | ||
package com.goalpanzi.mission_mate.core.data.common.di | ||
|
||
import android.content.Context | ||
import com.goalpanzi.mission_mate.core.data.common.DeviceInfoProvider | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
object DeviceInfoProviderModule { | ||
@Singleton | ||
@Provides | ||
fun provideADeviceInfoProvider( | ||
@ApplicationContext context: Context | ||
): DeviceInfoProvider { | ||
return DeviceInfoProvider(context) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
core/data/user/src/main/java/com/goalpanzi/mission_mate/core/data/user/FcmTokenManager.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,7 @@ | ||
package com.goalpanzi.mission_mate.core.data.user | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface FcmTokenManager { | ||
fun getFcmToken() : Flow<String> | ||
} |
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
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
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
11 changes: 11 additions & 0 deletions
11
...r/src/main/java/com/goalpanzi/mission_mate/core/domain/user/usecase/GetFcmTokenUseCase.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,11 @@ | ||
package com.goalpanzi.mission_mate.core.domain.user.usecase | ||
|
||
import com.goalpanzi.mission_mate.core.domain.user.repository.UserRepository | ||
import javax.inject.Inject | ||
|
||
class GetFcmTokenUseCase @Inject constructor( | ||
private val userRepository: UserRepository | ||
) { | ||
operator fun invoke() = userRepository.getFcmToken() | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
...rc/main/java/com/goalpanzi/mission_mate/core/domain/user/usecase/UpdateFcmTokenUseCase.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,18 @@ | ||
package com.goalpanzi.mission_mate.core.domain.user.usecase | ||
|
||
import com.goalpanzi.mission_mate.core.domain.user.repository.UserRepository | ||
import kotlinx.coroutines.flow.collect | ||
import kotlinx.coroutines.flow.firstOrNull | ||
import javax.inject.Inject | ||
|
||
class UpdateFcmTokenUseCase @Inject constructor( | ||
private val userRepository: UserRepository | ||
) { | ||
suspend operator fun invoke(fcmToken: String) { | ||
val cachedFcmToken = userRepository.getCachedFcmToken().firstOrNull() | ||
if(fcmToken != cachedFcmToken){ | ||
userRepository.setCachedFcmToken(fcmToken).collect() | ||
userRepository.updateFcmToken(fcmToken) | ||
} | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...in/java/com/goalpanzi/mission_mate/core/network/model/request/UpdateDeviceTokenRequest.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,10 @@ | ||
package com.goalpanzi.mission_mate.core.network.model.request | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class UpdateDeviceTokenRequest( | ||
val deviceToken: String, | ||
val deviceIdentifier: String, | ||
val osType: String | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,46 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.jetbrains.kotlin.android) | ||
alias(libs.plugins.hilt.android) | ||
alias(libs.plugins.kotlin.ksp) | ||
} | ||
|
||
android { | ||
namespace = "com.goalpanzi.mission_mate.core.notification" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
kotlin { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_17) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.bundles.test) | ||
implementation(libs.bundles.coroutines) | ||
|
||
ksp(libs.hilt.compiler) | ||
implementation(libs.hilt.android) | ||
} | ||
|
Empty file.
Oops, something went wrong.