From 3d60973c9ab40d003577ae281389a782c6f94ada Mon Sep 17 00:00:00 2001 From: "Eric C. Johnson" Date: Mon, 22 Jul 2024 14:40:45 -0600 Subject: [PATCH] W-16171426: [Android] Update Native Login Sample App to include QR Code Login Flow (Comment Out Log In Via UI Bridge API Generated QR Codes) --- .../app/build.gradle.kts | 4 +- .../app/src/main/AndroidManifest.xml | 20 +-- .../MainApplication.kt | 4 +- .../QrCodeEnabledLoginActivity.kt | 144 ++++++++--------- .../app/src/main/res/layout/sf__login.xml | 146 +++++++++--------- .../app/src/main/res/values/bootconfig.xml | 4 +- .../app/src/main/res/values/strings.xml | 3 +- .../app/src/main/res/xml/servers.xml | 6 - 8 files changed, 162 insertions(+), 169 deletions(-) delete mode 100644 AndroidNativeKotlinTemplate/app/src/main/res/xml/servers.xml diff --git a/AndroidNativeKotlinTemplate/app/build.gradle.kts b/AndroidNativeKotlinTemplate/app/build.gradle.kts index 9af953ef..093a5c05 100644 --- a/AndroidNativeKotlinTemplate/app/build.gradle.kts +++ b/AndroidNativeKotlinTemplate/app/build.gradle.kts @@ -8,8 +8,8 @@ plugins { dependencies { implementation("com.salesforce.mobilesdk:MobileSync:12.1.0") // Uncomment when enabling log in via Salesforce UI Bridge API generated QR codes - implementation("com.google.zxing:core:3.4.1") - implementation("com.journeyapps:zxing-android-embedded:4.3.0") +// implementation("com.google.zxing:core:3.4.1") +// implementation("com.journeyapps:zxing-android-embedded:4.3.0") } android { diff --git a/AndroidNativeKotlinTemplate/app/src/main/AndroidManifest.xml b/AndroidNativeKotlinTemplate/app/src/main/AndroidManifest.xml index bd31898e..28e866ae 100644 --- a/AndroidNativeKotlinTemplate/app/src/main/AndroidManifest.xml +++ b/AndroidNativeKotlinTemplate/app/src/main/AndroidManifest.xml @@ -25,22 +25,22 @@ - - - + + + + + + - - - + + + diff --git a/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/MainApplication.kt b/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/MainApplication.kt index 66bd7753..a4dee572 100644 --- a/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/MainApplication.kt +++ b/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/MainApplication.kt @@ -49,7 +49,7 @@ class MainApplication : Application() { * */ // Uncomment when enabling log in via Salesforce UI Bridge API generated QR codes - QrCodeEnabledLoginActivity::class.java) + /*QrCodeEnabledLoginActivity::class.java*/) MobileSyncSDKManager.getInstance().registerUsedAppFeature(FEATURE_APP_USES_KOTLIN) /* @@ -69,6 +69,6 @@ class MainApplication : Application() { // Enable login via Salesforce UI Bridge API generated QR code. // Uncomment when enabling log in via Salesforce UI Bridge API generated QR codes - MobileSyncSDKManager.getInstance().isQrCodeLoginEnabled = true + // MobileSyncSDKManager.getInstance().isQrCodeLoginEnabled = true } } diff --git a/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/QrCodeEnabledLoginActivity.kt b/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/QrCodeEnabledLoginActivity.kt index 1ea7ead0..a8190a4f 100644 --- a/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/QrCodeEnabledLoginActivity.kt +++ b/AndroidNativeKotlinTemplate/app/src/main/java/com/salesforce/androidnativekotlintemplate/QrCodeEnabledLoginActivity.kt @@ -1,72 +1,72 @@ -package com.salesforce.androidnativekotlintemplate - -import android.content.Intent -import android.os.Bundle -import android.view.View -import android.view.View.VISIBLE -import android.widget.Button -import androidx.activity.result.ActivityResult -import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts -import com.journeyapps.barcodescanner.ScanContract -import com.journeyapps.barcodescanner.ScanIntentResult -import com.journeyapps.barcodescanner.ScanOptions -import com.salesforce.androidnativekotlintemplate.R.id.qr_login_button -import com.salesforce.androidsdk.ui.LoginActivity - -/** - * A subclass of Salesforce Mobile SDK's login activity that enables log in via - * a Salesforce UI Bridge API generated QR code. If an app wishes not to use - * this feature, this class can be removed and use the superclass directly. - * - */ - // Uncomment when enabling log in via Salesforce UI Bridge API generated QR codes -class QrCodeEnabledLoginActivity : LoginActivity() { - - // region Activity Implementation - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - findViewById