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/onboarding_permission] 온보딩 권한 허용 기능 구현 #72

Merged
merged 32 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
75a0fa6
[feat]: OnBoardingRequestPermissionFragment에 이전 권한 허용 함수들 옮기기
kangyuri1114 Jan 10, 2024
2f0ec95
Merge branch 'feat/onboarding_ui' into feat/onboarding_permission
kangyuri1114 Jan 10, 2024
51a6ea2
[feat]: 온보딩 필요한 권한 허용 ActivityResultLauncher 구현
kangyuri1114 Jan 10, 2024
9a503e6
[refact]: 분기문 코드 통일
kangyuri1114 Jan 10, 2024
9b92336
[refact]: string 전환
kangyuri1114 Jan 10, 2024
7704c72
[delete]: 주석 제거
kangyuri1114 Jan 10, 2024
8ae117e
[delete]: 주석 제거
kangyuri1114 Jan 10, 2024
3736280
[refact]: refact code
kangyuri1114 Jan 10, 2024
e5a2a4e
[feat]: RequestPermissionFragment viewModel 생성
kangyuri1114 Jan 10, 2024
0fd46ba
[feat]: viewModel 분리
kangyuri1114 Jan 10, 2024
ec2ec58
[feat]: PermissionsState data class 분리
kangyuri1114 Jan 10, 2024
a122802
[fix]: 파일 이름 통일
kangyuri1114 Jan 10, 2024
e54fff6
[fix]: data class 분리
kangyuri1114 Jan 10, 2024
161592d
Merge remote-tracking branch 'origin/feat/onboarding_permission' into…
kangyuri1114 Jan 10, 2024
40a0908
[fix]: naming 변경
kangyuri1114 Jan 10, 2024
df45bbd
[fix]: OnBoarding 전체 수정
kez-lab Jan 11, 2024
2199758
[fix]: Fragment 코드 수정
kez-lab Jan 11, 2024
400050a
[fix]: Permission Fragment 코드 수정
kez-lab Jan 11, 2024
a565ebe
[fix]: flow collect
kez-lab Jan 11, 2024
1c2a6e4
[feat]: 넘버 피커 값 받아오기
kangyuri1114 Jan 12, 2024
a53eb83
[feat]: 넘버 피커 값 받아오기
kangyuri1114 Jan 12, 2024
2b726e7
[feat]: 넘버 피커 값 파싱
kangyuri1114 Jan 12, 2024
f15476b
[feat]: 선택한 시간 0인 경우 버튼 비활성화 분기 처리
kangyuri1114 Jan 12, 2024
e5d87a9
[feat]: 회원가입 성공 시 main으로 이동 뷰 연결
kangyuri1114 Jan 12, 2024
0834613
[fix]: 화면 이동 Navigation으로 변경
kangyuri1114 Jan 12, 2024
9a05e05
[fix]: selector state_enabled로 수정
kangyuri1114 Jan 12, 2024
4fa41ed
[feat]: 챌린지 기간 비활성화 UI
kangyuri1114 Jan 12, 2024
2c21f6e
[fix]: 텍스트 스타일 변경
kangyuri1114 Jan 12, 2024
019dcff
[fix]: fix merge error
kez-lab Jan 12, 2024
0b7c5fb
Merge branch 'develop' into feat/onboarding_permission
kez-lab Jan 12, 2024
b90d74d
[fix]: fix merge error
kez-lab Jan 12, 2024
88c8ce3
Merge branch 'develop' into feat/onboarding_permission
kez-lab Jan 12, 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
7 changes: 3 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ plugins {
alias(libs.plugins.crashlytics)
}

val properties =
Properties().apply {
load(rootProject.file("local.properties").inputStream())
}
val properties = Properties().apply {
load(rootProject.file("local.properties").inputStream())
}

