From 62716d7257aa84d7a980ac3bf62ecfbf2f22e463 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Thu, 15 Aug 2024 13:38:46 -0700 Subject: [PATCH 1/6] Updating version numbers to 12.2.0 --- README.md | 2 +- build.gradle.kts | 2 +- external/shared | 2 +- libs/MobileSync/AndroidManifest.xml | 4 ++-- libs/MobileSync/build.gradle.kts | 2 +- libs/SalesforceAnalytics/AndroidManifest.xml | 4 ++-- libs/SalesforceAnalytics/build.gradle.kts | 2 +- libs/SalesforceHybrid/AndroidManifest.xml | 4 ++-- libs/SalesforceHybrid/build.gradle.kts | 2 +- libs/SalesforceHybrid/res/xml/config.xml | 2 +- libs/SalesforceReact/AndroidManifest.xml | 4 ++-- libs/SalesforceReact/build.gradle.kts | 2 +- libs/SalesforceReact/package.json | 4 ++-- libs/SalesforceSDK/AndroidManifest.xml | 4 ++-- libs/SalesforceSDK/build.gradle.kts | 2 +- .../src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt | 2 +- libs/SmartStore/AndroidManifest.xml | 4 ++-- libs/SmartStore/build.gradle.kts | 2 +- libs/test/SalesforceHybridTest/res/xml/config.xml | 2 +- package.json | 2 +- tools/generate_doc.sh | 2 +- 21 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 4143e7ce85..bbf028aa73 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This pulls submodule dependencies from github. Introduction == -### What's New in 12.1.0 +### What's New in 12.2.0 See [release notes](https://github.com/forcedotcom/SalesforceMobileSDK-Android/releases). ### Native Applications diff --git a/build.gradle.kts b/build.gradle.kts index 3d3cede7c0..36a3db0137 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ buildscript { allprojects { group = "com.salesforce.mobilesdk" - version = "12.1.0" + version = "12.2.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/external/shared b/external/shared index 19422b09e4..603a4305b2 160000 --- a/external/shared +++ b/external/shared @@ -1 +1 @@ -Subproject commit 19422b09e44bd017c388c778bbbd994648dab038 +Subproject commit 603a4305b25e7552b97965a7ed58dd2623c709ea diff --git a/libs/MobileSync/AndroidManifest.xml b/libs/MobileSync/AndroidManifest.xml index 020d06642f..f7961bfed5 100644 --- a/libs/MobileSync/AndroidManifest.xml +++ b/libs/MobileSync/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="86" + android:versionName="12.2.0.dev"> diff --git a/libs/MobileSync/build.gradle.kts b/libs/MobileSync/build.gradle.kts index 35e32a76e7..b1a0088209 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.1.0" +rootProject.ext["PUBLISH_VERSION"] = "12.2.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "MobileSync" plugins { diff --git a/libs/SalesforceAnalytics/AndroidManifest.xml b/libs/SalesforceAnalytics/AndroidManifest.xml index 89593a324c..2a407a24ac 100644 --- a/libs/SalesforceAnalytics/AndroidManifest.xml +++ b/libs/SalesforceAnalytics/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="86" + android:versionName="12.2.0.dev"> diff --git a/libs/SalesforceAnalytics/build.gradle.kts b/libs/SalesforceAnalytics/build.gradle.kts index cabb6817b4..2d714e6e0b 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.1.0" +rootProject.ext["PUBLISH_VERSION"] = "12.2.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceAnalytics" plugins { diff --git a/libs/SalesforceHybrid/AndroidManifest.xml b/libs/SalesforceHybrid/AndroidManifest.xml index b68978fbca..b0941a435c 100644 --- a/libs/SalesforceHybrid/AndroidManifest.xml +++ b/libs/SalesforceHybrid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="86" + android:versionName="12.2.0.dev"> + version = "12.2.0"> diff --git a/libs/SalesforceReact/AndroidManifest.xml b/libs/SalesforceReact/AndroidManifest.xml index d4fdb5a8fa..7e0edb8d91 100644 --- a/libs/SalesforceReact/AndroidManifest.xml +++ b/libs/SalesforceReact/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="86" + android:versionName="12.2.0.dev"> + android:versionCode="86" + android:versionName="12.2.0.dev"> diff --git a/libs/SalesforceSDK/build.gradle.kts b/libs/SalesforceSDK/build.gradle.kts index 02623bd30b..4c96e33d57 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.1.0" +rootProject.ext["PUBLISH_VERSION"] = "12.2.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SalesforceSDK" plugins { diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt index ed92c80abf..a171762c23 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt @@ -1514,7 +1514,7 @@ open class SalesforceSDKManager protected constructor( protected var INSTANCE: SalesforceSDKManager? = null /** The current version of this SDK */ - const val SDK_VERSION = "12.1.0" + const val SDK_VERSION = "12.2.0.dev" /** * An intent action meant for instances of Salesforce SDK manager diff --git a/libs/SmartStore/AndroidManifest.xml b/libs/SmartStore/AndroidManifest.xml index 85060d7eed..10514b5256 100644 --- a/libs/SmartStore/AndroidManifest.xml +++ b/libs/SmartStore/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="86" + android:versionName="12.2.0.dev"> diff --git a/libs/SmartStore/build.gradle.kts b/libs/SmartStore/build.gradle.kts index 614640c80c..0625acc505 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.1.0" +rootProject.ext["PUBLISH_VERSION"] = "12.2.0" rootProject.ext["PUBLISH_ARTIFACT_ID"] = "SmartStore" plugins { diff --git a/libs/test/SalesforceHybridTest/res/xml/config.xml b/libs/test/SalesforceHybridTest/res/xml/config.xml index 690d3ceeca..2b449875ed 100644 --- a/libs/test/SalesforceHybridTest/res/xml/config.xml +++ b/libs/test/SalesforceHybridTest/res/xml/config.xml @@ -1,7 +1,7 @@ + version = "12.2.0"> diff --git a/package.json b/package.json index a8eda9c744..b7f666aa68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SalesforceMobileSDK-Android", - "version": "12.1.0", + "version": "12.2.0", "description": "Salesforce Mobile SDK for Android", "keywords": [ "mobilesdk", diff --git a/tools/generate_doc.sh b/tools/generate_doc.sh index 6936fd2069..b04c4e1df4 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.1 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.2 API" -sourcepath "libs/SalesforceAnalytics/src:libs/SalesforceSDK/src:libs/SmartStore/src:libs/MobileSync/src:libs/SalesforceHybrid/src:libs/SalesforceReact/src" -subpackages com fi From 9ee755b795f92a99026065dde6c9af0766bb7611 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Fri, 23 Aug 2024 14:49:46 -0700 Subject: [PATCH 2/6] Move to SQLCipher 4.6.1 --- 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 0625acc505..31fa3352e1 100644 --- a/libs/SmartStore/build.gradle.kts +++ b/libs/SmartStore/build.gradle.kts @@ -15,7 +15,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.6.0") + api("net.zetetic:sqlcipher-android:4.6.1") implementation("androidx.core:core-ktx:1.13.1") androidTestImplementation("androidx.test:runner:1.6.0") androidTestImplementation("androidx.test:rules:1.6.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 9762288605..a8b9b9fdea 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.6.0 community", store.getSQLCipherVersion()); + Assert.assertEquals("Wrong sqlcipher version", "4.6.1 community", store.getSQLCipherVersion()); } /** From b3cd88d5c8969a849bf91ae53c9d7ed5548122ac Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Mon, 26 Aug 2024 11:04:00 -0700 Subject: [PATCH 3/6] Revert change that retained okHttpBuilder. --- .../androidsdk/auth/HttpAccess.java | 35 +++++++------------ .../androidsdk/rest/RestClient.java | 8 ++--- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java index e50b435e66..6f73b32da7 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java @@ -58,8 +58,6 @@ public class HttpAccess { private String userAgent; private OkHttpClient okHttpClient; - private OkHttpClient.Builder okHttpBuilder; - private OkHttpClient.Builder unauthenticatedOkHttpBuilder; // Connection manager. private final ConnectivityManager conMgr; @@ -102,24 +100,26 @@ public HttpAccess(Context app, String userAgent) { * and user agent interceptor for an authenticated client. */ public OkHttpClient.Builder getOkHttpClientBuilder() { - if (okHttpBuilder == null) { - okHttpBuilder = createNewClientBuilder(); - } - - return okHttpBuilder; + ConnectionSpec connectionSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) + .tlsVersions(TlsVersion.TLS_1_1, TlsVersion.TLS_1_2) + .build(); + return new OkHttpClient.Builder() + .connectionSpecs(Collections.singletonList(connectionSpec)) + .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS) + .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS) + .addNetworkInterceptor(new UserAgentInterceptor()); } /** * * @return okHttpClient.Builder with appropriate connection spec * and user agent interceptor for an unauthenticated client. + * + * @deprecated To be removed in 14.0. Please use {{@link #getOkHttpClientBuilder()}} instead. */ + @Deprecated public OkHttpClient.Builder getUnauthenticatedOkHttpBuilder() { - if (unauthenticatedOkHttpBuilder == null) { - unauthenticatedOkHttpBuilder = createNewClientBuilder(); - } - - return unauthenticatedOkHttpBuilder; + return getOkHttpClientBuilder(); } /** @@ -158,17 +158,6 @@ public String getUserAgent() { return userAgent; } - private OkHttpClient.Builder createNewClientBuilder() { - ConnectionSpec connectionSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) - .tlsVersions(TlsVersion.TLS_1_1, TlsVersion.TLS_1_2) - .build(); - return new OkHttpClient.Builder() - .connectionSpecs(Collections.singletonList(connectionSpec)) - .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS) - .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS) - .addNetworkInterceptor(new UserAgentInterceptor()); - } - /** * Exception thrown if the device is offline, during an attempted HTTP call. */ diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java index 53003a6fa4..5e325ca66c 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java @@ -204,11 +204,9 @@ private synchronized void setOkHttpClientBuilder() { // If none cached, create new one if (okHttpClientBuilder == null) { - if (cacheKey.equals("unauthenticated")) { - okHttpClientBuilder = httpAccessor.getUnauthenticatedOkHttpBuilder(); - } else { - okHttpClientBuilder = httpAccessor.getOkHttpClientBuilder() - .addInterceptor(getOAuthRefreshInterceptor()); + okHttpClientBuilder = httpAccessor.getOkHttpClientBuilder(); + if (!cacheKey.equals("unauthenticated")) { + okHttpClientBuilder.addInterceptor(getOAuthRefreshInterceptor()); } OK_CLIENT_BUILDERS.put(getCacheKey(), okHttpClientBuilder); From 190e53b617ea15a1bfb0def099a40febc2869edd Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Mon, 26 Aug 2024 11:36:09 -0700 Subject: [PATCH 4/6] Bump lifecycle to fix compose issue. --- libs/SalesforceSDK/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/SalesforceSDK/build.gradle.kts b/libs/SalesforceSDK/build.gradle.kts index 4c96e33d57..8bf7e65fb0 100644 --- a/libs/SalesforceSDK/build.gradle.kts +++ b/libs/SalesforceSDK/build.gradle.kts @@ -22,7 +22,7 @@ dependencies { implementation("androidx.biometric:biometric:1.2.0-alpha05") implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4") implementation("androidx.window:window:1.3.0") implementation("androidx.window:window-core:1.3.0") androidTestImplementation("androidx.test:runner:1.6.0") From 62cfd23340e34628bbc215024e0f5021a2cc407d Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Mon, 26 Aug 2024 13:56:56 -0700 Subject: [PATCH 5/6] Deprecate getOkHttpClientBuilder and make createNewClientBuilder public. --- .../androidsdk/auth/HttpAccess.java | 35 +++++++++++++------ .../androidsdk/rest/RestClient.java | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java index 6f73b32da7..6b0b70dc98 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java @@ -98,16 +98,12 @@ public HttpAccess(Context app, String userAgent) { * * @return okHttpClient.Builder with appropriate connection spec * and user agent interceptor for an authenticated client. + * + * @deprecated To be removed in 14.0. Please use {@link #createNewClientBuilder()} instead. */ + @Deprecated public OkHttpClient.Builder getOkHttpClientBuilder() { - ConnectionSpec connectionSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) - .tlsVersions(TlsVersion.TLS_1_1, TlsVersion.TLS_1_2) - .build(); - return new OkHttpClient.Builder() - .connectionSpecs(Collections.singletonList(connectionSpec)) - .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS) - .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS) - .addNetworkInterceptor(new UserAgentInterceptor()); + return createNewClientBuilder(); } /** @@ -115,11 +111,28 @@ public OkHttpClient.Builder getOkHttpClientBuilder() { * @return okHttpClient.Builder with appropriate connection spec * and user agent interceptor for an unauthenticated client. * - * @deprecated To be removed in 14.0. Please use {{@link #getOkHttpClientBuilder()}} instead. + * @deprecated To be removed in 14.0. Please use {@link #createNewClientBuilder()} instead. */ @Deprecated public OkHttpClient.Builder getUnauthenticatedOkHttpBuilder() { - return getOkHttpClientBuilder(); + return createNewClientBuilder(); + } + + /** + * Creates a new OkHttp Client Builder with appropriate connection spec + * and user agent interceptor. + * + * @return the okHttpClient.Builder + */ + public OkHttpClient.Builder createNewClientBuilder() { + ConnectionSpec connectionSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) + .tlsVersions(TlsVersion.TLS_1_1, TlsVersion.TLS_1_2) + .build(); + return new OkHttpClient.Builder() + .connectionSpecs(Collections.singletonList(connectionSpec)) + .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS) + .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS) + .addNetworkInterceptor(new UserAgentInterceptor()); } /** @@ -128,7 +141,7 @@ public OkHttpClient.Builder getUnauthenticatedOkHttpBuilder() { */ public synchronized OkHttpClient getOkHttpClient() { if (okHttpClient == null) { - okHttpClient = getOkHttpClientBuilder().build(); + okHttpClient = createNewClientBuilder().build(); } return okHttpClient; } diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java index 5e325ca66c..dfb0f8d7e3 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestClient.java @@ -204,7 +204,7 @@ private synchronized void setOkHttpClientBuilder() { // If none cached, create new one if (okHttpClientBuilder == null) { - okHttpClientBuilder = httpAccessor.getOkHttpClientBuilder(); + okHttpClientBuilder = httpAccessor.createNewClientBuilder(); if (!cacheKey.equals("unauthenticated")) { okHttpClientBuilder.addInterceptor(getOAuthRefreshInterceptor()); } From d6ab20c15af584d4de764803e52498af9ae281fc Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Wed, 28 Aug 2024 20:05:27 -0700 Subject: [PATCH 6/6] Make sure to recreate dev actions for dev menu if front activity changes --- .../restexplorer/ExplorerActivity.java | 12 ---- .../restexplorer/LogoutDialogFragment.java | 61 ------------------- .../samples/restexplorer/RestExplorerApp.java | 12 ++-- 3 files changed, 7 insertions(+), 78 deletions(-) delete mode 100644 native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/LogoutDialogFragment.java diff --git a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/ExplorerActivity.java b/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/ExplorerActivity.java index 074612dab6..08d4551de5 100644 --- a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/ExplorerActivity.java +++ b/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/ExplorerActivity.java @@ -85,7 +85,6 @@ public class ExplorerActivity extends SalesforceActivity { private RestClient client; private TextView resultText; private TabHost tabHost; - private LogoutDialogFragment logoutConfirmationDialog; // Use for objectId fields auto-complete. private TreeSet knownIds = new TreeSet(); @@ -129,8 +128,6 @@ protected void onCreate(Bundle savedInstanceState) { // Makes the result area scrollable. resultText = (TextView) findViewById(R.id.result_text); resultText.setMovementMethod(new ScrollingMovementMethod()); - logoutConfirmationDialog = new LogoutDialogFragment(); - ((RestExplorerApp.RestExplorerSDKManager) RestExplorerApp.RestExplorerSDKManager.getInstance()) .addDevAction(this, "Export Credentials to Clipboard", this::exportCredentials); } @@ -140,15 +137,6 @@ public void onResume(RestClient client) { this.client = client; } - /** - * Returns the logout dialog fragment (used mainly by tests). - * - * @return Logout dialog fragment. - */ - public LogoutDialogFragment getLogoutConfirmationDialog() { - return logoutConfirmationDialog; - } - private void addTab(String tag, int titleId, int tabId) { tabHost.addTab(tabHost.newTabSpec(tag).setIndicator(getString(titleId)) .setContent(tabId)); diff --git a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/LogoutDialogFragment.java b/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/LogoutDialogFragment.java deleted file mode 100644 index 0c21278903..0000000000 --- a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/LogoutDialogFragment.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014-present, salesforce.com, inc. - * All rights reserved. - * Redistribution and use of this software in source and binary forms, with or - * without modification, are permitted provided that the following conditions - * are met: - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of salesforce.com, inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission of salesforce.com, inc. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -package com.salesforce.samples.restexplorer; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; - -import com.salesforce.androidsdk.app.SalesforceSDKManager; -import com.salesforce.androidsdk.auth.OAuth2; - -/** - * A simple dialog fragment to provide options at logout. - */ -public class LogoutDialogFragment extends DialogFragment { - - /** - * Default constructor. - */ - public LogoutDialogFragment() { - } - - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - return new AlertDialog.Builder(getActivity()) - .setTitle(R.string.logout_title) - .setPositiveButton(R.string.logout_yes, - (dialog, which) -> SalesforceSDKManager.getInstance() - .logout(null, getActivity(), true, OAuth2.LogoutReason.USER_LOGOUT)) - .setNegativeButton(R.string.logout_cancel, null) - .create(); - } -} diff --git a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/RestExplorerApp.java b/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/RestExplorerApp.java index 5bdc24f8a1..10627bd633 100644 --- a/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/RestExplorerApp.java +++ b/native/NativeSampleApps/RestExplorer/src/com/salesforce/samples/restexplorer/RestExplorerApp.java @@ -74,6 +74,7 @@ public void onCreate() { } static class RestExplorerSDKManager extends SalesforceSDKManager { + Activity frontActivityForDevActions; Map devActions; /** @@ -109,6 +110,11 @@ public static void initNative( public Map getDevActions( @NonNull Activity frontActivity ) { + if (frontActivityForDevActions != frontActivity) { + devActions = null; + frontActivityForDevActions = frontActivity; + } + if (devActions == null) { devActions = super.getDevActions(frontActivity); } @@ -117,11 +123,7 @@ public Map getDevActions( } public void addDevAction(Activity frontActivity, String name, DevActionHandler handler) { - if (devActions == null) { - devActions = super.getDevActions(frontActivity); - } - - devActions.put(name, handler); + getDevActions(frontActivity).put(name, handler); } } }