Skip to content

Commit

Permalink
#0-초기 코드 생성 (#3)
Browse files Browse the repository at this point in the history
* feat: Presentation 모듈 생성, Firebase 설정, 의존성 정리

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: coil 의존성 추가, toml 정리, 파이어베이스 local key 설정

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* chore: Presentation module 삭제 및 app 모듈로 통합

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: BaseFragment 생성

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: 기본 Fragment 생성

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: Navigation Component 설정

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* build: API 키 설정

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: RecyclerView Decoration 생성

Co-authored-by: DoTheBestMayB <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* add: font resource

Co-authored-by: DoTheBestMayB <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: kakaoMap 의존성 추가, toml 정리, buildConfig 설정

Co-authored-by: DoTheBestMayB <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: data 모듈 생성 및 retrofit 의존성 옮기기

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* style: Font, Dimen, Themes 설정

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* feat: data 모듈에 Repository 인터페이스 생성 및 필요한 데이터 클래스 정의

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* fix: textSize dp로 되어 있는 것을 dp로 바꾸기

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* chore: 코드 정렬 및 import 정리

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

* docs: 깃허브 템플릿 작성

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>

---------

Co-authored-by: rlaxodud214 <[email protected]>
Co-authored-by: yoonchanchoi <[email protected]>
Co-authored-by: kory0115 <[email protected]>
  • Loading branch information
4 people authored May 30, 2024
1 parent f12eda6 commit c613284
Show file tree
Hide file tree
Showing 100 changed files with 1,603 additions and 48 deletions.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 🚅 Issue 한 줄 요약

이슈를 한줄로 요약해주세요.

## 🤷 Issue 세부 내용

무슨 이슈인가요?

## ✨ 기대 결과

어떤 결과물을 원하시나요?

## 📸 스크린샷

이슈에 해당하는 부분을 보여주세요.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## (필수) 기능 구현 목록

- 구현 목록

## (필수) 스크린샷

- 사진 or GIF

## (선택) Issue

- 한 줄 요약
- 세부 내용

## (선택) 집중적으로 코드리뷰 받고 싶은 부분

- ex. Fragment와 RecyclerView의 생명주기에 맞게 제대로 구현했는지 검토 부탁드립니다.

## 참고사항

- 팀원이나 코드 리뷰어에게 공유해야 할 내용
27 changes: 25 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import java.util.Properties
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
alias(libs.plugins.googleService)
alias(libs.plugins.navigationSafeArgs)
alias(libs.plugins.ksp)
alias(libs.plugins.kotlinParcelize)
alias(libs.plugins.googleService)
alias(libs.plugins.hilt)
}

val properties = Properties()
Expand All @@ -25,7 +26,10 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "SOME_KEY", "${properties["some_key"]}")
buildConfigField("String", "FIREBASE_KEY", "${properties["firebase_key"]}")
buildConfigField("String", "KAKAO_MAP_NATIVE_KEY", "${properties["kakao_map_native_key"]}")
buildConfigField("String", "KAKAO_MAP_REST_API_KEY", "${properties["kakao_map_rest_api_key"]}")

}

buildTypes {
Expand All @@ -51,12 +55,14 @@ android {
}

dependencies {
implementation(project(":data"))

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.firebase.perf.ktx)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand All @@ -66,4 +72,21 @@ dependencies {
implementation(libs.firebase.firestore)
implementation(libs.firebase.messaging)
implementation(libs.firebase.storage)

// hilt
implementation(libs.hilt)
ksp(libs.hilt.compiler)

// navigation
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.androidx.navigation.fragment.ktx)

// datastore
implementation(libs.androidx.datastore.preferences)

// coil
implementation(libs.coil.kt)

// kakao Map
implementation(libs.kakao.maps)
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.bestapp.rice

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,38 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:name=".App"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Rice"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".ui.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".FireBaseMessageReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

</application>

</manifest>
14 changes: 14 additions & 0 deletions app/src/main/java/com/bestapp/rice/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.bestapp.rice

import android.app.Application
import com.google.firebase.FirebaseApp
import com.google.firebase.perf.metrics.AddTrace

class App : Application() {

@AddTrace(name = "onCreate")
override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(applicationContext)
}
}
57 changes: 57 additions & 0 deletions app/src/main/java/com/bestapp/rice/FireBaseMessageReceiver.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.bestapp.rice

import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.media.RingtoneManager
import androidx.core.app.NotificationCompat
import com.bestapp.rice.ui.MainActivity
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage

