Skip to content

Commit

Permalink
Merge pull request #328 from ddanglehee/fix/#327-oss_password_bug_fix
Browse files Browse the repository at this point in the history
[FIX] 오픈소스 라이선스 화면 갔다가 돌아올 때 다시 비밀번호 검사 안하도록 수정
  • Loading branch information
ddanglehee authored Jan 28, 2022
2 parents c45cdf6 + 4b28d0e commit ddfc866
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/main/java/com/ivyclub/contact/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import com.ivyclub.contact.ui.password.PasswordActivity
import com.ivyclub.contact.util.BaseActivity
import com.ivyclub.contact.util.hideKeyboard
import dagger.hilt.android.AndroidEntryPoint
import android.app.ActivityManager
import android.content.Context
import android.os.Build

@AndroidEntryPoint
class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
Expand Down Expand Up @@ -54,7 +57,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {

override fun onStop() {
super.onStop()
viewModel.lock()
val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val curComponentInfoInString = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
activityManager.appTasks[0].taskInfo.topActivity.toString()
} else {
activityManager.getRunningTasks(1)[0].topActivity.toString()
}

if ("OssLicensesMenuActivity" !in curComponentInfoInString) {
viewModel.lock()
}
}

private fun checkFromNotification() {
Expand Down

0 comments on commit ddfc866

Please sign in to comment.