Permalink
Browse files

Fixing the issue with Rx.changes.push after refactoring

  • Loading branch information...
1 parent 8de07ef commit addeacc278f74b1eea30ccc0871934a480803456 @dima committed Apr 21, 2010
View
@@ -19,7 +19,7 @@ Here's some of the things you can do with *RestfulX*:
that use _ActiveRecord_, _DataMapper_, _CouchRest_, _ActiveCouch_ and so on.
* *Communicate* between your Flex/AIR Rich Internet Application and service providers
- using either _XML_ or _JSON_.
+ using _AMF_, _XML_ or _JSON_.
* *Persist* your data directly in Adobe AIR _SQLite_ database or _CouchDB_
without any additional infrastructure or intermediate servers.
@@ -33,7 +33,7 @@ Here's some of the things you can do with *RestfulX*:
For details on how to get started with the RestfulX framework refer to:
- http://restfulx.org
+ http://restfulx.github.com
== Getting Involved
@@ -47,4 +47,4 @@ Get involved with the community:
== License
-Copyright (c) 2008-2009 Dima Berastau and Contributors, released under MIT License
+Copyright (c) 2008-2010 Dima Berastau and Contributors, released under MIT License
@@ -39,6 +39,7 @@ package org.restfulx.controllers {
import org.restfulx.services.IServiceProvider;
import org.restfulx.services.ISyncingServiceProvider;
import org.restfulx.utils.RxUtils;
+ import org.restfulx.utils.TypedArray;
[Bindable]
/**
@@ -187,7 +188,9 @@ package org.restfulx.controllers {
}
protected function onDirtyChanges(result:Object, token:Object = null):void {
- pushCount += (result as Array).length;
+ var data:TypedArray = result as TypedArray;
+
+ pushCount += data.source.length;
// no undo-redo for synchronization, and the stack is lost after undo-redo
if (pushCount) {
@@ -198,8 +201,8 @@ package org.restfulx.controllers {
Rx.enableUndoRedo = false;
}
}
-
- for each (var instance:Object in result as Array) {
+
+ for each (var instance:Object in data.source) {
if (instance["rev"] == 0) instance["rev"] = "";
switch (instance["sync"]) {
case DELETE:
@@ -46,7 +46,7 @@ package org.restfulx.services.air {
import org.restfulx.utils.TypedArray;
import org.restfulx.utils.RxUtils;
import org.restfulx.utils.UUID;
-
+
/**
* AIR Service Provider implementation.
*/
@@ -23,6 +23,7 @@
******************************************************************************/
package org.restfulx.services.amf {
import flash.events.ProgressEvent;
+ import flash.net.ObjectEncoding;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.utils.ByteArray;
@@ -119,7 +120,11 @@ package org.restfulx.services.amf {
}
protected override function decodeResult(result:Object):Object {
- return (ByteArray(result).readObject());
+ if (result is ByteArray) {
+ return (ByteArray(result).readObject());
+ } else {
+ return result;
+ }
}
}
}
@@ -287,7 +287,7 @@ package org.restfulx.services.http {
if (urlParams != "") {
request.url += "?" + urlParams;
}
-
+
file.reference.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, function(event:DataEvent):void {
var result:Object = decodeResult(event.data);
if (!hasErrors(result)) {

0 comments on commit addeacc

Please sign in to comment.