Forráskód Böngészése

Change attribute for message from text: to message:

Sebastián Katzer 8 éve
szülő
commit
773bf72bc8
1 módosított fájl, 12 hozzáadás és 12 törlés
  1. 12 12
      src/android/notification/Options.java

+ 12 - 12
src/android/notification/Options.java

@@ -105,6 +105,13 @@ public final class Options {
         return options;
     }
 
+    /**
+     * JSON object as string.
+     */
+    public String toString() {
+        return options.toString();
+    }
+
     /**
      * Gets the ID for the local notification.
      *
@@ -558,12 +565,12 @@ public final class Options {
      * @return null if there are no messages.
      */
     Message[] getMessages() {
-        Object value = options.opt("text");
+        Object text = options.opt("text");
 
-        if (value == null || value instanceof String)
+        if (text == null || text instanceof String)
             return null;
 
-        JSONArray list = (JSONArray) value;
+        JSONArray list = (JSONArray) text;
 
         if (list.length() == 0)
             return null;
@@ -573,23 +580,16 @@ public final class Options {
 
         for (int i = 0; i < messages.length; i++) {
             JSONObject msg = list.optJSONObject(i);
-            String text    = msg.optString("text");
+            String message = msg.optString("message");
             long timestamp = msg.optLong("date", now);
             String person  = msg.optString("person", null);
 
-            messages[i] = new Message(text, timestamp, person);
+            messages[i] = new Message(message, timestamp, person);
         }
 
         return messages;
     }
 
-    /**
-     * JSON object as string.
-     */
-    public String toString() {
-        return options.toString();
-    }
-
     /**
      * Strips the hex code #FF00FF => FF00FF
      *