@@ -102,7 +102,6 @@ import com.salesforce.androidsdk.auth.idp.interfaces.IDPManager
102102import com.salesforce.androidsdk.auth.idp.interfaces.SPManager
103103import com.salesforce.androidsdk.config.AdminPermsManager
104104import com.salesforce.androidsdk.config.AdminSettingsManager
105- import com.salesforce.androidsdk.config.BootConfig
106105import com.salesforce.androidsdk.config.BootConfig.getBootConfig
107106import com.salesforce.androidsdk.config.LoginServerManager
108107import com.salesforce.androidsdk.config.LoginServerManager.PRODUCTION_LOGIN_URL
@@ -1317,8 +1316,8 @@ open class SalesforceSDKManager protected constructor(
13171316 },
13181317 )
13191318
1320- // Do not show Logout or Switch User options in Dev menu on the Login screen.
1321- if (frontActivity !is LoginActivity ) {
1319+ // Do not show Logout or Switch User options in Dev menu on the Login screen or if there is no user(s) .
1320+ if (frontActivity !is LoginActivity && userAccountManager.cachedCurrentUser != null ) {
13221321 actions[" Logout" ] = object : DevActionHandler {
13231322 override fun onSelected () {
13241323 logout(frontActivity = frontActivity, reason = LogoutReason .USER_LOGOUT )
@@ -1356,52 +1355,60 @@ open class SalesforceSDKManager protected constructor(
13561355 " Browser Login Enabled" , " $isBrowserLoginEnabled " ,
13571356 " IDP Enabled" , " $isIDPLoginFlowEnabled " ,
13581357 " Identity Provider" , " $isIdentityProvider " ,
1359- " Current User" , userAccountManager.cachedCurrentUser?.accountName ? : " " ,
1360- " Current User Scopes" , userAccountManager.cachedCurrentUser?.scope?.replace(" " , " , " ) ? : " " ,
1361- " Access Token Expiration" , accessTokenExpiration(),
1362- " Authenticated Users" , usersToString(userAccountManager.authenticatedUsers)
1358+ " Authenticated Users" , userAccountManager.authenticatedUsers?.joinToString(separator = " ,\n " ) {
1359+ " ${it.displayName} (${it.username} )"
1360+ } ? : " none" ,
13631361 ).apply {
1364- addAll(
1365- getDevInfosFor(
1366- getBootConfig(appContext).asJSON(),
1367- " BootConfig"
1368- )
1369- )
1370- val runtimeConfig = getRuntimeConfig(appContext)
1371- addAll(
1372- listOf (
1373- " Managed?" ,
1374- " ${runtimeConfig.isManagedApp} "
1375- )
1376- )
1377- if (runtimeConfig.isManagedApp) {
1378- addAll(
1379- getDevInfosFor(
1380- runtimeConfig.asJSON(),
1381- " Managed Pref"
1382- )
1383- )
1362+ val bootConfigValues = DevSupportInfo .parseBootConfigInfo(getBootConfig(appContext))
1363+ addAll(bootConfigValues.flatMap { listOf (it.first, it.second) })
1364+
1365+ val currentUserValues = DevSupportInfo .parseUserInfoSection(userAccountManager.cachedCurrentUser)
1366+ currentUserValues?.let { (_, values) ->
1367+ addAll(values.flatMap { listOf (it.first, it.second) })
13841368 }
1369+
1370+ val runtimeConfigValues = DevSupportInfo .parseRuntimeConfig(getRuntimeConfig(appContext))
1371+ addAll(runtimeConfigValues.flatMap { listOf (it.first, it.second) })
13851372 }
13861373
1387- open val devSupportInfo
1388- get() = DevSupportInfo (
1389- SDK_VERSION ,
1390- appType,
1391- userAgent,
1392- userAccountManager.authenticatedUsers ? : emptyList(),
1393- authConfig = listOf (
1394- " Use Web Server Authentication" to " $useWebServerAuthentication " ,
1395- " Use Hybrid Authentication Token" to " $useHybridAuthentication " ,
1396- " Support Welcome Discovery" to " $supportsWelcomeDiscovery " ,
1397- " Browser Login Enabled" to " $isBrowserLoginEnabled " ,
1398- " IDP Enabled" to " $isIDPLoginFlowEnabled " ,
1399- " Identity Provider" to " $isIdentityProvider " ,
1400- ),
1401- BootConfig .getBootConfig(appContext),
1402- userAccountManager.currentUser,
1403- getRuntimeConfig(appContext),
1404- )
1374+ // val devSupportInfo: DevSupportInfo
1375+ // get() {
1376+ // val userList: String? = userAccountManager.authenticatedUsers?.joinToString(separator = ",\n") {
1377+ // "${it.displayName} (${it.username})"
1378+ // }
1379+ // val basicInfo = listOf(
1380+ // "SDK Version" to SDK_VERSION,
1381+ // "App Type" to appType,
1382+ // "User Agent" to userAgent,
1383+ // "Authenticated Users" to (userList ?: "None"),
1384+ // )
1385+ // val authConfig = listOf(
1386+ // "Use Web Server Authentication" to "$useWebServerAuthentication",
1387+ // "Use Hybrid Authentication Token" to "$useHybridAuthentication",
1388+ // "Support Welcome Discovery" to "$supportsWelcomeDiscovery",
1389+ // "Browser Login Enabled" to "$isBrowserLoginEnabled",
1390+ // "IDP Enabled" to "$isIDPLoginFlowEnabled",
1391+ // "Identity Provider" to "$isIdentityProvider",
1392+ // )
1393+ //
1394+ // return DevSupportInfo(
1395+ // basicInfo,
1396+ // authConfig,
1397+ // getBootConfig(appContext),
1398+ // userAccountManager.cachedCurrentUser,
1399+ // getRuntimeConfig(appContext),
1400+ // )
1401+ // }
1402+ //
1403+ // TODO: Replace devSupportInfo with the above implementation when devSupportInfos is removed in 14.0.
1404+ open val devSupportInfo: DevSupportInfo
1405+ get() = DevSupportInfo .createFromLegacyDevInfos(devSupportInfos)
1406+
1407+ private fun MutableList <Pair <String , String >>.findValueAndRemove (key : String ): String? =
1408+ find { it.first == key }?.let { pair ->
1409+ remove(pair)
1410+ pair.second
1411+ }
14051412
14061413 private fun accessTokenExpiration (): String {
14071414 val currentUser = userAccountManager.cachedCurrentUser
0 commit comments