Skip to content

Commit

Permalink
Merge pull request #334 from andygup/update_appcache
Browse files Browse the repository at this point in the history
v2.7.1
  • Loading branch information
andygup committed Apr 30, 2015
2 parents 3285f6d + 065cc25 commit 04e0208
Show file tree
Hide file tree
Showing 16 changed files with 212 additions and 124 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# offline-editor-js - Changelog

## Version 2.7.0.1
## Version 2.7.1 - April 29, 2015

This release has enhancements and has no breaking changes.

**Enhancements**
* Added `OfflineFeaturesManager.getFeatureLayerJSONDataStore()` for use in full offline browser restarts.

## Version 2.7.0.1 - April 28, 2015

Closes #323 - Add an FAQ doc.

## Version 2.7
## Version 2.7 - April 27, 2015

This release focused on improving the handling of attachments. Has breaking changes.

Expand Down
7 changes: 4 additions & 3 deletions dist/offline-edit-min.js

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions dist/offline-edit-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.7.0 - 2015-04-27
/*! offline-editor-js - v2.7.1 - 2015-04-29
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/*jshint -W030 */
Expand Down Expand Up @@ -111,7 +111,9 @@ define([
layer.objectIdField = this.DB_UID;

// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);
if(!this._editStore._isDBInit) {
this._initializeDB(dataStore,callback);
}

// we keep track of the FeatureLayer object
this._featureLayers[layer.url] = layer;
Expand Down Expand Up @@ -1096,6 +1098,28 @@ define([
}
},

/**
* Retrieves the optional feature layer storage object
* For use in full offline scenarios.
* @param callback callback(true, object) || callback(false, error)
*/
getFeatureLayerJSONDataStore: function(callback){
if(!this._editStore._isDBInit){
this._initializeDB(null,function(success) {
if(success){
this._editStore.getFeatureLayerJSON(function(success,message){
callback(success,message);
});
}
}.bind(this));
}
else {
this._editStore.getFeatureLayerJSON(function(success,message){
callback(success,message);
});
}
},

/* internal methods */

/**
Expand Down Expand Up @@ -1808,6 +1832,7 @@ O.esri.Edit.EditStore = function () {
"use strict";

this._db = null;
this._isDBInit = false;

// Public properties

Expand Down Expand Up @@ -2757,6 +2782,7 @@ O.esri.Edit.EditStore = function () {

request.onsuccess = function (event) {
this._db = event.target.result;
this._isDBInit = true;
console.log("database opened successfully");
callback(true);
}.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tiles-advanced-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/offline-tiles-advanced-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.7.0 - 2015-04-27
/*! offline-editor-js - v2.7.1 - 2015-04-29
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tiles-basic-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/offline-tiles-basic-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.7.0 - 2015-04-27
/*! offline-editor-js - v2.7.1 - 2015-04-29
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tpk-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/offline-tpk-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.7.0 - 2015-04-27
/*! offline-editor-js - v2.7.1 - 2015-04-29
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/**
Expand Down
8 changes: 7 additions & 1 deletion doc/howtouseeditlibrary.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ You can then retrieve this data after an offline restart by using the following
```js
featureLayer.getFeatureLayerJSONDataStore(function(success, dataStore){
offlineFeaturesManager.getFeatureLayerJSONDataStore(function(success, dataStore){
if(success){
myFeatureLayer = new
FeatureLayer(JSON.parse(dataStore.featureLayerCollection),{
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["GlobalID","BSID","ROUTES","STOPNAME"]
});
offlineFeaturesManager.extend(myFeatureLayer,function(result, error) {
if(result) {
console.log("Layer has been successfully rebuilt while offline!");
}
}
}
});
Expand Down
1 change: 1 addition & 0 deletions doc/offlinefeaturesmanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Methods | Returns | Description
`goOffline()` | nothing | Forces library into an offline state. Any edits applied to extended FeatureLayers during this condition will be stored locally.
`goOnline(callback)` | `callback( boolean, results )` | Forces library to return to an online state. If there are pending edits, an attempt will be made to sync them with the remote feature server. Callback function will be called when resync process is done. <br><br>Refer to the [How to use the edit library doc](howtouseeditlibrary.md) for addition information on the `results` object.
`getOnlineStatus()` | `ONLINE`, `OFFLINE` or `RECONNECTING`| Determines the current state of the manager. Please, note that this library doesn't detect actual browser offline/online condition. You need to use the `offline.min.js` library included in `vendor\offline` directory to detect connection status and connect events to goOffline() and goOnline() methods. See `military-offline.html` sample.
`getFeatureLayerJSONDataStore` | `callback( boolean, Object)` | **New @ v2.7.1** Returns the feature layer's dataStore Object.
`getReadableEdit()` | String | **DEPRECATED** @ v2.5. A string value representing human readable information on pending edits. Use `featureLayer.getAllEditsArray()`.


Expand Down
2 changes: 2 additions & 0 deletions lib/edit/editsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ O.esri.Edit.EditStore = function () {
"use strict";

this._db = null;
this._isDBInit = false;

// Public properties

Expand Down Expand Up @@ -954,6 +955,7 @@ O.esri.Edit.EditStore = function () {

request.onsuccess = function (event) {
this._db = event.target.result;
this._isDBInit = true;
console.log("database opened successfully");
callback(true);
}.bind(this);
Expand Down
26 changes: 25 additions & 1 deletion lib/edit/offlineFeaturesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ define([
layer.objectIdField = this.DB_UID;

// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);
if(!this._editStore._isDBInit) {
this._initializeDB(dataStore,callback);
}

// we keep track of the FeatureLayer object
this._featureLayers[layer.url] = layer;
Expand Down Expand Up @@ -1093,6 +1095,28 @@ define([
}
},

/**
* Retrieves the optional feature layer storage object
* For use in full offline scenarios.
* @param callback callback(true, object) || callback(false, error)
*/
getFeatureLayerJSONDataStore: function(callback){
if(!this._editStore._isDBInit){
this._initializeDB(null,function(success) {
if(success){
this._editStore.getFeatureLayerJSON(function(success,message){
callback(success,message);
});
}
}.bind(this));
}
else {
this._editStore.getFeatureLayerJSON(function(success,message){
callback(success,message);
});
}
},

/* internal methods */

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "offline-editor-js",
"version": "2.7.0",
"version": "2.7.1",
"description": "Lightweight set of libraries for working offline with map tiles and ArcGIS feature services",
"author": "Andy Gup <agup@esri.com> (http://blog.andygup.net)",
"license": "Apache 2",
Expand Down
Loading

0 comments on commit 04e0208

Please sign in to comment.