Skip to content

Commit cce98dc

Browse files
committed
2 parents a4dba19 + 1e647db commit cce98dc

15 files changed

Lines changed: 92 additions & 46 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ yarn.lock
2121
index.android.bundle*
2222
shared/test/test_credentials.json
2323
shared/test/ui_test_config.json
24+
**/bootconfig.xml
25+
!libs/test/**/bootconfig.xml
2426
native/NativeSampleApps/AuthFlowTester/src/main/assets/
2527
.vscode/

install.sh

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/bin/bash
2-
# Running this script will install all dependencies needed for all of the projects
2+
# Running this script will install all dependencies needed for all of the projects
3+
4+
# Run from repo root so relative paths work regardless of invocation directory
5+
cd "$(dirname "$0")"
36

47
# ensure that we have the correct version of all submodules
58
git submodule init
69
git submodule sync
710
git submodule update
811

12+
# Restore bootconfig.json in shared submodule to committed placeholders
13+
git -C external/shared checkout -- samples/mobilesyncexplorer/bootconfig.json samples/accounteditor/bootconfig.json 2>/dev/null || true
914

1015
# get react native
1116
pushd "libs/SalesforceReact"
@@ -14,3 +19,53 @@ rm yarn.lock
1419
yarn install
1520
./node_modules/.bin/react-native bundle --platform android --dev true --entry-file node_modules/react-native-force/test/alltests.js --bundle-output ../test/SalesforceReactTest/assets/index.android.bundle --assets-dest ../test/SalesforceReactTest/assets/
1621
popd
22+
23+
# Apply bootconfig placeholder substitution. Usage:
24+
# apply_bootconfig_paths [sample_file] path1 path2 ...
25+
# First arg is sample path (or empty for no sample). If sample is set, copy sample over each path (overwriting if present).
26+
# Then substitute env vars.
27+
apply_bootconfig_paths() {
28+
local sample_file=""
29+
[ -n "$1" ] && [ -f "$1" ] && sample_file="$1"
30+
shift
31+
while [ $# -gt 0 ]; do
32+
local bootconfig="$1"
33+
shift
34+
if [ -n "$sample_file" ]; then
35+
mkdir -p "$(dirname "$bootconfig")"
36+
cp "$sample_file" "$bootconfig"
37+
fi
38+
if [ -f "$bootconfig" ]; then
39+
# Substitute env vars if set
40+
if [ -n "${MSDK_ANDROID_REMOTE_ACCESS_CONSUMER_KEY:-}" ]; then
41+
gsed -i "s|__CONSUMER_KEY__|${MSDK_ANDROID_REMOTE_ACCESS_CONSUMER_KEY}|g" "$bootconfig"
42+
fi
43+
if [ -n "${MSDK_ANDROID_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
44+
gsed -i "s|__REDIRECT_URI__|${MSDK_ANDROID_REMOTE_ACCESS_CALLBACK_URL}|g" "$bootconfig"
45+
fi
46+
fi
47+
done
48+
}
49+
50+
BOOTCONFIG_SAMPLE="shared/bootconfig.xml.sample"
51+
BOOTCONFIG_XML_PATHS=(
52+
"libs/SalesforceSDK/res/values/bootconfig.xml"
53+
"native/NativeSampleApps/RestExplorer/res/values/bootconfig.xml"
54+
"native/NativeSampleApps/AuthFlowTester/src/main/res/values/bootconfig.xml"
55+
"native/NativeSampleApps/ConfiguredApp/res/values/bootconfig.xml"
56+
)
57+
BOOTCONFIG_JSON_PATHS=(
58+
"external/shared/samples/mobilesyncexplorer/bootconfig.json"
59+
"external/shared/samples/accounteditor/bootconfig.json"
60+
)
61+
62+
apply_bootconfig_paths "$BOOTCONFIG_SAMPLE" "${BOOTCONFIG_XML_PATHS[@]}"
63+
apply_bootconfig_paths "" "${BOOTCONFIG_JSON_PATHS[@]}"
64+
65+
if [ -z "${MSDK_ANDROID_REMOTE_ACCESS_CONSUMER_KEY:-}" ] || [ -z "${MSDK_ANDROID_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
66+
echo ""
67+
echo "Note: MSDK_ANDROID_REMOTE_ACCESS_CONSUMER_KEY and/or MSDK_ANDROID_REMOTE_ACCESS_CALLBACK_URL are not set."
68+
echo "To run the sample applications, define these environment variables or ensure bootconfig.xml"
69+
echo "files exist (created from shared/bootconfig.xml.sample) with remoteAccessConsumerKey and oauthRedirectURI set."
70+
echo ""
71+
fi

libs/SalesforceSDK/res/values/bootconfig.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKUpgradeManager.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,14 @@ private void updateFromBefore13_0_2() {
314314
PushMessaging.setReRegistrationRequested(true);
315315
}
316316

317-
/*
317+
/**
318318
* Migrate any accounts with account_type "com.salesforce.androidsdk" to a unique value.
319-
* TODO: Remove this in Mobile SDK 15.0
319+
*
320+
* @deprecated Will be removed in Mobile SDK 15.0.0.
320321
*/
321-
private void migrateAccountType() {
322+
@Deprecated
323+
@SuppressWarnings("DeprecatedIsStillUsed")
324+
public void migrateAccountType() {
322325
final String LEGACY_ACCOUNT_TYPE = "com.salesforce.androidsdk";
323326
if (SalesforceSDKManager.getInstance().getAccountType().equals(LEGACY_ACCOUNT_TYPE)) {
324327
SalesforceSDKLogger.e(TAG, "No app specific account type found. To ensure users " +

libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/LegacyAuthenticatorService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,11 @@
2626
*/
2727
package com.salesforce.androidsdk.auth;
2828

29-
class LegacyAuthenticatorService extends AuthenticatorService { }
29+
/**
30+
* Android requires service classes to be public. Do not use.
31+
*
32+
* @deprecated This class is used to migrate legacy accounts and will be removed in Mobile SDK 15.0.0.
33+
*/
34+
@Deprecated
35+
@SuppressWarnings("DeprecatedIsStillUsed")
36+
public final class LegacyAuthenticatorService extends AuthenticatorService { }

libs/test/SalesforceSDKTest/assets/www/bootconfig_absoluteStartPage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
3-
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
2+
"remoteAccessConsumerKey": "__CONSUMER_KEY__",
3+
"oauthRedirectURI": "__REDIRECT_URI__",
44
"oauthScopes": ["api","web"],
55
"isLocal": true,
66
"startPage": "https://www.salesforce.com/test.html",

libs/test/SalesforceSDKTest/assets/www/bootconfig_emptyOauthScopes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
3-
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
2+
"remoteAccessConsumerKey": "__CONSUMER_KEY__",
3+
"oauthRedirectURI": "__REDIRECT_URI__",
44
"oauthScopes": [],
55
"isLocal": true,
66
"startPage": "index.html",

libs/test/SalesforceSDKTest/assets/www/bootconfig_noOauthScopes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
3-
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
2+
"remoteAccessConsumerKey": "__CONSUMER_KEY__",
3+
"oauthRedirectURI": "__REDIRECT_URI__",
44
"isLocal": true,
55
"startPage": "index.html",
66
"errorPage": "error.html",

libs/test/SalesforceSDKTest/assets/www/bootconfig_relativeUnauthenticatedStartPage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
3-
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
2+
"remoteAccessConsumerKey": "__CONSUMER_KEY__",
3+
"oauthRedirectURI": "__REDIRECT_URI__",
44
"oauthScopes": ["api","web"],
55
"isLocal": false,
66
"startPage": "/apex/TestPage",

libs/test/SalesforceSDKTest/assets/www/bootconfig_remoteDeferredAuthNoUnauthenticatedStartPage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
3-
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
2+
"remoteAccessConsumerKey": "__CONSUMER_KEY__",
3+
"oauthRedirectURI": "__REDIRECT_URI__",
44
"oauthScopes": ["api","web"],
55
"isLocal": false,
66
"startPage": "/apex/TestPage",

0 commit comments

Comments
 (0)