-
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/lock_api]: 잠금화면 미션 실패 API 작업 #143
Conversation
# Conflicts: # data/usagestats/src/main/java/com/hmh/hamyeonham/usagestats/repository/DefaultUsageGoalsRepository.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.
수고하셨습니다......
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.
수정 후 머지하겠습니다.
전반적으로 코드를 너무 급히 짜다보니 맘에 안듭니다.
전체 리팩 한번 하시져
android:allowBackup="false" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" |
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.
앱 삭제시에도 Prefernce가 남아있어 allowBackup 을 false로 변경 했습니다.
companion object{ | ||
const val UN_LOCK_PACKAGE_NAME = "UN_LOCK_PACKAGE_NAME" | ||
} |
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.
IntentKey는 이런식 말고 더 좋은 방법으로 빼보면 좋을 것 같네요
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) |
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이 지속적으로 재 생성되는 것을 방지하기 위해 변수 할당으로 변경했습니다.
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() | ||
} | ||
) |
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.
이거 실행하면 Main도 같이 뜨는 이슈가 있어요 수정 계획
|
||
|
||
|
||
|
||
|
||
|
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.
줄낭비
Text( | ||
stringResource(R.string.do_unlock), | ||
modifier = Modifier.clickable(onClick = onClickUnLock), | ||
text = stringResource(R.string.do_unlock), | ||
style = HmhTypography.titleSmall, | ||
color = WhiteText | ||
) |
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.
앱 진입 말고 백그라운드 Kill 및 Finish 로직이 빠져있네요
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.
시스템 컴포넌트의 경우 Finish가 안되네요 Data단에서 System App 은 불러오지 못하도록 처리하겠습니다.
[feat/lock_api]: 잠금화면 미션 실패 API 작업
개요
작업 사항