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

[feat] 온보딩 ui 변경 #127

Merged
merged 25 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6b924b9
[mod] #116 installSplashScreen() 위치 수정
l2zh Mar 14, 2024
5bfbdc2
[feat] #116 앱 진입 플로우 수정 및 화면 이동 상태 처리
l2zh Mar 18, 2024
1146590
[mod] #116 스플래시 ui 수정
l2zh Mar 18, 2024
d60bc3b
Merge branch 'develop' into feat/#116-onboarding-ui-change
l2zh Mar 18, 2024
84e0fdf
Merge branch 'develop' into feat/#116-onboarding-ui-change
l2zh Mar 19, 2024
ad295d5
[mod] #116 권한 뷰 ui 수정
l2zh Mar 19, 2024
1084b22
[mod] #116 이용약관 뷰 ui 수정
l2zh Mar 19, 2024
e04880a
[mod] #116 로그인 뷰 ui 수정
l2zh Mar 19, 2024
0aa1a71
[mod] #116 온보딩 뷰 ui 수정
l2zh Mar 19, 2024
9f92e07
[mod] #116 startMotivoo 뷰 ui 수정
l2zh Mar 19, 2024
a4a4dd3
[mod] #116 초대코드 관련 뷰 ui 수정
l2zh Mar 19, 2024
4af4f36
Merge branch 'develop' into feat/#116-onboarding-ui-change
l2zh Mar 20, 2024
c454b82
[chore] #116 커서, 하이라이트 색상 변경
l2zh Mar 20, 2024
06bb2a7
[feat] #116 콜백 해제
l2zh Mar 20, 2024
e7dfbad
[chore] #116 초대코드 폰트 변경
l2zh Mar 22, 2024
76e392a
Merge branch 'develop' into feat/#116-onboarding-ui-change
l2zh Mar 24, 2024
c6d5b0c
[del] #116 로딩뷰 삭제
l2zh Mar 24, 2024
88f3cc3
[feat] #116 로그인 로딩뷰 추가
l2zh Mar 24, 2024
9dbc81b
[feat] #116 온보딩 로딩뷰 추가
l2zh Mar 24, 2024
618c8da
[feat] #116 초대코드 뷰 UiState 상태 변경
l2zh Mar 24, 2024
ab47f7e
[feat] #116 운동 모아보기 뷰 로딩뷰 추가
l2zh Mar 24, 2024
6f23fa4
[chore] #116 네트워크 에러 뷰 에셋 변경
l2zh Mar 24, 2024
9b2b3b0
[feat] #116 나이입력 텍스트 필드 플래그 값 추가
l2zh Mar 24, 2024
4a93a1e
[chore] #116 foregroundServiceType 변경 (리젝 사유)
l2zh Mar 25, 2024
a919332
Merge branch 'develop' into feat/#116-onboarding-ui-change
l2zh Mar 25, 2024
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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId "sopt.motivoo"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
versionCode 4
versionName "1.0.1"

buildConfigField "String", "BASE_URL", properties["base_url"]
buildConfigField "String", "FIREBASE_RULE_UID", properties["firebase_rule_uid"]
Expand Down
14 changes: 9 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
Expand All @@ -40,18 +40,22 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".presentation.home.broadcastreceiver.HomeAlarmReceiver"
<receiver
android:name=".presentation.home.broadcastreceiver.HomeAlarmReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" />
</intent-filter>
</receiver>

<service
android:name=".presentation.home.service.StepCountService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<activity android:name=".presentation.SampleDesignActivity"
android:exported="false"/>
android:foregroundServiceType="health" />

<activity
android:name=".presentation.SampleDesignActivity"
android:exported="false" />
<activity
android:name=".presentation.MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sopt.motivoo.data.datasource.remote

