Permalink
Browse files

Merge branch 'master' of github.com:HEROLABS/herolabs-apns

  • Loading branch information...
2 parents 5e4be19 + 8e51c8a commit ba69d2dcee87fdb100dd83c23c45b600d7b08996 @niclasmeier niclasmeier committed Sep 26, 2012
Showing with 6 additions and 9 deletions.
  1. +3 −6 src/herolabs/apns/message.clj
  2. +3 −3 test/herolabs_test/apns/message.clj
@@ -4,11 +4,7 @@
(defn with-badge [message number] (assoc-in message [:aps :badge ] number))
(defn with-sound [message sound]
- (cond
- (= :default sound) (update-in message [:aps ] #(dissoc % :sound ))
- (= "default" sound) (update-in message [:aps ] #(dissoc % :sound ))
- :else (assoc-in message [:aps :sound ] sound)
- )
+ (assoc-in message [:aps :sound ] (name sound))
)
(defn with-standard-alert [message body]
@@ -44,4 +40,5 @@
(if key
(assoc-in message [:aps :alert :body ] body)
message)
- )
+ )
+
@@ -7,9 +7,9 @@
(facts "about message assembly"
(with-badge {} 1) => (just {:aps {:badge 1}})
- (with-sound {} :default) => (just {:aps nil})
- (with-sound {} "default") => (just {:aps nil})
- (with-sound {} :chimes) => (just {:aps {:sound :chimes}})
+ (with-sound {} :default) => (just {:aps {:sound "default"}})
+ (with-sound {} "default") => (just {:aps {:sound "default"}})
+ (with-sound {} :chimes) => (just {:aps {:sound "chimes"}})
(with-standard-alert {} "Hello world") => (just {:aps {:alert "Hello world"}})
(with-action-loc-key {} "TEST") => (just {:aps {:alert {:action-loc-key "TEST"}}})
(with-loc-key {} "TEST") => (just {:aps {:alert {:loc-key "TEST"}}})

0 comments on commit ba69d2d

Please sign in to comment.