@@ -42,6 +42,7 @@ import com.duckduckgo.common.utils.ConflatedJob
42
42
import com.duckduckgo.common.utils.DispatcherProvider
43
43
import com.duckduckgo.di.scopes.ViewScope
44
44
import com.duckduckgo.sync.impl.R
45
+ import com.duckduckgo.sync.impl.SyncFeature
45
46
import com.duckduckgo.sync.impl.databinding.ViewSquareDecoratedBarcodeBinding
46
47
import com.duckduckgo.sync.impl.ui.qrcode.SquareDecoratedBarcodeViewModel.Command
47
48
import com.duckduckgo.sync.impl.ui.qrcode.SquareDecoratedBarcodeViewModel.Command.CheckCameraAvailable
@@ -80,6 +81,9 @@ constructor(
80
81
@Inject
81
82
lateinit var appBuildConfig: AppBuildConfig
82
83
84
+ @Inject
85
+ lateinit var syncFeature: SyncFeature
86
+
83
87
private val cameraBlockedDrawable by lazy {
84
88
ContextCompat .getDrawable(context, R .drawable.camera_blocked)
85
89
}
@@ -95,6 +99,7 @@ constructor(
95
99
}
96
100
97
101
private var beepManager: BeepManager ? = null
102
+
98
103
private val cameraSettings = CameraSettings ().apply {
99
104
isAutoFocusEnabled = true
100
105
isContinuousFocusEnabled = true
@@ -103,17 +108,12 @@ constructor(
103
108
private val conflatedStateJob = ConflatedJob ()
104
109
private val conflatedCommandJob = ConflatedJob ()
105
110
106
- init {
107
- if (appBuildConfig.isInternalBuild()) {
108
- beepManager = BeepManager (getActivity())
109
- }
110
- initQRScanner()
111
- }
112
-
113
111
override fun onAttachedToWindow () {
114
112
AndroidSupportInjection .inject(this )
115
113
super .onAttachedToWindow()
116
114
115
+ initQRScanner()
116
+
117
117
findViewTreeLifecycleOwner()?.lifecycle?.addObserver(viewModel)
118
118
119
119
val scope = findViewTreeLifecycleOwner()?.lifecycleScope!!
@@ -132,8 +132,13 @@ constructor(
132
132
}
133
133
134
134
private fun initQRScanner () {
135
- binding.barcodeView.cameraSettings = cameraSettings
136
- binding.barcodeView.decoderFactory = DefaultDecoderFactory (listOf (QR_CODE ))
135
+ if (syncFeature.qrCodeScannerHints().isEnabled()) {
136
+ if (appBuildConfig.isInternalBuild()) {
137
+ beepManager = BeepManager (getActivity())
138
+ }
139
+ binding.barcodeView.cameraSettings = cameraSettings
140
+ binding.barcodeView.decoderFactory = DefaultDecoderFactory (listOf (QR_CODE ))
141
+ }
137
142
}
138
143
139
144
override fun onDetachedFromWindow () {
0 commit comments