-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
… feat/onboarding_permission
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인후에 리마인드 주세욥!
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)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직이 중복되는 것 같은데 초기화 로직 분리 부탁드립니다!!
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() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id 숫자 말고 다른걸로 부탁드립니다.
viewModel.permissionsState.onEach { permissionsState -> | ||
updateNextButtonState(permissionsState) | ||
}.launchIn(viewLifeCycleScope) | ||
|
||
clickRequireAccessibilityButton() | ||
viewModel.checkPermissions(requireContext()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유리 함수분리!!!
data class OnBoardingPermissionsState( | ||
val isAccessibilityEnabled: Boolean = false, | ||
val isUsageStatsEnabled: Boolean = false, | ||
val isOverlayEnabled: Boolean = false, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State를 파일로 분리한 이유는 무엇인가요?
viewModelScope.launch { | ||
val accessibilityEnabled = checkAccessibilityServiceEnabled(context) | ||
val usageStatsEnabled = hasUsageStatsPermission(context) | ||
val overlayEnabled = hasOverlayPermission(context) | ||
|
||
_permissionsState.value = OnBoardingPermissionsState( | ||
accessibilityEnabled, | ||
usageStatsEnabled, | ||
overlayEnabled, | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기 scope로 감싼 이유는 무엇인가요?
# 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
개요
작업 사항
변경 사항(optional)
문제 사항
스크린샷(optional)
_2024_01_10_21_03_25_292.mp4