class FireBaseMessageReceiver : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) { //메세지 수신
super.onMessageReceived(remoteMessage)
remoteMessage.notification?.let {
it.title?.let { it1 -> it.body?.let { it2 -> sendNotification(it1, it2) } }
}
}

override fun onNewToken(token: String) { //토큰 발급
super.onNewToken(token)
}

private fun sendNotification(title: String, messageBody: String) { //알림 기본로직
val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(
this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE
)

val channelId = "my_channel"
val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val notificationBuilder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_launcher_background)
.setContentTitle(title)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)

val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

// 버전 분기 처리
val channel = NotificationChannel(
channelId,
"Channel human readable title",
NotificationManager.IMPORTANCE_DEFAULT
)
notificationManager.createNotificationChannel(channel)

notificationManager.notify(0 /* ID of notification */, notificationBuilder.build())
}
}
20 changes: 0 additions & 20 deletions app/src/main/java/com/bestapp/rice/MainActivity.kt

This file was deleted.

38 changes: 38 additions & 0 deletions app/src/main/java/com/bestapp/rice/model/FilterUiState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.bestapp.rice.model

import android.os.Parcelable
import com.bestapp.rice.data.model.remote.Filter
import kotlinx.parcelize.Parcelize

interface FilterUiState {

@Parcelize
data class FoodUiState(
val icon: String,
val name: String,
) : Parcelable, FilterUiState {

companion object {

fun createFrom(foodCategory: Filter.Food) = FoodUiState(
icon = foodCategory.icon,
name = foodCategory.name,
)
}
}

@Parcelize
data class CostUiState(
val name: Int,
val type: Int,
) : Parcelable, FilterUiState {

companion object {

fun createFrom(costCategory: Filter.Cost) = CostUiState(
name = costCategory.name,
type = costCategory.type
)
}
}
}
45 changes: 45 additions & 0 deletions app/src/main/java/com/bestapp/rice/model/MeetingUiState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.bestapp.rice.model

import android.os.Parcelable
import com.bestapp.rice.data.model.remote.Meeting
import kotlinx.parcelize.Parcelize

@Parcelize
data class MeetingUiState(
val meetingDocumentID: String,
val title: String,
val titleImage: String,
val placeLocationUiState: PlaceLocationUiState,
val time: String,
val recruits: Int,
val description: String,
val mainMenu: String,
val costValueByPerson: Int,
val costTypeByPerson: Int,
val host: String,
val members: List<String>,
val pendingMembers: List<String>,
val attendanceCheck: List<String>,
val activation: Boolean,
) : Parcelable {

companion object {
fun createFrom(meeting: Meeting) = MeetingUiState(
meetingDocumentID = meeting.meetingDocumentID,
title = meeting.title,
titleImage = meeting.titleImage,
placeLocationUiState = PlaceLocationUiState.createFrom(meeting.placeLocation),
time = meeting.time,
recruits = meeting.recruits,
description = meeting.description,
mainMenu = meeting.mainMenu,
costValueByPerson = meeting.costValueByPerson,
costTypeByPerson = meeting.costTypeByPerson,
host = meeting.host,
members = meeting.members,
pendingMembers = meeting.pendingMembers,
attendanceCheck = meeting.attendanceCheck,
activation = meeting.activation,
)
}
}
21 changes: 21 additions & 0 deletions app/src/main/java/com/bestapp/rice/model/PlaceLocationUiState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.bestapp.rice.model

import android.os.Parcelable
import com.bestapp.rice.data.model.remote.PlaceLocation
import kotlinx.parcelize.Parcelize

@Parcelize
data class PlaceLocationUiState(
val locationAddress: String,
val locationLat: String,
val locationLong: String,
) : Parcelable {

companion object {
fun createFrom(placeLocation: PlaceLocation) = PlaceLocationUiState(
locationAddress = placeLocation.locationAddress,
locationLat = placeLocation.locationLat,
locationLong = placeLocation.locationLong,
)
}
}
18 changes: 18 additions & 0 deletions app/src/main/java/com/bestapp/rice/model/PostUiState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.bestapp.rice.model

import android.os.Parcelable
import com.bestapp.rice.data.model.remote.Post
import kotlinx.parcelize.Parcelize

@Parcelize
data class PostUiState(
val postDocumentID: String,
val images: List<String>,
) : Parcelable {
companion object {
fun createFrom(post: Post) = PostUiState(
postDocumentID = post.postDocumentID,
images = post.images,
)
}
}
Loading

0 comments on commit c613284

Please sign in to comment.