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

PP-307: Resume account views correctly #227

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README-CHANGES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
<c:change date="2023-08-12T00:00:00+00:00" summary="Fixed crash when time tracking is not enabled."/>
</c:changes>
</c:release>
<c:release date="2023-09-20T14:23:59+00:00" is-open="true" ticket-system="org.nypl.jira" version="1.6.0">
<c:release date="2023-09-21T11:16:25+00:00" is-open="true" ticket-system="org.nypl.jira" version="1.6.0">
<c:changes>
<c:change date="2023-08-24T00:00:00+00:00" summary="Updated Kotlin version to 1.9.0"/>
<c:change date="2023-08-28T00:00:00+00:00" summary="Fixed crash when opening an audiobook with a null manifest."/>
Expand All @@ -316,11 +316,16 @@
</c:tickets>
</c:change>
<c:change date="2023-09-20T00:00:00+00:00" summary="Changed BasicToken login request method to POST."/>
<c:change date="2023-09-20T14:23:59+00:00" summary="Very wide covers have their widths restricted to avoid breaking the UI.">
<c:change date="2023-09-20T00:00:00+00:00" summary="Very wide covers have their widths restricted to avoid breaking the UI.">
<c:tickets>
<c:ticket id="PP-443"/>
</c:tickets>
</c:change>
<c:change date="2023-09-21T11:16:25+00:00" summary="Correctly update the Accounts UI when resuming from the lock screen.">
<c:tickets>
<c:ticket id="PP-307"/>
</c:tickets>
</c:change>
</c:changes>
</c:release>
</c:releases>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,28 @@ class AccountDetailFragment : Fragment(R.layout.account) {

val barcode = this.parameters.barcode
if (barcode == null) {
this.authenticationViews.setBasicUserAndPass("", "")
this.authenticationViews.blank()
} else {
this.authenticationViews.setBasicUserAndPass(
user = barcode,
password = ""
)
when (this.viewModel.account.provider.authentication) {
is AccountProviderAuthenticationDescription.Basic -> {
this.authenticationViews.setBasicUserAndPass(
user = barcode,
password = ""
)
}
is AccountProviderAuthenticationDescription.BasicToken -> {
this.authenticationViews.setBasicTokenUserAndPass(
user = barcode,
password = ""
)
}
AccountProviderAuthenticationDescription.Anonymous,
is AccountProviderAuthenticationDescription.COPPAAgeGate,
is AccountProviderAuthenticationDescription.OAuthWithIntermediary,
is AccountProviderAuthenticationDescription.SAML2_0 -> {
// Nothing to do.
}
}
}

/*
Expand All @@ -404,6 +420,12 @@ class AccountDetailFragment : Fragment(R.layout.account) {
} else {
this.toolbar.visibility = View.VISIBLE
}

/*
* Eagerly reconfigure the UI to ensure an up-to-date view when resuming from sleep.
*/

this.reconfigureAccountUI()
}

private fun instantiateAlternativeAuthenticationViews() {
Expand Down