From c9354e89e4d504a9f8e3c3f956c305cd4dcd5ad4 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Thu, 25 Apr 2024 15:30:22 -0700 Subject: [PATCH 1/9] Updating version numbers to 12.1.0 --- README.md | 2 +- external/shared | 2 +- libs/MobileSync/AndroidManifest.xml | 4 ++-- libs/SalesforceAnalytics/AndroidManifest.xml | 4 ++-- libs/SalesforceHybrid/AndroidManifest.xml | 4 ++-- libs/SalesforceHybrid/res/xml/config.xml | 2 +- libs/SalesforceReact/AndroidManifest.xml | 4 ++-- libs/SalesforceReact/package.json | 4 ++-- libs/SalesforceSDK/AndroidManifest.xml | 4 ++-- libs/SmartStore/AndroidManifest.xml | 4 ++-- libs/test/SalesforceHybridTest/res/xml/config.xml | 2 +- package.json | 2 +- tools/generate_doc.sh | 2 +- 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 3c228faa25..4143e7ce85 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This pulls submodule dependencies from github. Introduction == -### What's New in 12.0.0 +### What's New in 12.1.0 See [release notes](https://github.com/forcedotcom/SalesforceMobileSDK-Android/releases). ### Native Applications diff --git a/external/shared b/external/shared index 7b68744f95..67b3c53602 160000 --- a/external/shared +++ b/external/shared @@ -1 +1 @@ -Subproject commit 7b68744f95c08016c81fd4b54e5bf33564fd4407 +Subproject commit 67b3c53602404af9ec62a05f34654b35ac843e3d diff --git a/libs/MobileSync/AndroidManifest.xml b/libs/MobileSync/AndroidManifest.xml index 00a5863806..82bf14edba 100644 --- a/libs/MobileSync/AndroidManifest.xml +++ b/libs/MobileSync/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="84" + android:versionName="12.1.0.dev"> diff --git a/libs/SalesforceAnalytics/AndroidManifest.xml b/libs/SalesforceAnalytics/AndroidManifest.xml index 5a325e5481..2c7b0bd7a9 100644 --- a/libs/SalesforceAnalytics/AndroidManifest.xml +++ b/libs/SalesforceAnalytics/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="84" + android:versionName="12.1.0.dev"> diff --git a/libs/SalesforceHybrid/AndroidManifest.xml b/libs/SalesforceHybrid/AndroidManifest.xml index 49677df630..695a8a1580 100644 --- a/libs/SalesforceHybrid/AndroidManifest.xml +++ b/libs/SalesforceHybrid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="84" + android:versionName="12.1.0.dev"> + version = "12.1.0"> diff --git a/libs/SalesforceReact/AndroidManifest.xml b/libs/SalesforceReact/AndroidManifest.xml index 7c4e9c4403..fd756014b2 100644 --- a/libs/SalesforceReact/AndroidManifest.xml +++ b/libs/SalesforceReact/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="84" + android:versionName="12.1.0.dev"> + android:versionCode="84" + android:versionName="12.1.0.dev"> diff --git a/libs/SmartStore/AndroidManifest.xml b/libs/SmartStore/AndroidManifest.xml index 6e546251b0..f6c6b2de0a 100644 --- a/libs/SmartStore/AndroidManifest.xml +++ b/libs/SmartStore/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="84" + android:versionName="12.1.0.dev"> diff --git a/libs/test/SalesforceHybridTest/res/xml/config.xml b/libs/test/SalesforceHybridTest/res/xml/config.xml index a314d756d4..690d3ceeca 100644 --- a/libs/test/SalesforceHybridTest/res/xml/config.xml +++ b/libs/test/SalesforceHybridTest/res/xml/config.xml @@ -1,7 +1,7 @@ + version = "12.1.0"> diff --git a/package.json b/package.json index 7c62523fd6..a8eda9c744 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SalesforceMobileSDK-Android", - "version": "12.0.0", + "version": "12.1.0", "description": "Salesforce Mobile SDK for Android", "keywords": [ "mobilesdk", diff --git a/tools/generate_doc.sh b/tools/generate_doc.sh index 4f796b2bf8..6936fd2069 100755 --- a/tools/generate_doc.sh +++ b/tools/generate_doc.sh @@ -3,5 +3,5 @@ if [ ! -d "external" ] then echo "You must run this tool from the root directory of your repo clone" else - javadoc -d doc -author -version -verbose -use -doctitle "SalesforceSDK 12.0 API" -sourcepath "libs/SalesforceAnalytics/src:libs/SalesforceSDK/src:libs/SmartStore/src:libs/MobileSync/src:libs/SalesforceHybrid/src:libs/SalesforceReact/src" -subpackages com + javadoc -d doc -author -version -verbose -use -doctitle "SalesforceSDK 12.1 API" -sourcepath "libs/SalesforceAnalytics/src:libs/SalesforceSDK/src:libs/SmartStore/src:libs/MobileSync/src:libs/SalesforceHybrid/src:libs/SalesforceReact/src" -subpackages com fi From a3b60bdf774296cf70bb3cee3eeaac08670cab39 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Fri, 26 Apr 2024 09:56:22 -0700 Subject: [PATCH 2/9] Merge from master and setting version to 12.1.0 --- build.gradle.kts | 2 +- libs/MobileSync/build.gradle.kts | 2 +- libs/SalesforceAnalytics/build.gradle.kts | 2 +- libs/SalesforceHybrid/build.gradle.kts | 2 +- libs/SalesforceReact/build.gradle.kts | 2 +- libs/SalesforceSDK/build.gradle.kts | 2 +- libs/SmartStore/build.gradle.kts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d70c8a18c6..0484ca3d95 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ buildscript { allprojects { group = "com.salesforce.mobilesdk" - version = "12.0.0" + version = "12.1.0" // Ensure that we do not use newer language features that would make the SDK incompatible with // apps that do not target the latest version of Kotlin. diff --git a/libs/MobileSync/build.gradle.kts b/libs/MobileSync/build.gradle.kts index 147f93350d..11bde3b28f 100644 --- a/libs/MobileSync/build.gradle.kts +++ b/libs/MobileSync/build.gradle.kts @@ -1,7 +1,7 @@ @file:Suppress("UnstableApiUsage") rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "MobileSync" plugins { diff --git a/libs/SalesforceAnalytics/build.gradle.kts b/libs/SalesforceAnalytics/build.gradle.kts index 839503f994..d3685a121d 100644 --- a/libs/SalesforceAnalytics/build.gradle.kts +++ b/libs/SalesforceAnalytics/build.gradle.kts @@ -1,7 +1,7 @@ @file:Suppress("UnstableApiUsage") rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceAnalytics" plugins { diff --git a/libs/SalesforceHybrid/build.gradle.kts b/libs/SalesforceHybrid/build.gradle.kts index a9088e615f..abe80a0f0e 100644 --- a/libs/SalesforceHybrid/build.gradle.kts +++ b/libs/SalesforceHybrid/build.gradle.kts @@ -1,7 +1,7 @@ @file:Suppress("UnstableApiUsage") rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceHybrid" plugins { diff --git a/libs/SalesforceReact/build.gradle.kts b/libs/SalesforceReact/build.gradle.kts index 18dd2d56c6..ce64adde83 100644 --- a/libs/SalesforceReact/build.gradle.kts +++ b/libs/SalesforceReact/build.gradle.kts @@ -12,7 +12,7 @@ import org.apache.tools.ant.taskdefs.condition.Os val useIntlJsc = false rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceReact" plugins { diff --git a/libs/SalesforceSDK/build.gradle.kts b/libs/SalesforceSDK/build.gradle.kts index 0a90793295..ff7736e1a0 100644 --- a/libs/SalesforceSDK/build.gradle.kts +++ b/libs/SalesforceSDK/build.gradle.kts @@ -1,7 +1,7 @@ @file:Suppress("UnstableApiUsage") rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceSDK" plugins { diff --git a/libs/SmartStore/build.gradle.kts b/libs/SmartStore/build.gradle.kts index 14626ef197..4eca44ef27 100644 --- a/libs/SmartStore/build.gradle.kts +++ b/libs/SmartStore/build.gradle.kts @@ -1,7 +1,7 @@ @file:Suppress("UnstableApiUsage") rootProject.ext["PUBLISH_GROUP_ID"] = "com.salesforce.mobilesdk" -rootProject.ext["PUBLISH_VERSION"] = "12.0.0" +rootProject.ext["PUBLISH_VERSION"] = "12.1.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SmartStore" plugins { From b7fc67140df1a4e0e33e0289b5df09d39d1e60cc Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Thu, 2 May 2024 16:30:49 -0700 Subject: [PATCH 3/9] Fix protected functions not being open in classes recently converted to Kotlin. --- .../phonegap/ui/SalesforceDroidGapActivity.kt | 2 +- .../androidsdk/app/SalesforceSDKManager.kt | 40 +++---- .../salesforce/androidsdk/ui/LoginActivity.kt | 30 ++--- .../androidsdk/ui/OAuthWebviewHelper.kt | 32 +++--- .../phonegap/app/PublicOverrideTests.kt | 22 ++++ .../androidsdk/app/PublicOverridesTest.kt | 108 ++++++++++++++++++ 6 files changed, 178 insertions(+), 56 deletions(-) create mode 100644 libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt create mode 100644 libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt diff --git a/libs/SalesforceHybrid/src/com/salesforce/androidsdk/phonegap/ui/SalesforceDroidGapActivity.kt b/libs/SalesforceHybrid/src/com/salesforce/androidsdk/phonegap/ui/SalesforceDroidGapActivity.kt index 57d7a291a8..4aa9a035b9 100644 --- a/libs/SalesforceHybrid/src/com/salesforce/androidsdk/phonegap/ui/SalesforceDroidGapActivity.kt +++ b/libs/SalesforceHybrid/src/com/salesforce/androidsdk/phonegap/ui/SalesforceDroidGapActivity.kt @@ -306,7 +306,7 @@ open class SalesforceDroidGapActivity : CordovaActivity(), SalesforceActivityInt /** The unauthenticated start page from the boot configuration */ @Suppress("MemberVisibilityCanBePrivate") - protected val unauthenticatedStartPage + protected open val unauthenticatedStartPage get() = bootConfig?.unauthenticatedStartPage fun logout(callbackContext: CallbackContext?) { diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt index 42a156aa29..665c8419b8 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt @@ -230,7 +230,7 @@ open class SalesforceSDKManager protected constructor( }.also { field = it } /** The Salesforce SDK manager's login server manager */ - val loginServerManager by lazy { + open val loginServerManager by lazy { LoginServerManager(appContext) } @@ -316,8 +316,8 @@ open class SalesforceSDKManager protected constructor( * based on the value configured on the server */ @set:Synchronized - var isBrowserLoginEnabled = false - private set + open var isBrowserLoginEnabled = false + protected set /** Optionally enables browser session sharing */ var isShareBrowserSessionEnabled = false @@ -379,8 +379,9 @@ open class SalesforceSDKManager protected constructor( * By default, the display name under * [android.content.pm.ApplicationInfo.labelRes] will be used. */ + @Suppress("INAPPLICABLE_JVM_NAME") @get:JvmName("provideAppName") - var appName: String? = null + open var appName: String? = null get() = runCatching { if (field == null) { val packageInfo = appContext.packageManager.getPackageInfo( @@ -437,7 +438,7 @@ open class SalesforceSDKManager protected constructor( * BuildConfig.DEBUG unless another value is specified. * @return Boolean true enables developer support features; false otherwise */ - fun isDevSupportEnabled() = isDevSupportEnabledOverride ?: isDebugBuild + open fun isDevSupportEnabled() = isDevSupportEnabledOverride ?: isDebugBuild /** * Sets if developer support features are enabled. @@ -486,7 +487,7 @@ open class SalesforceSDKManager protected constructor( } /** Login options associated with the app */ - val loginOptions: LoginOptions get() = getLoginOptions(null, null) + open val loginOptions: LoginOptions get() = getLoginOptions(null, null) /** * Sets the login options associated with the app. @@ -494,7 +495,7 @@ open class SalesforceSDKManager protected constructor( * @param jwt The `jwt` * @param url The URL */ - fun getLoginOptions( + open fun getLoginOptions( jwt: String?, url: String? ) = loginOptionsInternal?.apply { @@ -530,10 +531,10 @@ open class SalesforceSDKManager protected constructor( * @return True if the Salesforce Mobile SDK should automatically logout when * the access token is revoked */ - fun shouldLogoutWhenTokenRevoked() = true + open fun shouldLogoutWhenTokenRevoked() = true /** The Salesforce SDK manager's user account manager */ - val userAccountManager: UserAccountManager by lazy { + open val userAccountManager: UserAccountManager by lazy { UserAccountManager.getInstance() } @@ -546,7 +547,7 @@ open class SalesforceSDKManager protected constructor( * for this option. This functionality will eventually be provided by the * backend. */ - var shouldBlockSalesforceIntegrationUser = false + open var shouldBlockSalesforceIntegrationUser = false /** * Creates a NativeLoginManager instance that allows the app to use its @@ -595,7 +596,7 @@ open class SalesforceSDKManager protected constructor( * false otherwise */ @Synchronized - fun setBrowserLoginEnabled( + internal fun setBrowserLoginEnabled( browserLoginEnabled: Boolean, shareBrowserSessionEnabled: Boolean ) { @@ -638,7 +639,7 @@ open class SalesforceSDKManager protected constructor( /** Returns the app display name used by the passcode dialog */ @Suppress("unused") - val appDisplayString = DEFAULT_APP_DISPLAY_NAME + open val appDisplayString = DEFAULT_APP_DISPLAY_NAME /** Returns the name of the app as defined in AndroidManifest.xml */ val applicationName @@ -719,8 +720,7 @@ open class SalesforceSDKManager protected constructor( /** * Starts the login flow if user account has been removed. */ - @Suppress("MemberVisibilityCanBePrivate") - protected fun startLoginPage() { + protected open fun startLoginPage() { // Clear cookies CookieManager.getInstance().removeAllCookies(null) @@ -870,7 +870,7 @@ open class SalesforceSDKManager protected constructor( * @param showLoginPage If true, displays the login page after removing the * account */ - fun logout( + open fun logout( /* Note: Kotlin's @JvmOverloads annotations does not generate this overload */ frontActivity: Activity?, showLoginPage: Boolean = true @@ -889,7 +889,7 @@ open class SalesforceSDKManager protected constructor( * account */ @JvmOverloads - fun logout( + open fun logout( account: Account? = null, frontActivity: Activity?, showLoginPage: Boolean = true @@ -1386,7 +1386,7 @@ open class SalesforceSDKManager protected constructor( * * @param activity The activity used to set style attributes */ - fun setViewNavigationVisibility(activity: Activity) { + open fun setViewNavigationVisibility(activity: Activity) { if (!isDarkTheme || activity.javaClass.name == loginActivityClass.name) { /* * This covers the case where OS dark theme is true, but app has @@ -1400,7 +1400,7 @@ open class SalesforceSDKManager protected constructor( * Determines whether the device has a compact screen. * Taken directly from https://developer.android.com/guide/topics/large-screens/large-screen-cookbook#kotlin */ - fun compactScreen(activity: Activity): Boolean { + open fun compactScreen(activity: Activity): Boolean { val metrics = WindowMetricsCalculator.getOrCreate().computeMaximumWindowMetrics(activity) val width = metrics.bounds.width() val height = metrics.bounds.height() @@ -1413,7 +1413,7 @@ open class SalesforceSDKManager protected constructor( @Suppress("unused") @OnLifecycleEvent(ON_STOP) - protected fun onAppBackgrounded() { + protected open fun onAppBackgrounded() { screenLockManager?.onAppBackgrounded() (biometricAuthenticationManager as? BiometricAuthenticationManager)?.onAppBackgrounded() @@ -1425,7 +1425,7 @@ open class SalesforceSDKManager protected constructor( @Suppress("unused") @OnLifecycleEvent(ON_START) - protected fun onAppForegrounded() { + protected open fun onAppForegrounded() { screenLockManager?.onAppForegrounded() (biometricAuthenticationManager as? BiometricAuthenticationManager)?.onAppForegrounded() diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt index e39d241fd1..251357dee0 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt @@ -280,8 +280,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { super.finish() } - @Suppress("MemberVisibilityCanBePrivate") - protected fun certAuthOrLogin() { + protected open fun certAuthOrLogin() { when { shouldUseCertBasedAuth() -> { val alias = getRuntimeConfig(this).getString(ManagedAppCertAlias) @@ -298,7 +297,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { } else -> { - d(TAG, "User agent login flow being triggered") + d(TAG, "Web server or user agent login flow triggered") webviewHelper?.loadLoginPage() } } @@ -325,12 +324,10 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * @return True if certificate based authentication flow should be used and * false otherwise */ - @Suppress("MemberVisibilityCanBePrivate") - protected fun shouldUseCertBasedAuth(): Boolean = + protected open fun shouldUseCertBasedAuth(): Boolean = getRuntimeConfig(this).getBoolean(RequireCertAuth) - @Suppress("MemberVisibilityCanBePrivate") - protected fun getOAuthWebviewHelper( + protected open fun getOAuthWebviewHelper( callback: OAuthWebviewHelperEvents, loginOptions: LoginOptions, webView: WebView, @@ -366,8 +363,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * @return true if the fix was applied and false if the key code was not * handled */ - @Suppress("MemberVisibilityCanBePrivate") - protected fun fixBackButtonBehavior(keyCode: Int) = + protected open fun fixBackButtonBehavior(keyCode: Int) = when (keyCode) { KEYCODE_BACK -> { handleBackBehavior() @@ -450,8 +446,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * reload the login page. * @param v The view that was clicked */ - @Suppress("MemberVisibilityCanBePrivate") - fun onClearCookiesClick(@Suppress("UNUSED_PARAMETER") v: View?) { + private fun onClearCookiesClick(@Suppress("UNUSED_PARAMETER") v: View?) { webviewHelper?.clearCookies() webviewHelper?.loadLoginPage() } @@ -461,7 +456,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * * @param v IDP login button */ - fun onIDPLoginClick(@Suppress("UNUSED_PARAMETER") v: View?) { + open fun onIDPLoginClick(v: View?) { SalesforceSDKManager.getInstance().spManager?.kickOffSPInitiatedLoginFlow( this, SPStatusCallback() @@ -472,8 +467,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * Called when the "reload" button is clicked to reloads the login page. * @param v The reload button */ - @Suppress("MemberVisibilityCanBePrivate") - fun onReloadClick(@Suppress("UNUSED_PARAMETER") v: View?) { + private fun onReloadClick(@Suppress("UNUSED_PARAMETER") v: View?) { webviewHelper?.loadLoginPage() } @@ -482,8 +476,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * activity. * @param v The pick server button */ - @Suppress("MemberVisibilityCanBePrivate") - fun onPickServerClick(@Suppress("UNUSED_PARAMETER") v: View?) { + private fun onPickServerClick(@Suppress("UNUSED_PARAMETER") v: View?) { Intent(this, ServerPickerActivity::class.java).also { intent -> startActivityForResult( intent, @@ -554,7 +547,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { } } - fun presentBiometric() { + internal fun presentBiometric() { val biometricPrompt = biometricPrompt val biometricManager = BiometricManager.from(this) when (biometricManager.canAuthenticate(authenticators)) { @@ -659,8 +652,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { .build() } - fun onBioAuthClick(@Suppress("UNUSED_PARAMETER") view: View?) = - presentBiometric() + open fun onBioAuthClick(view: View?) = presentBiometric() companion object { const val PICK_SERVER_REQUEST_CODE = 10 diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt index 018200a8fa..50963bbd0a 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt @@ -275,7 +275,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { var shouldReloadPage: Boolean = false private set - fun saveState(outState: Bundle) { + internal fun saveState(outState: Bundle) { val accountOptions = accountOptions webView?.saveState(outState) @@ -288,10 +288,10 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { } } - fun clearCookies() = + open fun clearCookies() = CookieManager.getInstance().removeAllCookies(null) - fun clearView() = + internal fun clearView() = webView?.loadUrl("about:blank") /** @@ -299,14 +299,14 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * needed. */ @Suppress("MemberVisibilityCanBePrivate") - protected fun makeWebViewClient() = AuthWebViewClient() + protected open fun makeWebViewClient() = AuthWebViewClient() /** * A factory method for the web Chrome client. This can be overridden as * needed */ @Suppress("MemberVisibilityCanBePrivate") - protected fun makeWebChromeClient() = WebChromeClient() + protected open fun makeWebChromeClient() = WebChromeClient() /** * A callback when the user facing part of the authentication flow completed @@ -318,7 +318,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * @param errorDesc The error description * @param e The exception */ - fun onAuthFlowError( + internal fun onAuthFlowError( error: String, errorDesc: String?, e: Throwable? @@ -365,7 +365,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { } @Suppress("MemberVisibilityCanBePrivate") - protected fun showError(exception: Throwable) { + protected open fun showError(exception: Throwable) { makeText( context, context.getString( @@ -380,7 +380,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * Reloads the authorization page in the web view. Also, updates the window * title so it's easier to identify the login system. */ - fun loadLoginPage() = loginOptions.let { loginOptions -> + internal fun loadLoginPage() = loginOptions.let { loginOptions -> when { isEmpty(loginOptions.jwt) -> { loginOptions.loginUrl = this@OAuthWebviewHelper.loginUrl @@ -499,7 +499,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { get() = loginOptions.oauthClientId @Suppress("MemberVisibilityCanBePrivate") - protected fun getAuthorizationUrl( + protected open fun getAuthorizationUrl( useWebServerAuthentication: Boolean, useHybridAuthentication: Boolean ): URI { @@ -551,11 +551,11 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * See the OAuth docs for the complete list of valid values */ @Suppress("MemberVisibilityCanBePrivate") - protected val authorizationDisplayType + protected open val authorizationDisplayType get() = context.getString(oauth_display_type) /** Override to customize the login url */ - protected val loginUrl: String? + protected open val loginUrl: String? get() = SalesforceSDKManager.getInstance().loginServerManager.selectedLoginServer?.url?.run { trim { it <= ' ' } } @@ -565,7 +565,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * URL. That redirect marks the end of the user facing portion of the * authentication flow. */ - protected inner class AuthWebViewClient : WebViewClient() { + protected open inner class AuthWebViewClient : WebViewClient() { override fun onPageFinished( view: WebView, @@ -716,14 +716,14 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * successfully. The last step is to call the identity service to get the * username. */ - fun onAuthFlowComplete(tr: TokenEndpointResponse?, nativeLogin: Boolean = false) { + open fun onAuthFlowComplete(tr: TokenEndpointResponse?, nativeLogin: Boolean = false) { d(TAG, "token response -> $tr") CoroutineScope(IO).launch { FinishAuthTask().execute(tr, nativeLogin) } } - fun onWebServerFlowComplete(code: String?) = + internal fun onWebServerFlowComplete(code: String?) = CoroutineScope(IO).launch { doCodeExchangeEndpoint(code) } @@ -1142,7 +1142,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { return salesforceHosts.map { host.endsWith(it) }.any() { it } } - protected fun addAccount(account: UserAccount?) { + private fun addAccount(account: UserAccount?) { val clientManager = ClientManager( context, SalesforceSDKManager.getInstance().accountType, @@ -1237,7 +1237,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { * The name to be shown for account in Settings -> Accounts & Sync * @return name to be shown for account in Settings -> Accounts & Sync */ - protected fun buildAccountName( + protected open fun buildAccountName( username: String?, instanceServer: String? ) = String.format( diff --git a/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt b/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt new file mode 100644 index 0000000000..0d1ee89d62 --- /dev/null +++ b/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt @@ -0,0 +1,22 @@ +package com.salesforce.androidsdk.phonegap.app + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.salesforce.androidsdk.phonegap.ui.SalesforceDroidGapActivity +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@SmallTest +class PublicOverrideTests { + @Test + fun overrideSalesforceDroidGapActivity() { + class Override : SalesforceDroidGapActivity() { + override val unauthenticatedStartPage: String + get() = "" + } + + // Instantiate to ensure this compiles. + Override() + } +} \ No newline at end of file diff --git a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt new file mode 100644 index 0000000000..c3aa5b0e63 --- /dev/null +++ b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt @@ -0,0 +1,108 @@ +@file:Suppress("DEPRECATION") + +package com.salesforce.androidsdk.app + +import android.accounts.Account +import android.app.Activity +import android.content.Context +import android.os.Bundle +import android.view.View +import android.webkit.WebChromeClient +import android.webkit.WebView +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import androidx.test.platform.app.InstrumentationRegistry +import com.salesforce.androidsdk.accounts.UserAccount +import com.salesforce.androidsdk.accounts.UserAccountManager +import com.salesforce.androidsdk.auth.OAuth2 +import com.salesforce.androidsdk.config.LoginServerManager +import com.salesforce.androidsdk.rest.ClientManager.LoginOptions +import com.salesforce.androidsdk.ui.LoginActivity +import com.salesforce.androidsdk.ui.OAuthWebviewHelper +import org.junit.Test +import org.junit.runner.RunWith +import java.net.URI + +/* + Note: The code style in this class is bad on purpose. + + The implementation of the overridden functions and properties does not matter, it is only there + for the sake of compilation. What is important is the list of overrideable functions/properties + that the test ensures still exist, which is easier to read without multi-line declarations and + implementations. + */ +@RunWith(AndroidJUnit4::class) +@SmallTest +internal class PublicOverridesTest { + private val context = InstrumentationRegistry.getInstrumentation().context + private val callback = object : OAuthWebviewHelper.OAuthWebviewHelperEvents { + override fun loadingLoginPage(loginUrl: String) {} + override fun onAccountAuthenticatorResult(authResult: Bundle) {} + override fun finish(userAccount: UserAccount?) {} + } + private val loginOptions = LoginOptions("", "", "", emptyArray()) + + @Test + fun overrideOAuthWebviewHelper() { + class Override(context: Context, callback: OAuthWebviewHelperEvents, loginOptions: LoginOptions) : OAuthWebviewHelper(context, callback, loginOptions) { + + override val authorizationDisplayType: String get() = "" + override val loginUrl: String get() = "" + + // functions/properties below this are used by internal apps + override fun clearCookies() {} + override fun getAuthorizationUrl(useWebServerAuthentication: Boolean, useHybridAuthentication: Boolean): URI { return URI("") } + override fun buildAccountName(username: String?, instanceServer: String?): String { return "" } + override fun makeWebChromeClient(): WebChromeClient { return WebChromeClient() } + override fun makeWebViewClient(): AuthWebViewClient { return AuthWebViewClient() } + override fun onAuthFlowComplete(tr: OAuth2.TokenEndpointResponse?, nativeLogin: Boolean) { } + @Suppress("unused") + private inner class TestClient: AuthWebViewClient() + } + + // Instantiate to ensure this compiles. + Override(context, callback, loginOptions) + } + + @Test + fun overrideLoginActivity() { + class Override : LoginActivity() { + override fun certAuthOrLogin() { } + override fun shouldUseCertBasedAuth(): Boolean { return true } + override fun getOAuthWebviewHelper(callback: OAuthWebviewHelper.OAuthWebviewHelperEvents, loginOptions: LoginOptions, webView: WebView, savedInstanceState: Bundle?): OAuthWebviewHelper { return OAuthWebviewHelper(this, callback, loginOptions, webView, savedInstanceState) } + override fun onIDPLoginClick(v: View?) { } + override fun onBioAuthClick(view: View?) { } + } + + // Instantiate to ensure this compiles. + Override() + } + + @Test + fun overrideSalesforceSDKManager() { + class Override(context: Context, mainActivity: Class) : SalesforceSDKManager(context, mainActivity) { + override fun shouldLogoutWhenTokenRevoked(): Boolean { return false } + override val appDisplayString: String get() = "" + override fun cleanUp(userAccount: UserAccount?) { } + override fun startLoginPage() { } + override fun getUserAgent(qualifier: String): String { return "" } + override fun compactScreen(activity: Activity): Boolean { return true } + + // functions/properties below this are used by internal apps + override var isBrowserLoginEnabled = false + override val userAccountManager: UserAccountManager get() = super.userAccountManager + override fun isDevSupportEnabled(): Boolean { return false } + override val loginOptions: LoginOptions get() = super.loginOptions + override fun getLoginOptions(jwt: String?, url: String?): LoginOptions { return loginOptions } + override fun logout(frontActivity: Activity?, showLoginPage: Boolean) { } + override fun logout(account: Account?, frontActivity: Activity?, showLoginPage: Boolean) { } + override val loginServerManager: LoginServerManager get() = super.loginServerManager + override fun setViewNavigationVisibility(activity: Activity) { } + override fun onAppBackgrounded() { } + override fun onAppForegrounded() { } + } + + // Instantiate to ensure this compiles. + Override() + } +} \ No newline at end of file From 0430cb7614bfc647f7f1d87e2455f7a7a842b96f Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Thu, 2 May 2024 17:13:20 -0700 Subject: [PATCH 4/9] Fix public override tests. --- .../androidsdk/phonegap/app/PublicOverrideTests.kt | 7 +++++-- .../com/salesforce/androidsdk/app/PublicOverridesTest.kt | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt b/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt index 0d1ee89d62..e55997a767 100644 --- a/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt +++ b/libs/test/SalesforceHybridTest/src/com/salesforce/androidsdk/phonegap/app/PublicOverrideTests.kt @@ -2,6 +2,7 @@ package com.salesforce.androidsdk.phonegap.app import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import androidx.test.platform.app.InstrumentationRegistry import com.salesforce.androidsdk.phonegap.ui.SalesforceDroidGapActivity import org.junit.Test import org.junit.runner.RunWith @@ -16,7 +17,9 @@ class PublicOverrideTests { get() = "" } - // Instantiate to ensure this compiles. - Override() + InstrumentationRegistry.getInstrumentation().runOnMainSync { + // Instantiate to ensure this compiles. + Override() + } } } \ No newline at end of file diff --git a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt index c3aa5b0e63..49608d3c0e 100644 --- a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt +++ b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt @@ -74,8 +74,10 @@ internal class PublicOverridesTest { override fun onBioAuthClick(view: View?) { } } - // Instantiate to ensure this compiles. - Override() + InstrumentationRegistry.getInstrumentation().runOnMainSync { + // Instantiate to ensure this compiles. + Override() + } } @Test From 2025b93a2f815b157cc6879f4aaf4676d00e202f Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Thu, 2 May 2024 19:32:58 -0700 Subject: [PATCH 5/9] no message --- .../salesforce/androidsdk/app/SalesforceSDKManager.kt | 2 +- .../src/com/salesforce/androidsdk/ui/LoginActivity.kt | 4 ++-- .../salesforce/androidsdk/ui/OAuthWebviewHelper.kt | 3 +-- .../salesforce/androidsdk/app/PublicOverridesTest.kt | 11 +++++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt index 665c8419b8..7536620d69 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt @@ -596,7 +596,7 @@ open class SalesforceSDKManager protected constructor( * false otherwise */ @Synchronized - internal fun setBrowserLoginEnabled( + fun setBrowserLoginEnabled( browserLoginEnabled: Boolean, shareBrowserSessionEnabled: Boolean ) { diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt index 251357dee0..1b732cdcdd 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt @@ -446,7 +446,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * reload the login page. * @param v The view that was clicked */ - private fun onClearCookiesClick(@Suppress("UNUSED_PARAMETER") v: View?) { + open fun onClearCookiesClick(v: View?) { webviewHelper?.clearCookies() webviewHelper?.loadLoginPage() } @@ -476,7 +476,7 @@ open class LoginActivity : AppCompatActivity(), OAuthWebviewHelperEvents { * activity. * @param v The pick server button */ - private fun onPickServerClick(@Suppress("UNUSED_PARAMETER") v: View?) { + open fun onPickServerClick(v: View?) { Intent(this, ServerPickerActivity::class.java).also { intent -> startActivityForResult( intent, diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt index 50963bbd0a..6e6c5cb320 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/OAuthWebviewHelper.kt @@ -494,8 +494,7 @@ open class OAuthWebviewHelper : KeyChainAliasCallback { }.getOrDefault(false) } - @Suppress("MemberVisibilityCanBePrivate") - protected val oAuthClientId: String + protected open val oAuthClientId: String get() = loginOptions.oauthClientId @Suppress("MemberVisibilityCanBePrivate") diff --git a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt index 49608d3c0e..f85f0c3a33 100644 --- a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt +++ b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PublicOverridesTest.kt @@ -6,6 +6,7 @@ import android.accounts.Account import android.app.Activity import android.content.Context import android.os.Bundle +import android.view.Menu import android.view.View import android.webkit.WebChromeClient import android.webkit.WebView @@ -56,6 +57,7 @@ internal class PublicOverridesTest { override fun makeWebChromeClient(): WebChromeClient { return WebChromeClient() } override fun makeWebViewClient(): AuthWebViewClient { return AuthWebViewClient() } override fun onAuthFlowComplete(tr: OAuth2.TokenEndpointResponse?, nativeLogin: Boolean) { } + override val oAuthClientId: String get() = super.oAuthClientId @Suppress("unused") private inner class TestClient: AuthWebViewClient() } @@ -67,11 +69,16 @@ internal class PublicOverridesTest { @Test fun overrideLoginActivity() { class Override : LoginActivity() { - override fun certAuthOrLogin() { } override fun shouldUseCertBasedAuth(): Boolean { return true } - override fun getOAuthWebviewHelper(callback: OAuthWebviewHelper.OAuthWebviewHelperEvents, loginOptions: LoginOptions, webView: WebView, savedInstanceState: Bundle?): OAuthWebviewHelper { return OAuthWebviewHelper(this, callback, loginOptions, webView, savedInstanceState) } override fun onIDPLoginClick(v: View?) { } override fun onBioAuthClick(view: View?) { } + + // functions/properties below this are used by internal apps + override fun fixBackButtonBehavior(keyCode: Int): Boolean { return false } + override fun certAuthOrLogin() { } + override fun getOAuthWebviewHelper(callback: OAuthWebviewHelper.OAuthWebviewHelperEvents, loginOptions: LoginOptions, webView: WebView, savedInstanceState: Bundle?): OAuthWebviewHelper { return OAuthWebviewHelper(this, callback, loginOptions, webView, savedInstanceState) } + override fun onPickServerClick(v: View?) { } + override fun onClearCookiesClick(v: View?) { } } InstrumentationRegistry.getInstrumentation().runOnMainSync { From de36d7308e38b22cdb09216b5124f28b3b9d2d53 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Fri, 3 May 2024 09:35:35 -0700 Subject: [PATCH 6/9] setversion.sh was no longer updating version in SalesforceSDKManager --- .../com/salesforce/androidsdk/app/SalesforceSDKManager.kt | 2 +- setversion.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt index 42a156aa29..b2d5428d26 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt @@ -1448,7 +1448,7 @@ open class SalesforceSDKManager protected constructor( protected var INSTANCE: SalesforceSDKManager? = null /** The current version of this SDK */ - const val SDK_VERSION = "12.0.0.dev" + const val SDK_VERSION = "12.1.0.dev" /** * An intent action meant for instances of Salesforce SDK manager diff --git a/setversion.sh b/setversion.sh index fda9992c3a..30a945cd20 100755 --- a/setversion.sh +++ b/setversion.sh @@ -82,7 +82,7 @@ update_config_xml () gsed -i "s/version.*=.*\"[^\"]*\">/version = \"${versionName}\">/g" ${file} } -update_salesforcesdkmanager_java () +update_salesforcesdkmanager_kt () { local file=$1 local versionName=$2 @@ -166,8 +166,8 @@ echo "*** Updating config.xml files ***" update_config_xml "./libs/SalesforceHybrid/res/xml/config.xml" "${OPT_VERSION}" update_config_xml "./libs/test/SalesforceHybridTest/res/xml/config.xml" "${OPT_VERSION}" -echo "*** Updating SalesforceSDKManager.java ***" -update_salesforcesdkmanager_java "./libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.java" "${VERSION_SUFFIXED}" +echo "*** Updating SalesforceSDKManager.kt ***" +update_salesforcesdkmanager_kt "./libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt" "${VERSION_SUFFIXED}" echo "*** Updating generate_doc.sh ***" update_generate_doc "./tools/generate_doc.sh" "${SHORT_VERSION}" From 28b9ea2975d8aee87df4146fd05b5d17a58ef8bb Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Fri, 3 May 2024 16:57:12 -0700 Subject: [PATCH 7/9] Move to sqlcipher 4.5.7 --- libs/SmartStore/build.gradle.kts | 2 +- .../salesforce/androidsdk/smartstore/store/SmartStoreTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/SmartStore/build.gradle.kts b/libs/SmartStore/build.gradle.kts index 4eca44ef27..d65e4e6d72 100644 --- a/libs/SmartStore/build.gradle.kts +++ b/libs/SmartStore/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { api(project(":libs:SalesforceSDK")) //noinspection GradleDependency - Needs to line up with supported SQLCipher version. api("androidx.sqlite:sqlite:2.2.0") - api("net.zetetic:sqlcipher-android:4.5.6") + api("net.zetetic:sqlcipher-android:4.5.7") implementation("androidx.core:core-ktx:1.12.0") androidTestImplementation("androidx.test:runner:1.5.2") androidTestImplementation("androidx.test:rules:1.5.0") diff --git a/libs/test/SmartStoreTest/src/com/salesforce/androidsdk/smartstore/store/SmartStoreTest.java b/libs/test/SmartStoreTest/src/com/salesforce/androidsdk/smartstore/store/SmartStoreTest.java index be229d5d74..86d8227fa7 100644 --- a/libs/test/SmartStoreTest/src/com/salesforce/androidsdk/smartstore/store/SmartStoreTest.java +++ b/libs/test/SmartStoreTest/src/com/salesforce/androidsdk/smartstore/store/SmartStoreTest.java @@ -116,7 +116,7 @@ public void testRuntimeSettings() { */ @Test public void testSQLCipherVersion() { - Assert.assertEquals("Wrong sqlcipher version", "4.5.6 community", store.getSQLCipherVersion()); + Assert.assertEquals("Wrong sqlcipher version", "4.5.7 community", store.getSQLCipherVersion()); } /** From 3eda87b1f420853b6b7b72b8bce212d2f0eb554b Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Fri, 3 May 2024 17:12:19 -0700 Subject: [PATCH 8/9] Running tests in dependant libraries --- .circleci/gitChangedLibs.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/gitChangedLibs.rb b/.circleci/gitChangedLibs.rb index 17016fe3eb..69a770f293 100644 --- a/.circleci/gitChangedLibs.rb +++ b/.circleci/gitChangedLibs.rb @@ -19,9 +19,10 @@ for prfile in prfiles path = prfile["filename"] - for lib in libsTopoSorted - if path.include? lib - libsModified.add(lib) + libsTopoSorted.each do |lib| + if path.include?(lib) + libsModified.merge(libsTopoSorted[libsTopoSorted.index(lib)..]) + break end end end From 7a3ebf741a9c590c72359409e58acc97195f597e Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Mon, 6 May 2024 14:27:59 -0700 Subject: [PATCH 9/9] Allow Kotlin subclasses of SalesforceSDKManager to set themselves as the internal instance. --- .../com/salesforce/androidsdk/app/SalesforceSDKManager.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt index 3992f05d24..3f0b053cb7 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt @@ -1487,6 +1487,12 @@ open class SalesforceSDKManager protected constructor( @Suppress("NON_FINAL_MEMBER_IN_OBJECT") // This allows Java subtypes to override this property without an inspector warning open fun getInstance() = INSTANCE ?: throw RuntimeException("Apps must call SalesforceSDKManager.init() first.") + /** Allow Kotlin subclasses to set themselves as the instance. */ + @JvmSynthetic + fun setInstance(subclass: SalesforceSDKManager) { + INSTANCE = subclass + } + /** * Indicates if a Salesforce SDK manager instance is initialized. * @return true if SalesforceSDKManager has been initialized already