Author: al
Date: Sat Sep  1 19:36:50 2012
New Revision: 1379829

URL: http://svn.apache.org/viewvc?rev=1379829&view=rev
Log:
Assumes receivedTime = sentTime for blip display. 
https://reviews.apache.org/r/6777/

Modified:
    incubator/wave/trunk/src/org/waveprotocol/wave/client/StageTwo.java
    
incubator/wave/trunk/src/org/waveprotocol/wave/client/wavepanel/render/UndercurrentShallowBlipRenderer.java

Modified: incubator/wave/trunk/src/org/waveprotocol/wave/client/StageTwo.java
URL: 
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/StageTwo.java?rev=1379829&r1=1379828&r2=1379829&view=diff
==============================================================================
--- incubator/wave/trunk/src/org/waveprotocol/wave/client/StageTwo.java 
(original)
+++ incubator/wave/trunk/src/org/waveprotocol/wave/client/StageTwo.java Sat Sep 
 1 19:36:50 2012
@@ -24,6 +24,7 @@ import org.waveprotocol.wave.client.acco
 import org.waveprotocol.wave.client.common.util.AsyncHolder;
 import org.waveprotocol.wave.client.common.util.ClientPercentEncoderDecoder;
 import org.waveprotocol.wave.client.common.util.CountdownLatch;
+import org.waveprotocol.wave.client.common.util.DateUtils;
 import org.waveprotocol.wave.client.concurrencycontrol.LiveChannelBinder;
 import org.waveprotocol.wave.client.concurrencycontrol.MuxConnector;
 import org.waveprotocol.wave.client.concurrencycontrol.WaveletOperationalizer;
@@ -585,7 +586,7 @@ public interface StageTwo {
 
     /** @return the renderer of intrinsic blip state. Subclasses may override. 
*/
     protected ShallowBlipRenderer createBlipDetailer() {
-      return new UndercurrentShallowBlipRenderer(getProfileManager(), 
getSupplement());
+      return new UndercurrentShallowBlipRenderer(getProfileManager(), 
getSupplement(), DateUtils.getInstance());
     }
 
     /** @return the thread state monitor. Subclasses may override. */

Modified: 
incubator/wave/trunk/src/org/waveprotocol/wave/client/wavepanel/render/UndercurrentShallowBlipRenderer.java
URL: 
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/wavepanel/render/UndercurrentShallowBlipRenderer.java?rev=1379829&r1=1379828&r2=1379829&view=diff
==============================================================================
--- 
incubator/wave/trunk/src/org/waveprotocol/wave/client/wavepanel/render/UndercurrentShallowBlipRenderer.java
 (original)
+++ 
incubator/wave/trunk/src/org/waveprotocol/wave/client/wavepanel/render/UndercurrentShallowBlipRenderer.java
 Sat Sep  1 19:36:50 2012
@@ -26,6 +26,7 @@ import org.waveprotocol.wave.model.suppl
 import org.waveprotocol.wave.model.wave.ParticipantId;
 
 import java.util.Set;
+import java.util.Date;
 
 /**
  * Defines the shallow blip rendering for the Undercurrent UI.
@@ -40,6 +41,9 @@ public final class UndercurrentShallowBl
   /** Provides read state of blips. */
   private final ReadableSupplementedWave supplement;
 
+  /** Provides direct access to a DateUtils instance */
+  private final DateUtils dateUtils;
+
   /**
    * Defines the rendering function for the contents of a blip.
    */
@@ -48,9 +52,10 @@ public final class UndercurrentShallowBl
   }
 
   public UndercurrentShallowBlipRenderer(
-      ProfileManager manager, ReadableSupplementedWave supplement) {
+      ProfileManager manager, ReadableSupplementedWave supplement, DateUtils 
dateUtils) {
     this.manager = manager;
     this.supplement = supplement;
+    this.dateUtils = dateUtils;
   }
 
   @Override
@@ -75,7 +80,14 @@ public final class UndercurrentShallowBl
 
   @Override
   public void renderTime(ConversationBlip blip, IntrinsicBlipMetaView meta) {
-    
meta.setTime(DateUtils.getInstance().formatPastDate(blip.getLastModifiedTime()));
+    if (blip.getLastModifiedTime() == 0) {
+      //Blip sent using c/s protocol, which has no timestamp attached 
(WAVE-181)
+      //Using received time as an estimate of the sent time
+      meta.setTime(dateUtils.formatPastDate(new Date().getTime()));
+    }
+    else {
+      meta.setTime(dateUtils.formatPastDate(blip.getLastModifiedTime()));
+    }
   }
 
   @Override


Reply via email to