Skip to content

Commit

Permalink
Merge pull request #70 from Team-Motivoo/qa/#69-onboarding-permission
Browse files Browse the repository at this point in the history
[QA] 권한 분기처리 추가
  • Loading branch information
l2zh committed Jan 18, 2024
2 parents ea6037d + 8650e16 commit acc413c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class PermissionFragment :
initRequiredPermissions()
if (checkPermissionsStatus() || isAllPermissionsGranted()) {
navigateToNextFragment()
} else if (areAllDeniedPermissionsRationale()) {
navigateToNextFragment()
} else {
getPermission()
}
Expand Down Expand Up @@ -107,6 +109,12 @@ class PermissionFragment :
requestMultiplePermissionsLauncher.launch(permissions)
}

private fun areAllDeniedPermissionsRationale(): Boolean {
return deniedPermissions.isNotEmpty() && deniedPermissions.all {
shouldShowRequestPermissionRationale(it)
}
}

private fun navigateToNextFragment() {
val navOptions = NavOptions.Builder()
.setPopUpTo(R.id.permissionFragment, true)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/navigation/navigation_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/navigation_main"
app:startDestination="@id/homeFragment">
app:startDestination="@id/splashFragment">

<fragment
android:id="@+id/splashFragment"
Expand Down Expand Up @@ -349,11 +349,11 @@
<argument
android:name="photoBitmap"
app:argType="android.graphics.Bitmap"
app:nullable="true"/>
app:nullable="true" />
<argument
android:name="photoUri"
app:argType="android.net.Uri"
app:nullable="true"/>
app:nullable="true" />
</dialog>
<fragment
android:id="@+id/loadingFragment"
Expand Down

0 comments on commit acc413c

Please sign in to comment.