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

Conversation

kangyuri1114
Copy link
Member

@kangyuri1114 kangyuri1114 commented Jan 10, 2024

개요

작업 사항

  • 온보딩 권한 허용 기능 구현
  • 온보딩 전반적인 flow오류 해결
  • 각 버튼 클릭 기능 오류 수

변경 사항(optional)

  • PermissionFragment 권한 허용 기능 3가지 구현
  • 클릭 이벤트 구현
  • PermissionFragmentViewModel 생성

문제 사항

  • 권한 3개 허용이 모두 되었을 때 액티비티의 다음 버튼 활성화 되도록 구현했는데, 설정 앱 접속 후 우리 앱 다시 접속해도 버튼이 활성화 되는 이슈가 있습니다.
  • 설정창 이동 후 뒤로가기 버튼 누르면 해당 설정창이 한 번 더 뜨는 이슈가 있습니다. 아무래도 클릭 이벤트 시에 requestPermission을 두번 호출하는 것 같긴 한데.... 못찾겠네요. 한 번 확인 부탁드립니다.

스크린샷(optional)

_2024_01_10_21_03_25_292.mp4

@kangyuri1114 kangyuri1114 added 💻feat 새로운 기능 추가 🐰유리 유리 작업 labels Jan 10, 2024
@kangyuri1114 kangyuri1114 self-assigned this Jan 10, 2024
@kangyuri1114 kangyuri1114 requested a review from a team as a code owner January 10, 2024 12:12
Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인후에 리마인드 주세욥!

Comment on lines +33 to +58
private val accessibilitySettingsLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(
ActivityResultContracts.StartActivityForResult(),
) {
if (viewModel.permissionsState.value.isAccessibilityEnabled) {
toast(getString(R.string.success_accessibility_settings))
}
}

private val overlayPermissionLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(
ActivityResultContracts.StartActivityForResult(),
) {
if (viewModel.permissionsState.value.isOverlayEnabled) {
toast(getString(R.string.success_overlay_permission))
}
}

private val usageStatsPermissionLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(
ActivityResultContracts.StartActivityForResult(),
) {
if (viewModel.permissionsState.value.isUsageStatsEnabled) {
toast(getString(R.string.success_usage_stats_permission))
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로직이 중복되는 것 같은데 초기화 로직 분리 부탁드립니다!!

Comment on lines +81 to +101
clOnboardingPermission1.setOnClickListener {
if (viewModel.permissionsState.value.isAccessibilityEnabled) {
toast(getString(R.string.already_accessibility_settings))
} else {
requestAccessibilitySettings()
}
}
clOnboardingPermission2.setOnClickListener {
if (viewModel.permissionsState.value.isUsageStatsEnabled) {
toast(getString(R.string.already_usage_stats_permission))
} else {
requestUsageAccessPermission()
}
}
clOnboardingPermission3.setOnClickListener {
if (viewModel.permissionsState.value.isOverlayEnabled) {
toast(getString(R.string.already_overlay_permission))
} else {
requestOverlayPermission()
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id 숫자 말고 다른걸로 부탁드립니다.

Comment on lines 71 to 76
viewModel.permissionsState.onEach { permissionsState ->
updateNextButtonState(permissionsState)
}.launchIn(viewLifeCycleScope)

clickRequireAccessibilityButton()
viewModel.checkPermissions(requireContext())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유리 함수분리!!!

Comment on lines +3 to +7
data class OnBoardingPermissionsState(
val isAccessibilityEnabled: Boolean = false,
val isUsageStatsEnabled: Boolean = false,
val isOverlayEnabled: Boolean = false,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State를 파일로 분리한 이유는 무엇인가요?

Comment on lines 23 to 34
viewModelScope.launch {
val accessibilityEnabled = checkAccessibilityServiceEnabled(context)
val usageStatsEnabled = hasUsageStatsPermission(context)
val overlayEnabled = hasOverlayPermission(context)

_permissionsState.value = OnBoardingPermissionsState(
accessibilityEnabled,
usageStatsEnabled,
overlayEnabled,
)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기 scope로 감싼 이유는 무엇인가요?

Base automatically changed from feat/onboarding_ui to develop January 11, 2024 20:28
kangyuri1114 and others added 8 commits January 12, 2024 18:26
# Conflicts:
#	app/build.gradle.kts
#	app/src/main/java/com/hmh/hamyeonham/SampleActivity.kt
#	app/src/main/java/com/hmh/hamyeonham/navigation/DefaultNavigationProvider.kt
#	core/common/src/main/java/com/hmh/hamyeonham/common/navigation/NavigationProvider.kt
#	core/network/proguard-rules.pro
#	core/network/src/main/java/com/hmh/hamyeonham/core/network/model/BaseResponse.kt
#	feature/login/src/main/java/com/hmh/hamyeonham/feature/login/LoginActivity.kt
#	feature/login/src/main/java/com/hmh/hamyeonham/feature/login/LoginViewModel.kt
#	feature/onboarding/src/main/java/com/hmh/hamyeonham/feature/onboarding/OnBoardingActivity.kt
#	feature/onboarding/src/main/java/com/hmh/hamyeonham/feature/onboarding/fragment/OnBoardingSelectUseTimeFragment.kt
#	settings.gradle.kts
# Conflicts:
#	app/src/main/java/com/hmh/hamyeonham/SampleActivity.kt
Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kez-lab kez-lab merged commit f2760b8 into develop Jan 12, 2024
1 check passed
@kez-lab kez-lab deleted the feat/onboarding_permission branch January 12, 2024 15:57
@jihyun0v0 jihyun0v0 changed the title [feat/onboarding permission] 온보딩 권한 허용 기능 구현 [feat/onboarding_permission] 온보딩 권한 허용 기능 구현 Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐰유리 유리 작업 💻feat 새로운 기능 추가
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[feat]: 권한 허용 코드 온보딩 UI에서 연결
2 participants