Skip to content
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

Migrate Quick Connect authorization workflow to Compose UI #86

Merged

Conversation

prudrabhat
Copy link
Contributor

@prudrabhat prudrabhat commented Feb 5, 2024

Description

Currently, the QuickConnect authorization workflow UI is based on XML based system. This PR migrates it to use Jetpack Compose UI for the 3.x version to enable better code flow and maintainability.

Key changes:

  • Added a QuickConnectScreen that is the entry point for the QuickConnect authorization phase. It hosts theQuickConnectView containing all the UI elements associated with this screen for easier instrumentation tests.
  • Added QuickConnectViewModel which is the bridge between the UI and the business logic (QuickConnectManager, SessionUIOperationHandler). This seamlessly fits into the workflow due to the changes done to quick connect UI being activity first unlike the 2.x pin screen.
  • AssuranceActivity which already hosts the PinScreen and StatusScreen will also host the QuickConnectScreen. AssuranceQuickConnectActitvity is no longer required and has been deleted. This makes Assurance a single activity flow with AssuranceNavHost as the single point of entry and control for the UI and business logic.
  • AssuranceQuickConnectView composes
    - AssuranceHeader and AssuranceSubHeader
    - QuickConnect graphic
    - QuickConnectErrorPanel which optionally displays the error during connection phase.
    - ActionButtonRow that contains a Cancel button and a multi-state Connect button.
    - The Connect button is using the custom ProgressButton composable that is managed by ButtonState that defines its behavior and style (mapped to one of Idle, Waiting, Retry)
  • Added unit tests and instrumentation tests

Related Issue

#88

How Has This Been Tested?

  • Unit tests
  • Instrumentation tests for UI components
  • Manual testing

Note that the tests on this PR will fail due to compilation errors pending PinScreen test fixes. These will come as a fast follow

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@prudrabhat prudrabhat marked this pull request as ready for review February 5, 2024 18:48

val assuranceStateManager: AssuranceStateManager =
AssuranceComponentRegistry.assuranceStateManager ?: run {
Log.e(
Copy link

Choose a reason for hiding this comment

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

Can you change it to use our Log API?

internal class QuickConnectViewModel : ViewModel {
private val quickConnectManager: QuickConnectManager
private val environment: AssuranceConstants.AssuranceEnvironment
private val _state: MutableState<ConnectionState>
Copy link

@praveek praveek Feb 6, 2024

Choose a reason for hiding this comment

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

private val _state: MutableState<ConnectionState>
internal val state: State<ConnectionState>
    get() = _state

@praveek
Copy link

praveek commented Feb 6, 2024

The changes look good. Can you update the Makefile so that the CI passes?

- Better way to set internal immutable state
- Use MobileCore.Log instead of android.util.log
@prudrabhat prudrabhat merged commit fd0758d into adobe:feature/v-next Feb 25, 2024
1 of 3 checks passed
@prudrabhat prudrabhat deleted the quickconnect_flow_migration branch March 5, 2024 22:51
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.

None yet

2 participants