Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…DK-Shared into dev
  • Loading branch information
bhariharan committed Sep 19, 2019
2 parents 8adcd2f + f553bd5 commit 5809f34
Show file tree
Hide file tree
Showing 60 changed files with 258 additions and 249 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Library to do file related REST API calls from JavaScript.

Library to do REST API calls from JavaScript using promises instead of callbacks.

**smartsync.js**
**mobilesync.js**

Contains the SmartSync data library.
Contains the MobileSync data library.
This library depends on force.js and cordova.force.js. It also requires underscore and backbone.

# /test
Expand All @@ -36,7 +36,7 @@ Contains all the tests for the SalesforceMobileSDK JavaScript libraries.

HTML page to run the tests outside the container.

**MockCordova.js, MockSDKInfo.js, MockSmartStore.js, MockSmartSyncPlugin.js**
**MockCordova.js, MockSDKInfo.js, MockSmartStore.js, MockMobileSyncPlugin.js**

Libraries used to mock the container when running tests directly in a browser.

Expand All @@ -48,6 +48,6 @@ Super class of test suites.

Test suites for SmartStore.

**SFSmartSyncTestSuite.js**
**SFMobileSyncTestSuite.js**

Test suite for SmartSync library.
Test suite for MobileSync library.
4 changes: 2 additions & 2 deletions gen/cordova_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module.exports = [
]
},
{
"file": "plugins/com.salesforce/com.salesforce.plugin.smartsync.js",
"id": "com.salesforce.plugin.smartsync",
"file": "plugins/com.salesforce/com.salesforce.plugin.mobilesync.js",
"id": "com.salesforce.plugin.mobilesync",
},
{
"file": "plugins/com.salesforce/com.salesforce.util.bootstrap.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

// Version this js was shipped with
var SALESFORCE_MOBILE_SDK_VERSION = "8.0.0";
var SERVICE = "com.salesforce.smartsync";
var SERVICE = "com.salesforce.mobilesync";

var exec = require("com.salesforce.util.exec").exec;
var defaultStoreConfig = {'isGlobalStore':false};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cordova.define("com.salesforce.plugin.smartsync", function(require, exports, module) {
cordova.define("com.salesforce.plugin.mobilesync", function(require, exports, module) {
/*
* Copyright (c) 2012-present, salesforce.com, inc.
* All rights reserved.
Expand Down Expand Up @@ -27,7 +27,7 @@ cordova.define("com.salesforce.plugin.smartsync", function(require, exports, mod

// Version this js was shipped with
var SALESFORCE_MOBILE_SDK_VERSION = "8.0.0";
var SERVICE = "com.salesforce.smartsync";
var SERVICE = "com.salesforce.mobilesync";

var exec = require("com.salesforce.util.exec").exec;
var defaultStoreConfig = {'isGlobalStore':false};
Expand Down
4 changes: 2 additions & 2 deletions libs/cordova.force.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,8 @@ cordova.define("com.salesforce.plugin.smartstore.client", function(require, expo
// For backward compatibility
navigator.smartstoreClient = cordova.require("com.salesforce.plugin.smartstore.client");

cordova.define("com.salesforce.plugin.smartsync", function (require, exports, module) {
var SERVICE = "com.salesforce.smartsync";
cordova.define("com.salesforce.plugin.mobilesync", function (require, exports, module) {
var SERVICE = "com.salesforce.mobilesync";

var exec = require("com.salesforce.util.exec").exec;
var defaultStoreConfig = {'isGlobalStore':false};
Expand Down
2 changes: 1 addition & 1 deletion libs/smartsync.js → libs/mobilesync.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
{
var sdkinfo = cordova.require("com.salesforce.plugin.sdkinfo");
if(sdkinfo && typeof(sdkinfo.registerAppFeature) === 'function'){
// register SmartSync JS App feature
// register MobileSync JS App feature
sdkinfo.registerAppFeature('SJ');
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/accounteditor/AccountEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down
1 change: 1 addition & 0 deletions samples/accounteditor/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/accounteditor/js/smartsync.js

This file was deleted.

2 changes: 1 addition & 1 deletion samples/fileexplorer/FileExplorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script src="js/force.js"></script>
<script src="js/force+files.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down
1 change: 1 addition & 0 deletions samples/fileexplorer/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/fileexplorer/js/smartsync.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="js/MockCordova.js"></script>
<script src="js/cordova.force.js"></script>
<script src="js/MockSmartStore.js"></script>
<script src="js/MockSmartSyncPlugin.js"></script>
<script src="js/MockMobileSyncPlugin.js"></script>
<!-- End Local Testing -->

<!-- Container -->
Expand All @@ -29,7 +29,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down Expand Up @@ -175,11 +175,11 @@ <h1 class="title">Contacts</h1>
},

syncDown: function() {
cordova.require("com.salesforce.plugin.smartsync").reSync("syncDownContacts" /* see usersyncs.json */, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").reSync("syncDownContacts" /* see usersyncs.json */, this.handleSyncUpdate.bind(this));
},

syncUp: function() {
cordova.require("com.salesforce.plugin.smartsync").reSync("syncUpContacts" /* see usersyncs.json */, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").reSync("syncUpContacts" /* see usersyncs.json */, this.handleSyncUpdate.bind(this));
},

sync: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"oauthRedirectURI": "testsfdc:///mobilesdk/detect/oauth/done",
"oauthScopes": ["api","web"],
"isLocal": true,
"startPage": "SmartSyncExplorer.html",
"startPage": "MobileSyncExplorer.html",
"errorPage": "error.html",
"shouldAuthenticate": true,
"attemptOfflineLoad": false,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions samples/mobilesyncexplorer/js/MockMobileSyncPlugin.js
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions samples/mobilesyncexplorer/js/mobilesync.js
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions samples/notesync/NoteSync.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="js/MockCordova.js"></script>
<script src="js/cordova.force.js"></script>
<script src="js/MockSmartStore.js"></script>
<script src="js/MockSmartSyncPlugin.js"></script>
<script src="js/MockMobileSyncPlugin.js"></script>
<!-- End Local Testing -->

<!-- Container -->
Expand All @@ -29,7 +29,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down Expand Up @@ -161,11 +161,11 @@ <h1 class="title"><%= Title %></h1>

syncDown: function() {
var target = {type:"custom", androidImpl:"com.salesforce.samples.notesync.ContentSoqlSyncDownTarget", iOSImpl:"SFContentSoqlSyncDownTarget", query:"SELECT " + this.fieldlist.join(",") + " FROM ContentNote LIMIT 1000"};
cordova.require("com.salesforce.plugin.smartsync").syncDown(target, "notes", {mergeMode:Force.MERGE_MODE_DOWNLOAD.LEAVE_IF_CHANGED}, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").syncDown(target, "notes", {mergeMode:Force.MERGE_MODE_DOWNLOAD.LEAVE_IF_CHANGED}, this.handleSyncUpdate.bind(this));
},

syncUp: function(event) {
cordova.require("com.salesforce.plugin.smartsync").syncUp("notes", {fieldlist: this.fieldlist}, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").syncUp("notes", {fieldlist: this.fieldlist}, this.handleSyncUpdate.bind(this));
},

inspect: function() {
Expand Down
1 change: 1 addition & 0 deletions samples/notesync/js/MockMobileSyncPlugin.js
1 change: 0 additions & 1 deletion samples/notesync/js/MockSmartSyncPlugin.js

This file was deleted.

1 change: 1 addition & 0 deletions samples/notesync/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/notesync/js/smartsync.js

This file was deleted.

8 changes: 4 additions & 4 deletions samples/simplesyncreact/SimpleSync.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script src="js/MockCordova.js"></script>
<script src="js/cordova.force.js"></script>
<script src="js/MockSmartStore.js"></script>
<script src="js/MockSmartSyncPlugin.js"></script>
<script src="js/MockMobileSyncPlugin.js"></script>
<!-- End Local Testing -->

<!-- Container -->
Expand All @@ -31,7 +31,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down Expand Up @@ -120,7 +120,7 @@ <h1 className="title">Users</h1>
},

syncDown: function(target) {
cordova.require("com.salesforce.plugin.smartsync").syncDown(target, "users", {}, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").syncDown(target, "users", {}, this.handleSyncUpdate.bind(this));
},

syncDownMru: function(event) {
Expand All @@ -136,7 +136,7 @@ <h1 className="title">Users</h1>
},

syncUp: function(event) {
cordova.require("com.salesforce.plugin.smartsync").syncUp("users", {fieldlist: this.fieldlist}, this.handleSyncUpdate.bind(this));
cordova.require("com.salesforce.plugin.mobilesync").syncUp("users", {fieldlist: this.fieldlist}, this.handleSyncUpdate.bind(this));
},

cacheSize: function() {
Expand Down
1 change: 1 addition & 0 deletions samples/simplesyncreact/js/MockMobileSyncPlugin.js
1 change: 0 additions & 1 deletion samples/simplesyncreact/js/MockSmartSyncPlugin.js

This file was deleted.

1 change: 1 addition & 0 deletions samples/simplesyncreact/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/simplesyncreact/js/smartsync.js

This file was deleted.

1 change: 0 additions & 1 deletion samples/smartsyncexplorer/js/MockSmartSyncPlugin.js

This file was deleted.

1 change: 0 additions & 1 deletion samples/smartsyncexplorer/js/smartsync.js

This file was deleted.

2 changes: 1 addition & 1 deletion samples/userandgroupsearch/UserAndGroupSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down
1 change: 1 addition & 0 deletions samples/userandgroupsearch/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/userandgroupsearch/js/smartsync.js

This file was deleted.

2 changes: 1 addition & 1 deletion samples/usersearch/UserSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<script src="js/force.js"></script>
<script src="js/force+promise.js"></script>
<script src="js/smartsync.js"></script>
<script src="js/mobilesync.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/stackrouter.js"></script>
<script src="js/auth.js"></script>
Expand Down
1 change: 1 addition & 0 deletions samples/usersearch/js/mobilesync.js
1 change: 0 additions & 1 deletion samples/usersearch/js/smartsync.js

This file was deleted.

11 changes: 10 additions & 1 deletion setversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ usage ()
{
echo "Use this script to set Mobile SDK version number in source files"
echo "Usage: $0 -v <version>"
echo " where: version is the version e.g. 7.2.0"
echo " where: version is the version e.g. 8.0.0"
}

parse_opts ()
Expand Down Expand Up @@ -73,6 +73,15 @@ echo -e "${YELLOW}*** SETTING VERSION TO ${OPT_VERSION} ***${NC}"
echo "*** Updating package.json ***"
update_package_json "./package.json" "${OPT_VERSION}"

echo "*** Updating bower.json ***"
update_package_json "./tools/bower.json" "${OPT_VERSION}"

echo "*** Updating package.json in tools ***"
update_package_json "./tools/package.json" "${OPT_VERSION}"

echo "*** Updating package-lock.json ***"
update_package_json "./tools/package-lock.json" "${OPT_VERSION}"

echo "*** Updating MockSDKInfo test ***"
update_mock_sdk_info "./test/MockSDKInfo.js" "${OPT_VERSION}"

Expand Down
22 changes: 11 additions & 11 deletions test/MockSmartSyncPlugin.js → test/MockMobileSyncPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
*/

/**
* MockSmartSyncPlugin
* MockMobileSyncPlugin
* Meant for development and testing only, the data is stored in SessionStorage, queries do full scans.
* NB: cleanResyncGhosts only works for soql sync down
*/

var MockSmartSyncPlugin = (function(window) {
var MockMobileSyncPlugin = (function(window) {
// Constructor
var module = function(storeConfig) {
this.storeConfig = storeConfig;
Expand Down Expand Up @@ -145,7 +145,7 @@ var MockSmartSyncPlugin = (function(window) {
successCB(sync);

if (target.type == "refresh") {
// smartsync.js doesn't have something equivalent to the (new in 5.0) refresh sync down
// mobilesync.js doesn't have something equivalent to the (new in 5.0) refresh sync down
// So we need to get the local ids, build a soql query out of them
// And use that for the collection
cache.find({queryType:"range", orderPath:cache.keyField, pageSize:500}) // XXX not handling case with more than 500 local ids
Expand Down Expand Up @@ -328,7 +328,7 @@ var SyncManagerMap = (function() {
syncManager = isGlobalStore?this.globalSyncManagers[storeName]:this.userSyncManagers[storeName];

if(syncManager == null) {
syncManager = new MockSmartSyncPlugin({'isGlobalStore': isGlobalStore,'storeName' :storeName});
syncManager = new MockMobileSyncPlugin({'isGlobalStore': isGlobalStore,'storeName' :storeName});
if(isGlobalStore == true)
this.globalSyncManagers[storeName] = syncManager;
else
Expand Down Expand Up @@ -376,34 +376,34 @@ var syncManagerMap = new SyncManagerMap();

(function (cordova, syncManager, globalSyncManager) {

var SMARTSYNC_SERVICE = "com.salesforce.smartsync";
var MOBILESYNC_SERVICE = "com.salesforce.mobilesync";

cordova.interceptExec(SMARTSYNC_SERVICE, "syncUp", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "syncUp", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.syncUp(args[0].target, args[0].soupName, args[0].options, args[0].syncName, successCB, errorCB);
});

cordova.interceptExec(SMARTSYNC_SERVICE, "syncDown", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "syncDown", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.syncDown(args[0].target, args[0].soupName, args[0].options, args[0].syncName, successCB, errorCB);
});

cordova.interceptExec(SMARTSYNC_SERVICE, "getSyncStatus", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "getSyncStatus", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.getSyncStatus(args[0].syncId || args[0].syncName, successCB, errorCB);
});

cordova.interceptExec(SMARTSYNC_SERVICE, "reSync", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "reSync", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.reSync(args[0].syncId || args[0].syncName, successCB, errorCB);
});

cordova.interceptExec(SMARTSYNC_SERVICE, "cleanResyncGhosts", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "cleanResyncGhosts", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.cleanResyncGhosts(args[0].syncId, successCB, errorCB);
});

cordova.interceptExec(SMARTSYNC_SERVICE, "deleteSync", function (successCB, errorCB, args) {
cordova.interceptExec(MOBILESYNC_SERVICE, "deleteSync", function (successCB, errorCB, args) {
var mgr = syncManagerMap.getSyncManager(args);
mgr.deleteSync(args[0].syncId || args[0].syncName, successCB, errorCB);
});
Expand Down
2 changes: 1 addition & 1 deletion test/MockSDKInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var MockSDKInfo = (function(window) {

cordova.interceptExec(SDKINFO_SERVICE, "getInfo", function (successCB, errorCB, args) {
successCB(new SDKInfo("8.0.0",
["com.salesforce.oauth", "com.salesforce.sdkinfo", "com.salesforce.sfaccountmanager", "com.salesforce.network", "com.salesforce.testrunner", "com.salesforce.smartstore", "com.salesforce.smartsync"],
["com.salesforce.oauth", "com.salesforce.sdkinfo", "com.salesforce.sfaccountmanager", "com.salesforce.network", "com.salesforce.testrunner", "com.salesforce.smartstore", "com.salesforce.mobilesync"],
"SalesforceHybridSDKTestApp", "1.0",
{
"remoteAccessConsumerKey": "3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa",
Expand Down
Loading

0 comments on commit 5809f34

Please sign in to comment.