Skip to content

Commit 174d249

Browse files
authored
Merge pull request #37 from Nexters/feature/add-fcm
푸시 알림을 구현합니다.
2 parents f01f280 + 2614575 commit 174d249

File tree

57 files changed

+482
-37
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+482
-37
lines changed

.github/workflows/ci-for-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ jobs:
1212
- name: Check out Repository
1313
uses: actions/[email protected]
1414

15+
- name: Create Google Services JSON File
16+
env:
17+
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
18+
run: |
19+
echo "$GOOGLE_SERVICES_JSON" > google-services.json.b64
20+
base64 -d -i google-services.json.b64 > ./app/google-services.json
21+
1522
- name: Create local.properties file
1623
run: touch local.properties
1724

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,5 @@ google-services.json
170170
/.idea/deploymentTargetSelector.xml
171171
/.idea/other.xml
172172
/.idea/kotlinc.xml
173+
174+
.b64

app/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
alias(libs.plugins.tuk.android.application)
33
alias(libs.plugins.tuk.android.application.compose)
44
alias(libs.plugins.tuk.android.application.hilt)
5+
alias(libs.plugins.google.service)
56
}
67

78
android {
@@ -16,5 +17,8 @@ dependencies {
1617
implementation(project(":core:data"))
1718
implementation(project(":core:auth-provider"))
1819
implementation(project(":core:weburl"))
20+
implementation(project(":core:push"))
1921
testImplementation(libs.junit)
22+
implementation(platform(libs.firebase.bom))
23+
implementation(libs.firebase.messaging)
2024
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
56
<application
67
android:name=".TukAndroidApp"
78
android:allowBackup="true"

app/src/main/res/drawable/ic_launcher_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:viewportWidth="108"
66
android:viewportHeight="108">
77
<path
8-
android:fillColor="#3DDC84"
8+
android:fillColor="#FFFFFF"
99
android:pathData="M0,0h108v108h-108z" />
1010
<path
1111
android:fillColor="#00000000"
Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
1-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:aapt="http://schemas.android.com/aapt"
3-
android:width="108dp"
4-
android:height="108dp"
5-
android:viewportWidth="108"
6-
android:viewportHeight="108">
7-
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
8-
<aapt:attr name="android:fillColor">
9-
<gradient
10-
android:endX="85.84757"
11-
android:endY="92.4963"
12-
android:startX="42.9492"
13-
android:startY="49.59793"
14-
android:type="linear">
15-
<item
16-
android:color="#44000000"
17-
android:offset="0.0" />
18-
<item
19-
android:color="#00000000"
20-
android:offset="1.0" />
21-
</gradient>
22-
</aapt:attr>
23-
</path>
24-
<path
25-
android:fillColor="#FFFFFF"
26-
android:fillType="nonZero"
27-
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
28-
android:strokeWidth="1"
29-
android:strokeColor="#00000000" />
30-
</vector>
1+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
2+
<background android:drawable="@color/ic_launcher_background"/>
3+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
4+
</adaptive-icon>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">tuk</string>
3-
</resources>
2+
<string name="app_name"></string>
3+
</resources>

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ plugins {
1010
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
1111
alias(libs.plugins.kotlin.ksp) apply false
1212
alias(libs.plugins.kotlin.parcelize) apply false
13+
alias(libs.plugins.google.service) apply false
1314
}

core/data/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ dependencies {
1111
implementation(project(":core:network"))
1212
implementation(project(":core:preference"))
1313
implementation(project(":core:domain"))
14+
implementation(project(":core:push"))
1415

1516
implementation(libs.retrofit)
1617
ksp(libs.hilt.compiler)
1718
implementation(libs.hilt.android)
19+
20+
implementation(platform(libs.firebase.bom))
21+
implementation(libs.firebase.messaging)
1822
}

core/data/src/main/java/com/plottwist/core/data/auth/repository/LoginRepositoryImpl.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,34 @@ package com.plottwist.core.data.auth.repository
22

33
import com.plottwist.core.data.common.DeviceInfoProvider
44
import com.plottwist.core.domain.auth.repository.LoginRepository
5+
import com.plottwist.core.domain.push.repository.PushRepository
56
import com.plottwist.core.network.model.auth.DeviceInfo
67
import com.plottwist.core.network.model.auth.GoogleLoginRequest
78
import com.plottwist.core.network.service.AuthApiService
89
import com.plottwist.core.preference.datasource.AuthDataSource
910
import kotlinx.coroutines.flow.Flow
1011
import kotlinx.coroutines.flow.collect
1112
import kotlinx.coroutines.flow.combine
13+
import kotlinx.coroutines.flow.firstOrNull
1214
import javax.inject.Inject
1315

1416

1517
class LoginRepositoryImpl @Inject constructor(
1618
private val loginService: AuthApiService,
1719
private val authDataSource: AuthDataSource,
18-
private val deviceInfoProvider: DeviceInfoProvider
20+
private val deviceInfoProvider: DeviceInfoProvider,
21+
private val pushRepository: PushRepository
1922
) : LoginRepository {
2023

2124
override suspend fun googleLogin(accountId: String): Result<Boolean> {
2225
return try {
26+
val fcmToken = pushRepository.getFcmToken().firstOrNull()?.getOrNull()
2327
val deviceInfo = DeviceInfo(
2428
deviceId = deviceInfoProvider.getDeviceSSAID(),
2529
deviceType = deviceInfoProvider.getDeviceType(),
2630
appVersion = deviceInfoProvider.getAppVersion(),
27-
osVersion = deviceInfoProvider.getOsVersion()
31+
osVersion = deviceInfoProvider.getOsVersion(),
32+
deviceToken = fcmToken
2833
)
2934

3035
val request = GoogleLoginRequest(

0 commit comments

Comments
 (0)