Skip to content

Commit

Permalink
Merging dev into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wmathurin committed Aug 31, 2023
2 parents 1d7c550 + 702159b commit 66beb12
Show file tree
Hide file tree
Showing 43 changed files with 328 additions and 106 deletions.
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aliases:
# Docker image tags can be found here: https://circleci.com/developer/images/image/cimg/android
- &cimg cimg/android:2022.09.2-node
- &cimg cimg/android:2023.06.1-node
# Most used according to https://gs.statcounter.com/android-version-market-share/mobile-tablet/worldwide
- &default-api-level 30

Expand Down Expand Up @@ -48,7 +48,7 @@ aliases:
command: |
sudo npm i npm@latest -g
sudo npm install -g [email protected]
sudo npm install -g cordova@8.1.2
sudo npm install -g cordova@12.0.0
sudo npm install -g typescript
cordova telemetry off
./install.sh
Expand Down Expand Up @@ -374,9 +374,11 @@ workflows:
pattern: "^pull/\\d+$"
value: << pipeline.git.branch >>
jobs:
- static-analysis
- static-analysis:
context: Android Unit Tests
- run-tests:
name: << matrix.lib >>
context: Android Unit Tests
matrix:
parameters:
lib: ["SalesforceAnalytics", "SalesforceSDK", "SmartStore", "MobileSync", "SalesforceHybrid", "SalesforceReact"]
Expand All @@ -401,12 +403,14 @@ workflows:
jobs:
- run-tests:
name: << matrix.lib >> API << pipeline.parameters.api-level >>
context: Android Unit Tests
matrix:
parameters:
lib: ["SalesforceAnalytics", "SalesforceSDK", "SmartStore", "MobileSync", "SalesforceHybrid", "SalesforceReact"]
api_level: [<< pipeline.parameters.api-level >>]
- test-rest-explorer:
name: RestExplorer API << pipeline.parameters.api-level >>
context: Android Unit Tests
matrix:
parameters:
api_level: [<< pipeline.parameters.api-level >>]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This pulls submodule dependencies from github.
Introduction
==

