Skip Menu |

This queue is for tickets about the WebService-UrbanAirship CPAN distribution.

Report information
The Basics
Id: 73200
Status: new
Priority: 0/
Queue: WebService-UrbanAirship

People
Owner: Nobody in particular
Requestors: radu [...] yx.ro
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.04
Fixed in: (no value)



Subject: Keep plus sign on badges for incremental updates
Urban Airship supports incremental updates of the badge values (http://urbanairship.com/docs/push.html#autobadge), but WebService::UrbanAirship::APNS transforms incremental values into plain numbers: $ perl -MData::Dumper -MWebService::UrbanAirship::APNS -we 'print Dumper( WebService::UrbanAirship::APNS->_craft_payload({ badge => "+2" }) )' $VAR1 = { 'badge' => 2 }; Perl is version 5.8.8, running on CentOS 5. With the proposed patch, the plus sign of the badge is preserved and it becomes possible to increment the value saved on the Urban Airship database: $ perl -MData::Dumper -MWebService::UrbanAirship::APNS -we 'print Dumper( WebService::UrbanAirship::APNS->_craft_payload({ badge => "+2" }) )' $VAR1 = { 'badge' => '+2' };
Subject: WebService-UrbanAirship-0.04-keep_badge_plus_sign.patch
--- WebService-UrbanAirship-0.04.orig/lib/WebService/UrbanAirship/APNS.pm 2009-10-02 09:18:29.000000000 -0700 +++ WebService-UrbanAirship-0.04/lib/WebService/UrbanAirship/APNS.pm 2011-09-14 08:29:48.000000000 -0700 @@ -456,7 +456,8 @@ my %args = %{shift || {}}; - my $badge = eval { int delete $args{badge} }; + my $badge = ($args{badge} =~ /^\s*\+/ ? '+' : '') + . eval { int delete $args{badge} }; my $alert = delete $args{alert}; my $sound = delete $args{sound};