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/lock_api]: 잠금화면 미션 실패 API 작업 #143

Merged
merged 9 commits into from
Jan 19, 2024

Conversation

kez-lab
Copy link
Member

@kez-lab kez-lab commented Jan 18, 2024

개요

작업 사항

  • 미션 실패 API 추가
  • Service 모듈 분리
  • 권한 로직 체크
  • 다이얼로그 추가

@kez-lab kez-lab added 🐱의진 의진이 작업 💻feat 새로운 기능 추가 labels Jan 18, 2024
@kez-lab kez-lab self-assigned this Jan 18, 2024
@kez-lab kez-lab requested a review from a team as a code owner January 18, 2024 23:33
Copy link
Member

@kangyuri1114 kangyuri1114 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다......

@kangyuri1114 kangyuri1114 changed the title feat/lock_api]: 잠금화면 미션 실패 API 작업 [feat/lock_api]: 잠금화면 미션 실패 API 작업 Jan 19, 2024
Copy link
Member Author

@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 +19 to 21
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Copy link
Member Author

@kez-lab kez-lab Jan 19, 2024

Choose a reason for hiding this comment

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

앱 삭제시에도 Prefernce가 남아있어 allowBackup 을 false로 변경 했습니다.

Comment on lines +6 to +8
companion object{
const val UN_LOCK_PACKAGE_NAME = "UN_LOCK_PACKAGE_NAME"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

IntentKey는 이런식 말고 더 좋은 방법으로 빼보면 좋을 것 같네요

Comment on lines 45 to 62
private fun checkUsage(event: AccessibilityEvent): Job {
val packageName = event.packageName?.toString() ?: return Job()

val (startTime, endTime) = getCurrentDayStartEndEpochMillis()
val usageStats = getUsageStatFromPackageUseCase(
startTime = startTime,
endTime = endTime,
packageName = packageName
)

ProcessLifecycleOwner.get().lifecycleScope.launch {
return ProcessLifecycleOwner.get().lifecycleScope.launch {
// 이벤트 처리 로직
val usageGoals = getUsageGoalsUseCase().first()
val myGoal = usageGoals.find { it.packageName == packageName } ?: return@launch
if (usageStats > myGoal.goalTime) {
val intent =
LockActivity.getIntent(this@LockAccessibilityService, packageName).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
startActivity(intent)
navigationProvider.toLock(packageName).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}.let(::startActivity)
Copy link
Member Author

Choose a reason for hiding this comment

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

코루틴 Scope이 지속적으로 재 생성되는 것을 방지하기 위해 변수 할당으로 변경했습니다.

Comment on lines 52 to 62
LockScreen(
packageName = packageName,
onClickUnLock = {
navigationProvider.toMain().apply {
putExtra(NavigationProvider.UN_LOCK_PACKAGE_NAME, packageName)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}.let(::startActivity)
finish()
}
)
Copy link
Member Author

Choose a reason for hiding this comment

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

이거 실행하면 Main도 같이 뜨는 이슈가 있어요 수정 계획

Comment on lines 23 to 28






Copy link
Member Author

Choose a reason for hiding this comment

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

줄낭비

Comment on lines 150 to 155
Text(
stringResource(R.string.do_unlock),
modifier = Modifier.clickable(onClick = onClickUnLock),
text = stringResource(R.string.do_unlock),
style = HmhTypography.titleSmall,
color = WhiteText
)
Copy link
Member Author

Choose a reason for hiding this comment

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

앱 진입 말고 백그라운드 Kill 및 Finish 로직이 빠져있네요

Copy link
Member Author

Choose a reason for hiding this comment

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

시스템 컴포넌트의 경우 Finish가 안되네요 Data단에서 System App 은 불러오지 못하도록 처리하겠습니다.

@kez-lab kez-lab merged commit 13f2873 into develop Jan 19, 2024
1 check passed
@kez-lab kez-lab deleted the feat/lock_api branch January 19, 2024 11:22
kez-lab added a commit that referenced this pull request Nov 20, 2024
[feat/lock_api]: 잠금화면 미션 실패 API 작업
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]: 잠금화면 미션 실패 로직 추가
2 participants