Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74371fd7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add fallback screen logic to CredentialSelectorActivity" into udc-dev am: 6eaa2302

parents 3dd75301 6eaa2302
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@ import com.android.credentialmanager.common.StartBalIntentSenderForResultContrac
import com.android.credentialmanager.createflow.CreateCredentialScreen
import com.android.credentialmanager.createflow.hasContentToDisplay
import com.android.credentialmanager.getflow.GetCredentialScreen
import com.android.credentialmanager.getflow.GetGenericCredentialScreen
import com.android.credentialmanager.getflow.hasContentToDisplay
import com.android.credentialmanager.getflow.isFallbackScreen
import com.android.credentialmanager.ui.theme.PlatformTheme

@ExperimentalMaterialApi
@@ -118,11 +120,19 @@ class CredentialSelectorActivity : ComponentActivity() {
                providerActivityLauncher = launcher
            )
        } else if (getCredentialUiState != null && hasContentToDisplay(getCredentialUiState)) {
            if (isFallbackScreen(getCredentialUiState)) {
                GetGenericCredentialScreen(
                        viewModel = viewModel,
                        getCredentialUiState = getCredentialUiState,
                        providerActivityLauncher = launcher
                )
            } else {
                GetCredentialScreen(
                        viewModel = viewModel,
                        getCredentialUiState = getCredentialUiState,
                        providerActivityLauncher = launcher
                )
            }
        } else {
            Log.d(Constants.LOG_TAG, "UI wasn't able to render neither get nor create flow")
            reportInstantiationErrorAndFinishActivity(credManRepo)
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.credentialmanager.getflow

import androidx.activity.compose.ManagedActivityResultLauncher
import androidx.activity.result.ActivityResult
import androidx.activity.result.IntentSenderRequest
import androidx.compose.runtime.Composable
import com.android.credentialmanager.CredentialSelectorViewModel

@Composable
fun GetGenericCredentialScreen(
        viewModel: CredentialSelectorViewModel,
        getCredentialUiState: GetCredentialUiState,
        providerActivityLauncher: ManagedActivityResultLauncher<IntentSenderRequest, ActivityResult>
) {
    // TODO(b/274129098): Implement Screen for mDocs
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -41,6 +41,10 @@ internal fun hasContentToDisplay(state: GetCredentialUiState): Boolean {
            !state.requestDisplayInfo.preferImmediatelyAvailableCredentials)
}

internal fun isFallbackScreen(state: GetCredentialUiState): Boolean {
    return false
}

internal fun findAutoSelectEntry(providerDisplayInfo: ProviderDisplayInfo): CredentialEntryInfo? {
    if (providerDisplayInfo.authenticationEntryList.isNotEmpty()) {
        return null