Skip to content

Commit af05759

Browse files
refactor: remove unnecessary if/else
References: https://outsystemsrd.atlassian.net/browse/RMET-4466
1 parent a62b048 commit af05759

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

src/main/java/com.outsystems.plugins.inappbrowser/osinappbrowserlib/views/OSIABWebViewActivity.kt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -371,27 +371,15 @@ class OSIABWebViewActivity : AppCompatActivity() {
371371
geolocationOrigin = null
372372
}
373373
REQUEST_CAMERA_PERMISSION -> {
374-
val granted = grantResults.all { it == PackageManager.PERMISSION_GRANTED }
375-
if (granted) {
376-
// permission granted, launch the file chooser
377-
try {
378-
filePathCallback?.let {
379-
(webView.webChromeClient as? OSIABWebChromeClient)?.retryFileChooser()
380-
}
381-
} catch (e: Exception) {
382-
Log.d(LOG_TAG, "Error launching file chooser. Exception: ${e.message}")
383-
(webView.webChromeClient as? OSIABWebChromeClient)?.cancelFileChooser()
384-
}
385-
} else {
386-
// permission denied, launch the file chooser without camera options
387-
try {
388-
filePathCallback?.let {
389-
(webView.webChromeClient as? OSIABWebChromeClient)?.retryFileChooser()
390-
}
391-
} catch (e: Exception) {
392-
Log.d(LOG_TAG, "Error launching file chooser. Exception: ${e.message}")
393-
(webView.webChromeClient as? OSIABWebChromeClient)?.cancelFileChooser()
374+
// permission granted, launch the file chooser
375+
// permission grant is determined in launchFileChooser
376+
try {
377+
filePathCallback?.let {
378+
(webView.webChromeClient as? OSIABWebChromeClient)?.retryFileChooser()
394379
}
380+
} catch (e: Exception) {
381+
Log.d(LOG_TAG, "Error launching file chooser. Exception: ${e.message}")
382+
(webView.webChromeClient as? OSIABWebChromeClient)?.cancelFileChooser()
395383
}
396384
}
397385
}

0 commit comments

Comments
 (0)