Skip to content

Commit 26fd53d

Browse files
authored
Merge pull request #181 from hellokitty-coding-club/release/v1.1.0
[REALESE] v1.1.0 (#178)
2 parents 3aded45 + 63ce454 commit 26fd53d

File tree

123 files changed

+1622
-380
lines changed

Some content is hidden

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

123 files changed

+1622
-380
lines changed

.github/workflows/prBuilder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
appId: ${{ secrets.FIREBASE_APP_ID }}
6161
token: ${{ secrets.FIREBASE_TOKEN }}
6262
groups: hello-kitty-coding-club
63-
file: app/build/outputs/apk/debug/app-debug.apk
63+
file: app/build/outputs/apk/dev/debug/app-dev-debug.apk
6464
releaseNotes: |
6565
${{ github.event.pull_request.title }}
6666
${{ github.event.pull_request.html_url }}

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# 미션 기반 코드리뷰 매칭 플랫폼, LGTM
22

3-
**'LGTM'은 SW 마에스트로 14기 프로젝트입니다.**
3+
## 📌 Introduction
44

5-
해당 `LGTM-Android` Repository는 **[@kxxhyorim](https://github.com/KxxHyoRim)** 1인 개발로 이루어지고 있습니다. (팀 구성 = 백엔드 2명, 안드로이드 1명)
5+
- [**LGTM이 궁금하시다면 Google Play로!**](https://play.google.com/store/apps/details?id=com.lgtm.android)
66

7-
![image](https://github.com/hellokitty-coding-club/LGTM-Android/assets/59546818/4cff9177-ac15-4ddf-9a74-3a0654c8a502)
7+
- 본 서비스는 SW마에스트로 14기 프로젝트입니다:)
8+
9+
10+
| | | |
11+
| -- | -- | -- |
12+
|![image](https://github.com/hellokitty-coding-club/LGTM-Android/assets/59546818/b1110a0c-35fc-4896-9d73-b2a3a197e205)| ![image](https://github.com/hellokitty-coding-club/LGTM-Android/assets/59546818/7baf51cc-8666-42e6-94b0-1952bfc02d98) | ![image](https://github.com/hellokitty-coding-club/LGTM-Android/assets/59546818/7d26d84b-3aef-4187-bc79-d7505a9b866e) |
813

914

1015

app/build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("UnstableApiUsage")
2+
13
import org.jetbrains.kotlin.konan.properties.Properties
24

35
val lgtmPropertiesFile = rootProject.file("lgtm.properties")
@@ -45,6 +47,23 @@ android {
4547
}
4648
}
4749

50+
flavorDimensions += "version"
51+
productFlavors {
52+
create("prod") {
53+
dimension = "version"
54+
manifestPlaceholders["appLabel"] = "LGTM"
55+
buildConfigField("boolean", "IS_PROD", "true")
56+
buildConfigField("boolean", "IS_DEV", "false")
57+
}
58+
create("dev") {
59+
dimension = "version"
60+
applicationIdSuffix = ".dev"
61+
manifestPlaceholders["appLabel"] = "(Dev)LGTM"
62+
buildConfigField("boolean", "IS_PROD", "false")
63+
buildConfigField("boolean", "IS_DEV", "true")
64+
}
65+
}
66+
4867
buildFeatures {
4968
buildConfig = true
5069
}

app/proguard-rules.pro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
-keep class * extends com.google.gson.TypeAdapter
2424
-keep class com.lgtm.android.data.** { *; }
2525
-keep class com.lgtm.domain.** { *; }
26+
-keep class com.swm.logging.android.** { *; }
2627

2728
-keep class * implements com.google.gson.TypeAdapterFactory
2829
-keep class * implements com.google.gson.JsonSerializer
@@ -99,9 +100,9 @@
99100
-keepclassmembers,allowshrinking,allowobfuscation interface * {
100101
@retrofit2.http.* <methods>;
101102
}
102-
103-
# Ignore annotation used for build tooling.
104-
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
103+
#
104+
## Ignore annotation used for build tooling.
105+
#-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
105106

106107
# Ignore JSR 305 annotations for embedding nullability information.
107108
-dontwarn javax.annotation.**

app/src/dev/google-services.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@
55
"storage_bucket": "lgtm-aeb7a.appspot.com"
66
},
77
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:1090377873764:android:5eb9f699608d0e5994e271",
11+
"android_client_info": {
12+
"package_name": "com.lgtm.android"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "1090377873764-b6gm8buak4slf1vf8a4osmjfm1ktokle.apps.googleusercontent.com",
18+
"client_type": 3
19+
}
20+
],
21+
"api_key": [
22+
{
23+
"current_key": "AIzaSyAsd0MS5XNM3GoQlHKw09z9X9pK3R2EC3Y"
24+
}
25+
],
26+
"services": {
27+
"appinvite_service": {
28+
"other_platform_oauth_client": [
29+
{
30+
"client_id": "1090377873764-b6gm8buak4slf1vf8a4osmjfm1ktokle.apps.googleusercontent.com",
31+
"client_type": 3
32+
}
33+
]
34+
}
35+
}
36+
},
837
{
938
"client_info": {
1039
"mobilesdk_app_id": "1:1090377873764:android:828cd0a400b0f62594e271",

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
android:name=".LGTMApplication"
99
android:allowBackup="false"
1010
android:icon="@mipmap/ic_launcher"
11-
android:label="@string/app_name"
11+
android:label="${appLabel}"
1212
android:roundIcon="@mipmap/ic_launcher_round"
1313
android:supportsRtl="true"
1414
android:theme="@style/Theme.LGTMAndroid"
@@ -37,7 +37,8 @@
3737

3838
<activity
3939
android:name=".auth.ui.signup.SignUpActivity"
40-
android:exported="false" />
40+
android:exported="false"
41+
android:windowSoftInputMode="adjustPan" />
4142

4243
<activity
4344
android:name=".main.MainActivity"
@@ -65,5 +66,9 @@
6566
android:exported="false"
6667
android:windowSoftInputMode="adjustResize" />
6768

69+
<activity
70+
android:name=".main.notification.NotificationCenterActivity"
71+
android:exported="false" />
72+
6873
</application>
6974
</manifest>

app/src/main/java/com/lgtm/android/LGTMApplication.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
package com.lgtm.android
22

33
import android.app.Application
4-
import com.lgtm.android.data.datasource.LgtmPreferenceDataSource
4+
import com.lgtm.domain.repository.AuthRepository
55
import com.swm.logging.android.SWMLogging
66
import dagger.hilt.android.HiltAndroidApp
7+
import java.util.Locale
78
import javax.inject.Inject
89

910
@HiltAndroidApp
1011
class LGTMApplication : Application() {
1112

1213
@Inject
13-
lateinit var lgtmPreferenceDataSource: LgtmPreferenceDataSource
14+
lateinit var authRepository: AuthRepository
1415

1516
override fun onCreate() {
1617
super.onCreate()
1718
SWMLogging.init(
1819
appVersion = BuildConfig.VERSION_NAME,
1920
osNameAndVersion = "$ANDROID ${android.os.Build.VERSION.SDK_INT}",
20-
baseUrl = if (BuildConfig.DEBUG) BuildConfig.LGTM_BASE_URL_DEBUG else BuildConfig.LGTM_BASE_URL_RELEASE,
21+
deviceModel = android.os.Build.MODEL,
22+
baseUrl = if (BuildConfig.IS_DEV) BuildConfig.LGTM_BASE_URL_DEBUG else BuildConfig.LGTM_BASE_URL_RELEASE,
2123
serverPath = "v1/log",
22-
token = getAuthToken()
24+
region = Locale.getDefault().toString(),
25+
userID = getUserId()
2326
)
2427
}
2528

26-
private fun getAuthToken(): String {
27-
return lgtmPreferenceDataSource.getValue(
28-
preferenceKey = LgtmPreferenceDataSource.Companion.PreferenceKey.ACCESS_TOKEN,
29-
defaultValue = "",
30-
isEncrypted = true
31-
)
29+
private fun getUserId(): String {
30+
return authRepository.getMemberId().toString()
3231
}
3332

3433
companion object {

app/src/main/java/com/lgtm/android/LGTMFirebaseMessagingService.kt

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
1+
@file:Suppress("MoveVariableDeclarationIntoWhen")
2+
13
package com.lgtm.android
24

35
import android.app.NotificationChannel
46
import android.app.NotificationManager
7+
import android.app.PendingIntent
8+
import android.app.TaskStackBuilder
9+
import android.content.ContentValues.TAG
510
import android.content.Context
6-
import android.graphics.Bitmap
11+
import android.content.Intent
712
import android.util.Log
813
import androidx.core.app.NotificationCompat
14+
import androidx.core.content.ContextCompat
915
import com.google.firebase.messaging.FirebaseMessaging
1016
import com.google.firebase.messaging.FirebaseMessagingService
1117
import com.google.firebase.messaging.RemoteMessage
1218
import com.lgtm.android.common_ui.R
19+
import com.lgtm.android.main.MainActivity
20+
import com.lgtm.android.manage_mission.dashboard.DashboardActivity
21+
import com.lgtm.android.manage_mission.ping_pong_junior.PingPongJuniorActivity
22+
import com.lgtm.domain.constants.ProcessState.CODE_REVIEW
23+
import com.lgtm.domain.constants.ProcessState.MISSION_FINISHED
24+
import com.lgtm.domain.constants.ProcessState.MISSION_PROCEEDING
25+
import com.lgtm.domain.constants.ProcessState.PAYMENT_CONFIRMATION
26+
import com.lgtm.domain.constants.ProcessState.WAITING_FOR_PAYMENT
27+
import com.lgtm.domain.constants.ProcessState.valueOf
1328
import com.lgtm.domain.firebase.LgtmMessagingService
1429
import com.lgtm.domain.usecase.DeviceTokenManagerUseCase
1530
import dagger.hilt.android.AndroidEntryPoint
1631
import javax.inject.Inject
1732

18-
1933
@AndroidEntryPoint
2034
class LGTMFirebaseMessagingService : FirebaseMessagingService(), LgtmMessagingService {
2135
@Inject
@@ -29,31 +43,65 @@ class LGTMFirebaseMessagingService : FirebaseMessagingService(), LgtmMessagingSe
2943
override fun onMessageReceived(remoteMessage: RemoteMessage) {
3044
super.onMessageReceived(remoteMessage)
3145

46+
Log.d(TAG, "onMessageReceived: ${remoteMessage.data}")
47+
3248
if (remoteMessage.data.isNotEmpty()) {
33-
// data 확인
49+
handleDataType(remoteMessage.data)
3450
}
3551

3652
remoteMessage.notification?.let {
37-
generateNotification(it.title!!, it.body!!)
53+
handleNotificationType(it)
3854
}
3955
}
4056

41-
private fun generateNotification(
42-
title: String?,
43-
message: String?,
44-
image: Bitmap? = null,
45-
) {
57+
private fun handleDataType(data: Map<String, String>) {
4658
val requestCode = System.currentTimeMillis().toInt()
4759

48-
val builder = NotificationCompat.Builder(this, channelID)
60+
val title = data["title"]
61+
val body = data["body"]
62+
val missionId: Int? = data["missionId"]?.toInt()
63+
val processState = data["pushCategory"]?.let { valueOf(it) }
64+
val intent = when (processState) {
65+
WAITING_FOR_PAYMENT, PAYMENT_CONFIRMATION, CODE_REVIEW ->
66+
Intent(this, DashboardActivity::class.java)
67+
.putExtra(DashboardActivity.MISSION_ID, missionId)
68+
69+
MISSION_PROCEEDING, MISSION_FINISHED ->
70+
Intent(this, PingPongJuniorActivity::class.java)
71+
.putExtra(DashboardActivity.MISSION_ID, missionId)
72+
73+
else -> return
74+
}
75+
76+
val mainIntent = Intent(this, MainActivity::class.java)
77+
78+
val stackBuilder = TaskStackBuilder.create(this)
79+
.addParentStack(MainActivity::class.java)
80+
.addNextIntent(mainIntent)
81+
.addNextIntent(intent)
82+
83+
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE)
84+
85+
val builder = createNotificationBuilder(title, body, resultPendingIntent)
86+
notifyWithChannel(requestCode, builder)
87+
}
88+
89+
private fun createNotificationBuilder(
90+
title: String?,
91+
message: String?,
92+
contentIntent: PendingIntent?,
93+
): NotificationCompat.Builder {
94+
return NotificationCompat.Builder(this, channelID)
4995
.setPriority(NotificationCompat.PRIORITY_HIGH)
50-
.setSmallIcon(R.drawable.ic_launcher_foreground)
51-
// .setColor(Color.argb(255, 133, 120, 255)) // havit_purple
96+
.setSmallIcon(R.drawable.ic_launch_mono)
97+
.setColor(ContextCompat.getColor(this, R.color.green))
5298
.setAutoCancel(true)
5399
.setContentTitle(title)
54-
.setLargeIcon(image)
55100
.setStyle(NotificationCompat.BigTextStyle().bigText(message))
101+
.setContentIntent(contentIntent)
102+
}
56103

104+
private fun notifyWithChannel(requestCode: Int, builder: NotificationCompat.Builder) {
57105
val notificationManager =
58106
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
59107

@@ -63,6 +111,15 @@ class LGTMFirebaseMessagingService : FirebaseMessagingService(), LgtmMessagingSe
63111
notificationManager.notify(requestCode, builder.build())
64112
}
65113

114+
private fun handleNotificationType(notification: RemoteMessage.Notification) {
115+
val title = notification.title ?: ""
116+
val message = notification.body ?: ""
117+
val requestCode = System.currentTimeMillis().toInt()
118+
119+
val builder = createNotificationBuilder(title, message, null)
120+
notifyWithChannel(requestCode, builder)
121+
}
122+
66123
override fun getDeviceToken(tokenCallBack: (String?) -> Unit) {
67124
FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
68125
if (!task.isSuccessful) {

app/src/main/java/com/lgtm/android/di/NetworkModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.lgtm.android.di
22

33
import com.google.gson.GsonBuilder
4-
import com.lgtm.android.BuildConfig.DEBUG
4+
import com.lgtm.android.BuildConfig.IS_DEV
55
import com.lgtm.android.BuildConfig.LGTM_BASE_URL_DEBUG
66
import com.lgtm.android.BuildConfig.LGTM_BASE_URL_RELEASE
77
import com.lgtm.android.data.datasource.LgtmPreferenceDataSource
@@ -64,7 +64,7 @@ object NetworkModule {
6464
@Singleton
6565
fun providesLGTMRetrofit(okHttpClient: OkHttpClient): Retrofit =
6666
Retrofit.Builder()
67-
.baseUrl(if (DEBUG) LGTM_BASE_URL_DEBUG else LGTM_BASE_URL_RELEASE)
67+
.baseUrl(if (IS_DEV) LGTM_BASE_URL_DEBUG else LGTM_BASE_URL_RELEASE)
6868
.client(okHttpClient)
6969
.addConverterFactory(
7070
GsonConverterFactory.create(

app/src/main/java/com/lgtm/android/di/RepositoryModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package com.lgtm.android.di
33
import com.lgtm.android.data.repository.AuthRepositoryImpl
44
import com.lgtm.android.data.repository.IntroRepositoryImpl
55
import com.lgtm.android.data.repository.MissionRepositoryImpl
6+
import com.lgtm.android.data.repository.NotificationRepositoryImpl
67
import com.lgtm.android.data.repository.ProfileRepositoryImpl
78
import com.lgtm.domain.repository.AuthRepository
89
import com.lgtm.domain.repository.IntroRepository
910
import com.lgtm.domain.repository.MissionRepository
11+
import com.lgtm.domain.repository.NotificationRepository
1012
import com.lgtm.domain.repository.ProfileRepository
1113
import dagger.Binds
1214
import dagger.Module
@@ -37,4 +39,9 @@ interface RepositoryModule {
3739
profileRepositoryImpl: ProfileRepositoryImpl
3840
): ProfileRepository
3941

42+
@Binds
43+
fun bindsNotificationRepository(
44+
notificationRepositoryImpl: NotificationRepositoryImpl
45+
): NotificationRepository
46+
4047
}

0 commit comments

Comments
 (0)