Skip to content

Commit ca54706

Browse files
authored
Add camera permission granted listener (#234)
1 parent 3a7e9ec commit ca54706

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
33

44
## UNRELEASED
55
### Added
6+
* ui: Add listener to `SelfScanningFragment` to react to camera permission changes
67
### Changed
78
### Removed
89
### Fixed

ui/src/main/java/io/snabble/sdk/ui/scanner/SelfScanningFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ open class SelfScanningFragment : BaseFragment(), MenuProvider {
5858
createSelfScanningView()
5959
requireView().announceForAccessibility(getString(R.string.Snabble_Scanner_Accessibility_eventBackInScanner))
6060
explainScanner()
61+
onCameraPermissionGrantedListener?.invoke()
6162
} else {
6263
canAskAgain = ActivityCompat.shouldShowRequestPermissionRationale(
6364
requireActivity(),
@@ -67,6 +68,11 @@ open class SelfScanningFragment : BaseFragment(), MenuProvider {
6768
}
6869
}
6970

71+
/**
72+
* Add a listener to get notified if the camera permission has been granted
73+
*/
74+
var onCameraPermissionGrantedListener: (() -> Unit)? = null
75+
7076
override fun onCreateActualView(
7177
inflater: LayoutInflater,
7278
container: ViewGroup?,

0 commit comments

Comments
 (0)