Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release/2.1.0] #223

Merged
merged 12 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,25 @@ assignees: ''

---

### 발견한 문제
# ⚠️ Bug Report

---
## 발견한 문제

<aside>
💡 정확한 문제와 상황을 적어주세요. 나중에 개발자가 다시 시연하기 편하게 상황까지 적어주시면 좋습니다.
> 정확한 문제와 상황을 적어주세요. 나중에 개발자가 다시 시연하기 편하게 상황까지 적어주시면 좋습니다.

</aside>

### 스크린샷

---
## 스크린샷

<aside>
💡 텍스트로 설명하기 어렵거나 편하 게 이해하기 위해서는 발생한 문제의 스크린샷까지 남겨주세요.
> 텍스트로 설명하기 어렵거나 편하게 이해하기 위해서는 발생한 문제의 스크린샷이나 동영상을 남겨주세요.

</aside>

### 플랫폼(Android, iOS, Web)

---

- 플랫폼:
- 디바이스:
- OS:
- 브라우저:
## 플랫폼(Android)

### 기타 정보
- 디바이스:

---
## 기타 정보

- 앱 버전:
- 앱 버전:
88 changes: 88 additions & 0 deletions .github/workflows/qa_apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Android APK Build and Slack Upload

on:
workflow_dispatch: # 버튼을 누를 시 실행되도록 설정
inputs:
environment:
description: 'Select environment'
required: true
default: 'qa'
type: choice
options:
- qa
- production

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Create Local Properties
run: touch local.properties

- name: Access Local Properties
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
KAKAO_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
run: |
echo DEV_BASE_URL=\"$DEV_BASE_URL\" >> local.properties
echo PROD_BASE_URL=\"$PROD_BASE_URL\" >> local.properties
echo KAKAO_NATIVE_APP_KEY=$KAKAO_APP_KEY >> local.properties

- name: Generate google-services.json
run: |
echo "$GOOGLE_SERVICE" > app/google-services.json.b64
base64 -d -i app/google-services.json.b64 > app/google-services.json
env:
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Debug APK
run: ./gradlew assembleDebug --stacktrace

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app
path: app/build/outputs/apk/debug/app-debug.apk

- name: Slack - Send Msg
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,commit,repo,author,job,ref,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Slack - Upload APK
if: github.event_name == 'workflow_dispatch'
uses: MeilCli/slack-upload-file@v4
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
initial_comment: 'APK 빌드가 완료되었습니다.'
file_type: 'apk'
file_name: 'app-debug.apk'
file_path: './app/build/outputs/apk/debug/app-debug.apk'
11 changes: 7 additions & 4 deletions .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release Tag

on:
push:
branches: [ "production" ]

#트리거 요소
on:
pull_request:
branches:
- production
types:
- closed

jobs:
build:
Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@
## 📌 Project Init

- 숭실대 학식 리뷰 앱
- 기간: 2023.03 ~
- PlayStore : [EAT-SSU](https://play.google.com/store/apps/details?id=com.eassu.android)
- 기간: 2023.03 ~
- [PlayStore 바로가기](https://play.google.com/store/apps/details?id=com.eassu.android)

![그래픽이미지](https://github.com/user-attachments/assets/e89f46bb-dece-45a9-a453-a00bf9d463cd)



## 🛠 Tech Stack
- `Kotlin`
- `MVVM` + `Clean Architecture`
- `Coroutine`
- `Flow`
- `UiState`
- `Hilt`
- Kotlin
- MVVM
- Clean Architecture
- Coroutine + Flow
- UiState
- Hilt
- xml + viewBinding (+dataBinding)
- Retrofit2 + Okhttp3
- Gilde
- KaKao OAuth SDK
- Firebase RemoteConfig, Crashlytics

## 🤔 Not Yet..
- `Modularization`
- `Jetpack Compose`
- `DataSource` + `Repository Pattern`
- Modularization
- Jetpack Compose
- DataSource + Repository Pattern

## 📄 Package
```
Expand All @@ -44,7 +53,7 @@ com.eatssu.android


## 🤖 Android
- Android Studio : Android Studio Hedgehog | 2023.1.1 Patch 2
- Android Studio : Android Studio Koala | 2024.1.1
- JDK : 17
- minSDK : 23
- targetSDK : 34
Expand Down
13 changes: 8 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ android {
namespace = "com.eatssu.android"
compileSdk = 34

// S8: API 28
// S21: API 33
defaultConfig {
applicationId = "com.eatssu.android"
minSdk = 23
targetSdk = 34
versionCode = 19
versionName = "2.0.0"
versionCode = 1
versionName = "2.1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -138,14 +141,14 @@ dependencies {
implementation(libs.lifecycle.viewmodel)
implementation(libs.lifecycle.livedata)

// Firebase
implementation(libs.play.services.base)
implementation(libs.firebase.config)

// Firebase
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.config)
implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics)


// Timber for logging
implementation(libs.timber)
}
Expand Down
20 changes: 0 additions & 20 deletions app/release/output-metadata.json

This file was deleted.

17 changes: 16 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<!-- 이미지 관련 -->
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
Expand All @@ -17,11 +18,15 @@
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature
android:name="android.hardware.camera"
android:required="true" />

<!-- 알림 관련 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<application
android:name=".App"
android:allowBackup="true"
Expand All @@ -36,6 +41,16 @@
android:theme="@style/Theme.EatSSUAndroid"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<receiver
android:name=".util.NotificationReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<activity
android:name=".ui.mypage.DeveloperActivity"
android:exported="false" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/eatssu/android/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import timber.log.Timber
@HiltAndroidApp
class App: Application() {
companion object{
lateinit var appContext : Context
lateinit var appContext: Context //todo 이거 빼기
}

override fun onCreate() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// PreferencesRepository.kt
package com.eatssu.android.data.repository

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.preferencesDataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map

class PreferencesRepository(private val context: Context) {

private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")

companion object {
private val DAILY_NOTIFICATION_KEY = booleanPreferencesKey("daily_notification")
}

val dailyNotificationStatus: Flow<Boolean> = context.dataStore.data
.map { preferences ->
preferences[DAILY_NOTIFICATION_KEY] ?: false // Default value is false
}

suspend fun setDailyNotificationStatus(status: Boolean) {
context.dataStore.edit { preferences ->
preferences[DAILY_NOTIFICATION_KEY] = status
}
}
}
44 changes: 44 additions & 0 deletions app/src/main/java/com/eatssu/android/data/usecase/AlarmUsecase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.eatssu.android.data.usecase

import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import com.eatssu.android.util.NotificationReceiver
import java.util.Calendar
import javax.inject.Inject

class AlarmUseCase @Inject constructor(private val context: Context) {

fun scheduleAlarm() {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = Intent(context, NotificationReceiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(
context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)

val calendar = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, 11)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}

if (calendar.timeInMillis <= System.currentTimeMillis()) {
calendar.add(Calendar.DAY_OF_YEAR, 1)
}

alarmManager.setRepeating(
AlarmManager.RTC_WAKEUP, calendar.timeInMillis, AlarmManager.INTERVAL_DAY, pendingIntent
)
}

fun cancelAlarm() {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = Intent(context, NotificationReceiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(
context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
alarmManager.cancel(pendingIntent)
}
}
Loading
Loading