Skip to content

Commit

Permalink
Merge pull request #181 from hellokitty-coding-club/release/v1.1.0
Browse files Browse the repository at this point in the history
[REALESE] v1.1.0 (#178)
  • Loading branch information
KxxHyoRim authored Nov 8, 2023
2 parents 3aded45 + 63ce454 commit 26fd53d
Show file tree
Hide file tree
Showing 123 changed files with 1,622 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
appId: ${{ secrets.FIREBASE_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
groups: hello-kitty-coding-club
file: app/build/outputs/apk/debug/app-debug.apk
file: app/build/outputs/apk/dev/debug/app-dev-debug.apk
releaseNotes: |
${{ github.event.pull_request.title }}
${{ github.event.pull_request.html_url }}
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# 미션 기반 코드리뷰 매칭 플랫폼, LGTM

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

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

![image](https://github.com/hellokitty-coding-club/LGTM-Android/assets/59546818/4cff9177-ac15-4ddf-9a74-3a0654c8a502)
- 본 서비스는 SW마에스트로 14기 프로젝트입니다:)


| | | |
| -- | -- | -- |
|![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) |



Expand Down
19 changes: 19 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("UnstableApiUsage")

import org.jetbrains.kotlin.konan.properties.Properties

val lgtmPropertiesFile = rootProject.file("lgtm.properties")
Expand Down Expand Up @@ -45,6 +47,23 @@ android {
}
}

flavorDimensions += "version"
productFlavors {
create("prod") {
dimension = "version"
manifestPlaceholders["appLabel"] = "LGTM"
buildConfigField("boolean", "IS_PROD", "true")
buildConfigField("boolean", "IS_DEV", "false")
}
create("dev") {
dimension = "version"
applicationIdSuffix = ".dev"
manifestPlaceholders["appLabel"] = "(Dev)LGTM"
buildConfigField("boolean", "IS_PROD", "false")
buildConfigField("boolean", "IS_DEV", "true")
}
}

buildFeatures {
buildConfig = true
}
Expand Down
7 changes: 4 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
-keep class * extends com.google.gson.TypeAdapter
-keep class com.lgtm.android.data.** { *; }
-keep class com.lgtm.domain.** { *; }
-keep class com.swm.logging.android.** { *; }

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
Expand Down Expand Up @@ -99,9 +100,9 @@
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
#
## Ignore annotation used for build tooling.
#-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
Expand Down
29 changes: 29 additions & 0 deletions app/src/dev/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@
"storage_bucket": "lgtm-aeb7a.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1090377873764:android:5eb9f699608d0e5994e271",
"android_client_info": {
"package_name": "com.lgtm.android"
}
},
"oauth_client": [
{
"client_id": "1090377873764-b6gm8buak4slf1vf8a4osmjfm1ktokle.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAsd0MS5XNM3GoQlHKw09z9X9pK3R2EC3Y"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1090377873764-b6gm8buak4slf1vf8a4osmjfm1ktokle.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1090377873764:android:828cd0a400b0f62594e271",
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:name=".LGTMApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${appLabel}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LGTMAndroid"
Expand Down Expand Up @@ -37,7 +37,8 @@

<activity
android:name=".auth.ui.signup.SignUpActivity"
android:exported="false" />
android:exported="false"
android:windowSoftInputMode="adjustPan" />

<activity
android:name=".main.MainActivity"
Expand Down Expand Up @@ -65,5 +66,9 @@
android:exported="false"
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".main.notification.NotificationCenterActivity"
android:exported="false" />

</application>
</manifest>
19 changes: 9 additions & 10 deletions app/src/main/java/com/lgtm/android/LGTMApplication.kt
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
package com.lgtm.android

import android.app.Application
import com.lgtm.android.data.datasource.LgtmPreferenceDataSource
import com.lgtm.domain.repository.AuthRepository
import com.swm.logging.android.SWMLogging
import dagger.hilt.android.HiltAndroidApp
import java.util.Locale
import javax.inject.Inject

@HiltAndroidApp
class LGTMApplication : Application() {

@Inject
lateinit var lgtmPreferenceDataSource: LgtmPreferenceDataSource
lateinit var authRepository: AuthRepository

override fun onCreate() {
super.onCreate()
SWMLogging.init(
appVersion = BuildConfig.VERSION_NAME,
osNameAndVersion = "$ANDROID ${android.os.Build.VERSION.SDK_INT}",
baseUrl = if (BuildConfig.DEBUG) BuildConfig.LGTM_BASE_URL_DEBUG else BuildConfig.LGTM_BASE_URL_RELEASE,
deviceModel = android.os.Build.MODEL,
baseUrl = if (BuildConfig.IS_DEV) BuildConfig.LGTM_BASE_URL_DEBUG else BuildConfig.LGTM_BASE_URL_RELEASE,
serverPath = "v1/log",
token = getAuthToken()
region = Locale.getDefault().toString(),
userID = getUserId()
)
}

private fun getAuthToken(): String {
return lgtmPreferenceDataSource.getValue(
preferenceKey = LgtmPreferenceDataSource.Companion.PreferenceKey.ACCESS_TOKEN,
defaultValue = "",
isEncrypted = true
)
private fun getUserId(): String {
return authRepository.getMemberId().toString()
}

companion object {
Expand Down
83 changes: 70 additions & 13 deletions app/src/main/java/com/lgtm/android/LGTMFirebaseMessagingService.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
@file:Suppress("MoveVariableDeclarationIntoWhen")

package com.lgtm.android

import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.TaskStackBuilder
import android.content.ContentValues.TAG
import android.content.Context
import android.graphics.Bitmap
import android.content.Intent
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.lgtm.android.common_ui.R
import com.lgtm.android.main.MainActivity
import com.lgtm.android.manage_mission.dashboard.DashboardActivity
import com.lgtm.android.manage_mission.ping_pong_junior.PingPongJuniorActivity
import com.lgtm.domain.constants.ProcessState.CODE_REVIEW
import com.lgtm.domain.constants.ProcessState.MISSION_FINISHED
import com.lgtm.domain.constants.ProcessState.MISSION_PROCEEDING
import com.lgtm.domain.constants.ProcessState.PAYMENT_CONFIRMATION
import com.lgtm.domain.constants.ProcessState.WAITING_FOR_PAYMENT
import com.lgtm.domain.constants.ProcessState.valueOf
import com.lgtm.domain.firebase.LgtmMessagingService
import com.lgtm.domain.usecase.DeviceTokenManagerUseCase
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject


@AndroidEntryPoint
class LGTMFirebaseMessagingService : FirebaseMessagingService(), LgtmMessagingService {
@Inject
Expand All @@ -29,31 +43,65 @@ class LGTMFirebaseMessagingService : FirebaseMessagingService(), LgtmMessagingSe
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)

Log.d(TAG, "onMessageReceived: ${remoteMessage.data}")

if (remoteMessage.data.isNotEmpty()) {
// data 확인
handleDataType(remoteMessage.data)
}

remoteMessage.notification?.let {
generateNotification(it.title!!, it.body!!)
handleNotificationType(it)
}
}

private fun generateNotification(
title: String?,
message: String?,
image: Bitmap? = null,
) {
private fun handleDataType(data: Map<String, String>) {
val requestCode = System.currentTimeMillis().toInt()

val builder = NotificationCompat.Builder(this, channelID)
val title = data["title"]
val body = data["body"]
val missionId: Int? = data["missionId"]?.toInt()
val processState = data["pushCategory"]?.let { valueOf(it) }
val intent = when (processState) {
WAITING_FOR_PAYMENT, PAYMENT_CONFIRMATION, CODE_REVIEW ->
Intent(this, DashboardActivity::class.java)
.putExtra(DashboardActivity.MISSION_ID, missionId)

MISSION_PROCEEDING, MISSION_FINISHED ->
Intent(this, PingPongJuniorActivity::class.java)
.putExtra(DashboardActivity.MISSION_ID, missionId)

else -> return
}

val mainIntent = Intent(this, MainActivity::class.java)

val stackBuilder = TaskStackBuilder.create(this)
.addParentStack(MainActivity::class.java)
.addNextIntent(mainIntent)
.addNextIntent(intent)

val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE)

val builder = createNotificationBuilder(title, body, resultPendingIntent)
notifyWithChannel(requestCode, builder)
}

private fun createNotificationBuilder(
title: String?,
message: String?,
contentIntent: PendingIntent?,
): NotificationCompat.Builder {
return NotificationCompat.Builder(this, channelID)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setSmallIcon(R.drawable.ic_launcher_foreground)
// .setColor(Color.argb(255, 133, 120, 255)) // havit_purple
.setSmallIcon(R.drawable.ic_launch_mono)
.setColor(ContextCompat.getColor(this, R.color.green))
.setAutoCancel(true)
.setContentTitle(title)
.setLargeIcon(image)
.setStyle(NotificationCompat.BigTextStyle().bigText(message))
.setContentIntent(contentIntent)
}

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

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

private fun handleNotificationType(notification: RemoteMessage.Notification) {
val title = notification.title ?: ""
val message = notification.body ?: ""
val requestCode = System.currentTimeMillis().toInt()

val builder = createNotificationBuilder(title, message, null)
notifyWithChannel(requestCode, builder)
}

override fun getDeviceToken(tokenCallBack: (String?) -> Unit) {
FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
if (!task.isSuccessful) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/lgtm/android/di/NetworkModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.lgtm.android.di

import com.google.gson.GsonBuilder
import com.lgtm.android.BuildConfig.DEBUG
import com.lgtm.android.BuildConfig.IS_DEV
import com.lgtm.android.BuildConfig.LGTM_BASE_URL_DEBUG
import com.lgtm.android.BuildConfig.LGTM_BASE_URL_RELEASE
import com.lgtm.android.data.datasource.LgtmPreferenceDataSource
Expand Down Expand Up @@ -64,7 +64,7 @@ object NetworkModule {
@Singleton
fun providesLGTMRetrofit(okHttpClient: OkHttpClient): Retrofit =
Retrofit.Builder()
.baseUrl(if (DEBUG) LGTM_BASE_URL_DEBUG else LGTM_BASE_URL_RELEASE)
.baseUrl(if (IS_DEV) LGTM_BASE_URL_DEBUG else LGTM_BASE_URL_RELEASE)
.client(okHttpClient)
.addConverterFactory(
GsonConverterFactory.create(
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/lgtm/android/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.lgtm.android.di
import com.lgtm.android.data.repository.AuthRepositoryImpl
import com.lgtm.android.data.repository.IntroRepositoryImpl
import com.lgtm.android.data.repository.MissionRepositoryImpl
import com.lgtm.android.data.repository.NotificationRepositoryImpl
import com.lgtm.android.data.repository.ProfileRepositoryImpl
import com.lgtm.domain.repository.AuthRepository
import com.lgtm.domain.repository.IntroRepository
import com.lgtm.domain.repository.MissionRepository
import com.lgtm.domain.repository.NotificationRepository
import com.lgtm.domain.repository.ProfileRepository
import dagger.Binds
import dagger.Module
Expand Down Expand Up @@ -37,4 +39,9 @@ interface RepositoryModule {
profileRepositoryImpl: ProfileRepositoryImpl
): ProfileRepository

@Binds
fun bindsNotificationRepository(
notificationRepositoryImpl: NotificationRepositoryImpl
): NotificationRepository

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.lgtm.android.di
import com.lgtm.android.data.service.AuthService
import com.lgtm.android.data.service.IntroService
import com.lgtm.android.data.service.MissionService
import com.lgtm.android.data.service.NotificationService
import com.lgtm.android.data.service.ProfileService
import dagger.Module
import dagger.Provides
Expand Down Expand Up @@ -34,4 +35,10 @@ object RetrofitServiceModule {
@Singleton
fun providesProfileService(retrofit: Retrofit): ProfileService =
retrofit.create(ProfileService::class.java)


@Provides
@Singleton
fun providesNotificationService(retrofit: Retrofit): NotificationService =
retrofit.create(NotificationService::class.java)
}
6 changes: 6 additions & 0 deletions app/src/main/java/com/lgtm/android/navigator/LgtmNavigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.lgtm.android.auth.ui.SignInActivity
import com.lgtm.android.common_ui.navigator.FakeLgtmNavigator
import com.lgtm.android.create_mission.CreateMissionActivity
import com.lgtm.android.main.MainActivity
import com.lgtm.android.main.notification.NotificationCenterActivity
import com.lgtm.android.manage_mission.dashboard.DashboardActivity
import com.lgtm.android.manage_mission.ping_pong_junior.PingPongJuniorActivity
import com.lgtm.android.mission_detail.MissionDetailActivity
Expand Down Expand Up @@ -56,4 +57,9 @@ class LgtmNavigator @Inject constructor(
}
context.startActivity(intent)
}

override fun navigateToNotificationCenter(context: Context) {
val intent = Intent(context, NotificationCenterActivity::class.java)
context.startActivity(intent)
}
}
Loading

0 comments on commit 26fd53d

Please sign in to comment.