-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New UI Instructions Screen #449
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f7a1255
setting up paparazzi
jumaallan 3aa7882
setting up v3 instruction screen
jumaallan 18d2ede
added selfie capture screen ui and tests
jumaallan 1f790bc
Merge branch 'main' into feat/new-ui-v3-instructions
jumaallan 75450dd
add v2 UI
jumaallan 38c2da8
bump up VERSION (#455)
jumaallan 501b86d
Bump the androidx group with 5 updates (#454)
dependabot[bot] f5f0069
Bump the agp group with 2 updates (#453)
dependabot[bot] 434f592
Merge branch 'feat/new-ui-epic' into feat/new-ui-v3-instructions
jumaallan 3db5744
add instruction screen to new ui
jumaallan 43e3810
duplicate theme and cleaning up
jumaallan 523464b
updated selfie capture flow
jumaallan 469d6e5
updated tests
jumaallan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
lib/src/androidTest/java/com/smileidentity/compose/selfie/v2/SelfieCaptureScreenV2Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.smileidentity.compose.selfie.v2 | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import com.smileidentity.SmileID | ||
import com.smileidentity.compose.components.SmileThemeSurface | ||
import com.smileidentity.compose.theme.colorScheme | ||
import com.smileidentity.compose.theme.typography | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class SelfieCaptureScreenV2Test { | ||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
|
||
@Test | ||
fun shouldShowInstructions() { | ||
// given | ||
val instructionsSubstring = | ||
"Position your head in the camera view. Then move in the direction that is indicated" | ||
|
||
// when | ||
composeTestRule.setContent { | ||
SmileThemeSurface( | ||
SmileID.colorScheme, | ||
SmileID.typography, | ||
) { | ||
SelfieCaptureInstructionScreenV2 {} | ||
} | ||
} | ||
|
||
// then | ||
composeTestRule.onNodeWithText(instructionsSubstring, substring = true).assertIsDisplayed() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
lib/src/main/java/com/smileidentity/compose/components/AnimatedInstructions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.smileidentity.compose.components | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Modifier | ||
import com.airbnb.lottie.compose.LottieAnimation | ||
import com.airbnb.lottie.compose.LottieClipSpec | ||
import com.airbnb.lottie.compose.LottieCompositionSpec | ||
import com.airbnb.lottie.compose.LottieConstants | ||
import com.airbnb.lottie.compose.animateLottieCompositionAsState | ||
import com.airbnb.lottie.compose.rememberLottieComposition | ||
import com.smileidentity.R | ||
|
||
@Composable | ||
fun LottieInstruction(modifier: Modifier = Modifier, startFrame: Int = 0, endFrame: Int = 286) { | ||
val composition by rememberLottieComposition( | ||
LottieCompositionSpec.RawRes(R.raw.si_anim_instruction_screen), | ||
) | ||
val progress by animateLottieCompositionAsState( | ||
composition = composition, | ||
clipSpec = LottieClipSpec.Frame(startFrame, endFrame), | ||
reverseOnRepeat = false, | ||
ignoreSystemAnimatorScale = true, | ||
iterations = LottieConstants.IterateForever, | ||
) | ||
LottieAnimation( | ||
modifier = modifier, | ||
composition = composition, | ||
progress = { progress }, | ||
) | ||
} |
36 changes: 36 additions & 0 deletions
36
lib/src/main/java/com/smileidentity/compose/components/ContinueButton.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.smileidentity.compose.components | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import com.smileidentity.compose.preview.SmilePreviews | ||
|
||
/** | ||
* A button that allows theming customizations | ||
*/ | ||
@Composable | ||
internal fun ContinueButton( | ||
buttonText: String, | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit, | ||
) { | ||
Button( | ||
onClick = onClick, | ||
modifier = modifier.fillMaxWidth(), | ||
) { | ||
Text( | ||
text = buttonText, | ||
) | ||
} | ||
} | ||
|
||
@SmilePreviews | ||
@Composable | ||
private fun ContinueButtonButtonPreview() { | ||
ContinueButton( | ||
buttonText = "Continue", | ||
onClick = {}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
lib/src/main/java/com/smileidentity/compose/selfie/v2/SelfieCaptureInstructionScreenV2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.smileidentity.compose.selfie.v2 | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.smileidentity.R | ||
import com.smileidentity.compose.components.ContinueButton | ||
import com.smileidentity.compose.components.LottieInstruction | ||
import com.smileidentity.compose.components.SmileIDAttribution | ||
|
||
@Composable | ||
fun SelfieCaptureInstructionScreenV2( | ||
modifier: Modifier = Modifier, | ||
showAttribution: Boolean = true, | ||
onInstructionsAcknowledged: () -> Unit = { }, | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
modifier = modifier | ||
.fillMaxSize() | ||
.padding(20.dp), | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center, | ||
modifier = Modifier | ||
.fillMaxHeight() | ||
.fillMaxWidth() | ||
.verticalScroll(rememberScrollState()) | ||
.weight(1f), | ||
) { | ||
LottieInstruction( | ||
modifier = Modifier | ||
.size(200.dp) | ||
.padding(bottom = 16.dp), | ||
) | ||
Text( | ||
text = stringResource(R.string.si_smart_selfie_v3_instructions), | ||
textAlign = TextAlign.Center, | ||
style = MaterialTheme.typography.titleMedium.copy( | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
textAlign = TextAlign.Center, | ||
), | ||
modifier = Modifier | ||
.padding(24.dp) | ||
.testTag("smart_selfie_instructions_v2_instructions_text"), | ||
) | ||
} | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(8.dp), | ||
) { | ||
ContinueButton( | ||
buttonText = stringResource(R.string.si_smart_selfie_v3_get_started), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.testTag("smart_selfie_instructions_v2_get_started_button"), | ||
onClick = onInstructionsAcknowledged, | ||
) | ||
if (showAttribution) { | ||
SmileIDAttribution() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jumaallan this will be in a seperate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes