Skip to content

Commit

Permalink
Merge pull request #352 from andygup/array_fix
Browse files Browse the repository at this point in the history
v2.9.2
  • Loading branch information
andygup committed Jun 17, 2015
2 parents 74a7b3b + cd9d871 commit 7cc71aa
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 15 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# offline-editor-js - Changelog

## Version 2.9.2 - June 17, 2015

No breaking changes.

**Enhancements**
* OfflineFeaturesManager now overrides layer.hasAttachments property. The override is available after a feature layer
has been extended. This fixes an existing bug in the ArcGIS JS API when you create a feature layer from a featureCollectionObject
the hasAttachmens property does not get correctly repopulated.

**Bug fix**
* Fixes issue in offlineFeaturesManager's featureCollection data store when using it with multiple feature layers.
Subsequent featureLayerCollections were being stored as arrays instead of objects.
* Minor tweak to appcache-tiles.appcache. It was broken.

## Version 2.9.1 - May 28, 2015

No breaking changes.
Expand Down
6 changes: 3 additions & 3 deletions dist/offline-edit-min.js

Large diffs are not rendered by default.

9 changes: 7 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.9.1 - 2015-05-29
/*! offline-editor-js - v2.9.2 - 2015-06-17
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/*jshint -W030 */
Expand Down Expand Up @@ -787,6 +787,11 @@ define([
featureCollections: featureCollectionsArray
};

// THIS IS A HACK.
// There is a bug in JS API 3.11+ when you create a feature layer from a featureCollectionObject
// the hasAttachments property does not get properly repopulated.
layer.hasAttachments = featureCollection.featureLayerCollection.layerDefinition.hasAttachments;

// If the featureCollectionsObject already exists
if(success){
var count = 0;
Expand All @@ -801,7 +806,7 @@ define([

// If we have a new feature layer then add it to the featureCollections array
if(count === 0) {
result.featureCollections.push(featureCollectionsArray);
result.featureCollections.push(featureCollection);
}
}
// If it does not exist then we need to add a featureCollectionsObject
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.9.1 - 2015-05-29
/*! offline-editor-js - v2.9.2 - 2015-06-17
* 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.9.1 - 2015-05-29
/*! offline-editor-js - v2.9.2 - 2015-06-17
* 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.9.1 - 2015-05-29
/*! offline-editor-js - v2.9.2 - 2015-06-17
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/**
Expand Down
7 changes: 6 additions & 1 deletion lib/edit/offlineFeaturesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ define([
featureCollections: featureCollectionsArray
};

// THIS IS A HACK.
// There is a bug in JS API 3.11+ when you create a feature layer from a featureCollectionObject
// the hasAttachments property does not get properly repopulated.
layer.hasAttachments = featureCollection.featureLayerCollection.layerDefinition.hasAttachments;

// If the featureCollectionsObject already exists
if(success){
var count = 0;
Expand All @@ -798,7 +803,7 @@ define([

// If we have a new feature layer then add it to the featureCollections array
if(count === 0) {
result.featureCollections.push(featureCollectionsArray);
result.featureCollections.push(featureCollection);
}
}
// If it does not exist then we need to add a featureCollectionsObject
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.9.1",
"version": "2.9.2",
"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
3 changes: 2 additions & 1 deletion samples/appcache-tiles.appcache
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ http://js.arcgis.com/3.11/esri/dijit/images/attribute_inspector_sprite.png
http://js.arcgis.com/3.11/esri/dijit/images/ajax-loader.gif
http://js.arcgis.com/3.11/esri/images/map/logo-sm.png
http://js.arcgis.com/3.11/esri/images/map/logo-med.png
http://js.arcgis.com/3.11/esri/css/esri.css
http://js.arcgis.com/3.11/dijit/themes/claro/claro.css
http://js.arcgis.com/3.12/esri/css/esri.css
http://js.arcgis.com/3.11/esri/nls/jsapi_en-us.js
#
//services.arcgisonline.com/ArcGIS/rest/info?f=json
Expand All @@ -35,6 +35,7 @@ http://js.arcgis.com/3.11/esri/nls/jsapi_en-us.js
//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js
//esri.github.io/bootstrap-map-js/src/js/bootstrapmap.js
https://code.jquery.com/jquery-2.1.1.min.js
https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.j

# Custom feature service
http://services.arcgis.com/IZtlGBUe4KTzLOl4/arcgis/rest/services/BPX_RTD_BusStops2/FeatureServer/0?f=json
Expand Down
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"appHomePage": "appcache-features.html",
"optimizedApiURL": "../samples/jsolib",
"arcGISBaseURL": "http://js.arcgis.com/3.11",
"version": "2.9.1",
"version": "2.9.2",
"private": true,
"description": "manifest generator project",
"repository": {
Expand Down
5 changes: 5 additions & 0 deletions test/spec/offlineAttachmentsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ describe("Attachments", function()
});
});

async.it("Verify hasAttachments", function(done) {
expect(g_featureLayer.hasAttachments).toBe(true);
done();
});

async.it("add attachment to (offline) feature g2_offline", function(done)
{
expect(g_featureLayer.graphics.length).toBe(4);
Expand Down

0 comments on commit 7cc71aa

Please sign in to comment.