import sopt.motivoo.data.model.request.onboarding.RequestOnboardingDto
import sopt.motivoo.data.model.request.onboarding.RequestPostInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseFinishedOnboardingDto
import sopt.motivoo.data.model.response.onboarding.ResponseGetInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseGetMatchedResultDto
import sopt.motivoo.data.model.response.onboarding.ResponseOnboardingDto
Expand All @@ -21,9 +20,6 @@ class OnboardingDataSource @Inject constructor(
suspend fun getInviteCode(): ResponseGetInviteCodeDto =
onboardingService.getInviteCode()

suspend fun getOnboardingFinished(): ResponseFinishedOnboardingDto =
onboardingService.getOnboardingFinished()

suspend fun patchInviteCode(
requestPostInviteCodeDto: RequestPostInviteCodeDto
): ResponsePostInviteCodeDto =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@ data class ResponseLoginDto(
@SerialName("refresh_token")
val refreshToken: String,
@SerialName("token_type")
val tokenType: String
val tokenType: String,
@SerialName("is_finished_onboarding")
val isFinishedOnboarding: Boolean,
@SerialName("is_matched")
val isMatched: Boolean
)

fun toLoginInfo(): LoginInfo {
return LoginInfo(
accessToken = data.accessToken,
nickName = data.nickname,
id = data.id,
refreshToken = data.refreshToken
refreshToken = data.refreshToken,
isOnboardingFinished = data.isFinishedOnboarding,
isMatched = data.isMatched
)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package sopt.motivoo.data.repository

import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import sopt.motivoo.domain.repository.NetworkRepository
import sopt.motivoo.util.NetworkState
import javax.inject.Inject
Expand All @@ -11,11 +9,4 @@ class NetworkRepositoryImpl @Inject constructor(
) : NetworkRepository {

override val networkStateFlow = networkState.networkState

private val _isLoading = MutableSharedFlow<Boolean>(replay = 1)
override val isLoading get() = _isLoading.asSharedFlow()

override suspend fun setLoading(isLoading: Boolean) {
_isLoading.emit(isLoading)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sopt.motivoo.data.repository
import sopt.motivoo.data.datasource.remote.OnboardingDataSource
import sopt.motivoo.data.model.request.onboarding.RequestOnboardingDto
import sopt.motivoo.data.model.request.onboarding.RequestPostInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseFinishedOnboardingDto
import sopt.motivoo.data.model.response.onboarding.ResponseOnboardingDto
import sopt.motivoo.domain.entity.onboarding.GetMatchedInfo
import sopt.motivoo.domain.entity.onboarding.InviteCodeInfo
Expand All @@ -23,9 +22,6 @@ class OnboardingRepositoryImpl @Inject constructor(
override suspend fun getInviteCode(): Result<InviteCodeInfo> =
runCatching { onboardingDataSource.getInviteCode().toGetInviteCode() }

override suspend fun getOnboardingFinished(): Result<ResponseFinishedOnboardingDto> =
runCatching { onboardingDataSource.getOnboardingFinished() }

override suspend fun patchInviteCode(requestPostInviteCodeDto: RequestPostInviteCodeDto): Result<MatchedInfo> =
runCatching {
onboardingDataSource.patchInviteCode(requestPostInviteCodeDto).toMatchedInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import retrofit2.http.PATCH
import retrofit2.http.POST
import sopt.motivoo.data.model.request.onboarding.RequestOnboardingDto
import sopt.motivoo.data.model.request.onboarding.RequestPostInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseFinishedOnboardingDto
import sopt.motivoo.data.model.response.onboarding.ResponseGetInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseGetMatchedResultDto
import sopt.motivoo.data.model.response.onboarding.ResponseOnboardingDto
Expand All @@ -21,9 +20,6 @@ interface OnboardingService {
@POST("parentchild/invite")
suspend fun getInviteCode(): ResponseGetInviteCodeDto

@GET("user/onboarding")
suspend fun getOnboardingFinished(): ResponseFinishedOnboardingDto

@PATCH("parentchild/match")
suspend fun patchInviteCode(
@Body requestPostInviteCodeDto: RequestPostInviteCodeDto
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/sopt/motivoo/di/NavigationModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package sopt.motivoo.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import sopt.motivoo.domain.entity.MotivooStorage
import sopt.motivoo.util.NavigationDecider
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object NavigationModule {
@Provides
@Singleton
fun provideNavigationDecider(motivooStorage: MotivooStorage): NavigationDecider =
NavigationDecider(motivooStorage)
}
7 changes: 0 additions & 7 deletions app/src/main/java/sopt/motivoo/di/RetrofitModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,19 @@ import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import sopt.motivoo.BuildConfig.BASE_URL
import sopt.motivoo.BuildConfig.DEBUG
import sopt.motivoo.data.datasource.local.MotivooStorageImpl
import sopt.motivoo.data.datasource.remote.intercepter.AuthInterceptor
import sopt.motivoo.data.datasource.remote.intercepter.ErrorInterceptor
import sopt.motivoo.data.datasource.remote.listener.AuthTokenRefreshListener
import sopt.motivoo.data.datasource.remote.listener.AuthTokenRefreshListenerImpl
import sopt.motivoo.data.datasource.remote.listener.NetworkErrorListener
import sopt.motivoo.data.datasource.remote.listener.NetworkErrorListenerImpl
import sopt.motivoo.domain.entity.MotivooStorage
import java.util.concurrent.TimeUnit
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object RetrofitModule {

@Provides
@Singleton
fun provideDataStore(motivooStorageImpl: MotivooStorageImpl): MotivooStorage =
motivooStorageImpl

@Provides
@Singleton
@AuthInterceptorQualifier
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/sopt/motivoo/di/StorageModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package sopt.motivoo.di

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import sopt.motivoo.data.datasource.local.MotivooStorageImpl
import sopt.motivoo.domain.entity.MotivooStorage
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object StorageModule {
@Provides
@Singleton
fun provideMotivooStorage(@ApplicationContext context: Context): MotivooStorage =
MotivooStorageImpl(context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ data class LoginInfo(
val nickName: String,
val id: Long,
val refreshToken: String,
val isOnboardingFinished: Boolean,
val isMatched: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ import kotlinx.coroutines.flow.SharedFlow
interface NetworkRepository {

val networkStateFlow: SharedFlow<Boolean>
val isLoading: SharedFlow<Boolean>
suspend fun setLoading(isLoading: Boolean)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sopt.motivoo.domain.repository
import retrofit2.http.Body
import sopt.motivoo.data.model.request.onboarding.RequestOnboardingDto
import sopt.motivoo.data.model.request.onboarding.RequestPostInviteCodeDto
import sopt.motivoo.data.model.response.onboarding.ResponseFinishedOnboardingDto
import sopt.motivoo.data.model.response.onboarding.ResponseOnboardingDto
import sopt.motivoo.domain.entity.onboarding.GetMatchedInfo
import sopt.motivoo.domain.entity.onboarding.InviteCodeInfo
Expand All @@ -15,8 +14,6 @@ interface OnboardingRepository {

suspend fun getInviteCode(): Result<InviteCodeInfo>

suspend fun getOnboardingFinished(): Result<ResponseFinishedOnboardingDto>

suspend fun patchInviteCode(requestPostInviteCodeDto: RequestPostInviteCodeDto): Result<MatchedInfo>

suspend fun getMatchedResult(): Result<GetMatchedInfo>
Expand Down
45 changes: 15 additions & 30 deletions app/src/main/java/sopt/motivoo/presentation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.navigation.ui.setupWithNavController
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
Expand All @@ -32,6 +33,7 @@ import sopt.motivoo.presentation.onboarding.OnboardingViewModel
import sopt.motivoo.presentation.onboarding.WhatActivityQuestionFragmentDirections
import sopt.motivoo.presentation.onboarding.WhatExerciseQuestionFragmentDirections
import sopt.motivoo.presentation.type.NavigationSourceType
import sopt.motivoo.util.NetworkState
import sopt.motivoo.util.extension.checkNetworkState
import sopt.motivoo.util.extension.colorOf
import sopt.motivoo.util.extension.hideKeyboard
Expand All @@ -56,10 +58,13 @@ class MainActivity : AppCompatActivity() {
@Inject
lateinit var mainDispatcher: CoroutineDispatcher

@Inject
lateinit var networkState: NetworkState

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.Theme_MOTIVOOAOS)
super.onCreate(savedInstanceState)
installSplashScreen()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
initView()
Expand All @@ -69,26 +74,16 @@ class MainActivity : AppCompatActivity() {
}

private fun collectData() {
mainViewModel.isLoading.flowWithLifecycle(
lifecycle,
Lifecycle.State.STARTED
).onEach { isLoading ->
val navController: NavController = findNavController(R.id.fc_main)
if (isLoading && navController.currentDestination?.id != R.id.loadingFragment) {
navController.navigate(R.id.loadingFragment)
} else if (!isLoading && navController.currentDestination?.id == R.id.loadingFragment) {
navController.popBackStack()
}
}.launchIn(lifecycleScope)

mainViewModel.networkState.flowWithLifecycle(
lifecycle,
Lifecycle.State.STARTED
).onEach { isConnected ->
if (!isConnected) {
showNetworkErrorDialog()
}
}.launchIn(lifecycleScope)
)
.distinctUntilChanged()
.onEach { isConnected ->
if (!isConnected) {
showNetworkErrorDialog()
}
}.launchIn(lifecycleScope)

onboardingViewModel.navigationEvent.flowWithLifecycle(
lifecycle,
Expand Down Expand Up @@ -137,17 +132,9 @@ class MainActivity : AppCompatActivity() {
}

private fun initView() {
val redirectToLogin = intent.getBooleanExtra(REDIRECT_TO_LOGIN, false)
val navController =
supportFragmentManager.findFragmentById(R.id.fc_main)?.findNavController()

if (redirectToLogin) {
val bundle = Bundle().apply {
putBoolean(REDIRECT_TO_LOGIN, true)
}
navController?.setGraph(R.navigation.navigation_main, bundle)
}

with(binding) {
bnvMain.itemIconTintList = null
navController?.let { navController ->
Expand Down Expand Up @@ -304,10 +291,8 @@ class MainActivity : AppCompatActivity() {

override fun onDestroy() {
authTokenRefreshListener.clearOnTokenRefreshFailedCallback()
networkErrorListener.clearOnApiCallFailedCallback()
networkState.cleanup()
super.onDestroy()
}

companion object {
const val REDIRECT_TO_LOGIN = "redirectToLogin"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ class MainViewModel @Inject constructor(
) : ViewModel() {

val networkState: SharedFlow<Boolean> = networkRepository.networkStateFlow
val isLoading: SharedFlow<Boolean> = networkRepository.isLoading
}
54 changes: 0 additions & 54 deletions app/src/main/java/sopt/motivoo/presentation/SplashFragment.kt

This file was deleted.

Loading
Loading