Skip to content
Browse files

added object_proxy for attachment to avoid warnings, fixed comment ou…

…t-of-order by Rounding the timestamps (as strings with .'s they were comparing wrong), stoppid flicker on updates by applying minHeight to LikesRenderer, de-anonymized ProfileFetched function in CommentRenderer so that multiple renderers could update their local display objects without being stuck in the global namespace, which was a bug if you had the same comments visible on multiple tabs at the same time..
  • Loading branch information...
1 parent e79312a commit 209ba0b65fa02de7dadc6183d85712af2353760f @jubishop committed
View
8 fbair/nile/renderers/AttachmentRenderer.mxml
@@ -83,8 +83,9 @@
import fbair.nile.renderers.MediaItem;
import fbair.util.HashArray;
- import mx.events.FlexEvent;
import mx.collections.ArrayCollection;
+ import mx.events.FlexEvent;
+ import mx.utils.ObjectProxy;
public static const MaxImageWidth:int = 117;
public static const MaxImageHeight:int = 160;
@@ -139,8 +140,11 @@
if (mediaItems) updateImageDimensions();
// Create properties
- if (data.properties is Array)
+ if (data.properties is Array) {
+ for (var i:int = 0; i < data.properties.length; i++)
+ data.properties[i] = new ObjectProxy(data.properties[i]);
itemPropertyList = new ArrayCollection(data.properties);
+ }
}
// Fight global warming!
View
2 fbair/nile/renderers/CommentBox.mxml
@@ -121,7 +121,7 @@
fromid:FBConnect.session.uid,
id:event.data,
text:commentInput.text,
- time:(new Date().time / 1000),
+ time:Math.round(new Date().time / 1000),
post_id:data.post_id
});
View
14 fbair/nile/renderers/CommentRenderer.mxml
@@ -89,12 +89,14 @@
// Fetch the profile data for this user.
ProfileCache.getProfile(data.fromid).addEventListener(
- ProfileCache.PROFILE_FETCHED,
- function(event:FBEvent):void {
- if (!data) return;
- data.name = event.data.name;
- data.url = event.data.url;
- });
+ ProfileCache.PROFILE_FETCHED, profileFetched);
+ }
+
+ // Called when we've fetched profile data
+ private function profileFetched(event:FBEvent):void {
+ if (!data) return;
+ data.name = event.data.name;
+ data.url = event.data.url;
}
// Called when user has clicked delete button
View
5 fbair/nile/renderers/CommentsRenderer.mxml
@@ -140,9 +140,10 @@
// Determine position of comment based on timestamp
var entry_position:int = 0;
while(entry_position < commentsHash.length &&
- commentsHash.getAt(entry_position).data.time < renderer.data.time)
+ Number(commentsHash.getAt(entry_position).data.time) <
+ Number(renderer.data.time))
entry_position++;
-
+
// Add comment renderer to the stage
if (entry_position == commentsHash.length) {
commentsBox.addChild(renderer);
View
9 fbair/nile/renderers/NileRenderer.mxml
@@ -53,9 +53,9 @@
data.actorURL)}" />
<!-- Target of wall-post -->
<mx:HBox styleName="nileStoryTarget"
- visible="{data.targetName != null}"
+ visible="{data.targetName}"
horizontalGap="-4"
- includeInLayout="{data.targetName != null}">
+ includeInLayout="{data.targetName}">
<mx:Label styleName="targetArrow" text="" />
<mx:Label styleName="actorTitle"
@@ -228,13 +228,12 @@
}
}
- // Ok NOW that everything is proxied, we set our data, by merging it
super.data = FlexUtil.merge(data, new ObjectProxy(new_data));
if (!data) return;
// Get name of our actor, to build message text, if not already built
// If this entry has a target, let's get that profile data too
- if (!data.actors) {
+ if (!data.actorName || !data.actorURL) {
if (data.target_id) {
ProfileCache.getProfile(data.target_id).addEventListener(
ProfileCache.PROFILE_FETCHED, profileFetched);
@@ -276,7 +275,7 @@
private function profileFetched(event:FBEvent):void {
if (!data) return;
- // Make sure the profile cach has what we need
+ // Make sure the profile cache has what we need
if (!ProfileCache.hasProfile(data.actor_id)) return;
if (data.target_id && !ProfileCache.hasProfile(data.target_id)) return;
View
2 fbair/nile/renderers/UFI.mxml
@@ -69,6 +69,8 @@
<renderer:LikesRenderer id="likesRenderer"
styleName="likeText"
width="100%"
+ minHeight="{StringUtil.empty(data.likeText) ? 0
+ : 16}"
data="{data}" />
</util:FlowBox>
View
5 fbair/styles/renderers.css
@@ -96,11 +96,6 @@
color: #808080;
}
-.likesRenderer {
- horizontalGap: 2;
- paddingBottom: 2;
-}
-
.likeText {
color: #aaaaaa;
left: -2;
View
6 fbair/util/CommentCache.as
@@ -129,9 +129,6 @@ package fbair.util {
"where " + requested_ids.join(" or ") + " " +
"order by time desc"
}).addEventListener(FBEvent.SUCCESS, function(event:FBEvent):void {
- // Mark our time for freshness
- fetchTime = (new Date()).time;
-
var results:Array = event.data as Array;
// We need to break up the results by post_id
@@ -142,6 +139,9 @@ package fbair.util {
commentCache[result.post_id].push(result);
}
+ // Mark our time for freshness
+ fetchTime = (new Date()).time;
+
// Now dispatch our groups to the listeners
for (var post_id:String in commentCache)
currentRequests[post_id].dispatcher.dispatchEvent(
View
6 fbair/util/display/StubbornImage.as
@@ -52,19 +52,19 @@ package fbair.util.display {
}
private function statusChanged(event:StatusEvent):void {
- Output.error("Image Status changed: " + urlMonitor.available +
+ Output.log("Image Status changed: " + urlMonitor.available +
" for source: " + origSource);
if (urlMonitor.available) reload();
}
private function reload():void {
- Output.error("Reloading image: " + origSource);
+ Output.log("Reloading image: " + origSource);
load(origSource);
}
override public function set source(new_source:Object):void {
if (new_source.constructor == Class) {
- Output.error("Image re-setting source to crap: " + new_source
+ Output.log("Image re-setting source to crap: " + new_source
+ " from " + source);
super.source = null;
} else {

0 comments on commit 209ba0b

Please sign in to comment.
Something went wrong with that request. Please try again.