android {
namespace = "com.hmh.hamyeonham"
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/com/hmh/hamyeonham/SampleActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import android.view.animation.AnimationUtils
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.hmh.hamyeonham.challenge.appselection.AppselectionActivity
import com.hmh.hamyeonham.common.view.viewBinding
import com.hmh.hamyeonham.databinding.ActivitySampleBinding
import com.hmh.hamyeonham.feature.login.LoginActivity
import com.hmh.hamyeonham.feature.main.MainActivity
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -23,8 +21,7 @@ class SampleActivity : AppCompatActivity() {
val splashScreen = installSplashScreen()
initSplashAnimation(splashScreen)
setContentView(binding.root)
// startActivity(Intent(this, LoginActivity::class.java))
startActivity(Intent(this, MainActivity::class.java))
startActivity(Intent(this, LoginActivity::class.java))
finish()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import com.hmh.hamyeonham.common.navigation.NavigationProvider
import com.hmh.hamyeonham.feature.login.LoginActivity
import com.hmh.hamyeonham.feature.main.MainActivity
import com.hmh.hamyeonham.feature.onboarding.OnBoardingActivity
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
Expand All @@ -18,4 +19,8 @@ class DefaultNavigationProvider @Inject constructor(
override fun toLogin(): Intent {
return Intent(context, LoginActivity::class.java)
}

override fun toMain(): Intent {
return Intent(context, MainActivity::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import android.content.Intent
interface NavigationProvider {
fun toOnBoarding(): Intent
fun toLogin(): Intent
fun toMain(): Intent
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ inline fun SpannableStringBuilder.textAppearance(
@StyleRes style: Int,
builderAction: SpannableStringBuilder.() -> Unit
) = inSpans(TextAppearanceSpan(context, style), builderAction = builderAction)

fun String.extractDigits(): Int {
return try {
this.filter { it.isDigit() }.toIntOrNull() ?: 0
} catch (e: NumberFormatException) {
0
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ fun convertTimeToString(time: Long): String {
if (minutes > 0 || hours == 0L) append(" $minutes 분")
}.trim()
}

// 분을 ms로 바꾸는 함수
fun Int.timeToMs(): Long {
return this * 60 * 1000L
}
Empty file.
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions data/userinfo/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Empty file.
21 changes: 21 additions & 0 deletions domain/userinfo/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.hmh.hamyeonham.common.context.toast
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.hmh.hamyeonham.common.navigation.NavigationProvider
import com.hmh.hamyeonham.common.view.viewBinding
import com.hmh.hamyeonham.feature.login.databinding.ActivityLoginBinding
Expand Down
Empty file.
21 changes: 21 additions & 0 deletions feature/mypage/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
1 change: 1 addition & 0 deletions feature/onboarding/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ android {
dependencies {
implementation(projects.core.common)
implementation(projects.core.designsystem)
implementation(project(":feature:main"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.hmh.hamyeonham.feature.onboarding
import android.accessibilityservice.AccessibilityService
import android.util.Log
import android.view.accessibility.AccessibilityEvent
import com.hmh.hamyeonham.common.context.toast

class OnBoardingAccessibilityService : AccessibilityService() {
override fun onAccessibilityEvent(event: AccessibilityEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.hmh.hamyeonham.common.view.viewBinding
import com.hmh.hamyeonham.feature.onboarding.databinding.ActivityOnBoardingBinding
import com.hmh.hamyeonham.feature.onboarding.viewModel.OnBoardingViewModel
import com.hmh.hamyeonham.feature.onboarding.viewmodel.OnBoardingEffect
import com.hmh.hamyeonham.feature.onboarding.viewmodel.OnBoardingViewModel
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand All @@ -25,29 +26,35 @@ class OnBoardingActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
initViewPager()
initViews()
checkNextButtonEnable()
setBackPressedCallback()
}

private fun initViews() {
initBackButton()
initViewPager()
}

private fun initBackButton() {
binding.ivOnboardingBack.setOnClickListener {
navigateToPreviousOnboardingStep()
}
}

private fun initViewPager() {
val pagerAdapter = setOnboardingPageAdapter()
binding.btnOnboardingNext.setOnClickListener {
viewModel.initializeButtonStates()
navigateToNextOnboardingStep(pagerAdapter)
}
binding.ivOnboardingBack.setOnClickListener {
viewModel.initializeButtonStates()
navigateToPreviousOnboardingStep()
}
}

private fun navigateToPreviousOnboardingStep() {
binding.vpOnboardingContainer.let { viewPager ->
val currentItem = viewPager.currentItem
binding.vpOnboardingContainer.run {
val currentItem = this.currentItem
if (currentItem > 0) {
viewPager.currentItem = currentItem - 1
updateProgressBar(currentItem - 1, viewPager.adapter?.itemCount ?: 1)
this.currentItem = currentItem - 1
updateProgressBar(currentItem - 1, adapter?.itemCount ?: 1)
} else {
onBackPressedCallback.isEnabled = false
onBackPressedDispatcher.onBackPressed()
Expand All @@ -70,11 +77,14 @@ class OnBoardingActivity : AppCompatActivity() {
}

private fun checkNextButtonEnable() {
viewModel.clickNextButtonEnable.flowWithLifecycle(lifecycle)
.onEach { clickNextButtonEnable ->
binding.btnOnboardingNext.isEnabled = clickNextButtonEnable
binding.btnOnboardingNext.isSelected = clickNextButtonEnable
}.launchIn(lifecycleScope)
viewModel.onboardEffect.flowWithLifecycle(lifecycle).onEach {
when (it) {
is OnBoardingEffect.ActiveNextButton -> {
binding.btnOnboardingNext.isEnabled = it.isActive
binding.btnOnboardingNext.isSelected = it.isActive
}
}
}.launchIn(lifecycleScope)
}

private fun setBackPressedCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,30 @@ package com.hmh.hamyeonham.feature.onboarding

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.hmh.hamyeonham.common.navigation.NavigationProvider
import com.hmh.hamyeonham.common.view.viewBinding
import com.hmh.hamyeonham.feature.onboarding.databinding.ActivityOnBoardingDoneSingUpBinding
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class OnBoardingDoneSingUpActivity : AppCompatActivity() {
private val binding by viewBinding(ActivityOnBoardingDoneSingUpBinding::inflate)

@Inject
lateinit var navigationProvider: NavigationProvider

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

binding.btnOnboardingDoneNext.setOnClickListener {
moveToMainActivity()
}
}

private fun moveToMainActivity() {
startActivity(navigationProvider.toMain())
finish()
}
}
Loading