Skip to content

Conversation

mircea-yoti
Copy link
Contributor

Purpose

The sample webapp module was using the old View system and deprecated APIs. This PR updates it to use Jetpack Compose and handle insets for edge-to-edge display.

Approach

  • Updated compile and target sdk version to 34
  • Removed deprecated storage permission requests
  • Migrated UI to Compose: Instead of the shake-toggled bottom sheet, show the main screen composable directly. After URL input, use navigation-compose to navigate to the web screen composable.
  • Enabled edge-to-edge
  • Migrated permission requests to use ActivityResult API
  • Migrated camera and file picker handling to use ActivityResult APIs

Scope of changes

webapp module UI.

Checklist

  • Check the web sample app works the same as before, but now with a fresh UI, drawn edge-to-edge

Tagged

@lampkicking/android-dev

The permissions READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE are legacy permissions
that grant broad, unrestricted access to the shared external storage volume. For privacy
and security reasons, Google has been systematically deprecating and restricting them.

After testing, it seems safe to remove them, they no longer appear to be required.

Related to YD-6940
Instead of the shake-toggled bottom sheet, show the main screen composable
directly. After URL input, use navigation-compose to navigate to the web
screen composable.

Close-session and session-finish alert dialogs have also been migrated to Compose.

Related to YD-6940
Also replace legacy AlertDialog with Composable equivalent.

Related to YD-6940
View system components were replaced with Jetpack Compose.

Related to YD-6940
Related to YD-6940
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the webapp module from the legacy View system to Jetpack Compose while updating deprecated APIs and enabling edge-to-edge display. The migration replaces the shake-to-configure behavior with a direct main screen UI and implements proper navigation between screens.

Key changes:

  • Updated compile and target SDK from 33 to 34
  • Migrated UI from XML layouts to Compose with MainScreen and WebScreen composables
  • Replaced deprecated permission handling with ActivityResult API

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webapp/build.gradle Updates SDK versions and dependencies to support Compose
webapp/src/main/AndroidManifest.xml Removes deprecated storage permissions
webapp/src/main/java/com/yoti/mobile/android/sdk/yotidocscan/websample/MainActivity.kt Complete rewrite using Compose, ActivityResult APIs, and navigation
webapp/src/main/java/com/yoti/mobile/android/sdk/yotidocscan/websample/MainScreen.kt New Compose screen for URL input and session start
webapp/src/main/java/com/yoti/mobile/android/sdk/yotidocscan/websample/WebScreen.kt New Compose screen containing WebView with dialogs
webapp/src/main/java/com/yoti/mobile/android/sdk/yotidocscan/websample/ui/Theme.kt Compose theme definition
webapp/src/main/java/com/yoti/mobile/android/sdk/yotidocscan/websample/AppDestinations.kt Navigation destinations constants
webapp/src/main/res/values/strings.xml New string resources for Compose UI
webapp/src/main/res/values/styles.xml Simplified theme using Material Design
Multiple deleted files Removes XML layouts, drawable, colors, and accelerometer listener

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -46,4 +48,10 @@ dependencies {
// Multi-module projects: Add this dependency because of Android Studio Issue
// and androix.navigation dependencies management https://issuetracker.google.com/issues/152245564
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'

def composeBom = platform("androidx.compose:compose-bom:2025.04.00")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we declare the versions in a dedicated file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here: 74bddca 🚀

value = sessionUrl,
onValueChange = onSessionUrlChanged,
label = {
Text(text = stringResource(id = R.string.session_url_hint))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No color or font size/style ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, just use the default text style, should suffice given it's simply a demo app for YDS.

onClick = onStartSessionClicked,
enabled = sessionUrl.isNotBlank()
) {
Text(text = stringResource(id = R.string.start_session_button))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No color or font size/style ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comment above.

@@ -54,4 +54,6 @@ dependencies {
implementation 'androidx.compose.material3:material3'
implementation 'androidx.activity:activity-compose'
debugImplementation 'androidx.compose.ui:ui-tooling'

implementation 'androidx.navigation:navigation-compose:2.8.9'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok to have the version hardcoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here: 74bddca 🚀

Comment on lines 39 to 56
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
WebView(context).apply {
WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG)
configureSettings(settings)
configureWebViewClient(this, onPageCommitVisible)
configureWebChromeClient(
this,
onFilePathCallbackReady,
onShowCameraAndFilePickerChooser
)
}
},
update = { webView ->
sessionUrl.takeIf { it.isNotBlank() }?.let { webView.loadUrl(it) }
}
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a dedicated @Composable private fun

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here: a78069a 🚀

text = { Text(stringResource(id = R.string.session_finished_dialog_text)) },
confirmButton = {
TextButton(onClick = onConfirm) {
Text(stringResource(id = R.string.session_finished_dialog_confirm_button))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No color or font size/style ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered above

@mircea-yoti mircea-yoti requested a review from damienlo August 21, 2025 08:41
Copy link

@yotisunil yotisunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the ID document scan, the review screen is blank.
6161325071277343697 (1)
Hence, not approved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants