Skip to content

Commit

Permalink
Merge pull request #274 from mash-up-kr/release/v1.1.4
Browse files Browse the repository at this point in the history
[Release] version 1.1.4
  • Loading branch information
jaeryo2357 authored Apr 8, 2023
2 parents dd03fd3 + 559fc56 commit d82ef1b
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 78 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# recruit_android

##Description
매쉬업 브랜딩팀 출석체크 앱
MashUp Official App

## Developer
김유정

> 🏆 명예 멤버
>
> [김유정](https://github.com/YuChocopie)

양민욱
정민지
안석주

## Commit Rule
- 🛠refactor : 새로운 기능이 아닌 코드를 재정비 하였을 때 (변수 이름 바꾸기)
Expand Down
11 changes: 3 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId "com.mashup"
minSdkVersion minVersion
targetSdkVersion targetVersion
versionCode 19
versionName "1.1.3"
versionCode 20
versionName "1.1.4"

testInstrumentationRunner "com.mashup.core.testing.MashUpTestRunner"
vectorDrawables {
Expand Down Expand Up @@ -96,6 +96,7 @@ dependencies {
implementation project(":core:testing")
implementation project(":core:common")
implementation project(":core:datastore")
implementation project(":core:firebase")
implementation project(":feature:setting")

// ml Kit
Expand All @@ -106,12 +107,6 @@ dependencies {
implementation "androidx.camera:camera-lifecycle:$cameraVersion"
implementation "androidx.camera:camera-view:$cameraVersion"

// google firebase
implementation platform("com.google.firebase:firebase-bom:$firebaseVersion")
implementation "com.google.firebase:firebase-analytics-ktx"
implementation "com.google.firebase:firebase-crashlytics-ktx"
implementation "com.google.firebase:firebase-messaging-ktx"

// hilt
implementation "com.google.dagger:hilt-android:$hiltVersion"
kapt "com.google.dagger:hilt-compiler:$hiltVersion"
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

<queries>
<package android:name="com.android.vending" />
<intent>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="https" android:host="play.google.com" />
</intent>
</queries>

<application
android:name=".MashUpApplication"
android:icon="@mipmap/ic_launcher"
Expand Down Expand Up @@ -90,6 +98,7 @@
<activity
android:name=".ui.error.NetworkDisconnectActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mashup/base/BaseViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ abstract class BaseViewModel : ViewModel() {
}
}

abstract fun handleErrorCode(code: String)
open fun handleErrorCode(code: String) {}
}
18 changes: 0 additions & 18 deletions app/src/main/java/com/mashup/data/repository/FirebaseRepository.kt

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/java/com/mashup/ui/login/LoginViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.mashup.ui.login

import com.mashup.base.BaseViewModel
import com.mashup.core.common.model.Validation
import com.mashup.core.firebase.FirebaseRepository
import com.mashup.core.model.Platform
import com.mashup.data.repository.FirebaseRepository
import com.mashup.data.repository.MemberRepository
import com.mashup.datastore.data.repository.UserPreferenceRepository
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down
11 changes: 3 additions & 8 deletions app/src/main/java/com/mashup/ui/schedule/ScheduleFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class ScheduleFragment : BaseFragment<FragmentScheduleBinding>() {
override fun initViews() {
super.initViews()
initSwipeRefreshLayout()
initRefreshButton()
initViewPager()
}

Expand All @@ -93,13 +92,6 @@ class ScheduleFragment : BaseFragment<FragmentScheduleBinding>() {
}
}

private fun initRefreshButton() {
viewBinding.btnRefresh.onThrottleFirstClick(viewLifecycleOwner.lifecycleScope) {
AnalyticsManager.addEvent(eventName = LOG_SCHEDULE_LIST_REFRESH)
viewModel.getScheduleList()
}
}

private fun initViewPager() {
viewBinding.vpSchedule.apply {
val pageMarginPx = resources.getDimensionPixelOffset(R.dimen.pageMargin)
Expand Down Expand Up @@ -180,6 +172,9 @@ class ScheduleFragment : BaseFragment<FragmentScheduleBinding>() {
is ScheduleTitleState.DateCount -> {
getString(R.string.event_list_title, scheduleTitleState.dataCount).fromHtml()
}
is ScheduleTitleState.SchedulePreparing -> {
getString(R.string.preparing_attendance)
}
}
}

Expand Down
15 changes: 10 additions & 5 deletions app/src/main/java/com/mashup/ui/schedule/ScheduleViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ class ScheduleViewModel @Inject constructor(
}
_scheduleState.emit(
ScheduleState.Success(
scheduleTitleState = when (response.data.progress) {
SchedulesProgress.DONE -> {
scheduleTitleState = when {
response.data.progress == SchedulesProgress.DONE -> {
ScheduleTitleState.End(generateNumber)
}
SchedulesProgress.NOT_REGISTERED -> {
response.data.progress == SchedulesProgress.NOT_REGISTERED -> {
ScheduleTitleState.Empty
}
SchedulesProgress.ON_GOING -> {
ScheduleTitleState.DateCount(response.data.dateCount ?: 0)
response.data.progress == SchedulesProgress.ON_GOING &&
response.data.dateCount != null -> {
ScheduleTitleState.DateCount(response.data.dateCount)
}
else -> {
ScheduleTitleState.SchedulePreparing
}
},
scheduleList = if (response.data.scheduleList.isEmpty()) {
Expand Down Expand Up @@ -126,6 +130,7 @@ sealed interface ScheduleTitleState {
data class DateCount(val dataCount: Int) : ScheduleTitleState
data class End(val generatedNumber: Int) : ScheduleTitleState
object Empty : ScheduleTitleState
object SchedulePreparing : ScheduleTitleState
}

sealed interface ScheduleState {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mashup/ui/signup/SignUpViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.mashup.ui.signup

import com.mashup.base.BaseViewModel
import com.mashup.core.common.model.Validation
import com.mashup.core.firebase.FirebaseRepository
import com.mashup.core.model.Platform
import com.mashup.data.repository.FirebaseRepository
import com.mashup.data.repository.MemberRepository
import com.mashup.datastore.data.repository.UserPreferenceRepository
import com.mashup.ui.signup.state.CodeState
Expand Down
62 changes: 57 additions & 5 deletions app/src/main/java/com/mashup/ui/splash/SplashActivity.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package com.mashup.ui.splash

import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.activity.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.mashup.R
import com.mashup.base.BaseActivity
import com.mashup.core.common.extensions.setStatusBarColorRes
import com.mashup.core.common.extensions.setStatusBarDarkTextColor
import com.mashup.core.common.widget.CommonDialog
import com.mashup.databinding.ActivitySplashBinding
import com.mashup.datastore.data.repository.UserPreferenceRepository
import com.mashup.ui.login.LoginActivity
import com.mashup.util.AnalyticsManager
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand All @@ -27,14 +33,13 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
@Inject
lateinit var userPreferenceRepository: UserPreferenceRepository

private val splashViewModel: SplashViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

lifecycleScope.launchWhenResumed {
delay(2000)
startActivity(LoginActivity.newIntent(this@SplashActivity))
}
setUi()
observeViewModel()
initAnalyticsManager()
}

Expand All @@ -43,6 +48,53 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
setStatusBarDarkTextColor(false)
}

private fun observeViewModel() {
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
launch {
splashViewModel.onLowerAppVersion.collectLatest {
CommonDialog(this@SplashActivity).apply {
setTitle("업데이트")
setMessage("정상적인 이용을 위해\n업데이트가 필요합니다.")
setNegativeButton(text = "확인") {
moveNextScreen()
}
setPositiveButton(text = "업데이트 하기") {
moveGooglePayForUpdate()
}
show()
}
}
}
launch {
splashViewModel.onFinishInit.collectLatest {
moveNextScreen()
}
}
}
}
splashViewModel.checkAppVersion(this)
}

private fun moveNextScreen() {
startActivity(LoginActivity.newIntent(this@SplashActivity))
finish()
}

private fun moveGooglePayForUpdate() {
try {
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(
"https://play.google.com/store/apps/details?id=com.mashup"
)
setPackage("com.android.vending")
}
startActivity(intent)
finish()
} catch (ignore: Exception) {
}
}

private fun initAnalyticsManager() {
AnalyticsManager.init(this)
lifecycleScope.launch {
Expand Down
43 changes: 43 additions & 0 deletions app/src/main/java/com/mashup/ui/splash/SplashViewModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.mashup.ui.splash

import android.content.Context
import androidx.core.content.pm.PackageInfoCompat
import com.mashup.base.BaseViewModel
import com.mashup.core.firebase.FirebaseRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import javax.inject.Inject


@HiltViewModel
class SplashViewModel @Inject constructor(
private val firebaseRepository: FirebaseRepository
) : BaseViewModel() {

private val _onLowerAppVersion = MutableSharedFlow<Unit>()
val onLowerAppVersion: SharedFlow<Unit> = _onLowerAppVersion

private val _onFinishInit = MutableSharedFlow<Unit>()
val onFinishInit: SharedFlow<Unit> = _onFinishInit

fun checkAppVersion(context: Context) = mashUpScope {
try {
val localVersionCode = PackageInfoCompat.getLongVersionCode(
context.packageManager.getPackageInfo(context.packageName, 0)
)
val resentAppVersion = firebaseRepository.getRecentAppVersion()
if (localVersionCode < resentAppVersion) {
_onLowerAppVersion.emit(Unit)
} else {
delay(2000L)
_onFinishInit.emit(Unit)
}
} catch (cancelException: CancellationException) {
throw cancelException
} catch (ignore: Exception) {
}
}
}
23 changes: 2 additions & 21 deletions app/src/main/res/layout/fragment_schedule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,13 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginEnd="50dp"
android:lineSpacingExtra="2dp"
android:textAppearance="@style/TextAppearance.Mashup.Header1_24_B"
app:layout_constraintEnd_toStartOf="@+id/btn_refresh"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/event_list_title" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/btn_refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="20dp"
android:background="@drawable/bg_line_r6_200"
android:drawableStart="@drawable/ic_refresh"
android:drawablePadding="2dp"
android:paddingStart="8dp"
android:paddingTop="7dp"
android:paddingEnd="8dp"
android:paddingBottom="7dp"
android:text="@string/event_refresh"
android:textAppearance="@style/TextAppearance.Mashup.Caption1_12_M"
android:textColor="@color/gray700"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
tools:text="@string/event_list_title" />

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vpSchedule"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<string name="what_attendance_plus_content8">회장/부회장 : +100</string>

<string name="total_activity_count">활동 점수</string>
<string name="event_list_title"><![CDATA[다음 세미나 일정까지\n<font color="#6A36FF">%d</font>일 남았습니다!]]></string>
<string name="event_refresh">일정 새로고침</string>
<string name="event_list_title"><![CDATA[다음 세미나 일정까지<br><font color="#6A36FF">%d</font>일 남았습니다!]]></string>
<string name="event_list_card_title"><![CDATA[<font color="#383E4C"><b>%s</b></font>님의 현재 출석현황이에요]]></string>
<string name="attendance">출석</string>
<string name="absent">결석</string>
Expand All @@ -37,6 +36,7 @@
<string name="sign_out_msg">매시업을 잊지말아죠...</string>
<string name="sign_out_msg_detail">탈퇴하시면 Admin에 저장된 모든 관련정보는 탈퇴일자 기준으로 3년간 보관된 후 삭제됩니다. 삭제된 정보는 복구할 수 없으니 신중하게 결정해주세요.</string>
<string name="activity_history">활동 히스토리</string>
<string name="preparing_attendance">다음 세미나 준비 중이에요.\n조금만 기다려주세요.</string>

<string name="title_activity_main">MainActivity</string>
<string name="total_attendance_score">총 출석점수</string>
Expand Down
Loading

0 comments on commit d82ef1b

Please sign in to comment.