### What's New in 11.0.0
### What's New in 11.1.0
See [release notes](https://github.com/forcedotcom/SalesforceMobileSDK-Android/releases).

### Native Applications
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {

allprojects {
group = 'com.salesforce.mobilesdk'
version = '11.0.0'
version = '11.1.0'
repositories {
mavenLocal()
maven {
Expand Down
2 changes: 1 addition & 1 deletion external/shared
Submodule shared updated 34 files
+1 −1 gen/cordova_plugins.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.mobilesync.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.network.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.oauth.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.sdkinfo.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.sfaccountmanager.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.smartstore.client.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.plugin.smartstore.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.bootstrap.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.event.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.exec.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.logger.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.promiser.js
+1 −1 gen/plugins/com.salesforce/com.salesforce.util.push.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.mobilesync.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.network.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.oauth.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.sdkinfo.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.sfaccountmanager.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.smartstore.client.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.plugin.smartstore.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.bootstrap.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.event.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.exec.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.logger.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.promiser.js
+1 −1 gen/plugins_with_define/com.salesforce/com.salesforce.util.push.js
+1 −1 libs/cordova.force.js
+1 −1 package.json
+1 −1 test/MockSDKInfo.js
+1 −1 test/SFSDKInfoTestSuite.js
+1 −1 test/SFTestRunnerPlugin.js
+1 −1 tools/bower.json
+1 −1 tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ContentSoqlSyncDownTarget(JSONObject target) throws JSONException {
@Override
public JSONArray startFetch(SyncManager syncManager, long maxTimeStamp) throws IOException, JSONException {
String queryToRun = maxTimeStamp > 0 ? SoqlSyncDownTarget.addFilterForReSync(getQuery(maxTimeStamp), getModificationDateFieldName(), maxTimeStamp) : getQuery(maxTimeStamp);
syncManager.getRestClient().sendSync(RestRequest.getRequestForUserInfo()); // cheap call to refresh session
syncManager.getRestClient().sendSync(RestRequest.getRequestForLimits(ApiVersionStrings.VERSION_NUMBER)); // cheap call to refresh session
RestRequest request = buildQueryRequest(syncManager.getRestClient().getAuthToken(), queryToRun);
RestResponse response = syncManager.sendSyncWithMobileSyncUserAgent(request);
JSONArray records = parseSoapResponse(response);
Expand Down
4 changes: 2 additions & 2 deletions libs/MobileSync/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="80"
android:versionName="11.0.0">
android:versionCode="81"
android:versionName="11.1.0.dev">

<application />

Expand Down
2 changes: 1 addition & 1 deletion libs/MobileSync/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ android {

ext {
PUBLISH_GROUP_ID = 'com.salesforce.mobilesdk'
PUBLISH_VERSION = '11.0.0'
PUBLISH_VERSION = '11.1.0'
PUBLISH_ARTIFACT_ID = 'MobileSync'
}

Expand Down
4 changes: 2 additions & 2 deletions libs/SalesforceAnalytics/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="80"
android:versionName="11.0.0">
android:versionCode="81"
android:versionName="11.1.0.dev">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
2 changes: 1 addition & 1 deletion libs/SalesforceAnalytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ android {

ext {
PUBLISH_GROUP_ID = 'com.salesforce.mobilesdk'
PUBLISH_VERSION = '11.0.0'
PUBLISH_VERSION = '11.1.0'
PUBLISH_ARTIFACT_ID = 'SalesforceAnalytics'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
Expand All @@ -60,7 +59,6 @@ public class Encryptor {
private static final String AES_CBC_CIPHER = "AES/CBC/PKCS5Padding";
private static final String AES_GCM_CIPHER = "AES/GCM/NoPadding";
private static final String MAC_TRANSFORMATION = "HmacSHA256";
private static final String SHA1PRNG = "SHA1PRNG";
private static final String RSA_PKCS1 = "RSA/ECB/PKCS1Padding";
private static final String BOUNCY_CASTLE = "BC";
private static final int READ_BUFFER_LENGTH = 1024;
Expand All @@ -72,7 +70,7 @@ public class Encryptor {
* @return Initialized cipher.
*/
public static Cipher getEncryptingCipher(String encryptionKey)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException {
throws InvalidAlgorithmParameterException, InvalidKeyException {
final byte[] keyBytes = Base64.decode(encryptionKey, Base64.DEFAULT);
return getEncryptingCipher(keyBytes, generateInitVector());
}
Expand Down Expand Up @@ -534,8 +532,9 @@ private static byte[] decryptWithPrivateKey(PrivateKey privateKey, String data,
return null;
}

private static byte[] generateInitVector() throws NoSuchAlgorithmException {
final SecureRandom random = SecureRandom.getInstance(SHA1PRNG);
private static byte[] generateInitVector() {
// Create the system recommended secure random number generator provider algorithm.
final SecureRandom random = new SecureRandom();
byte[] iv = new byte[12];
random.nextBytes(iv);
return iv;
Expand Down
4 changes: 2 additions & 2 deletions libs/SalesforceHybrid/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="80"
android:versionName="11.0.0">
android:versionCode="81"
android:versionName="11.1.0.dev">

<application />
</manifest>
2 changes: 1 addition & 1 deletion libs/SalesforceHybrid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ android {

ext {
PUBLISH_GROUP_ID = 'com.salesforce.mobilesdk'
PUBLISH_VERSION = '11.0.0'
PUBLISH_VERSION = '11.1.0'
PUBLISH_ARTIFACT_ID = 'SalesforceHybrid'
}

Expand Down
2 changes: 1 addition & 1 deletion libs/SalesforceHybrid/res/xml/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "com.salesforce.androidsdk"
version = "11.0.0">
version = "11.1.0">

<content src="index.html" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.salesforce.androidsdk.config.LoginServerManager;
import com.salesforce.androidsdk.phonegap.app.SalesforceHybridSDKManager;
import com.salesforce.androidsdk.phonegap.util.SalesforceHybridLogger;
import com.salesforce.androidsdk.rest.ApiVersionStrings;
import com.salesforce.androidsdk.rest.ClientManager;
import com.salesforce.androidsdk.rest.ClientManager.AccountInfoNotFoundException;
import com.salesforce.androidsdk.rest.ClientManager.RestClientCallback;
Expand Down Expand Up @@ -349,7 +350,7 @@ public void authenticatedRestClient(RestClient client) {
* but a stale session ID will cause the WebView to redirect
* to the web login.
*/
SalesforceDroidGapActivity.this.client.sendAsync(RestRequest.getRequestForUserInfo(), new AsyncRequestCallback() {
SalesforceDroidGapActivity.this.client.sendAsync(RestRequest.getRequestForLimits(ApiVersionStrings.VERSION_NUMBER), new AsyncRequestCallback() {

@Override
public void onSuccess(RestRequest request, RestResponse response) {
Expand Down Expand Up @@ -422,7 +423,7 @@ public void authenticatedRestClient(RestClient client) {
});
return;
}
client.sendAsync(RestRequest.getRequestForUserInfo(), new AsyncRequestCallback() {
client.sendAsync(RestRequest.getRequestForLimits(ApiVersionStrings.VERSION_NUMBER), new AsyncRequestCallback() {

@Override
public void onSuccess(RestRequest request, RestResponse response) {
Expand Down
4 changes: 2 additions & 2 deletions libs/SalesforceReact/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="80"
android:versionName="11.0.0">
android:versionCode="81"
android:versionName="11.1.0.dev">

<application />
</manifest>
2 changes: 1 addition & 1 deletion libs/SalesforceReact/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ afterEvaluate {

ext {
PUBLISH_GROUP_ID = 'com.salesforce.mobilesdk'
PUBLISH_VERSION = '11.0.0'
PUBLISH_VERSION = '11.1.0'
PUBLISH_ARTIFACT_ID = 'SalesforceReact'
}

Expand Down
4 changes: 2 additions & 2 deletions libs/SalesforceReact/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SalesforceReact",
"version": "11.0.0",
"version": "11.1.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
Expand All @@ -9,7 +9,7 @@
"create-react-class": "^15.7.0",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-force": "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative.git#v11.0.0"
"react-native-force": "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative.git#dev"
},
"devDependencies": {
"@babel/core": "^7.12.9",
Expand Down
4 changes: 2 additions & 2 deletions libs/SalesforceSDK/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="80"
android:versionName="11.0.0">
android:versionCode="81"
android:versionName="11.1.0.dev">

<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Expand Down
2 changes: 1 addition & 1 deletion libs/SalesforceSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ android {

ext {
PUBLISH_GROUP_ID = 'com.salesforce.mobilesdk'
PUBLISH_VERSION = '11.0.0'
PUBLISH_VERSION = '11.1.0'
PUBLISH_ARTIFACT_ID = 'SalesforceSDK'
}

Expand Down
11 changes: 6 additions & 5 deletions libs/SalesforceSDK/res/values/sf__strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<string name="sf__pick_server">Change Server</string>
<string name="sf__clear_cookies">Clear Cookies</string>
<string name="sf__reload">Reload</string>
<string name="sf__launch_idp">Login with IDP App</string>
<string name="sf__login_with_biometric">Login with Biometric</string>
<string name="sf__launch_idp">Log In with IDP App</string>
<string name="sf__login_with_biometric">Log In with Biometric</string>
<string name="sf__setup_biometric_unlock">Setup Biometric Unlock</string>

<!-- Server picker -->
Expand All @@ -50,19 +50,20 @@
<string name="sf__account_selector_text">Select an account to use</string>

<!-- SP status updates -->
<string name="sf__failed_to_send_request_to_idp">Failed to send request to IDP app</string>
<string name="sf__login_request_sent_to_idp">Login request sent to IDP app</string>
<string name="sf__auth_code_received_from_idp">IDP app successfully obtained authorization code</string>
<string name="sf__error_received_from_idp">IDP app failed to obtain authorization code</string>
<string name="sf__failed_to_exchange_authorization_code">Failed to exchange authorization code</string>
<string name="sf__login_complete">Login complete</string>
<string name="sf__login_complete">Log in complete</string>

<!-- IDP status updates -->
<string name="sf__login_request_sent_to_sp">Login request sent to SP app</string>
<string name="sf__getting_auth_code_from_server">Getting authorization code for SP app</string>
<string name="sf__failed_to_get_authorization_code">Failed to get authorization code for SP app</string>
<string name="sf__auth_code_sent_to_sp">Authorization code sent to SP app</string>
<string name="sf__error_received_from_sp">SP app failed to exchange authorization code</string>
<string name="sf__sp_login_complete">SP app login complete</string>
<string name="sf__sp_login_complete">SP app log in complete</string>

<!-- Managed app restrictions -->
<string name="sf__app_service_hosts_description">Used to specify login hosts for the application.</string>
Expand Down Expand Up @@ -90,7 +91,7 @@

<!-- Biometric Authentication Opt In Dialog -->
<string name="sf__biometric_opt_in_title">Biometric Login</string>
<string name="sf__biometric_opt_in_message">Use your fingerprint to quickly login. Biometric information is never stored.</string>
<string name="sf__biometric_opt_in_message">Use your fingerprint to quickly log in. Biometric information is never stored.</string>
<string name="sf__biometric_opt_in_approve">Enable</string>
<string name="sf__biometric_opt_in_deny">Use Password</string>
<string name="sf__biometric_signout_user">Signing out %s.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import android.webkit.CookieManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
Expand Down Expand Up @@ -100,6 +101,7 @@
import java.util.SortedSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.regex.Pattern;

/**
* This class serves as an interface to the various
Expand All @@ -114,7 +116,7 @@ public class SalesforceSDKManager implements LifecycleObserver {
/**
* Current version of this SDK.
*/
public static final String SDK_VERSION = "11.0.0";
public static final String SDK_VERSION = "11.1.0.dev";

/**
* Intent action meant for instances of SalesforceSDKManager residing in other processes
Expand Down Expand Up @@ -181,6 +183,9 @@ public class SalesforceSDKManager implements LifecycleObserver {
private boolean useWebServerAuthentication = true; // web server flow ON by default - but app can opt out by calling setUseWebServerAuthentication(false)

private boolean useHybridAuthentication = true; // hybrid authentication flows ON by default - but app can opt out by calling setUseHybridAuthentication(false)

private Pattern customDomainInferencePattern;

private Theme theme = Theme.SYSTEM_DEFAULT;
private String appName;

Expand Down Expand Up @@ -672,6 +677,28 @@ public synchronized void setUseHybridAuthentication(boolean useHybridAuthenticat
this.useHybridAuthentication = useHybridAuthentication;
}

/**
* Returns the pattern used to detect the use of "Use Custom Domain" input from login web view.
*
* @return pattern if set or null
*/
public synchronized Pattern getCustomDomainInferencePattern() {
return customDomainInferencePattern;
}

/**
* Detect use of "Use Custom Domain" input from login web view using the given regex.
* Example for a specific org:
* "^https:\\/\\/mobilesdk\\.my\\.salesforce\\.com\\/\\?startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage\\.apexp"
* For any my domain:
* "^https:\\/\\/[a-zA-Z0-9]+\\.my\\.salesforce\\.com/\\?startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage\\.apexp"
*
* @param pattern regex to use when detecting use of custom domain on login
*/
public synchronized void setCustomDomainInferencePattern(@Nullable Pattern pattern) {
this.customDomainInferencePattern = pattern;
}

/**
* Returns whether the IDP login flow is enabled.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.salesforce.androidsdk.app.SalesforceSDKManager
import com.salesforce.androidsdk.auth.OAuth2.getAuthorizationUrl
import com.salesforce.androidsdk.auth.OAuth2.getFrontdoorUrl
import com.salesforce.androidsdk.config.BootConfig
import com.salesforce.androidsdk.rest.ApiVersionStrings
import com.salesforce.androidsdk.rest.ClientManager
import com.salesforce.androidsdk.rest.RestClient
import com.salesforce.androidsdk.rest.RestRequest
Expand Down Expand Up @@ -119,7 +120,7 @@ internal class IDPAuthCodeHelper private constructor(
SalesforceSDKLogger.d(TAG, "Obtaining valid access token")
buildRestClient()?.let {restClient ->
val restResponse = try {
restClient.sendSync(RestRequest.getRequestForUserInfo())
restClient.sendSync(RestRequest.getRequestForLimits(ApiVersionStrings.VERSION_NUMBER))
} catch (e: IOException) {
SalesforceSDKLogger.e(TAG, "Failed to obtain valid access token", e)
null
Expand Down
Loading

0 comments on commit 66beb12

Please sign in to comment.